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: true, 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, 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 }, { 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.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 30, items: [this.panelBtn] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); }, //end initUIComponents onRefreshClick: function (button, event) { this.storeList.load({ params: { refbillno:this.RefBillNo }, waitMsg: "正在查询数据...", scope: this }); }, 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/Delete', params: { 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 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(); } });