define(function (require) { return function (context) { var $dlg, $form, isEdit = false; 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: {tuId: context.tuId}, 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: 'tuId', xtype: 'hidden'}, { name: 'phone', label: '电话', required: true, validType: 'phoneNum', maxlength: 60, width: 350, }, { name: 'name', label: '联系人姓名', required: true, maxlength: 60, width: 350, }, ] ], } }, buttons: [ { text: "检查电话", iconCls: "fa fa-save", onClick: function () { var queryForm = $form.formGet(); if (queryForm.phone == "") { $.yvan.msg('请先选输入电话号码'); return; } $.yvan.ajax({ url: api('/OutUser/getUptownHomeByPhone'), data: {phone: queryForm.phone}, method: 'post', async: false, success: function (data) { if (data.data.linkman != null) { $form.formSet({name: data.data.linkman}); } } }); } }, { text: "保存", iconCls: "fa fa-save", onClick: function () { $.yvan.postForm($form, { url: api('/OutUser/saveOutUserLY2'), 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'); } } ] }; }; });