12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- define(function (require) {
- return function (context) {
- var $dlg, $form, isEdit = false;
- var widgets = {
- // 小区搜索
- selectUptownWidget: {
- url: '/app/whepi/scan/uptownWidget.js',
- bind: {
- uptownId: 'uptownId',
- uptownName: 'uptownName'
- }
- },
- };
- return {
- xtype: 'dialog',
- dialogId: 'dialogEnvLog',
- title: context.isEdit ? '编辑大门基本信息' : '新增大门基本信息',
- width: 450,
- height: 300,
- onOpen: function () {
- $dlg = $(this);
- if (context.isEdit) {
- $.yvan.ajax({
- loadingMask: false,
- url: api('/qrImg/getDoorById'),
- type: 'GET',
- data: {doorId: context.doorId},
- success: function (data) {
- $dlg.find('form');
- $form.formSet(data.data);
- }
- });
- }
- },
- center: {
- items: {
- width: 450,
- height: 756,
- autoSizeColumns: true,
- xtype: 'formgroup',
- onRender: function () {
- $form = $(this);
- },
- items: [
- [
- {name: 'doorId', xtype: 'hidden'},
- {label: '小区ID', name: 'uptownId', xtype: 'hidden', widget: widgets.selectUptownWidget},
- {
- name: 'uptownName',
- label: '小区名称',
- xtype: 'searchbox',
- maxlength: 60,
- width: 350,
- required: true,
- widget: widgets.selectUptownWidget
- },
- {
- name: 'doorName',
- label: '大门名称',
- required: true,
- maxlength: 60,
- width: 350,
- },]
- ],
- }
- },
- buttons: [
- {
- text: "保存", iconCls: "fa fa-save", onClick: function () {
- $.yvan.postForm($form, {
- url: (context.isEdit ? api('/qrImg/updateDoor') : api('/qrImg/insertDoor')),
- success: function (data) {
- if (data.data == 1) {
- $.yvan.msg('保存成功');
- $dlg.window('close');
- if ($.type(context.confirm) === 'function') {
- context.confirm();
- }
- }
- }
- });
- }
- }, {
- text: "关闭", iconCls: "fa fa-times", onClick: function () {
- $dlg.dialog('close');
- }
- }
- ]
- };
- };
- });
|