Ext.namespace('DsTruck'); DsTruck.WlPcIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.DsTruck.WlPcIndex.superclass.constructor.call(this); }; Ext.extend(DsTruck.WlPcIndex, Ext.Panel, { OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, TabPanel: null, RefBillNo: '*', initUIComponents: function () { //定义数据集 this.storeList = Ext.create('Ext.data.Store', { model: 'WlPcHead', remoteSort: true, proxy: { type: 'ajax', url: '/TruckMng/WlBsCard/GetPcDataList', 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: 120 }, { sortable: true, dataIndex: 'LrDate', header: '录入日期', width: 80 }, { sortable: true, dataIndex: 'LrTime', header: '录入时间', width: 80 }, { sortable: true, dataIndex: 'RzDate', header: '入账日期', width: 80 }, { sortable: true, dataIndex: 'RzTime', header: '入账时间', width: 80 }, { sortable: true, dataIndex: 'JzDate', header: '结账日期', width: 80 }, { sortable: true, dataIndex: 'UserCode', header: '用户编码', renderer: function (value, p, record) { return value + '-' + record.data.UserCode_Ref; }, width: 60 }, { sortable: true, dataIndex: 'UserName', header: '用户姓名', width: 80 }, { sortable: true, dataIndex: 'OrgCode', header: '组织编码', renderer: function (value, p, record) { return value + '-' + record.data.OrgCode_Ref; }, width: 80 }, { sortable: true, dataIndex: 'OrgName', header: '组织名称', 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: 'ExpTime', header: '派车时间', width: 80 }, { sortable: true, dataIndex: 'ContainerType', header: '箱型', renderer: function (value, p, record) { return value + '-' + record.data.ContainerType_Ref; }, width: 200 }, { sortable: true, dataIndex: 'ContainerQty', header: '箱量', width: 100 }, { sortable: true, dataIndex: 'ContainerNa', header: '箱号封号', width: 200 }, { sortable: true, dataIndex: 'IsDouble', header: '是否双背', width: 20 }, { sortable: true, dataIndex: 'VoyVeg', header: '船名航次', renderer: function (value, p, record) { return value + '-' + record.data.VoyVeg_Ref; }, width: 80 }, { sortable: true, dataIndex: 'EtDate', header: '开船日期', width: 80 }, { sortable: true, dataIndex: 'EndPortDate', header: '截港日期', width: 80 }, { sortable: true, dataIndex: 'MblNo', header: '提单号', width: 120 }, { sortable: true, dataIndex: 'SendYard', header: '拖箱场站', renderer: function (value, p, record) { return value + '-' + record.data.SendYard_Ref; }, width: 80 }, { sortable: true, dataIndex: 'RtnYard', header: '返箱场站', renderer: function (value, p, record) { return value + '-' + record.data.RtnYard_Ref; }, width: 80 }, { sortable: true, dataIndex: 'DstArea', header: '目的地', width: 80 }, { sortable: true, dataIndex: 'DetiNation', header: '工厂地址', width: 200 }, { sortable: true, dataIndex: 'FactoryAddr', header: '拖货地址', width: 200 }, { sortable: true, dataIndex: 'LinkTel', header: '联系电话', width: 200 }, { sortable: true, dataIndex: 'LinkMan', header: '联系人', width: 200 }, { 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: 'MblNoSe', header: '提单号2', width: 120 }, { sortable: true, dataIndex: 'SendYardSe', header: '拖箱场站2', renderer: function (value, p, record) { return value + '-' + record.data.SendYardSe_Ref; }, width: 80 }, { sortable: true, dataIndex: 'RtnYardSe', header: '返箱场站2', renderer: function (value, p, record) { return value + '-' + record.data.RtnYardSe_Ref; }, width: 80 }, { sortable: true, dataIndex: 'DstAreaSe', header: '目的地2', width: 80 }, { sortable: true, dataIndex: 'DetiNationSe', header: '工厂地址2', width: 200 }, { sortable: true, dataIndex: 'FactoryAddrSe', header: '拖货地址2', width: 200 }, { sortable: true, dataIndex: 'LinkTelSe', header: '联系电话2', width: 200 }, { sortable: true, dataIndex: 'LinkManSe', header: '联系人2', width: 200 }, { sortable: true, dataIndex: 'RatedMil', header: '额定里程', width: 160 }, { sortable: true, dataIndex: 'RatedFuel', header: '额定油耗', width: 160 }, { sortable: true, dataIndex: 'FuelQty', header: '本次加油量', width: 160 }, { sortable: true, dataIndex: 'RealMil', header: '实际里程', width: 160 }, { sortable: true, dataIndex: 'RealFuel', header: '实际油耗', width: 160 }, { sortable: true, dataIndex: 'NoLoadMil', header: '空箱里程', width: 160 }, { sortable: true, dataIndex: 'OverLoadMil', header: '重箱里程', width: 160 }, { sortable: true, dataIndex: 'Ton', header: '运量', width: 160 }, { sortable: true, dataIndex: 'AroundTon', header: '周转量', width: 160 }, { sortable: true, dataIndex: 'LoadCount', header: '运输次数', width: 160 }, { sortable: true, dataIndex: 'ArriveDate', header: '到厂日期', width: 80 }, { sortable: true, dataIndex: 'ArriveTime', header: '到厂时间', width: 80 }, { sortable: true, dataIndex: 'DdCode', header: '调度员编码', renderer: function (value, p, record) { return value + '-' + record.data.DdCode_Ref; }, width: 60 }, { sortable: true, dataIndex: 'DdName', header: '调度员姓名', width: 80 }, { sortable: true, dataIndex: 'ReturnDate', header: '返回日期', width: 80 }, { sortable: true, dataIndex: 'ReturnTime', header: '返回时间', width: 80 }, { sortable: true, dataIndex: 'HzDate', header: '汇总日期', width: 80 }, { sortable: true, dataIndex: 'Remark', header: '备注', width: 200 }, { 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: 'RefBillType', header: '相关单据类型', width: 160 }, { sortable: true, dataIndex: 'RefBillNo', header: '相关单据号', width: 200 }, { sortable: true, dataIndex: 'RefBillNoSe', header: '相关单据号2', width: 200 } ] }); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { this.SelectedRecord = record; this.OprationStatus = 'edit'; this.TabPanel.setActiveTab(1); }, this); this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { labelAlign: 'right', labelWidth: 90, msgTarget: 'qtip' }, items: [{ name: 'OrgCode', fieldLabel: '组织编码' }] }); //查询工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "新建", iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; this.TabPanel.setActiveTab(1); }, scope: this }, { 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.formSearch, this.panelBtn] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); }, //end initUIComponents 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/WlBsCard/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 }); } });