You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsRptNoTotalZl/MsSysZlSetEdit.js

285 lines
8.5 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsSysZlSetEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsSysZlSetEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsSysZlSetEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
//#region 编辑form
//枚举参照相关(编辑form)
//表参照相关(编辑form)
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 5,
autoScroll: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
1 year ago
fieldLabel: Zi.LAN.ZL1NAME,
2 years ago
name: 'ZL1NAME'
}, {
1 year ago
fieldLabel: Zi.LAN.ZL1DAY,
2 years ago
name: 'ZL1DAY'
}, {
1 year ago
fieldLabel: Zi.LAN.ZL2NAME,
2 years ago
name: 'ZL2NAME'
}, {
1 year ago
fieldLabel: Zi.LAN.ZL2DAY,
2 years ago
name: 'ZL2DAY'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
1 year ago
fieldLabel: Zi.LAN.ZL3NAME,
2 years ago
name: 'ZL3NAME'
}, {
1 year ago
fieldLabel: Zi.LAN.ZL3DAY,
2 years ago
name: 'ZL3DAY'
}, {
1 year ago
fieldLabel: Zi.LAN.ZL4NAME,
2 years ago
name: 'ZL4NAME'
}, {
1 year ago
fieldLabel: Zi.LAN.ZL4DAY,
2 years ago
name: 'ZL4DAY'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
1 year ago
fieldLabel: Zi.LAN.ZL5NAME,
2 years ago
name: 'ZL5NAME'
}, {
1 year ago
fieldLabel: Zi.LAN.ZL5DAY,
2 years ago
name: 'ZL5DAY'
}, {
1 year ago
fieldLabel: Zi.LAN.ZL6NAME ,
2 years ago
name: 'ZL6NAME'
}, {
1 year ago
fieldLabel: Zi.LAN.ZL6DAY ,
2 years ago
name: 'ZL6DAY'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
1 year ago
fieldLabel: Zi.LAN.ZL7NAME ,
2 years ago
name: 'ZL7NAME'
}, {
1 year ago
fieldLabel: Zi.LAN.ZL7DAY ,
2 years ago
name: 'ZL7DAY'
}, {
1 year ago
fieldLabel: Zi.LAN.ZL8NAME,
2 years ago
name: 'ZL8NAME'
}, { xtype: 'hiddenfield' }
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
1 year ago
text: Zi.LAN.Save,
2 years ago
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
1 year ago
text: Zi.LAN.SaveAndClose,
2 years ago
handler: function (button, event) {
this.Save('1');
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 布局
//控件布局
Ext.apply(this, {
items: [this.panelBtn, this.formEdit]
});
//#endregion
//绑定查询窗体
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsRptNoTotalZl/GetZlSet',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('GID').setDisabled(false);
var data = basicForm.getValues();
basicForm.findField('GID').setDisabled(true);
if (this.opStatus == 'add') {
data.GID = NewGuid();
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsRptNoTotalZl/SaveZlSet',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
if (type == '0') {
this.opStatus = 'edit';
basicForm.findField('GID').setDisabled(true);
} else if (type == '1') {
window.close();
} else {
this.LoadData('add', '');
basicForm.findField('GID').setDisabled(false);
}
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}
});