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/TruckMng/Viewsjs/MsWlBs/MsWlPcIndex.js

749 lines
26 KiB
JavaScript

2 years ago
Ext.namespace('DsTruck');
DsTruck.MsWlPcIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.MsWlPcIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.MsWlPcIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
TabPanel: null,
RefBillNo: '*',
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsWlPcHead',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWlPc/GetDataList',
reader: {
id: 'BillNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
split: true,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: [{
sortable: true,
dataIndex: 'BillNo',
header: '物流号',
width: 150
}, {
sortable: true,
dataIndex: 'UserCode',
header: '用户编码',
width: 60
}, {
sortable: true,
dataIndex: 'UserName',
header: '用户姓名',
width: 80
}, {
sortable: true,
dataIndex: 'OrgCode',
header: '组织编码',
width: 80
}, {
sortable: true,
dataIndex: 'OrgName',
header: '组织名称',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'RefCustName',
header: '委托单位(托单)',
//renderer: function (value, p, record) { return value + '-' + record.data.CustName_Ref; },
width: 80
}, {
sortable: true,
dataIndex: 'TruckNo',
header: '车牌号',
width: 200
}, {
sortable: true,
dataIndex: 'DrvName',
header: '司机姓名',
width: 200
}, {
sortable: true,
dataIndex: 'Mobile',
header: '司机手机',
width: 160
}, {
sortable: true,
dataIndex: 'ExpDate',
header: '派车日期',
width: 80
}, {
sortable: true,
dataIndex: 'FeeOpStatus',
header: '费用操作状态',
renderer: function (value, p, record) { return value + '-' + record.data.FeeOpStatus_Ref; },
width: 85
}, {
sortable: true,
dataIndex: 'EtDate',
header: '开船日期',
width: 80
}, {
sortable: true,
dataIndex: 'YardCode',
header: '拖箱场站',
renderer: function (value, p, record) { return value + '-' + record.data.YardName; },
width: 80
}, {
sortable: true,
dataIndex: 'RtnYardCode',
header: '返箱场站',
renderer: function (value, p, record) { return value + '-' + record.data.RtnYardName; },
width: 80
}, {
sortable: true,
dataIndex: 'DstArea',
header: '目的地',
width: 80
}, {
sortable: true,
dataIndex: 'DetiNation',
header: '工厂地址',
width: 200
}, {
sortable: true,
dataIndex: 'LinkTel',
header: '联系电话',
width: 200
}, {
sortable: true,
dataIndex: 'LinkMan',
header: '联系人',
width: 200
}, {
sortable: true,
dataIndex: 'RatedMil',
header: '额定里程',
width: 160
}, {
sortable: true,
dataIndex: 'RatedFuel',
header: '额定油耗',
width: 160
}, {
sortable: true,
dataIndex: 'RealMil',
header: '实际里程',
width: 160
}, {
sortable: true,
dataIndex: 'RealFuel',
header: '实际油耗',
width: 160
}, {
sortable: true,
dataIndex: 'ArriveDate',
header: '到厂日期',
width: 80
}, {
sortable: true,
dataIndex: 'DdCode',
header: '调度员编码',
renderer: function (value, p, record) { return value + '-' + record.data.DdCode_Ref; },
width: 60
}, {
sortable: true,
dataIndex: 'ReturnDate',
header: '返回时间',
width: 80
}, {
sortable: true,
dataIndex: 'RefBillNo',
header: '托单物流号',
width: 200
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 200
}, {
//xtype: 'checkcolumn',
sortable: true,
dataIndex: 'IsDouble',
header: '是否双背',
width: 20
}, {
sortable: true,
dataIndex: 'RefBillNoSe',
header: '双背托单物流号',
width: 200
}
//#region 双背信息 (不显示)
// , {
// sortable: true,
// dataIndex: 'ContainerTypeSe',
// header: '箱型2',
// renderer: function (value, p, record) { return value + '-' + record.data.ContainerTypeSe_Ref; },
// width: 200
// }, {
// sortable: true,
// dataIndex: 'ContainerQtySe',
// header: '箱量2',
// width: 100
// }, {
// sortable: true,
// dataIndex: 'MblNoSe',
// header: '提单号2',
// width: 120
// }, {
// sortable: true,
// dataIndex: 'VoyVegSe',
// header: '船名航次2',
// renderer: function (value, p, record) { return value + '-' + record.data.VoyVegSe_Ref; },
// width: 80
// }, {
// sortable: true,
// dataIndex: 'EtDateSe',
// header: '开船日期2',
// width: 80
// }, {
// sortable: true,
// dataIndex: 'EndPortDateSe',
// header: '截港日期2',
// width: 80
// }, {
// sortable: true,
// dataIndex: 'YardCodeSe',
// header: '场站编码2',
// renderer: function (value, p, record) { return value + '-' + record.data.YardCodeSe_Ref; },
// width: 80
// }, {
// sortable: true,
// dataIndex: 'RtnYardSe',
// header: '场站名称2',
// width: 80
// }, {
// sortable: true,
// dataIndex: 'DstAreaSe',
// header: '目的地2',
// width: 80
// }, {
// sortable: true,
// dataIndex: 'FactoryAddrSe',
// header: '拖货地址2',
// width: 200
// }, {
// sortable: true,
// dataIndex: 'DetiNationSe',
// header: '工厂地址2',
// width: 200
// }, {
// sortable: true,
// dataIndex: 'LinkManSe',
// header: '联系人2',
// width: 200
// }, {
// sortable: true,
// dataIndex: 'LinkTelSe',
// header: '联系电话2',
// width: 200
// }
//#endregion
]
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
this.TabPanel.setActiveTab(1);
}, this);
//添加删除工具条
this.panelBtn = new Ext.Panel({
region: "center",
tbar: [
{
id: 'pcindexbtnAdd',
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
this.TabPanel.setActiveTab(1);
},
scope: this
},
{
id: 'pcindexbtnDelete',
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}
]
});
//查询用于添加至托单的双背路单
this.formSearch = Ext.widget('form', {
frame: true,
region: 'north',
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: [
//this.comboxAddCustCode, this.comboxOpLb,
{
xtype: 'button',
width: 75,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
width: 75,
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, {
xtype: 'button',
width: 75,
text: "添至托单",
iconCls: "btnupload",
handler: function (button, event) {
this.onAddSB(button, event);
},
scope: this
},
/*{
fieldLabel: '从..派车日期',
name: 'EXPDATE_min',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..派车日期',
name: 'EXPDATE_max',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},*/{
fieldLabel: '车号',
name: 'TRUCKNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, { xtype: 'hiddenfield', flex: 3 }
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.storeSBPC = Ext.create('Ext.data.Store', {
model: 'MsWlPcHead',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWlPc/GetSBPC',
reader: {
id: 'BillNo',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.gridSBPCList = new Ext.grid.GridPanel({
store: this.storeSBPC,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: [{
sortable: true,
dataIndex: 'BillNo',
header: '物流号',
width: 150
}, {
sortable: true,
dataIndex: 'UserCode',
header: '用户编码',
width: 60
}, {
sortable: true,
dataIndex: 'UserName',
header: '用户姓名',
width: 80
}, {
sortable: true,
dataIndex: 'OrgCode',
header: '组织编码',
width: 80
}, {
sortable: true,
dataIndex: 'OrgName',
header: '组织名称',
hidden: true,
width: 200
}, {
sortable: true,
dataIndex: 'TruckNo',
header: '车牌号',
width: 200
}, {
sortable: true,
dataIndex: 'DrvName',
header: '司机姓名',
width: 200
}, {
sortable: true,
dataIndex: 'Mobile',
header: '司机手机',
width: 160
}, {
sortable: true,
dataIndex: 'ExpDate',
header: '派车日期',
width: 80
}, {
sortable: true,
dataIndex: 'FeeOpStatus',
header: '费用操作状态',
renderer: function (value, p, record) { return value + '-' + record.data.FeeOpStatus_Ref; },
width: 85
}, {
sortable: true,
dataIndex: 'EtDate',
header: '开船日期',
width: 80
}, {
sortable: true,
dataIndex: 'YardCode',
header: '拖箱场站',
renderer: function (value, p, record) { return value + '-' + record.data.YardName; },
width: 80
}, {
sortable: true,
dataIndex: 'RtnYardCode',
header: '返箱场站',
renderer: function (value, p, record) { return value + '-' + record.data.RtnYardName; },
width: 80
}, {
sortable: true,
dataIndex: 'DstArea',
header: '目的地',
width: 80
}, {
sortable: true,
dataIndex: 'DetiNation',
header: '工厂地址',
width: 200
}, {
sortable: true,
dataIndex: 'LinkTel',
header: '联系电话',
width: 200
}, {
sortable: true,
dataIndex: 'LinkMan',
header: '联系人',
width: 200
}, {
sortable: true,
dataIndex: 'RatedMil',
header: '额定里程',
width: 160
}, {
sortable: true,
dataIndex: 'RatedFuel',
header: '额定油耗',
width: 160
}, {
sortable: true,
dataIndex: 'RealMil',
header: '实际里程',
width: 160
}, {
sortable: true,
dataIndex: 'RealFuel',
header: '实际油耗',
width: 160
}, {
sortable: true,
dataIndex: 'ArriveDate',
header: '到厂日期',
width: 80
}, {
sortable: true,
dataIndex: 'DdCode',
header: '调度员编码',
renderer: function (value, p, record) { return value + '-' + record.data.DdCode_Ref; },
width: 60
}, {
sortable: true,
dataIndex: 'ReturnDate',
header: '返回时间',
width: 80
}, {
sortable: true,
dataIndex: 'RefBillNo',
header: '托单物流号',
width: 200
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 200
}, {
//xtype: 'checkcolumn',
sortable: true,
dataIndex: 'IsDouble',
header: '是否双背',
width: 20
}
]
});
//#region 布局
this.paneladddetail = new Ext.Panel({
layout: "border",
region: 'center',
height: 300,
items: [this.gridSBPCList]
});
this.paneladd = new Ext.Panel({
title: '添加双背路单',
layout: "border",
split: true,
region: "south",
height: 220,
items: [this.formSearch, this.paneladddetail]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 30,
items: [this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList, this.paneladd]
});
}, //end initUIComponents
onRefreshClick: function (button, event) {
var condition = this.getCondition();
this.storeSBPC.load({
params: { condition: condition, refbillno: this.RefBillNo },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var TRUCKNO = form.findField('TRUCKNO').getValue();
sql = sql + getAndConSql(sql, TRUCKNO, "TRUCKNO like '%" + TRUCKNO + "%'");
/*
var EXPDATE_min = form.findField('EXPDATE_min').getRawValue();
sql = sql + getAndConSql(sql, EXPDATE_min, "EXPDATE >= '" + EXPDATE_min + "'");
var EXPDATE_max = form.findField('EXPDATE_max').getRawValue();
sql = sql + getAndConSql(sql, EXPDATE_max, "EXPDATE <= '" + EXPDATE_max + " 23:59:59'");
*/
return sql;
},
onDeleteClick: 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') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/TruckMng/MsWlPc/DeletePC',
params: {
BS_BILLNO: this.RefBillNo,
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
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);
}, //onDeleteClick
onAddSB: function (button, event) {//添加双背
var selections = this.gridSBPCList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
var PC_BILLNO = record.data.BillNo;
var BS_BILLNO = this.RefBillNo;
var _this = this;
Ext.Msg.wait('正在添加数据...');
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/TruckMng/MsWlPc/AddSB',
params: {
BS_BILLNO: BS_BILLNO,
PC_BILLNO: PC_BILLNO
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//两个数据集都需要load一下
_this.QryDataList(BS_BILLNO);
_this.onRefreshClick();
//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
Ext.Msg.hide();
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.RefBillNo;
return ret;
},
QryDataList: function (refbillno) {
this.RefBillNo = refbillno;
this.storeList.load({
params: { refbillno: refbillno },
waitMsg: '正在查询数据...',
scope: this
});
},
setBtnOnlyQuery: function () {
var pcindexbtnAdd = Ext.getCmp('pcindexbtnAdd');
var pcindexbtnDelete = Ext.getCmp('pcindexbtnDelete');
//pcindexbtnAdd.setVisible(false);
//pcindexbtnDelete.setVisible(false);
pcindexbtnAdd.disable();
pcindexbtnDelete.disable();
}
});