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.

2847 lines
100 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.MsOpPriceProjectEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpPriceProjectEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpPriceProjectEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
editFactryRecord: null,
FactryStatus: 'add',
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
//#region 编辑form
//枚举参照相关(编辑form)
this.formname = 'MsOpPriceProjectEdit';
this.storeLANE = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.Lane',
proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' }
});
this.storeLANE.load();
this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '航线',
store: this.storeLANE,
name: 'LINE',
valueField: 'LANE',
displayField: 'LANE'
});
this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
autoLoad: true,
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeCodeDisport.load();
this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的港',
store: this.storeCodeDisport,
name: 'PORTDISCHARGE',
valueField: 'PORT',
displayField: 'PORT'
});
this.storePORTLOAD = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
autoLoad: true,
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storePORTLOAD.load();
this.comboxPORTLOAD = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '起运港',
store: this.storePORTLOAD,
name: 'PORTLOAD',
valueField: 'PORT',
displayField: 'PORT'
});
this.storeTRANSPORT = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
autoLoad: true,
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' }
});
this.storeTRANSPORT.load();
this.comboxTRANSPORT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '中转港',
store: this.storeTRANSPORT,
name: 'TRANSPORT',
valueField: 'PORT',
displayField: 'PORT'
});
//客户加载_船公司
this.storeCARRIER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCARRIER.load({ params: { condition: "ISCARRIER='1'" } });
//船公司
this.comboxCARRIER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船公司',
store: this.storeCARRIER,
forceSelection: true,
name: 'CARRIER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeCountry',
proxy: { url: '/MvcShipping/MsCodeCountry/GetDataList' }
});
this.storeCountry.load({ params: { start: 0, limit: 1000, condition: "" } });
this.comboxCountry = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '国家',
store: this.storeCountry,
name: 'COUNTRY',
valueField: 'COUNTRY',
displayField: 'COUNTRY'
});
this.StoreCTNSTATUS = Ext.create('DsExt.ux.RefEnumStore', {});
this.StoreCTNSTATUS.load({ params: { enumTypeId: 97029 } });
this.comboxCTNSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCTNSTATUS,
fieldLabel: '箱状态',
forceSelection: true,
name: 'CTNSTATUS',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//运输条款
this.storeSERVICE = Ext.create('DsExt.ux.RefTableStore', {
model: 'CODE_SERVICE',
proxy: { url: '/CommMng/BasicDataRef/GetCodeServiceList' }
});
this.storeSERVICE.load({ params: { condition: "" } });
this.comboxSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '运输条款',
store: this.storeSERVICE,
forceSelection: true,
name: 'SERVICE',
valueField: 'SERVICE',
displayField: 'SERVICE'
});
this.StoreWEEKETD = Ext.create('Ext.data.Store', {
fields: ['ID', 'NAME']
});
this.StoreWEEKETD.add({ "ID": "周一", "NAME": "周一" });
this.StoreWEEKETD.add({ "ID": "周二", "NAME": "周二" });
this.StoreWEEKETD.add({ "ID": "周三", "NAME": "周三" });
this.StoreWEEKETD.add({ "ID": "周四", "NAME": "周四" });
this.StoreWEEKETD.add({ "ID": "周五", "NAME": "周五" });
this.StoreWEEKETD.add({ "ID": "周六", "NAME": "周六" });
this.StoreWEEKETD.add({ "ID": "周日", "NAME": "周日" });
this.comboxWEEKETD = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '船期',
autosize: true,
bodyPadding: 7,
name: 'WEEKETDAA',
flex: 2,
labelWidth: 90,
store: this.StoreWEEKETD,
queryMode: 'local',
triggerOnClick: false,
valueField: 'ID',
displayField: 'NAME'
});
this.storeAgent = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListAgent' }
});
this.storeAgent.load();
this.comboxAgent = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '代理',
store: this.storeAgent,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
//forceSelection: true,
name: 'AGENTNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
// this.formEdit.getForm().findField('AGENTATTN').setValue(records[0].data.TEL);
// this.formEdit.getForm().findField('AGENTADDR').setValue(records[0].data.ADDR);
}
}
}
});
this.storeGOODTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeGOODTYPE.load({ params: { enumTypeId: 97028 } });
this.comboxGOODTYPE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeGOODTYPE,
fieldLabel: '货物类别',
name: 'GOODTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCode.load();
//客服
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '维护人',
store: this.storeOpCode,
forceSelection: true,
name: 'OP',
valueField: 'GID',
displayField: 'CodeAndName'
});
this.storePRJECTTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storePRJECTTYPE.load({ params: { enumTypeId: 99070 } });
this.comboxPRJECTTYPE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storePRJECTTYPE,
fieldLabel: '方案类别',
name: 'PRJECTTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storePRJECTSOURCE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storePRJECTSOURCE.load({ params: { enumTypeId: 99071 } });
this.comboxPRJECTSOURCE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storePRJECTSOURCE,
fieldLabel: '运价来源',
name: 'PRJECTSOURCE',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeISTRANSPORT = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeISTRANSPORT.add({ "FSTATUS": "1", "NAME": "是" });
this.storeISTRANSPORT.add({ "FSTATUS": "", "NAME": "否" });
this.comboxISTRANSPORT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否中转',
store: this.storeISTRANSPORT,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'ISTRANSPORT'
});
this.storeISBEST = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeISBEST.add({ "FSTATUS": "1", "NAME": "是" });
this.storeISBEST.add({ "FSTATUS": "0", "NAME": "否" });
this.comboxISBEST = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否最优方案',
labelWidth: 90,
store: this.storeISBEST,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'ISBEST'
});
this.storeISSTOP = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeISSTOP.add({ "FSTATUS": "是", "NAME": "是" });
this.storeISSTOP.add({ "FSTATUS": "", "NAME": "否" });
this.comboxISSTOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否停用',
labelWidth: 90,
store: this.storeISSTOP,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'ISSTOP'
});
//表参照相关(编辑form)
_this = this;
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 5,
autoScroll: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
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'
}, {
fieldLabel: 'COMPANYID',
name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'PRICETYPE',
name: 'PRICETYPE', flex: 0, hidden: true, margins: '0'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPRJECTTYPE, this.comboxPRJECTSOURCE, this.comboxAgent, {
fieldLabel: '开始日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'BEGINDATE'
}, {
fieldLabel: '有效日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'VALIDETD'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxPORTLOAD, this.comboxPORTDISCHARGE, this.comboxCARRIER, this.comboxGOODTYPE, {
fieldLabel: '方案状态',
readOnly:true,
name: 'BSSTATUS'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxISTRANSPORT, this.comboxISBEST, {
fieldLabel: '航程',
name: 'VOYAGE',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
this.GetPriceChange();
}
}
}, {
fieldLabel: '日租金',
name: 'RENTOFDAY',
listeners: {
scope: this,
blur: function (field, The, eOpts) {
this.GetPriceChange();
}
}
}, {
fieldLabel: '租金',
name: 'RENTAMOUNT'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxSERVICE, this.comboxCTNSTATUS, {
fieldLabel: '报价日期',
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'PRICEDATE'
}, {
fieldLabel: '是否停用',
readOnly: true,
disabled: true,
name: 'ISSTOP'
}, { xtype: 'hiddenfield' }]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '佣金比率',
name: 'CHANGERATE',
regex: /^(-?\d+)(\.\d+)?$/,
regexText: '请输入正确的数值!'
}, {
fieldLabel: '创建人',
readOnly: true,
disabled: true,
name: 'INPUTBYREF'
}, {
fieldLabel: '创建日期',
readOnly: true,
disabled: true,
name: 'INPUTTIME'
}, this.comboxOP]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '方案批注',
name: 'PRJECTMARK'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注',
name: 'REMARKS'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#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
},
{
text: "保存",
iconCls: "btnsave",
id: 'btnsave',
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
text: "保存并关闭",
id: 'btnsaveandclose',
handler: function (button, event) {
this.Save('1');
},
scope: this
},
'-',
{
text: "保存并新建",
id: 'btnsaveandnew',
handler: function (button, event) {
this.Save('2');
},
scope: this
},
'-',
{
text: "复制并新建",
id: 'btncopyandsave',
handler: function (button, event) {
var basicForm = this.formEdit.getForm();
this.opStatus = 'add';
basicForm.findField('GID').setDisabled(false);
var field = basicForm.findField('GID');
var BSNO = NewGuid();
field.setValue(BSNO);
basicForm.findField('GID').setDisabled(true);
var field = basicForm.findField('INPUTBYREF');
field.setValue('');
var field = basicForm.findField('INPUTTIME');
field.setValue('');
var field = basicForm.findField('BSSTATUS');
field.setValue('未提交');
var field = basicForm.findField('ISSTOP');
field.setValue('否');
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("LINKGID", '*');
memberbody.set("GID", NewGuid());
memberbody.set("FEESTATUS",1);
};
this.GetEditStatus();
},
scope: this
},
, '-', {
id: 'btnSubmitAudit',
text: '提交审核',
tooltip: '提交审核',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, {
id: 'btnSubmitAuditBack',
text: '撤销提交',
tooltip: '撤销提交',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 费用信息
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'MsOpPriceItems',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpPrice/GetPriceItemsList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListGood = Ext.create('Ext.data.Store', {
model: 'MsCodeMSDS',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsCodeMSDS/GetDataListRm',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//this.storeListGood.load({ params: { condition: ""} });
this.comboxGoods = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeListGood,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'REJECTID',
valueField: 'GID',
displayField: 'GOODNAME'
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef.load({ params: { condition: "" } });
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef,
forceSelection: true,
name: 'FEENAME',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr.load({ params: { condition: "" } });
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCurr,
forceSelection: true,
name: 'CURRENCY',
valueField: 'CURR',
displayField: 'CURR'
});
this.storeFeeUnit = Ext.create('DsExt.ux.RefTableStore', {
fields: ['UNIT'],
proxy: { url: '/MvcShipping/MsCodeFeeTemplate/GetFeeUnit' }
});
this.storeFeeUnit.load({ params: { condition: "" } });
this.comboxFeeUnit = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeUnit,
forceSelection: true,
name: 'UNIT',
valueField: 'UNIT',
displayField: 'UNIT'
});
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustomerNameRef.load({ params: { condition: "" } });
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustomerNameRef,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.thispricetype = PRICETYPE;
this.storePRICECLASS = Ext.create('DsExt.ux.RefEnumStore', {});
this.storePRICECLASS.load({ params: { enumTypeId: 97061 } });
this.comboxPRICECLASS = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storePRICECLASS,
name: 'PRICECLASS',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.initgirdbillcolums = [{
sortable: true,
dataIndex: 'GID',
header: '编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'LINKGID',
header: '业务编号',
hidden: true,
width: 0
}, {
sortable: true,
dataIndex: 'ITEMSNO',
header: '序号',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
renderer: Ext.util.Format.numberRenderer('00'),
align: 'right',
width: 60
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '付款方',
editor: this.comboxCustomerNameRef,
width: 110
}, {
sortable: true,
dataIndex: 'FEENAME',
header: '费用名称',
editor: this.comboxFeeNameRef,
width: 140
}, {
sortable: true,
dataIndex: 'UNIT',
header: '标准',
editor: this.comboxFeeUnit,
width: 100
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
editor: this.comboxCurr,
width: 100
}, {
sortable: true,
dataIndex: 'UNITPRICE',
header: '单价',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
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; },
align: 'right',
width: 110
}, {
sortable: true,
dataIndex: 'REMARKS',
header: '备注',
editor: {
xtype: 'textfield',
selectOnFocus: true,
enableKeyEvents: true
},
width: 250
}, {
sortable: true,
dataIndex: 'PRICECLASS',
header: '类别归属',
editor: this.comboxPRICECLASS,
width: 100
}, {
sortable: true,
dataIndex: 'ISSTOP',
header: '是否停用', //'是否海运',
width: 60,
renderer: function (value, cellmeta) {
if (value == '1' || value == true || value == 'true') {
return "是";
} else {
return "否";
}
}
}, {
sortable: true,
dataIndex: 'FEESTATUS_REF',
header: '费用状态',
width: 60
}, {
sortable: true,
dataIndex: 'REASON',
header: '原因',
width: 60
}, {
sortable: true,
dataIndex: 'INPUTBYREF',
header: '创建人',
width: 60
}, {
sortable: true,
dataIndex: 'INPUTTIME',
header: '创建日期',
width: 80
}, {
sortable: true,
dataIndex: 'MODIFYUSERREF',
header: '录入人',
width: 60
}, {
sortable: true,
dataIndex: 'MODIFYTIME',
header: '录入日期',
width: 80
}, {
sortable: true,
dataIndex: 'AUDITNAME',
header: '审核人',
width: 60
}, {
sortable: true,
dataIndex: 'AUDITDATE',
header: '审核日期',
width: 80
}];
this.girdbillcolums = this.initgirdbillcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridListBody = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selModel: this.GridCheckBoxModel,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('FEESTATUS');
return Shipping.FeeGetRowClass(feeStatus);
}
},
tbar: [{
text: '增加明细',
tooltip: '增加明细',
id: "btnadddetail",
iconCls: "btnadddetail",
handler: function (button, event) {
this.addDetail();
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
id: "btndeldetail",
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDeletePriceItemsClick();
},
scope: this
}, '-', {
text: '停用明细',
tooltip: '停用明细',
handler: function (button, event) {
this.onStopPriceItemsClick();
},
scope: this
},
// '-', {
// text: '提交审核',
// tooltip: '提交审核',
// id: "btnSubmitAudit",
// handler: function (button, event) {
// this.onSubmitAuditClick();
// },
// scope: this
//}, '-', {
// text: '撤销提交',
// tooltip: '撤销提交审核',
// id: "btnCancelSubmitAudit",
// handler: function (button, event) {
// this.onCancelAuditNewClick();
// },
// scope: this
//}, '-', {
// text: '申请修改',
// tooltip: '申请修改',
// id: "btnShenModify",
// handler: function (button, event) {
// this.onShenModifyClick();
// },
// scope: this
//},
// '-', {
// text: '取消申请', //'取消申请',
// tooltip: '取消申请', //'取消申请',
// id: 'btnShenCancel',
// handler: function (button, event) {
// this.onCancelShenClick();
// },
// scope: this
//}, '-', {
// text: '查看历史申请', //'查看信息',
// tooltip: '查看历史申请', //查看信息',
// handler: function (button, event) {
// this.onViewDetailClick();
// },
// scope: this
// },
'-', {
text: '引入费用',
tooltip: '引入费用',
menu:
[
{
text: "历史引入",
handler: function (menu, event) {
_this.onHistryAddDetailClick(menu, event);
}
}
]
}, {
text: '保存列表样式',
menu: [
{
text: '保存',
handler: function (button, event) {
_this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridListBody.columns, _this.girdbillcolums, 1, true);
}
}, {
text: '初始化',
handler: function (menu, event) {
_this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridListBody.columns, _this.initgirdbillcolums, 1, true);
}
}],
scope: this
}, {
text: "导出Excel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportBillClick(button, event);
},
scope: this
}],
columns: this.girdbillcolums
});
this.gridListBody.on('edit', function (editor, e, eOpts) {
this.gridListAfterEdit(editor, e, eOpts);
}, this);
this.NewFee = Ext.widget('form', {
frame: true,
region: 'east',
width: 300,
hidden: true,
trackResetOnLoad: true,
title: '运价新值', //'费用新值',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'LINKGID', //'业务编号',
name: 'LINKGID', hidden: true
}, {
fieldLabel: 'GID', //'GId',,
name: 'GID', flex: 0, hidden: true, margins: '0'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '付款方', //'不含税单价',
name: 'CUSTOMERNAME'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '费用名称', //'不含税单价',
name: 'FEENAME'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '币别', //'不含税单价',
name: 'CURRENCY'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '标准', //'不含税单价',
name: 'UNIT'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '单价', //'不含税单价',
xtype: 'numberfield',
name: 'UNITPRICE'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '类别归属', //'备注',
name: 'PRICECLASS'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注', //'备注',
name: 'REMARKS'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '修改原因', //'修改原因',
flex: 2,
name: 'REASON'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.panelBody = new Ext.Panel({
title: '运价详细信息',
layout: "border",
region: 'center',
animate: true,
// autoScroll: true,
// containerScroll: true,
frame: false,
items: [this.gridListBody, this.NewFee]
});
this.storeChFeeModify = Ext.create('Ext.data.Store', {
model: 'MsOpPriceItems',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcContainer/MsOpPrice/GetModifyData',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridListBody.getSelectionModel().on('select', function (model, record, index) {
var FeeStatus = record.data.FEESTATUS;
var GId = record.data.GID;
if (FeeStatus == 3) {
this.NewFee.setVisible(true);
this.storeChFeeModify.load({
params: { FeeID: GId, ApplyType: 2 },
callback: function (r, options, success) {
if (success) {
_this.NewFee.getForm().loadRecord(_this.storeChFeeModify.getAt(0));
}
},
scope: this
});
} else {
this.NewFee.setVisible(false);
}
}, this);
//#endregion
//#region 明细表-单据图片档案管理
_this = this;
this.storeDocList = Ext.create('Ext.data.Store', {
model: 'ReceiptDocmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/ReceiptDoc/GetDocList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.DocListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.DocCM = Ext.create('Ext.selection.CheckboxModel');
this.gridDocList = new Ext.grid.GridPanel({
store: this.storeDocList,
enableHdMenu: false,
region: 'center',
// width: 350,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.DocListCellEditing],
selModel: this.DocCM,
selType: 'cellmodel',
tbar: [{
text: '删除',
tooltip: '删除',
iconCls: "btndeletedetail",
id: 'btnEDelDoc',
handler: function (button, event) {
this.onDelFileClick(button, event);
},
scope: this
}, '-', {
text: '上传附件',
tooltip: '上传附件',
iconCls: "btnadddetail",
id: 'btnEAddDoc',
handler: function (button, event) {
this.onUpLoadFileClick(button, event);
},
scope: this
}],
columns: [{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'R_GID',
header: 'R_GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'URL',
header: '文件名',
width: 140,
renderer: function (value, p, record) {
return '<a href="' + record.data.Driect_URL + '" style=' + '"text-decoration:none"' + '>' + value + '</a>';
}
},
{
sortable: true, hidden: true,
dataIndex: 'Driect_URL',
header: 'Driect_URL',
width: 80
}, {
xtype: 'actioncolumn',
width: 50,
text: '图片预览', //操作
items: [{
icon: '/images/icons/btnSearch.gif', // Use a URL in the icon config
tooltip: '预览',
handler: function (grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
var filePath = rec.get('Driect_URL') + '?a=' + Math.random();
var imgView = new Shipping.FileView({ filePath: filePath });
imgView.show();
}
}]
},
{
sortable: true, hidden: true,
dataIndex: 'MODIFIEDUSER',
header: 'MODIFIEDUSER',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDUSERRef',
header: '上传人',
width: 80
},
{
sortable: true,
dataIndex: 'MODIFIEDTIME',
header: '上传时间',
width: 135
}
]
});
this.panelDoc = new Ext.Panel({
id: "panelDoc",
layout: "border",
region: "north",
height: 150,
flex: 1.5,
title: '需求附件', //autoScroll: true,
frame: false,
split: true,
items: [this.gridDocList]
});
//#endregion
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center", split: true,
items: [
this.panelBody
, this.panelDoc
]
});
//#region 布局
//控件布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 250,
items: [this.panelBtn, this.formEdit]
});
Ext.apply(this, {
items: [this.panelTop, this.MainTab]
});
//#endregion
//绑定查询窗体
this.gridListCellEditing.on('beforeedit', function (editor, e) {
return this.cellEditingBeforeEdit(editor, e);
}, this);
this.storeBodyList.on('beforeload', function (store) {
var acondition = " LINKGID='" + this.editRecord.get('GID') + "'";
Ext.apply(store.proxy.extraParams, { condition: acondition });
}, this);
this.storeDocList.on('beforeload', function (store) {
var xcondition = " BSNO='" + this.editRecord.get('GID') + "'";
Ext.apply(store.proxy.extraParams, { condition: xcondition });
}, this);
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
this.storeFeeNameRefm = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRefm.load({ params: { condition: "" } });
this.comboxFeeNameRefm = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRefm,
fieldLabel: '费用名称',
forceSelection: true,
name: 'FEENAME',
valueField: 'Name',
displayField: 'CodeAndName'
});
this.StoreCurrm = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurrm.load({ params: { condition: "" } });
this.comboxCurrm = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCurrm,
fieldLabel: '币别',
forceSelection: true,
name: 'CURRENCY',
valueField: 'CURR',
displayField: 'CURR'
});
this.storeFeeUnitm = Ext.create('DsExt.ux.RefTableStore', {
fields: ['UNIT'],
proxy: { url: '/MvcShipping/MsCodeFeeTemplate/GetFeeUnit' }
});
this.storeFeeUnitm.load({ params: { condition: "" } });
this.comboxFeeUnitm = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeUnitm,
forceSelection: true,
fieldLabel: '标准',
name: 'UNIT',
valueField: 'UNIT',
displayField: 'UNIT'
});
this.storeCustomerNameRefm = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustomerNameRefm.load({ params: { condition: "" } });
this.comboxCustomerNameRefm = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustomerNameRefm,
fieldLabel: '付款方',
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.thispricetype = PRICETYPE;
this.storePRICECLASSm = Ext.create('DsExt.ux.RefEnumStore', {});
this.storePRICECLASSm.load({ params: { enumTypeId: 97061 } });
this.comboxPRICECLASSm = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storePRICECLASSm,
fieldLabel: '类别归属',
name: 'PRICECLASS',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.NewFeeEdit = Ext.widget('form', {
frame: true,
region: 'center',
trackResetOnLoad: true,
title: '运价新值', //'费用新值',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'LINKGID', //'业务编号',
name: 'LINKGID', hidden: true
}, {
fieldLabel: 'GID', //'GId',,
name: 'GID', flex: 0, hidden: true, margins: '0'
}, this.comboxFeeNameRefm, this.comboxCustomerNameRefm, this.comboxCurrm]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxFeeUnitm, {
fieldLabel: '单价', //'不含税单价',
xtype: 'numberfield',
name: 'UNITPRICE'
}, this.comboxPRICECLASSm
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注', //'备注',
name: 'REMARKS'
}, {
fieldLabel: '修改原因', //'修改原因',
flex: 2,
name: 'REASON'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.OldFee = Ext.widget('form', {
frame: true,
region: 'center',
title: '运价旧值', //'费用旧值',
trackResetOnLoad: true,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID', //'业务编号',
name: 'GID', hidden: true
}, {
fieldLabel: 'LINKGID', //'GId',,
name: 'LINKGID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'AUDITDATE', //'Remark',
name: 'AUDITDATE', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'AUDITNAME', //'Remark',
name: 'AUDITNAME', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'ISSTOP', //'Remark',
name: 'ISSTOP', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'FEESTATUS', //'Remark',
name: 'FEESTATUS', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'INPUTBY', //'Remark',
name: 'INPUTBY', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'INPUTTIME', //'Remark',
name: 'INPUTTIME', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: '费用名称', //'费用名称',
readOnly: true,
name: 'FEENAME'
}, {
fieldLabel: '付款方', //'费用对象',
readOnly: true,
name: 'CUSTOMERNAME'
}, {
fieldLabel: '标准', //'费用对象',
readOnly: true,
name: 'UNIT'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '币别', //'单位标准',
readOnly: true,
name: 'CURRENCY'
}, {
fieldLabel: '单价', //'不含税单价',
readOnly: true,
name: 'UNITPRICE',
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: '备注', //'税率',
readOnly: true,
name: 'REMARKS'
}, {
fieldLabel: '类别归属', //'含税单价',
readOnly: true,
name: 'PRICECLASS'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.winShenModifyShow = Ext.create('Ext.window.Window', {
title: '运价申请修改', //"费用申请修改",
width: 700,
//height : 120,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
layout: "anchor",
items: [this.OldFee, this.NewFeeEdit],
buttons: [{
text: "提交申请", //"提交申请",
minWidth: 70,
handler: function () {
var form = _this.NewFeeEdit.getForm();
var FeeName = form.findField('FEENAME').getValue();
if (FeeName == '' || FeeName == null || FeeName == undefined) {
Ext.Msg.show({ title: '提示', msg: '费用名称不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //费用名称不能为空!'
return;
};
var CustomerName = form.findField('CUSTOMERNAME').getValue();
if (CustomerName == '' || CustomerName == null || CustomerName == undefined) {
Ext.Msg.show({ title: '提示', msg: '付款方不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Currency = form.findField('CURRENCY').getValue();
if (Currency == '' || Currency == null || Currency == undefined) {
Ext.Msg.show({ title: '提示', msg: '币别不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var REASON = form.findField('REASON').getValue();
if (REASON == '' || REASON == null || REASON == undefined) {
Ext.Msg.show({ title: '提示', msg: '修改原因不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
_this.onCreateModifyClick();
}
}, {
text: "取消申请", //"取消申请",
minWidth: 70,
handler: function () {
_this.winShenModifyShow.close();
}
}]
});
//绑定事件
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
if (this.ParentWin) {
var ret = this.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.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcContainer/MsOpPrice/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;
}
var data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
this.formEdit.getForm().findField('PRICETYPE').setValue(PRICETYPE);
var acondition = "";
if (this.opStatus == 'edit')
acondition = " LINKGID='" + this.editRecord.get('GID') + "'";
else
acondition = " LINKGID='11111'";
this.storeBodyList.load({ params: { condition: acondition } });
var xcondition = " BSNO='" + this.editRecord.get('GID') + "'";
_this.Loading = true;
_this.storeDocList.load({
params: { condition: xcondition },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
_this.Loading = false;
}
});
this.GetEditStatus();
} 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();
}
var j = 0;
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
var VALIDETD = member.data.STARTTIME;
if (VALIDETD != '')
VALIDETD = Ext.util.Format.date(VALIDETD, 'Y-m-d');
member.data.VALIDETD = VALIDETD;
bodydatas.push(member);
j = j + 1;
}
if (j == 0) {
Ext.Msg.show({ title: '提示', msg: '费用信息不能为空,请先录入费用信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcContainer/MsOpPrice/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
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().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('MsOpPrice', 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("LINKGID", this.editRecord.get('GID'));
memberbody.commit();
};
} else if (type == '1') {
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("LINKGID", this.editRecord.get('GID'));
memberbody.commit();
};
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
});
}
}
});
}, //end save
addDetail: function () {
// if (this.opStatus == "add") {
// Ext.Msg.show({ title: '提示', msg: '商品信息未保存,无法添加费用信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
// }
var MSDSID = this.formEdit.getForm().findField('GID').getValue();
var SerialNo = this.GetHandleSerialNo(this.storeBodyList);
//var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo);
var record = Ext.create('MsOpPriceItems', {
GID: NewGuid(),
LINKGID: '*',
ITEMSNO: SerialNo,
FEENAME: '',
UNIT: '',
UNITPRICE: 0,
CURRENCY: '',
CHANGERATE: 0,
FEESTATUS: 1,
GOODSNAME: '',
REMARKS: ''
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
},
GetPriceChange: function () {
var VOYAGE = this.formEdit.getForm().findField('VOYAGE').getValue();
var RENTOFDAY = this.formEdit.getForm().findField('RENTOFDAY').getValue();
if (VOYAGE == "") return 0;
if (RENTOFDAY == "") return 0;
var freight = Mul(VOYAGE, RENTOFDAY);
this.formEdit.getForm().findField('RENTAMOUNT').setValue(freight);
},
GetHandleSerialNo: function (store) {
var result = 0;
if (result == 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
if (parseInt(member.data.ITEMSNO) > parseInt(result)) {
result = member.data.ITEMSNO;
}
}
}
result = parseInt(result) + 1;
return result;
},
gridListAfterEdit: function (editor, e, eOpts) {
if (e.value == e.originalValue) return;
if (e.field == 'REJECTID') {
var selectrecords = DsStoreQueryBy(this.storeListGood, 'GID', e.value);
if (selectrecords.getCount() > 0) {
var selectdata = selectrecords.getAt(0).data;
e.record.set('GOODNAME', selectdata.GOODNAME);
} else {
e.record.set('GOODNAME', '');
}
}
},
onSubmitAuditClick: function () {
var btnESave = Ext.getCmp('btnsave');
var btnESaveAndClose = Ext.getCmp('btnsaveandclose');
var btnESaveAndNew = Ext.getCmp('btnsaveandnew');
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
var billstatus = this.formEdit.getForm().findField('BSSTATUS').getValue();
if ((billstatus == "提交审核") || (billstatus == "审核通过")) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
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();
}
var j = 0;
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
var VALIDETD = member.data.STARTTIME;
if (VALIDETD != '')
VALIDETD = Ext.util.Format.date(VALIDETD, 'Y-m-d');
member.data.VALIDETD = VALIDETD;
bodydatas.push(member);
j = j + 1;
}
if (j == 0) {
Ext.Msg.show({ title: '提示', msg: '费用信息不能为空,请先录入费用信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcContainer/MsOpPrice/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
body: jsonBody,
issub:true
},
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);
this.GetEditStatus();
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.add(returnData);
this.editRecord = arrNewRecords[0];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsOpPrice', 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();
}
} 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
});
}
}
});
},
onSubmitAuditBackClick: function () {
var GID = this.formEdit.getForm().findField('GID').getValue();
var billstatus = this.formEdit.getForm().findField('BSSTATUS').getValue();
if (billstatus != "提交审核") {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.formEdit.getForm().findField('GID').setDisabled(false);
var data = this.formEdit.getForm().getValues(false, false, false);
this.formEdit.getForm().findField('GID').setDisabled(true);
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpPrice/SubmitAuditBackForm',
params: {
data: Ext.JSON.encode(data)
},
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;
} else {
var condition = " GID='" + GID+ "'";
this.LoadData(this.opStatus, condition);
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSubmitAuditDetailClick: function (button, event) {
var GidStr = '';
store = this.storeBodyList;
var modifyrecords = store.getUpdatedRecords(); // 获取修改的行的数据,无法获取幻影数据
var phantoms = store.getNewRecords(); //获得幻影行
modifyrecords = modifyrecords.concat(phantoms); //将幻影数据与真实数据合并
if (modifyrecords.length != 0) {
Ext.Msg.show({ title: '提示', msg: '有未保存的费用,请先保存费用然后再提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要提交审核的费用!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var insert;
for (var i = 0; i < records.length; i++) {
var rec = records[i];
}
var bodyDrChFeeDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var feeStatus = rec.data.FEESTATUS;
var Gid = rec.data.GID;
var canDelete = feeStatus == 1 || feeStatus == 6;
if (canDelete == false) {
Ext.Msg.show({
title: '提示',
msg: '只能费用状态为[录入状态]和[驳回提交]的费用才能提交审核,请重新选择',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
} else {
bodyDrChFeeDatas.push(rec);
GidStr = GidStr + Gid;
}
}
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
_thisfee = this;
if (GidStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/MvcContainer/MsOpPrice/SubmitAuditNew',
params: {
feebody: jsonChFeeBody
},
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;
} else {
var acondition = "";
acondition = " LINKGID='" + _this.editRecord.get('GID') + "'";
this.storeBodyList.load({ params: { condition: acondition } });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onCancelAuditNewClick: function (menu, event, type) {
var GidStr = '';
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请选择运价明细', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
for (var i = 0; i < records.length; i++) {
var rec = records[i];
var feeStatus = rec.data.FEESTATUS;
var Gid = rec.data.GID;
var canDelete = feeStatus == 2;
if (canDelete == false) {
Ext.Msg.show({
title: '提示',
msg: '只能状态为[提交审核]的运价才能撤销提交审核,请重新选择', //'只能费用状态为[提交审核]的费用才能撤销提交审核,请重新选择',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
} else {
if (GidStr == '')
GidStr = Gid;
else {
GidStr = GidStr + ',' + Gid;
}
}
}
_thisfee = this;
if (GidStr == '') {
} else {
var urlStr = '/MvcContainer/MsOpPrice/CancelAudit';
Ext.Ajax.request({
waitMsg: '正在更新数据...', //'正在添加数据...',
url: urlStr,
params: {
GidStr: GidStr
},
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;
} else {
_this.storeBodyList.reload();
}
} else {
Ext.MessageBox.alert('服务器响应出错!', response.responseText);
}
},
scope: this
});
}
},
onShenModifyClick: function () {
var selectedRecords = [];
selectedRecords = this.GridCheckBoxModel.selected.items;
if (selectedRecords.count == 0) {
Ext.Msg.show({ title: '提示', msg: '请选择要申请修改的运价', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var rec = selectedRecords[0];
if (rec.data.FEESTATUS != 0) {
Ext.Msg.show({ title: '提示', msg: '当前状态不允许申请修改', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
this.NewFeeEdit.getForm().loadRecord(rec);
this.OldFee.getForm().loadRecord(rec);
this.winShenModifyShow.show();
},
onCreateModifyClick: function (type) {
var data = this.NewFeeEdit.getForm().getValues();
var olddata = this.OldFee.getForm().getValues();
_thisfee = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...', //'正在添加数据...',
url: '/MvcContainer/MsOpPrice/ShenModify',
params: {
data: Ext.JSON.encode(data),
olddata: Ext.JSON.encode(olddata)
},
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;
} else {
_this.storeBodyList.reload();
_this.winShenModifyShow.close();
}
} else {
Ext.MessageBox.alert('服务器响应出错!', response.responseText);
}
},
scope: this
});
},
onCancelShenClick: function (button, event, type) {
var selectedRecords = [];
selectedRecords = this.GridCheckBoxModel.selected.items;
if (selectedRecords.count == 0) {
Ext.Msg.show({ title: '提示', msg: '请选择要取消申请的运价', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.FEESTATUS != 3 && rec.data.FEESTATUS != 4) {
Ext.Msg.show({ title: '提示', msg: '当前状态不允许取消申请', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
var bodyDrChFeeDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
bodyDrChFeeDatas.push(rec);
}
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
Ext.Ajax.request({
waitMsg: '正在取消申请...', //'正在取消申请...',
url: '/MvcContainer/MsOpPrice/CancelShenList',
params: {
feedata: jsonChFeeBody
},
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;
} else {
_this.storeBodyList.reload();
}
} else {
Ext.MessageBox.alert('服务器响应出错!', response.responseText);
}
},
scope: this
});
},
onHistryAddDetailClick: function (menu, event, type) {
DsOpenEditWin("/MvcContainer/MsOpPrice/HistryFeeAgentIndex", "历史引入费用");
},
onViewDetailClick: function (button, event, type) {
var gid = _this.editRecord.get('GID');
var openSet = "height=740, width=890, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " + (screen.height - 540) / 2 + ",Left= " + (screen.width - 890) / 2
var openType = "_blank";
var openUrl = "../../MvcContainer/MsOpPrice/HistoryView?bsno=" + gid;
window.open(openUrl, openType, openSet);
},
onDeletePriceItemsClick: function () {
var selections = this.gridListBody.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的费用信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
if (rec.data.LINKGID == "*" || rec.data.LINKGID == "") {
this.storeBodyList.remove(selections[i]);
} else {
if (rec.data.FEESTATUS != 1 && rec.data.FEESTATUS != 6) {
Ext.Msg.show({ title: '提示', msg: '当前状态不允许删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
if (rec.data.FEESTATUS == 1 || rec.data.FEESTATUS == 6)
bodyAddDatas.push(rec);
}
}
}
if (bodyAddDatas.length == 0) return;
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcContainer/MsOpPrice/DeletePriceItems',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var acondition = " LINKGID='" + this.editRecord.get('GID') + "'";
this.storeBodyList.load({ params: { condition: acondition } });
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 });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onStopPriceItemsClick: function () {
var selections = this.gridListBody.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要停用的费用信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
if (rec.data.LINKGID == "*" || rec.data.LINKGID == "") {
} else {
bodyAddDatas.push(rec);
}
}
if (bodyAddDatas.length == 0) return;
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定停用选中的记录吗?', function (btn) {
if (btn == 'yes') {
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在更新数据...');
Ext.Ajax.request({
waitMsg: '正在更新数据...',
url: '/MvcContainer/MsOpPrice/StopPriceItems',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var acondition = " LINKGID='" + this.editRecord.get('GID') + "'";
this.storeBodyList.load({ params: { condition: acondition } });
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 });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
cellEditingBeforeEdit: function (editor, e) {
var chfeefeeStatus = e.record.get('FEESTATUS');
var canedit = chfeefeeStatus == 1 || chfeefeeStatus == 6;
return canedit;
},
onExportBillClick: function () {
_this = this;
if (this.storeBodyList.getCount() == 0) {
return;
}
var sortstr = '';
var sql = '';
var billno = this.editRecord.get('GID');
sql = " LINKGID='" + billno + "'"
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcContainer/MsOpPrice/GetPriceItemsListStr',
scope: this,
params: {
condition: sql,
sort: sortstr
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.data;
var sql1 = returnstr;
sql1 = sql1.replace(/\+/g, "@@@")
sql1 = sql1.replace(/\>/g, "&&&")
sql1 = sql1.replace(/\</g, "%%%")
if (sql1 != '') {
GridExportBySql(sql1, this.formname + 'bill', '代理运价费用明细.xls');
}
} 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
});
}
}
});
},
//#region 上传图片
onDelFileClick: function (button, event) {
var feeGidSql = '';
var selectedRecords = [];
selectedRecords = this.DocCM.selected.items;
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要删除的附件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确定要删除选中的附件吗?', function (btn) {
if (btn == 'yes') {
if (selectedRecords.length > 0) {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.GID == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeDocList.remove(selectedRecords[i]);
} else {
var feeGId = "'" + rec.data.GID + "'";
if (feeGidSql == '') {
feeGidSql = feeGId;
} else {
feeGidSql = feeGidSql + "," + feeGId;
}
}
}
}
_this = this;
Ext.Msg.wait('正在删除数据...');
if (feeGidSql != '') {
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpReceipt/DeleteUploadFile',
params: {
data: feeGidSql
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
this.storeDocList.remove(selectedRecords[i]);
}
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 });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
} else {
Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}, this);
}
, onUpLoadFileClick: function (button, event) {
var billno = this.formEdit.getForm().findField('GID').getValue();
me = this;
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 40,
frame: true,
bodyStyle: 'padding:5px 5px 0',
autoScroll: true,
border: false,
fileUpload: true,
items: [{
xtype: 'fileuploadfield',
id: 'LoadFile',
name: 'LoadFile',
emptyText: '请选择文件',
fieldLabel: '文件',
buttonText: '选择文件',
allowBlank: false,
buttonCfg:
{
iconCls: 'uploaddialog'
},
anchor: '98%'
}],
buttons: [{
text: '上传',
type: 'submit',
handler: function () {
var UserFilePath = Ext.getCmp('LoadFile').getValue();
// if (!CheckFileExt(UserFilePath, /.jpg|.gif|.png|.bmp|.pdf/i)) {
// Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为图片文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
// }
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/MvcShipping/MsOpReceipt/UploadFile',
waitMsg: '正在上传',
method: 'POST',
submitEmptyText: false,
async: false,
params: {
CUSTNO: billno,
BSNO: billno
},
success: function (form, action) {
win.close(this);
Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
var condition = billno;
var condition2 = " BSNO='" + condition + "' ";
me.Loading = true;
me.storeDocList.load({
params: { condition: condition2 },
waitMsg: "正在查询数据...",
scope: this,
callback: function () {
me.Loading = false;
}
});
},
failure: function (form, action) {
form.reset();
if (action.failureType == Ext.form.Action.SERVER_INVALID)
Ext.MessageBox.alert('警告', action.result.errors.msg);
}
});
}
}, {
text: '关闭',
type: 'submit',
handler: function () {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传文件",
width: 360,
height: 120,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
}
,
//#endregion
//#region 编辑时按钮等的状态
GetEditStatus: function () {
var canedit = false;
var ISSTOP = this.formEdit.getForm().findField('ISSTOP').getValue();
var BSSTATUS = this.formEdit.getForm().findField('BSSTATUS').getValue();
if (BSSTATUS == '审核通过' || BSSTATUS == '提交审核' || ISSTOP == "是") {
var canedit = false;
_this.setSaveBtnStatus(canedit);
return;
}
var op = this.formEdit.getForm().findField('OP').getValue();
var modustr = "";
if (PRICETYPE == "1") {
modustr = "modPriceSeae";
}
else if (PRICETYPE == "2") {
modustr = "modPriceSeai";
}
else if (PRICETYPE == "3") {
modustr = "modPriceAgent";
}
else if (PRICETYPE == "4") {
modustr = "modPriceYard";
} else if (PRICETYPE == "6") {
modustr = "modPriceProject";
}
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
});
_this = this;
this.StoreOpRange.load({ params: { optype: modustr },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
canedit = true;
} else {
canedit = false;
}
} else { canedit = false; }
_this.setSaveBtnStatus(canedit);
}
}
});
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnsave');
var btnESaveAndClose = Ext.getCmp('btnsaveandclose');
var btnESaveAndNew = Ext.getCmp('btnsaveandnew');
var btnECopyAndNew = Ext.getCmp('btncopyandsave');
var btnadddetail = Ext.getCmp('btnadddetail');
var btndeldetail = Ext.getCmp('btndeldetail');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
// btnECopyAndNew.enable();
btnadddetail.enable();
btndeldetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
// btnECopyAndNew.disable();
btnadddetail.disable();
btndeldetail.disable();
}
},
//#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 condition = '';
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.data.length - 1)) {
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var condition = '';
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 drmodify = this.storeBodyList.getModifiedRecords();
if (drmodify.length != 0)
return '运价详细信息';
if (panelEdit.formEdit.getForm().isDirty() == true)
return '运价信息';
else return '';
} //
});