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/MsInfoClient/MsInfoClientDsEdit.js

1646 lines
55 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.MsInfoClientDsEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsInfoClientDsEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsInfoClientDsEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
Editdata: null,
stroplb: '往来单位',
initUIComponents: function () {
this.serialNo = 0;
//this.bodyDel = [];
this.itemindex = 1;
this.initloaddata = 0;
//#region 信息加载
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modExchangesUnit"} });
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeOpCode2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
this.storeOpCode3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefListRm' }
});
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeOpCode,
// forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//操 作
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户经理',//操 作
store: this.storeOpCode2,
// forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//单证
this.comboxDOC = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客服',//单 证
store: this.storeOpCode3,
// forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'DOC',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//所属集团公司
// this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
// model: 'DsShipping.ux.CustomRefModel',
// proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
// });
// this.storeCustCode.load({ params: { condition: " 1=1 "} });
// this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '所属集团公司',
// store: this.storeCustCode,
// labelWidth: 90,
// forceSelection: true,
// name: 'PCORPNAME',
// valueField: 'CustName',
// displayField: 'CodeAndName'
// });
//键值维护表_客户级别
this.storeCrmKeyCodeCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CrmKeyCodeModel',
proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' }
});
this.storeCrmKeyCodeCode.load({ params: { condition: " and KEYTYPE='客户级别'"} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '客户级别',
//labelWidth: 50,
store: this.storeCrmKeyCodeCode,
forceSelection: true,
name: 'PCORPNAME',
//width: 100,
valueField: 'KEYVALUE',
displayField: 'KEYVALUE',
value: ''
//
});
//#endregion
//#region 数据集
this.myCheckboxService = new Ext.form.CheckboxGroup({
id: 'myService',
xtype: 'checkboxgroup',
fieldLabel: '客户属性',
columns: 7,
items: [{
boxLabel: '委托单位',
inputValue: true,
name: 'ISCONTROLLER'
}, {
boxLabel: '供应商',//船公司
inputValue: true,
name: 'ISCARRIER'
}
// , {
// boxLabel: '场站',
// inputValue: true,
// name: 'ISYARD'
// }, {
// boxLabel: '车队',
// inputValue: true,
// name: 'ISTRUCK'
// }, {
// boxLabel: '报关行',
// inputValue: true,
// name: 'ISCUSTOM'
// }, {
// boxLabel: '订舱代理',
// inputValue: true,
// name: 'ISBOOKING'
// }, {
// boxLabel: '代理',
// inputValue: true,
// name: 'ISAGENT'
// }, {
// boxLabel: '航空公司',
// inputValue: true,
// name: 'ISAIRLINES'
// }, {
// boxLabel: '仓库',
// inputValue: true,
// name: 'ISWAREHOUSE'
// }, {
// boxLabel: '快递公司',
// inputValue: true,
// name: 'ISEXPRESS'
// }, {
// boxLabel: '国内代理',
// inputValue: true,
// name: 'ISAGENTCN'
// }, {
// boxLabel: '保险公司',
// inputValue: true,
// name: 'ISINSURE'
// }, {
// boxLabel: '发货人',
// inputValue: true,
// name: 'ISSHIPPER'
// }, {
// boxLabel: '收货人',
// inputValue: true,
// name: 'ISCONSIGNEE'
// }, {
// boxLabel: '通知人',
// inputValue: true,
// name: 'ISNOTIFYPARTY'
// }, {
// boxLabel: '租箱公司',
// inputValue: true,
// name: 'ISLEASING'
// }, {
// boxLabel: '贸易代理',
// inputValue: true,
// name: 'ISTRADINGAGENCY'
// }, {
// boxLabel: '经营单位',
// inputValue: true,
// name: 'ISENTERP'
// }, {
// boxLabel: '船代',
// inputValue: true,
// name: 'ISSHIPAGENCY'
// }, {
// boxLabel: '其他',
// inputValue: true,
// name: 'ISOTHER'
// }
]
});
this.CheckISSTOP = new Ext.form.Checkbox({
fieldLabel: '停止使用',
inputValue: true,
name: 'ISSTOP'
});
me = this;
this.storeStlName = Ext.create('Ext.data.Store', {
fields: ['FRT']
});
this.storeStlName.add({ "FRT": "次结" });
this.storeStlName.add({ "FRT": "年结" });
// this.storeStlName.add({ "FRT": "票结" });
// this.storeStlName.add({ "FRT": "周结" });
// this.storeStlName.add({ "FRT": "月结" });
// this.storeStlName.add({ "FRT": "半月结" });
this.comboxStlName = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '结费方式',
labelWidth: 80,
store: this.storeStlName,
forceSelection: true,
name: 'STLNAME',
valueField: 'FRT',
displayField: 'FRT',
listeners: {
scope: this,
change: function (field, newValue, oldValue, eOpts) {
}
}
});
this.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
model: 'ConutryRef',
proxy: { url: '/CommMng/BasicDataRef/GetCountryRefList' }
});
this.storeCountry.load({ params: { condition: ""} });
this.comboxCountry = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '所在国',
store: this.storeCountry,
forceSelection: true,
name: 'countryid',
valueField: 'countryid',
displayField: 'country_idandname'
});
//#endregion
//#region 编辑formEdit 基本信息
this.panelBodyAttn = new Ext.Panel({
title:'客户联系人', //'冻柜信息',
layout: "anchor",
region: 'center',
height: 90,
frame: true,
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '主要负责人',
labelWidth: 70,
flex: 1,
name: 'CHIEF'
}, {
fieldLabel: '职位',//MSN
labelWidth: 40,
allowBlank: true,
flex: 1,
name: 'MSN'
}, {
fieldLabel: '电话',
labelWidth: 40,
flex: 1,
name: 'TEL'
}, {
fieldLabel: '手机',//FAX
labelWidth: 40,
flex: 1,
name: 'FAX'
}, {
fieldLabel: 'QQ',
labelWidth: 40,
flex: 1,
name: 'QQ'
}, {
fieldLabel: 'EMAIL',
allowBlank: true,
labelWidth: 40,
flex: 1,
name: 'EMAIL'
}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '次要负责人',//网址
labelWidth: 70,
allowBlank: true,
flex: 1,
name: 'WEB'
}, {
fieldLabel: '职位',//城市
labelWidth: 40,
flex: 1,
name: 'CITY'
}, {
fieldLabel: '电话',//省(州)
labelWidth: 40,
flex: 1,
name: 'PROVINCE'
}, {
fieldLabel: '手机',//国家
labelWidth: 40,
flex: 1,
name: 'COUNTRY'
}, {
fieldLabel: 'QQ',//企业备案号
flex: 1,
labelWidth: 40,
name: 'REGISTRATIONNO'
}, {
fieldLabel: 'EMAIL',//商检备案号
labelWidth: 40,
flex: 1,
name: 'InspectionNo'
}]
}
]
});
this.panelBodyWAttn = new Ext.Panel({
title: '我司联系人', //'冻柜信息',
layout: "anchor",
region: 'center',
height: 65,
frame: true,
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSALE, this.comboxOP, this.comboxDOC, { xtype: 'hiddenfield' }]
}
]
});
this.panelBodyBuy = new Ext.Panel({
title: '购买产品信息', //'冻柜信息',
layout: "anchor",
region: 'center',
height: 65,
frame: true,
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '安装时间',//上半月并改为10个字节
flex: 1,
name: 'STLFIRSTHALFDATE',
format: 'Y-m-d',
xtype: 'datefield',
tooltip: '日期格式XXXX-XX-XX'
}, {
fieldLabel: '维护截止时间',//下半月并改为10个字节
flex: 1,
labelWidth: 80,
name: 'STLMIDDLEDATE',
format: 'Y-m-d',
xtype: 'datefield',
tooltip: '日期格式XXXX-XX-XX'
}, this.comboxCustCode, this.comboxStlName]
}
]
});
this.StoreCUSTTYPE = Ext.create('Ext.data.Store', {
fields: ['CUSTTYPE']
});
this.StoreCUSTTYPE.add({ "CUSTTYPE": "潜在" });
this.StoreCUSTTYPE.add({ "CUSTTYPE": "目标" });
this.StoreCUSTTYPE.add({ "CUSTTYPE": "拒绝" });
this.StoreCUSTTYPE.add({ "CUSTTYPE": "拜访演示" });
this.StoreCUSTTYPE.add({ "CUSTTYPE": "商务" });
this.StoreCUSTTYPE.add({ "CUSTTYPE": "合作" });
this.comboxCUSTTYPE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCUSTTYPE,
fieldLabel: '客户类型', //'默认付费方式',
forceSelection: true,
name: 'CUSTTYPE',
valueField: 'CUSTTYPE',
displayField: 'CUSTTYPE'
});
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 5,
layout: 'anchor',
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '编号',
name: 'GID', hidden: true
}, {
fieldLabel: '客户编码',
allowBlank: true,
flex: 1,
name: 'CODENAME'
}, {
fieldLabel: '客户简称',
allowBlank: true,
flex: 1,
name: 'SHORTNAME'
}, {
fieldLabel: '客户全称',
allowBlank: true,
flex: 2,
name: 'DESCRIPTION'
}
// , {
// fieldLabel: '客户级别',//EDI代码
// flex: 1,
// name: 'EDICODE'
// }
// , {
// fieldLabel: 'EDI代码2',
// flex: 1,
// name: 'EDICODE2'
// }
,
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '英文全称',
name: 'ENFULLNAME'
}, {
fieldLabel: '地址',
name: 'ADDR'
} ]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCUSTTYPE, {
fieldLabel: '客户来源',
name: 'CUSTCLASS'
}, {
fieldLabel: '客户规模',
name: 'CUSTGUIMO'
}, {
fieldLabel: '客户属性',
readOnly: true,
disabled: true,
name: 'CUSTPROP'
}]
},
this.panelBodyAttn, this.panelBodyWAttn, this.panelBodyBuy
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [//this.CheckISSTOP,
{
fieldLabel: '登陆名',
flex: 1,
name: 'LOGINNAME'
}, {
fieldLabel: '密码',
flex: 1,
name: 'LOGINPASSWORD'
}, {
fieldLabel: '录入人',
readOnly: true,
disabled: true,
name: 'OPNAME'
}, { xtype: 'hiddenfield' }
// , {
// fieldLabel: '冷藏费率',
// flex: 1,
// xtype:'numberfield',
// name: 'UNITPRICE'
// }
]
}
, this.myCheckboxService, {
xtype: 'textareafield',
grow: true,
fieldLabel: '备 注',
height: 60,
name: 'REMARK',
anchor: '100%'
}
// , {
// xtype: 'textareafield',
// grow: true,
// fieldLabel: '提单信息',
// height: 90,
// name: 'BLCONTENT',
// anchor: '100%'
// }
]
}); //end this.formEdit
this.formACC = Ext.widget('form', {
region: 'north',
frame: true,
bodyPadding: 5,
layout: 'anchor',
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 110,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '财务应收账款代码',
flex: 1,
name: 'FARCODE'
}, {
fieldLabel: '财务应付账款代码',
flex: 1,
name: 'FAPCODE'
}, {
fieldLabel: '财务序号',
flex: 1,
name: 'ORDERNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '发票抬头',
allowBlank: true,
flex: 1,
name: 'BILLRISES1'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '发票地址电话', //'发票地址电话',
flex: 1,
name: 'INVADDRTEL'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '人民币支票抬头',
flex: 1,
name: 'RMBBILLRISES'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '美元支票抬头',
flex: 1,
name: 'USDBILLRISES'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '纳税人识别号',
flex: 1,
name: 'TAXNO'
}]
}
// , {
// xtype: 'container',
// layout: 'hbox',
// defaultType: 'textfield',
// items: [this.comboxStlName]
// }
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '结费日期',
flex: 1,
name: 'STLDATE'
}
// , {
// fieldLabel: '上半月',
// flex: 1,
// name: 'STLFIRSTHALFDATE'
// }, {
// fieldLabel: '下半月',
// flex: 1,
// name: 'STLMIDDLEDATE'
// }
]
}
]
}); //end this.formEdit
//#endregion
//#region 定义数据集 往来单位银行账户
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsInfoClientBankModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsInfoClient/GetBankList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.girdcolums = [{
sortable: true,
dataIndex: 'GID',
text: '唯一编码',
width: 0
}, {
text: '代码',
dataIndex: 'CODENAME',
width: 50,
align: 'center',
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
text: '币别',
dataIndex: 'CURRENCY',
width: 50,
align: 'center',
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
text: '户头名称',
dataIndex: 'ACCOUNTNAME',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
text: '银行名称',
dataIndex: 'BANKNAME',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
text: '银行账户',
dataIndex: 'ACCOUNT',
width: 150,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
text: '银行地址',
dataIndex: 'BANKADDR',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
text: '财务软件代码',
dataIndex: 'FINANCESOFTCODE',
width: 100,
align: 'center',
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
text: '代理银行名称',
dataIndex: 'BANKAGENTNAME',
width: 100,
align: 'center',
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
text: '代理银行SWIFT',
dataIndex: 'SWIFT',
width: 100,
align: 'center',
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
text: '银行SWIFT',
dataIndex: 'BANKACNO',
width: 100,
align: 'center',
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
text: '所在国',
dataIndex: 'COUNTRYID',
width: 100,
align: 'center',
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.COUNTRY;
},
editor: this.comboxCountry
}, {
text: 'COUNTRY',hidden:true,
dataIndex: 'COUNTRY',
width: 100,
align: 'center',
}, {
text: '备注',
dataIndex: 'REMARK',
width: 100,
align: 'center',
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}];
//#endregion
//#region gridList列表显示信息
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1 //1单击2双击
});
this.gridList = new Ext.grid.GridPanel({
region: 'center',
store: this.storeBodyList,
enableHdMenu: false, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
rowLines: true,
columnLines: true,
tbar: [{
text: '',
tooltip: '添加账户',
iconCls: "btnadd",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
},
'-', {
text: '',
tooltip: '删除账户',
iconCls: "btndelete",
handler: function (button, event) {
this.onDelDetailClick(button, event);
},
scope: this
}
],
loadMask: { msg: "数据加载中,请稍等..." },
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
columns: this.girdcolums
});
//#endregion
this.panelBank = new Ext.Panel({
layout: "border",
region: "center",
split: true,
items: [this.gridList]
});
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnEPrev',
text: "上一客户",
// iconCls: "btnsave",
handler: function (button, event) {
this.PrevRecord();
},
scope: this
}, {
id: 'btnENext',
text: "下一客户",
// iconCls: "btnsave",
handler: function (button, event) {
this.NextRecord();
},
scope: this
}, {
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, {
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
}, {
id: 'btnESaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
}, '-', {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}, {
text: "新建",
handler: function (button, event) {
this.LoadData('add', '');
var basicForm = this.formEdit.getForm();
basicForm.findField('GID').setDisabled(false);
},
scope: this
}, '-', {
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}]
}); //end 按钮Toolbar
//#endregion
//#region 框架结构
this.panelpage = new Ext.Panel({
title: '客户基本信息',
layout: "border",
region: 'center',
animate: true,
//autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formEdit]
});
this.panelAcc = new Ext.Panel({
title: '财务信息',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.formACC, this.panelBank]
});
this.tabSeaeWTpanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
enableTabScroll: true,
items:
[
this.panelpage,
this.panelAcc
]
});
this.panelSeae = new Ext.Panel({
title: '客户信息',
id: 'pnlmodCUSTInfo',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
//closable:true,
items: [this.panelBtn, this.tabSeaeWTpanel]
});
this.treestore = new Ext.data.TreeStore({
model: 'DsShipping.ux.ModuleModel',
nodeParam: 'PARENTID',
proxy: {
type: 'ajax',
url: '/MvcShipping/MsBaseInfo/GetModuTreeRefList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
},
autoLoad: true,
root: {
name: '根节点',
expanded: true,
id: '5EA51E0B-BEC4-4F41-B384-54B51B70C81A'
}
});
this.tabtree = new Ext.tree.Panel({
region: 'west',
title: '往来单位',
split: true,
width: 180,
collapsible: true,
margins: '0 0 0 0',
store: this.treestore,
rootVisible: false,
hideHeaders: true,
animate: false,
lines: false,
columns: [{
xtype: 'treecolumn',
text: '模块名称',
width: 178,
dataIndex: 'DESCRIPTION'
}],
listeners: {
scope: this,
'itemclick': function (_this, record, item, index, e, eOpts) {
var finded = false;
if (record.data.MODULEURL == '@') {
this.tabSeaepanel.setActiveTab(0);
} else if (record.data.MODULEURL != '#') {
var children = this.tabSeaepanel.items;
if (children) {
for (var i = 0, len = children.length; i < len; i++) {
if (children.items[i].id) {
if (children.items[i].id == 'pnl' + record.data.NAME) {
this.tabSeaepanel.setActiveTab(i);
finded = true;
}
}
}
}
if (finded == false) {
if (this.formEdit.getForm().findField('SHORTNAME').getValue() == "") {
Ext.Msg.show({ title: '注意', msg: '请先保存客户信息后再打开其他模块!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
} else {
var paneltabitems = new Ext.Panel({
id: 'pnl' + record.data.NAME,
layout: "fit",
region: "center",
autoScroll: true,
frame: false,
closable: true,
title: record.data.DESCRIPTION,
html: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + record.data.MODULEURL + '"> </iframe>'
});
this.tabSeaepanel.add(paneltabitems);
this.tabSeaepanel.setActiveTab(paneltabitems);
this.tabSeaepanel.doLayout();
}
}
}
}
}
});
this.tabSeaepanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
enableTabScroll: true,
items:
[
this.panelSeae
],
listeners: {
scope: this,
'beforetabchange': function (tabPanel, newCard, oldCard, eOpts) {
if (oldCard.id == "pnlmodAireAllFee") {
var feemodify = oldCard.panelFee.getModifyStatus();
if (feemodify) {
Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return false;
}
}
if (oldCard.id == "pnlmodAireAmendFee") {
var feemodify = oldCard.panelFee.getModifyStatus();
if (feemodify) {
Ext.Msg.show({ title: '警告', msg: '费用未保存,请先保存费用!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
return false;
}
}
}
}
});
Ext.apply(this, {
items: [this.tabtree, this.tabSeaepanel]
});
//#endregion
this.LoadInitData();
//#region 其他
parentWin = window.parent.opener._thisclient;
this.InitData();
this.gridList.on('edit', function (editor, e, eOpts) {
this.ACCAfterEdit(editor, e, eOpts);
}, this);
}, //end initUIComponents
//#region 加载事件
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
}
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
this.storeBodyList.load({ params: { condition: "LINKID='" + this.editRecord.get('GID') + "'", isedit: "1"} });
}
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
//this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsInfoClient/GetData',
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;
}
data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.formACC.getForm().reset();
this.formACC.getForm().setValues(data);
if (data.CUSTPROP != '合作客户') {
this.panelBodyBuy.setVisible(false);
}
if (this.opStatus == 'add') {
// this.LoadDefValue();
}
this.Editdata = data;
this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
var gid = '*';
}, // end LoadDate
//#endregion
LoadInitData: function () {
this.storeOpCode.load();
},
//#region 保存
Save: function (type) {
var basicForm = this.formEdit.getForm();
var basicForm2 = this.formACC.getForm();
if (!basicForm.isValid()) {
return;
}
if (!basicForm2.isValid()) {
return;
}
var j = 0;
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
j = j + 1;
bodydatas.push(member);
}
//
if (j == 0) {
alert('请注意:未录入银行信息!');
}
var cust=this.formEdit.getForm().findField('SHORTNAME').getValue();
if (cust==""){
Ext.Msg.show({ title: '提示', msg: '客户简称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
this.formEdit.getForm().findField('GID').setDisabled(false);
var data2 = this.formACC.getForm().getValues(false, false, false);
var data = this.formEdit.getForm().getValues(false, false, false);
this.formEdit.getForm().findField('GID').setDisabled(true);
var datajs=Ext.JSON.encode(data);
var reg = new RegExp("<", "g"); //创建正则RegExp对象
var stringObj="";
stringObj = datajs.toString();
var datajs = stringObj.replace(reg, "❥");
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsInfoClient/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: datajs,
data2: Ext.JSON.encode(data2),
body: jsonBody
},
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().reset();
this.formEdit.getForm().setValues(returnData);
this.formACC.getForm().reset();
this.formACC.getForm().setValues(returnData);
this.Editdata = returnData;
var _sd={
data:""
};
_sd.data=returnData;
//this.onStartClick(_sd);
//
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.insert(0, returnData);
this.editRecord = this.StoreList.getAt(0);
if (type == '0') {
this.opStatus = 'edit';
basicForm.findField('GID').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("LINKID", this.editRecord.get('GID'));
memberbody.commit();
};
} else if (type == '1') {
window.close();
} else if (type == '2') {
this.LoadData('add', '');
}
if (type == '0') {
this.opStatus = 'edit';
basicForm.findField('GID').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("LINKID", this.editRecord.get('GID'));
memberbody.commit();
};
} else if (type == '1') {
window.close();
} else if (type == '2') {
this.LoadData('add', '');
}
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsInfoClientModel', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
if (type == '0') {
this.opStatus = 'edit';
basicForm.findField('GID').setDisabled(true);
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("LINKID", this.editRecord.get('GID'));
memberbody.commit();
};
} else if (type == '1') {
window.close();
} else if (type == '2') {
this.LoadData('add', '');
}
}
} 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
});
}
}
});
}, //end save
//#endregion
//#region 银行明细
onAddDetailClick: function (button, event) {
var record = Ext.create('MsInfoClientBankModel', {
GID: NewGuid(),
LINKID: '*',
ACCOUNTNAME: '',
CODENAME: '',
CURRENCY: 'RMB',
BANKNAME: '',
ACCOUNT: '',
FINANCESOFTCODE: '',
REMARK: ''
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 3 });
},
onDelDetailClick: function (button, event) {
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.LINKID == "" || rec.data.LINKID == "*")//如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeBodyList.remove(selectedRecords[i]);
}
else {
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsInfoClient/DeleteBank',
params: {
data: Ext.JSON.encode(rec.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeBodyList.remove(rec);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
//this.storeBodyList.remove(selectedRecords[i]);
}
},
//#endregion
ACCAfterEdit: function (editor, e, eOpts) {
if (e.field == 'COUNTRYID') {
var records = DsStoreQueryBy(this.storeCountry, 'countryid', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('COUNTRY', data.country);
} else {
e.record.set('COUNTRY', '');
}
}
},
//#region 编辑时按钮等的状态
GetEditStatus: function () {
var cust=this.formEdit.getForm().findField('SHORTNAME').getValue();
if (cust!=""){
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsInfoClient/ISUSE',
params: {
cust:cust
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
this.formEdit.getForm().findField('SHORTNAME').setReadOnly(true);
} else {
}
} else {
}
},
scope: this
});
}
_this = this;
var OPNAME=this.formEdit.getForm().findField('OPNAME').getValue();
this.StoreOpRange.load({ params: { optype: "modExchangesUnit" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', OPNAME);
if (records.getCount() > 0) {
canedit = true;
} else {
canedit = false;
}
} else { canedit = false; }
_this.setSaveBtnStatus(canedit);
}
}
});
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
}
},
//#endregion
//#region 打印
Print: function () {
var basicForm = this.formEdit.getForm();
var billNo = basicForm.findField('GID').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'MSINFOCLIENT';
var sql1 = "SET LANGUAGE 'us_english' SELECT * FROM info_client WHERE GID = '" + billNo + "'";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
//#endregion
PrevRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var j = this.StoreList.indexOf(this.editRecord);
if (j == 0) {
Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
if (j == this.StoreList.count) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var children = this.tabSeaeWTpanel.items;
if (children) {
for (var i = children.length - 1, len = 0; i >= len; i--) {
if (children.items[i].id) {
if (children.items[i].id == 'pnlmodCUSTInfo') {
} else {
children.items[i].close();
}
}
}
}
this.tabSeaepanel.doLayout();
j = j - 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
NextRecord: function () {
var modifystr = this.getIsModify();
if (modifystr != "") {
Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 ', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var j = this.StoreList.indexOf(this.editRecord);
if (j == (this.StoreList.count - 1)) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var children = this.tabSeaeWTpanel.items;
if (children) {
for (var i = children.length - 1, len = 0; i >= len; i--) {
if (children.items[i].id) {
if (children.items[i].id == 'pnlmodCUSTInfo') {
// this.tabSeaepanel.setActiveTab(i);
} else {
children.items[i].close();
}
}
}
}
this.tabSeaepanel.doLayout();
j = j + 1;
this.editRecord = this.StoreList.getAt(j);
if (this.opStatus == 'edit') {
condition = "GID='" + this.editRecord.get('GID') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
},
getIsModify: function () {
// var feepanel = Ext.getCmp('pnlmodAiriAllFee');
// if (feepanel != NaN && feepanel != null) {
// var feemodify = feepanel.panelFee.getModifyStatus();
// if (feemodify) {
// return '费用信息';
// }
// }
// var feeamendpanel = Ext.getCmp('pnlmodAiriAmendFee');
// if (feeamendpanel != NaN && feeamendpanel != null) {
// var feemodify = feeamendpanel.panelFee.getModifyStatus();
// if (feemodify) {
// return '更改单信息';
// }
// }
var drmodify = this.storeBodyList.getModifiedRecords();
if (drmodify.length != 0)
return '银行信息';
if (panelEdit.formEdit.getForm().isDirty() == true || panelEdit.formACC.getForm().isDirty() == true || drmodify.length != 0) {
return '基本信息';
}
else return '';
}
, onStartClick: function (returnData) {
//this.onSaveClick();
//var selections = this.gridList.getSelectionModel().getSelection();
var bodyList = [];
bodyList.push(returnData);
var jsonBody = ConvertRecordsToJsonAll(bodyList);
if (jsonBody == '') {
return;
}
Ext.Ajax.request({
waitMsg: '正在提交数据...',
url: '/MvcShipping/MsInfoClient/IC_Start',
params: {
USERID: USERID,
data: jsonBody
},
callback: function (options, success, response) {
if (success) {
this.onRefreshClick();
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}
});