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/MsExchangesUnit/MsExchangesUnitEdit.js

1318 lines
51 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
Shipping.MsExchangesUnitEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsExchangesUnitEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsExchangesUnitEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
Editdata: null,
initUIComponents: function () {
//#region formSearch 下拉框信息加载
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
//揽货人
this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeOpCode,
forceSelection: true,
name: 'SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//操 作
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操作',
store: this.storeOpCode,
forceSelection: true,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//单证
this.comboxDOC = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '单证',
store: this.storeOpCode,
forceSelection: true,
name: 'DOC',
valueField: 'UserName',
displayField: 'CodeAndName'
});
//结算方式
Ext.define('STLNAMEModel', { extend: 'Ext.data.Model', fields: [{ name: 'Name', type: 'string'}] });
var dataSTLNAME = [{ "Name": "票结" }, { "Name": "月结" }, { "Name": "半月结" }, { "Name": "周结" }, { "Name": ""}];
var storeSTLNAME = Ext.create('Ext.data.Store', { model: 'STLNAMEModel', data: dataSTLNAME });
this.comboxSTLNAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '结算方式',
forceSelection: true,
store: storeSTLNAME,
name: 'STLNAME',
valueField: 'Name',
displayField: 'Name',
listeners: {
scope: this,
'change': function (_Field, newValue, oldValue, eOpts) {
if (newValue == "票结") {
this.formJSFS.getForm().findField('STLDATEPJ').show(); //票结
Ext.getCmp('lbPJ').show(); //票结
Ext.getCmp('lbZJ').hide(); //周结
this.formJSFS.getForm().findField('STLDATE').hide(); //月结
this.formJSFS.getForm().findField('STLFIRSTHALFDATE').hide(); //上半月
this.formJSFS.getForm().findField('STLMIDDLEDATE').hide(); //下半月
}
else if (newValue == "月结") {
this.formJSFS.getForm().findField('STLDATEPJ').hide(); //票结
Ext.getCmp('lbPJ').hide(); //票结
Ext.getCmp('lbZJ').hide(); //周结
this.formJSFS.getForm().findField('STLDATE').show(); //月结
this.formJSFS.getForm().findField('STLFIRSTHALFDATE').hide(); //上半月
this.formJSFS.getForm().findField('STLMIDDLEDATE').hide(); //下半月
}
else if (newValue == "半月结") {
this.formJSFS.getForm().findField('STLDATEPJ').hide(); //票结
Ext.getCmp('lbPJ').hide(); //票结
Ext.getCmp('lbZJ').hide(); //周结
this.formJSFS.getForm().findField('STLDATE').hide(); //月结
this.formJSFS.getForm().findField('STLFIRSTHALFDATE').show(); //上半月
this.formJSFS.getForm().findField('STLMIDDLEDATE').show(); //下半月
}
else if (newValue == "周结") {
this.formJSFS.getForm().findField('STLDATEPJ').show(); //票结
Ext.getCmp('lbPJ').hide(); //票结
Ext.getCmp('lbZJ').show(); //周结
this.formJSFS.getForm().findField('STLDATE').hide(); //月结
this.formJSFS.getForm().findField('STLFIRSTHALFDATE').hide(); //上半月
this.formJSFS.getForm().findField('STLMIDDLEDATE').hide(); //下半月
}
}
}
});
//#endregion
//#region 编辑formHead 基本信息
this.formHead = Ext.widget('form', {
region: 'north',
style: 'border:0px solid black; border-top:0;', //隐藏边框
frame: true,
fieldDefaults: {
labelAlign: 'right',
flex: 1,
labelWidth: 60
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '编号',
name: 'GID',
hidden: true,
value: "*"
}, {
xtype: "checkbox", //checkbox控件
id: "ISSTOP",
name: "ISSTOP",
boxLabel: "该往来单位停止使用",
width: 160,
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, this.comboxSALE, this.comboxOP, this.comboxDOC]
}]
});
this.formJBXX = Ext.widget('form', {
title: '基本信息',
region: 'north',
frame: true,
collapsible: true, //将激活折叠功能
fieldDefaults: {
labelAlign: 'right',
flex: 1,
labelWidth: 90
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '*客户代码',
name: 'CODENAME',
style: 'color:red',
allowBlank: false
},
{
fieldLabel: '*客户简称',
name: 'SHORTNAME',
style: 'color:red',
allowBlank: false
},
{
fieldLabel: '*客户全称',
name: 'DESCRIPTION',
style: 'color:red',
allowBlank: false,
listeners: {
scope: this,
'blur': {
fn: function (_field, e) {
var qc = _field.value.toString();
//发票抬头 本位币
var sBillRises1 = this.formCWXX.getForm().findField('BillRises1').getValue("").toString();
if (sBillRises1 == "") {
this.formCWXX.getForm().findField('BillRises1').setValue(qc);
}
//发票抬头 外币
var sBillRises2 = this.formCWXX.getForm().findField('BillRises2').getValue("").toString();
if (sBillRises2 == "") {
this.formCWXX.getForm().findField('BillRises2').setValue(qc);
}
//支票抬头 本位币
var sRMBBillRises = this.formCWXX.getForm().findField('RMBBillRises').getValue("").toString();
if (sRMBBillRises == "") {
this.formCWXX.getForm().findField('RMBBillRises').setValue(qc);
}
//支票抬头 外币
var sUSDBillRises = this.formCWXX.getForm().findField('USDBillRises').getValue("").toString();
if (sUSDBillRises == "") {
this.formCWXX.getForm().findField('USDBillRises').setValue(qc);
}
}
}
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '序号',
name: 'TAXNO'
},
{
fieldLabel: '英文简称',
name: 'NAME'
},
{
fieldLabel: '英文全称',
name: 'ENFULLNAME'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '负责人',
name: 'CHIEF'
},
{
fieldLabel: '电话',
name: 'TEL'
}, {
fieldLabel: '传真',
name: 'FAX'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '公司地址',
name: 'ADDR'
},
{
fieldLabel: '邮箱',
name: 'EMAIL'
},
{
fieldLabel: '网页',
name: 'WEB'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'QQ',
name: 'QQ'
},
{
fieldLabel: 'MSN',
name: 'MSN'
},
{
fieldLabel: '组织机构代码',
name: 'ORGANIZATIONCODE'
}]
}]
});
this.formQYSX = Ext.widget('form', {
title: '*往来单位属性(可以多选)',
region: 'north',
frame: true,
collapsible: true, //将激活折叠功能
fieldDefaults: {
labelAlign: 'right',
flex: 1,
labelWidth: 60
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: "checkbox", //checkbox控件
name: "ISCARRIER",
boxLabel: "船公司",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISCONTROLLER",
boxLabel: "委托单位",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISYARD",
boxLabel: "场站",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISCUSTOM",
boxLabel: "报关行",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISSHIPPER",
boxLabel: "发货人",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISCONSIGNEE",
boxLabel: "收货人",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: "checkbox", //checkbox控件
name: "ISBOOKING",
boxLabel: "订舱代理",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISAIRLINES",
boxLabel: "航空公司",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISWAREHOUSE",
boxLabel: "仓库",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISEXPRESS",
boxLabel: "快递公司",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISAGENTCN",
boxLabel: "国内代理",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISAGENT",
boxLabel: "国外代理",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: "checkbox", //checkbox控件
name: "ISTRUCK",
boxLabel: "车队",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISWHARF",
boxLabel: "码头",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISSHIPPINGAGENT",
boxLabel: "船代",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISINSURE",
boxLabel: "保险公司",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISLEASING",
boxLabel: "租箱公司",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISTRADINGAGENCY",
boxLabel: "贸易代理",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
xtype: "checkbox", //checkbox控件
name: "ISENTERP",
boxLabel: "经营单位",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
xtype: "checkbox", //checkbox控件
name: "ISOTHER",
boxLabel: "其他_",
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
name: 'OTHERS'
}, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield'}]
}]//end items(fieldset 1)
});
this.formYWXX = Ext.widget('form', {
title: '业务信息设置',
region: 'north',
frame: true,
collapsible: true, //将激活折叠功能
fieldDefaults: {
labelAlign: 'right',
flex: 1,
labelWidth: 110
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '仓储费(吨/天)',
name: 'UNITPRICE'
}, {
fieldLabel: '企业备案号',
name: 'REGISTRATIONNO'
}, {
fieldLabel: 'Edi代码',
name: 'EDICODE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注',
name: 'REMARK',
height: 80,
flex: 4
}]
}]//end items(fieldset 1)
});
this.formKHYJ = Ext.widget('form', {
//title: '客户运价信息设置',
region: 'north',
style: 'border:0px solid black; border-top:0;', //隐藏边框
frame: true,
fieldDefaults: {
labelAlign: 'right',
flex: 1,
labelWidth: 60
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '登陆代码',
name: 'LOGINNAME'
}, {
fieldLabel: '登录密码',
name: 'LOGINPASSWORD'
}]
}]
});
this.formCWXX = Ext.widget('form', {
//title: '财务信息',
region: 'north',
frame: true,
fieldDefaults: {
labelAlign: 'right',
flex: 1,
labelWidth: 120
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '税号',
name: 'TAXNUMBER'
}, { xtype: 'hiddenfield'}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '发票抬头 本位币',
name: 'BillRises1'
}, {
fieldLabel: '发票抬头 外币',
name: 'BillRises2'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '支票抬头 本位币',
name: 'RMBBillRises'
}, {
fieldLabel: '支票抬头 外币',
name: 'USDBillRises'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '开户银行 本位币',
name: 'RMBBank'
}, {
fieldLabel: '开户银行 外币',
name: 'USDBank'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '开户行账号 本位币',
name: 'RMBAccount'
}, {
fieldLabel: '开户行账号 外币',
name: 'USDAccount'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '联机行号 本位币',
name: 'RMBOnlineNO'
}, {
fieldLabel: '联机行号 外币',
name: 'USDOnlineNO'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '开户行地址 本位币',
name: 'RMBBankAddress'
}, {
fieldLabel: '开户行地址 外币',
name: 'USDBankAddress'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '财务帐款代码 应收',
name: 'FARCODE'
},
{
fieldLabel: '财务帐款代码 应付',
name: 'FAPCODE'
}]
}]//end items(fieldset 1)
});
this.formJSFS = Ext.widget('form', {
title: '结算方式',
region: 'north',
frame: true,
collapsible: true, //将激活折叠功能
fieldDefaults: {
labelAlign: 'right',
flex: 1,
labelWidth: 120
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '信用最大金额 本位币',
name: 'RMBMaxAmountCredit',
value: 0,
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值!',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
fieldLabel: '信用最大金额 外币',
name: 'USDMaxAmountCredit',
value: 0,
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值!',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '(本位币+外币)合计',
name: 'MaxAmountCredit',
value: 0,
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值!'
},
{
fieldLabel: '外币汇率',
name: 'USDExchangeRate',
value: 0,
blankText: '请填写数值!',
allowBlank: false,
regex: /^\d+(\.\d{1,4})?$/,
regexText: '请输入正确的数值!'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSTLNAME, { xtype: 'hiddenfield'}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ xtype: 'hiddenfield', height: 5}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '结算时间',
name: 'STLDATEPJ',
blankText: '请填写数值!',
regex: /^\+?[1-9][0-9]*$/,
regexText: '请输入正确的数值!',
listeners: {
scope: this,
'blur': {
fn: function (_field, e) {
this.getDay(3);
}
}
}
}, {
//票结时间
xtype: 'label',
id: 'lbPJ',
name: 'lbPJ',
flex: 1,
text: "业务日期发生“XX”日即为最晚结算日期"
}, {
//周结时间
xtype: 'label',
id: 'lbZJ',
name: 'lbZJ',
flex: 1,
text: "(注:业务日期发生在星期“几”!)"
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
//月结时间
fieldLabel: '结算时间',
name: 'STLDATE',
blankText: '请填写数值!',
regex: /^\+?[1-9][0-9]*$/,
regexText: '请输入正确的数值!',
listeners: {
scope: this,
'blur': {
fn: function (_field, e) {
this.getDay(0);
}
}
}
}, { xtype: 'hiddenfield'}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
//半月结时间
fieldLabel: '结算时间 上半月',
name: 'STLFIRSTHALFDATE',
blankText: '请填写数值!',
regex: /^\+?[1-9][0-9]*$/,
regexText: '请输入正确的数值!',
listeners: {
scope: this,
'blur': {
fn: function (_field, e) {
this.getDay(1);
}
}
}
}, {
//半月结时间
fieldLabel: '下半月',
name: 'STLMIDDLEDATE',
blankText: '请填写数值!',
regex: /^\+?[1-9][0-9]*$/,
regexText: '请输入正确的数值!',
listeners: {
scope: this,
'blur': {
fn: function (_field, e) {
this.getDay(2);
}
}
}
}]
}]//end items(fieldset 1)
});
this.formBlank = Ext.widget('form', {
region: 'south',
height: 30,
style: 'border:0px solid black; border-top:0;', //隐藏边框
frame: true,
items: [{ xtype: 'container'}]
});
//#endregion
//#region 工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
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) {
this.LoadData('add', '');
},
scope: this
}, '-', {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}]
}); //end 按钮Toolbar
//#endregion
//#region 页面布局
//根节点
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: '0791bbcc-8079-49de-8175-6063b9826ac1'
id: '0791bbcc-8079-49de-8175-6063b9826ac0'
}
});
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) {
if (record.data.MODULEURL == '@') {
this.tabCompanysPanel.setActiveTab(0);
} else if (record.data.MODULEURL != '#') {
if (Ext.getCmp('pnl' + record.data.NAME)) {
var children = this.tabCompanysPanel.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.tabCompanysPanel.setActiveTab(i);
}
}
}
}
} else {
if (this.formHead.getForm().findField('GID').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.tabCompanysPanel.add(paneltabitems);
this.tabCompanysPanel.setActiveTab(paneltabitems);
this.tabCompanysPanel.doLayout();
}
}
}
}
}
});
//#region tab页
this.panelJBXX = new Ext.Panel({
title: '基本信息',
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [this.formHead, this.formJBXX, this.formQYSX, this.formYWXX, this.formBlank]
});
this.panelCWXX = new Ext.Panel({
title: '财务信息',
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [this.formCWXX, this.formJSFS]
});
this.panelKHYJXXSZ = new Ext.Panel({
title: '客户运价信息设置',
layout: "border",
region: 'center',
margin: '0 0',
frame: true,
items: [this.formKHYJ, this.formBlank]
});
this.tabpanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: false,
frame: false,
region: 'center',
id: "TabPanelID",
enableTabScroll: true,
items:
[
this.panelJBXX,
this.panelCWXX,
this.panelKHYJXXSZ
]
});
//#endregion
this.panelCompanys = new Ext.Panel({
title: '往来单位',
id: 'pnlmodExchangesUnitInfo',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
items: [this.panelBtn, this.tabpanel]
});
this.tabCompanysPanel = new Ext.TabPanel({
activeTab: 0,
autoWidth: true,
border: true,
frame: false,
region: 'center',
id: "tabCompanysPanel",
enableTabScroll: true,
items: [this.panelCompanys]
});
Ext.apply(this, {
items: [this.tabtree, this.tabCompanysPanel]
});
//#endregion
parentWin = window.parent.opener;
this.InitData();
}, //end initUIComponents
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.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.bodyDel = [];
this.opStatus = opstatus;
//
this.formJSFS.getForm().findField('STLDATEPJ').hide(); //票结
Ext.getCmp('lbPJ').hide(); //票结
Ext.getCmp('lbZJ').hide(); //周结
this.formJSFS.getForm().findField('STLDATE').hide(); //月结
this.formJSFS.getForm().findField('STLFIRSTHALFDATE').hide(); //上半月
this.formJSFS.getForm().findField('STLMIDDLEDATE').hide(); //下半月
//
if (this.opStatus == 'add') {
this.formHead.getForm().reset();
this.formJBXX.getForm().reset();
this.formQYSX.getForm().reset();
this.formYWXX.getForm().reset();
this.formKHYJ.getForm().reset();
this.formCWXX.getForm().reset();
this.formHead.getForm().findField('GID').setDisabled(false);
this.formHead.getForm().findField('GID').setValue("*");
this.formHead.getForm().findField('GID').setDisabled(true);
}
else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsExchangesUnit/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.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
this.formJBXX.getForm().reset();
this.formJBXX.getForm().setValues(data);
this.formQYSX.getForm().reset();
this.formQYSX.getForm().setValues(data);
this.formYWXX.getForm().reset();
this.formYWXX.getForm().setValues(data);
this.formKHYJ.getForm().reset();
this.formKHYJ.getForm().setValues(data);
this.formCWXX.getForm().reset();
this.formCWXX.getForm().setValues(data);
//
//this.GetEditStatus(data.MODIFIEDUSERNAME.toString());
this.GetEditStatus(SHOWNAME.toString());
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}, // end LoadDate
GetEditStatus: function (MODIFIEDUSERNAME) {
var canedit = false;
//var MODIFIEDUSERNAME = this.formHead.getForm().findField('MODIFIEDUSERNAME').getValue();
_this = this;
this.StoreOpRange.load({ params: { optype: "modExchangesUnit" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', MODIFIEDUSERNAME);
if (recordins.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();
}
},
Save: function (type) {
var basicForm1 = this.formHead.getForm();
if (!basicForm1.isValid()) {
return;
}
var basicForm2 = this.formJBXX.getForm();
if (!basicForm2.isValid()) {
return;
}
var basicForm3 = this.formQYSX.getForm();
if (!basicForm3.isValid()) {
return;
}
var basicForm4 = this.formYWXX.getForm();
if (!basicForm4.isValid()) {
return;
}
var basicForm5 = this.formKHYJ.getForm();
if (!basicForm5.isValid()) {
return;
}
var basicForm6 = this.formCWXX.getForm();
if (!basicForm6.isValid()) {
return;
}
var basicForm7 = this.formJSFS.getForm();
if (!basicForm7.isValid()) {
return;
}
//
this.formHead.getForm().findField('GID').setDisabled(false);
var dataHead = this.formHead.getForm().getValues(false, false, false);
var dataJBXX = this.formJBXX.getForm().getValues(false, false, false);
var dataQYSX = this.formQYSX.getForm().getValues(false, false, false);
var dataYWXX = this.formYWXX.getForm().getValues(false, false, false);
var dataKHYJ = this.formKHYJ.getForm().getValues(false, false, false);
var dataCWXX = this.formCWXX.getForm().getValues(false, false, false);
var dataJSFS = this.formJSFS.getForm().getValues(false, false, false);
this.formHead.getForm().findField('GID').setDisabled(true);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsExchangesUnit/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(dataHead),
data2: Ext.JSON.encode(dataJBXX),
data3: Ext.JSON.encode(dataQYSX),
data4: Ext.JSON.encode(dataYWXX),
data5: Ext.JSON.encode(dataKHYJ),
data6: Ext.JSON.encode(dataCWXX),
data7: Ext.JSON.encode(dataJSFS)
},
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.formHead.getForm().reset();
this.formHead.getForm().setValues(returnData);
this.formJBXX.getForm().reset();
this.formJBXX.getForm().setValues(returnData);
this.formQYSX.getForm().reset();
this.formQYSX.getForm().setValues(returnData);
this.formYWXX.getForm().reset();
this.formYWXX.getForm().setValues(returnData);
this.formKHYJ.getForm().reset();
this.formKHYJ.getForm().setValues(returnData);
this.formCWXX.getForm().reset();
this.formCWXX.getForm().setValues(returnData);
this.formJSFS.getForm().reset();
this.formJSFS.getForm().setValues(returnData);
//
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsExchangesUnitEntity', 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();
}
//
this.opStatus = 'edit';
if (type == '0') {
Ext.Msg.show({ title: '提示', msg: '操作成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
} 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
getDay: function (sday) {
if (sday == 0) {
var syue = this.formJSFS.getForm().findField('STLDATE').getValue();
if (syue != "") {
if (parseInt(syue) > 0 && parseInt(syue) < 32) {
}
else {
//alert("月结期限超出正常天数!");
Ext.Msg.show({ title: '提示', msg: '月结期限超出正常天数!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.formJSFS.getForm().findField('STLDATE').setValue("");
return;
}
}
}
else if (sday == 1) {
var shang = this.formJSFS.getForm().findField('STLFIRSTHALFDATE').getValue();
if (shang != "") {
if (parseInt(shang) > 0 && parseInt(shang) < 16) {
}
else {
//alert("上半月结期限超出正常天数!");
Ext.Msg.show({ title: '提示', msg: '上半月结期限超出正常天数!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.formJSFS.getForm().findField('STLFIRSTHALFDATE').setValue("");
return;
}
}
}
else if (sday == 2) {
var xia = this.formJSFS.getForm().findField('STLMIDDLEDATE').getValue();
if (xia != "") {
if (parseInt(xia) > 15 && parseInt(xia) < 32) {
}
else {
//alert("下半月结期限超出正常天数!");
Ext.Msg.show({ title: '提示', msg: '下半月结期限超出正常天数!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.formJSFS.getForm().findField('STLMIDDLEDATE').setValue("");
return;
}
}
}
}
});