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.

483 lines
16 KiB
JavaScript

9 months ago
Ext.namespace('Shipping');
var HistryAdd =1;
Shipping.MsInfoClientWhileBsAdd = function (config, addtype) {
Ext.applyIf(this, config);
HistryAdd = addtype;
this.initUIComponents();
window.Shipping.MsInfoClientWhileBsAdd.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsInfoClientWhileBsAdd, Ext.Panel, {
PageSize: 30,
ParentWin: null,
feeType: 0,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
StoreFee: null,
StoreFeeUnit: null,
StoreFeeCust: null,
EditRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsClientBsWhile',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpBill/GetBLListData',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 主grid
this.initgirdcolums = [{
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',//委托编号
width: 120
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',//主提单号
width: 120
}, {
sortable: true,
dataIndex: 'HBLNO',
header: '分提单号', //分提单号
width: 120
}, {
sortable: true,
dataIndex: 'CUSTOMNO',
header: '报关单号', //报关单号
width: 120
}, {
sortable: true,
id: '',
align: 'center',
dataIndex: 'BSSTATUSREF',
header: '业务锁定',//业务锁定
width: 60,
renderer: function (value, cellmeta) {
if (value == '锁定') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
},
{
sortable: true,
id: '',
align: 'center',
dataIndex: 'FEESTATUSREF',
header: '费用锁定',//费用锁定
width: 60,
renderer: function (value, cellmeta) {
if (value == '锁定') {
return "<img src='../../../../TruckMng/Content/Images/Lock.png' />";
}
}
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',//委托单位
width: 100
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',//开船日期
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'SALE',
header: '揽货人',//揽货人
width: 80
}, {
sortable: true,
dataIndex: 'CNTRTOTAL',
header: '集装箱',//集装箱
width: 120
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间', //会计期间
width: 80
}, {
sortable: true,
dataIndex: 'BSSOURCE',
header: '业务来源', //业务来源
width: 80
}, {
sortable: true,
dataIndex: 'BSSOURCEDETAIL',
header: '来源明细', //业务来源
width: 80
}, {
sortable: true,
dataIndex: 'OP',
header: '操作', //操作
width: 80
}, {
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人', //录入人
width: 80
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港', //起运港
width: 120
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的港', //目的港
width: 120
}, {
sortable: true,
dataIndex: 'PLACERECEIPT',
header: '收货地', //收货地
width: 120
}, {
sortable: true,
dataIndex: 'DESTINATION',
header: '目的地', //目的地
width: 120
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名', //船名
width: 150
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次', //航次
width: 60
}, {
sortable: true,
dataIndex: 'CARRIER',
header: '船公司', //航次
width: 60
}];
this.girdcolums = this.initgirdcolums;
this.gridListCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
columns: this.girdcolums,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.girdcolums);
//#endregion
//#region 固定费用明细表
//#region formSearch
//#region formSearch枚举参照相关
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
//委托单位
_this = this;
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
_this = this;
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '编号',
name: 'MblNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCustCode,{
fieldLabel: '从开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Min',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '至开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Max',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
}]
}]
});
//#endregion formSearch
//#region 按钮ToolBar
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "添加",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onAddClick(button, event);
},
scope: this
}
]
});
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 50,
items: [this.formSearch]
});
Ext.apply(this, {
items: [this.panelBtn,this.panelTop, this.gridList]
});
//#endregion
parentWin = window.parent.opener._thisclientblack;
//#region 事件绑定
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridList.getSelectionModel().select(0);
//this.gridListCheckBoxModel.selectAll();
}
}, this);
//#endregion
//#region 自动刷新(已经提交但是尚未审核的业务,哪怕一票货中有一笔费用没审核也显示)
//#endregion
// this.SetBtnRight();
}, //end initUIComponents
onAutoRefresh: function () {
var sql = '';
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onAddClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定添加该记录吗?', function (btn) {
if (btn == 'yes') {
var bodyAddDatas = [];
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsInfoClient/SaveClientBsWhile',
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
parentWin.storeUserList.reload();
window.closeAction = 'destroy';
window.close();
}
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);
}, //onDeleteClick
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
//客户名称
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "v_op_bill.CUSTOMERNAME='" + CUSTOMERNAME + "'");
var mblNo = form.findField('MblNo').getValue();
sql = sql + getAndConSql(sql, mblNo, " (MBLNO like '%" + mblNo + "%' or HBLNO like '%" + mblNo + "%' or CUSTNO like '%" + mblNo + "%') ");
var custDate_Min = form.findField('CustDate_Min').getRawValue();
sql = sql + getAndConSql(sql, custDate_Min, "ETD >= '" + custDate_Min + "'");
var custDate_Max = form.findField('CustDate_Max').getRawValue();
sql = sql + getAndConSql(sql, custDate_Max, "ETD<= '" + custDate_Max + " 23:59:59'");
return sql;
}
});