123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- define(function (require) {
- return function (context) {
- var $dlg, $form;
- //获取单位信息
- function getUnitList() {
- var _datas = [];
- $.yvan.ajax({
- url: api('/sys/sysUnit/queryAll'),
- data: {unitType: context.unitType, unitId: context.unitIdA},
- method: 'post',
- async: false,
- success: function (data) {
- if (data.data != null && data.data != undefined) {
- for (var i = 0; i < data.data.length; i++) {
- _datas.push({
- "id": data.data[i].unitId,
- "text": data.data[i].unitName
- })
- }
- }
- }
- });
- return _datas;
- }
- return {
- xtype: 'dialog',
- dialogId: 'dialogSysUnitConver',
- title: '换算信息',
- width: 900,
- height: 200,
- onOpen: function () {
- $dlg = $(this);
- if (context.isEdit) {
- $.yvan.ajax({
- loadingMask: false,
- url: api('/sys/sysUnitCv/getById'), // 需要改,不然不能显示非数据库中的字段信息
- type: 'GET',
- data: {
- converId: context.converId,
- },
- success: function (data) {
- $dlg.find('form');
- if (!isNotNull(data) || !isNotNull(data.data)) {
- return;
- }
- $form.formSet(data.data);
- }
- });
- } else {
- $form.formSet({
- beActive: 'Y'
- });
- }
- },
- center: {
- items: {
- xtype: 'formgroup',
- onRender: function () {
- $form = $(this);
- },
- items: [[
- {name: 'converId', xtype: 'hidden'},
- {name: 'numa', label: '转换单位A', required: true},
- {name: 'unitIda', label: '转换单位A', value: context.unitIdA, xtype: 'hidden'},
- {name: 'numb', label: context.unitNameA + '=', required: true},
- {
- name: 'unitIdb',
- label: '转换单位B',
- xtype: 'yvselect',
- required: true,
- panelHeight: 220,
- data: getUnitList(),
- ff: 500,
- },
- ]]
- }
- },
- buttons: [
- {
- text: "提交", iconCls: "fa fa-save", onClick: function () {
- $.yvan.postForm($form, {
- url: (context.isEdit ? api('/sys/sysUnitCv/update') : api('/sys/sysUnitCv/insert')),
- success: function () {
- $.yvan.msg('操作成功');
- if (context.isEdit) {
- $dlg.window('close');
- }
- if ($.type(context.confirm) === 'function') {
- context.confirm();
- }
- }
- });
- }
- }, {
- text: "关闭", iconCls: "fa fa-times", onClick: function () {
- $dlg.dialog('close');
- }
- }
- ]
- };
- };
- });
|