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.
521 lines
14 KiB
JavaScript
521 lines
14 KiB
JavaScript
Ext.namespace('Shipping');
|
|
|
|
Shipping.PiLiangFeeEdit = function (config) {
|
|
Ext.applyIf(this, config);
|
|
this.initUIComponents();
|
|
window.Shipping.PiLiangFeeEdit.superclass.constructor.call(this);
|
|
};
|
|
|
|
Ext.extend(Shipping.PiLiangFeeEdit, Ext.Panel, {
|
|
PageSize: 15,
|
|
ParentWin: null,
|
|
OprationStatus: null, //仅当弹出界面时使用
|
|
EditRecord: null,
|
|
strbsno: '',
|
|
|
|
initUIComponents: function () {
|
|
|
|
|
|
|
|
//编辑form
|
|
|
|
|
|
//#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/GetDataList',
|
|
reader: {
|
|
id: 'GID',
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
});
|
|
|
|
this.storeListGood.load({ params: { condition: ""} });
|
|
|
|
this.comboxGoods = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.storeListGood,
|
|
forceSelection: true,
|
|
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.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
clicksToEdit: 1
|
|
});
|
|
|
|
this.gridListBody = new Ext.grid.GridPanel({
|
|
store: this.storeBodyList,
|
|
enableHdMenu: false,
|
|
region: 'center',
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
plugins: [this.gridListCellEditing],
|
|
selType: 'cellmodel',
|
|
|
|
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
|
|
}],
|
|
|
|
columns: [{
|
|
sortable: true,
|
|
dataIndex: 'GID',
|
|
header: '编号',
|
|
hidden: true,
|
|
width: 0
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'LINKGID',
|
|
header: '业务编号',
|
|
hidden: true,
|
|
width: 0
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'FEENAME',
|
|
header: '费用名称',
|
|
editor: this.comboxFeeNameRef,
|
|
width: 140
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'UNIT',
|
|
header: '标准',
|
|
editor: this.comboxFeeUnit,
|
|
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
|
|
}]
|
|
});
|
|
|
|
|
|
|
|
this.panelBody = new Ext.Panel({
|
|
title: '运价详细信息',
|
|
layout: "border",
|
|
region: 'center',
|
|
animate: true,
|
|
// autoScroll: true,
|
|
// containerScroll: true,
|
|
frame: false,
|
|
items: [this.gridListBody]
|
|
});
|
|
|
|
|
|
|
|
//#endregion 明细表
|
|
|
|
|
|
this.girdcolums = [{
|
|
sortable: true,
|
|
dataIndex: 'GID',
|
|
header: 'GID',
|
|
hidden: true,
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'COMPANYID',
|
|
header: 'COMPANYID',
|
|
hidden: true,
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'PRICETYPE',
|
|
header: 'PRICETYPE',
|
|
hidden: true,
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'LINE',
|
|
header: '航线',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'COUNTRY',
|
|
header: '国家',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'PORTLOAD',
|
|
header: '起运港',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'PORTDISCHARGE',
|
|
header: '目的港',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'TRANSPORT',
|
|
header: '中转港',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'CARRIER',
|
|
header: '船公司',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'WEEKETD',
|
|
header: '船期',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'VOYAGE',
|
|
header: '航程',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'VALIDETD',
|
|
header: '有效期',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'SERVICE',
|
|
header: '运输条款',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'CTNSTATUS',
|
|
header: '箱状态',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'OTRMB',
|
|
header: 'RMB其他',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'OTUSD',
|
|
header: 'USD其他',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'TOTALRMB',
|
|
header: '合计RMB',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'TOTALUSD',
|
|
header: '合计USD',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'REMARKS',
|
|
header: '备注',
|
|
width: 200
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'INPUTBYREF',
|
|
header: '录入人',
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'INPUTTIME',
|
|
header: '录入时间',
|
|
width: 100
|
|
}];
|
|
|
|
|
|
this.storeBodyAddList = Ext.create('Ext.data.Store', {
|
|
model: 'MsOpPrice'
|
|
});
|
|
|
|
//明细表表格
|
|
|
|
|
|
this.gridAddList = new Ext.grid.GridPanel({
|
|
store: this.storeBodyAddList,
|
|
enableHdMenu: false,
|
|
region: 'center',
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
columns: this.girdcolums
|
|
});
|
|
|
|
parentWin = window.parent.opener;
|
|
this.InitData();
|
|
|
|
//#endregion
|
|
|
|
//#region 按钮ToolBar
|
|
this.panelBtn = new Ext.Panel({
|
|
region: "north",
|
|
tbar: [
|
|
|
|
{
|
|
text: "新建",
|
|
iconCls: "btnadd",
|
|
handler: function (button, event) {
|
|
this.addDetail();
|
|
},
|
|
scope: this
|
|
|
|
},
|
|
{
|
|
text: "删除",
|
|
iconCls: "btndelete",
|
|
handler: function (button, event) {
|
|
this.deleteDetail();
|
|
},
|
|
scope: this
|
|
},
|
|
'-',
|
|
|
|
{
|
|
text: "更新业务",
|
|
iconCls: "btnsave",
|
|
handler: function (button, event) {
|
|
this.onPostDetailClick(button, event);
|
|
},
|
|
scope: this
|
|
}
|
|
]
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
//#region 布局
|
|
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
layout: "border",
|
|
region: "north",
|
|
height: 250,
|
|
items: [this.panelBtn, this.formEdit, this.panelBody]
|
|
});
|
|
|
|
|
|
this.panelFee = new Ext.Panel({
|
|
layout: "border",
|
|
region: "center",
|
|
items: [
|
|
this.gridAddList
|
|
]
|
|
});
|
|
|
|
Ext.apply(this, {
|
|
items: [this.panelTop, this.panelFee]
|
|
});
|
|
//#endregion
|
|
|
|
|
|
|
|
this.InitGrid();
|
|
|
|
// this.SetBtnRight();
|
|
|
|
}, //end initUIComponents
|
|
|
|
InitData: function () {
|
|
var condition = '';
|
|
_this = this;
|
|
if (parentWin) {
|
|
var ret = parentWin.OprationSwap();
|
|
var AddList = ret[3];
|
|
for (var j = 0; j < AddList.getCount(); j += 1) {
|
|
var memberbody = AddList.getAt(j);
|
|
this.storeBodyAddList.add(memberbody);
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
InitGrid: function () {
|
|
|
|
|
|
|
|
},
|
|
|
|
addDetail: function () {
|
|
|
|
|
|
var record = Ext.create('MsOpPriceItems', {
|
|
GID: NewGuid(),
|
|
LINKGID: '*',
|
|
ITEMSNO:1,
|
|
FEENAME: '',
|
|
UNIT: '',
|
|
UNITPRICE: 0,
|
|
CURRENCY: '',
|
|
CHANGERATE: 0,
|
|
GOODSNAME: '',
|
|
REMARKS: ''
|
|
});
|
|
this.storeBodyList.add(record);
|
|
var n = this.storeBodyList.getCount();
|
|
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
|
|
},
|
|
|
|
deleteDetail: function () {
|
|
|
|
var selectedRecords = this.CheckBoxModel.selected.items;
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
this.storeBodyList.remove(selectedRecords[i]);
|
|
}
|
|
|
|
},
|
|
onPostDetailClick: function (button, event) {
|
|
|
|
|
|
var bodyBillDatas = [];
|
|
|
|
|
|
for (i = 0; i < this.storeBodyAddList.getCount(); i += 1) {
|
|
var memberyf = this.storeBodyAddList.getAt(i);
|
|
bodyBillDatas.push(memberyf);
|
|
};
|
|
|
|
var jsonbodyBill = ConvertRecordsToJsonAll(bodyBillDatas);
|
|
|
|
|
|
var bodyFeeDatas = [];
|
|
for (i = 0; i < this.storeBodyList.getCount(); i += 1) {
|
|
var memberyf = this.storeBodyList.getAt(i);
|
|
bodyFeeDatas.push(memberyf);
|
|
};
|
|
var jsonbodyFee = ConvertRecordsToJsonAll(bodyFeeDatas);
|
|
|
|
|
|
|
|
|
|
_this = this;
|
|
Ext.Msg.wait('正在生成数据, 请稍侯..');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在生成数据...',
|
|
url: '/MvcContainer/MsOpPrice/PiliangFee',
|
|
scope: this,
|
|
params: {
|
|
bill: jsonbodyBill,
|
|
fee: jsonbodyFee
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
Ext.MessageBox.hide();
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
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 });
|
|
}
|
|
} else {
|
|
Ext.Msg.show({ title: '请重试',
|
|
msg: '服务器响应出错',
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
});
|
|
|
|
|