123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- define(function (require) {
- return function (context) {
- var $dlg;
- return {
- xtype: 'dialog',
- dialogId: 'dialogld',
- title: context.isEdit ? '新增' : '编辑' + 'ID标识',
- width: 400,
- height: 460,
- onOpen: function () {
- console.log('onBeforeClose');
- $dlg = $(this);
- $dlg.formSet(context.row);
- },
- center: {
- items: {
- xtype: 'form',
- items: [
- [{name: 'idName', label: 'ID标识', required: true}],
- [{name: 'idDesc', label: '标识说明', required: true}],
- [{name: 'idType', label: '编号生成规则', labelWidth: 'auto'}],
- [{name: 'idExpress', label: '序号类型', required: true}]
- ]
- }
- },
- buttons: [
- {
- text: '关闭', iconCls: 'fa fa-times-circle', onClick: function () {
- //关闭方法
- $dlg.window('close');
- }
- },
- {
- text: '保存', iconCls: 'fa fa-save', onClick: function () {
- var newData = $dlg.formGet();
- if (newData.idName === null || newData.idName === '') {
- $.yvan.msg('请填ID标识');
- return;
- }
- if (newData.idDesc === null || newData.idDesc === '') {
- $.yvan.msg('请填标识说明');
- return;
- }
- // if (newData.idType === null || newData.idType === '') {
- // $.yvan.msg('请填编号生成规则');
- // return;
- // }
- if (newData.idExpress === null || newData.idExpress === '') {
- $.yvan.msg('请填序号类型');
- return;
- }
- var url = '/sys/Code/edit';
- if (context.isEdit === false) {
- url = '/sys/Code/add';
- }
- $.yvan.ajax({
- url: api(url),
- contentType: "application/json; charset=utf-8",
- data: JSON.stringify(newData),
- method: 'post',
- success: function (data) {
- $.yvan.msg(data.msg);
- $dlg.window('close');
- context.ok();
- },
- error: function (data) {
- $.yvan.msg(data.msg);
- }
- });
- }
- }
- ]
- }
- }
- });
|