Ext.namespace('Shipping'); Shipping.HistryTruckIndex= function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.HistryTruckIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.HistryTruckIndex, Ext.Panel, { PageSize: 30, ParentWin: null, feeType: 0, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, storeBodyList: null, StoreFeeUnit: null, StoreFeeCust: null, EditRecord: null, PEditRecord: null, initUIComponents: function () { //定义数据集 Ext.define('MsOpLetterTruck', { extend: 'Ext.data.Model', idProperty: 'LE_ID', fields: [ { name: 'LE_ID', type: 'string' }, { name: 'BSNO', type: 'string' }, { name: 'TRUCK', type: 'string' }, { name: 'CTNS', type: 'string' }, { name: 'YARD', type: 'string' }, { name: 'YARDATTN', type: 'string' }, { name: 'YARDTEL', type: 'string' }, { name: 'INPUTTIME', type: 'string' }, { name: 'CUSTOMERNAME', type: 'string' }, { name: 'FACTRYNAME', type: 'string' }, { name: 'FACTRYTIME', type: 'string' }, { name: 'FACTRYATTN', type: 'string' }, { name: 'FACTRYTEL', type: 'string' }, { name: 'FACTRYADDR', type: 'string' }, { name: 'RETURNYARD', type: 'string' }, { name: 'RETURNATTN', type: 'string' }, { name: 'RETURNTEL', type: 'string' }, { name: 'TRUCKDATE', type: 'string' }, { name: 'TRUCKFEE', type: 'number' }, { name: 'OTHERFEE', type: 'number' }, { name: 'PAYTYPE', type: 'string' }, { name: 'REMARK', type: 'string' }, { name: 'KGS', type: 'string' }, { name: 'VESSEL', type: 'string' }, { name: 'VOYNO', type: 'string' }, { name: 'MBLNO', type: 'string' }, { name: 'TRUCKDETAIL', type: 'string' }, { name: 'RETRUNYARDTIME', type: 'string' }, { name: 'CLOSINGDATE', type: 'string' }, { name: 'TEAMTYPE', type: 'string' }, { name: 'ISTEAMSTATUS', type: 'string' }, { name: 'INPUTBY', type: 'string' }, { name: 'INPUTBYREF', type: 'string' }, { name: 'CARGODATE', type: 'string' }, { name: 'DDOP', type: 'string' }, { name: 'TRUCKSTATUS', type: 'string' }, { name: 'ISFEE', type: 'string' } ] }); this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsOpLetterTruck', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpLetter/BsTruckListData', reader: { id: 'GId', root: 'data', totalProperty: 'totalCount' } } }); //#region 主grid this.gridListCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'west', width:300, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.gridListCheckBoxModel, viewConfig: { autoFill: true, enableTextSelection: true }, columns: [{ sortable: true, dataIndex: 'MBLNO', header: Zi.LAN.MBLNO, width: 130 }, { sortable: true, dataIndex: 'VESSEL', header: Zi.LAN.VESSEL, width: 130 }, { sortable: true, dataIndex: 'VOYNO', header: Zi.LAN.VOYNO, width: 50 }, { sortable: true, dataIndex: 'ETD', header: Zi.LAN.ETD, renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 86 }, { sortable: true, dataIndex: 'PORTLOAD', header: Zi.LAN.PORTLOAD, width: 130 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: Zi.LAN.PORTDISCHARGE, width: 130 }, { dataIndex: 'CUSTOMERNAME', header: Zi.LAN.CUSTOMERNAME, width: 120 }, { dataIndex: 'SALE', header: Zi.LAN.SALE, width: 70 }, { sortable: true, dataIndex: 'ACCDATE', header: Zi.LAN.ACCDATE, width: 80 }, { dataIndex: 'CARRIER', header: Zi.LAN.CARRIER, width: 100 }, { dataIndex: 'BSSOURCE', header: Zi.LAN.BSSOURCE, width: 80 }, { dataIndex: 'TRUCK', header: Zi.LAN.TRUCKER, width: 80 }, { dataIndex: 'YARD', header: Zi.LAN.YARD, width: 80 }, { dataIndex: 'RETURNYARD', header: Zi.LAN.RETURNYARD, width: 80 }, { dataIndex: 'CTNS', header: Zi.LAN.CTNS, width: 80 } ], // paging bar on the bottom bbar: Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: Zi.LAN.displayMsg, emptyMsg: Zi.LAN.emptyMsg }) }); this.gridList.addListener('itemclick', function (dataview, record, item, index, e, b) { _this.editRecord = record; _this.OpStatus = 'edit'; _this.LoadData("edit", "LE_ID='" + record.data.LE_ID + "'"); }, this); //#region 编辑formEdit 入货通知 this.formEdit = Ext.widget('form', { region: 'north', height: 460, frame: true, bodyPadding: 5, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '业务编号', name: 'BSNO', hidden: true }, { fieldLabel: 'LE_ID', hidden: true, name: 'LE_ID' }, { fieldLabel: 'TRUCK', hidden: true, name: 'TRUCK' }, { fieldLabel: 'OTHERFEE', hidden: true, name: 'OTHERFEE' }, { fieldLabel: 'ISFEE', hidden: true, name: 'ISFEE' }, { fieldLabel: 'CUSTOMERNAME', hidden: true, name: 'CUSTOMERNAME' }, { fieldLabel: 'MBLNO', hidden: true, name: 'MBLNO' } , { fieldLabel: Zi.LAN.CTNS, readOnly: true, name: 'CTNS' }, { fieldLabel: Zi.LAN.KGS, name: 'KGS' } , { fieldLabel: Zi.LAN.TRUCKFEE, xtype: 'numberfield', name: 'TRUCKFEE', value: 0 } , { fieldLabel: Zi.LAN.PAYTYPE, name: 'PAYTYPE' }, { fieldLabel: Zi.LAN.TRUCKDATE, format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'TRUCKDATE' } ] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.YARD, name: 'YARD' }, { fieldLabel: Zi.LAN.YARDATTN, name: 'YARDATTN' }, { fieldLabel: Zi.LAN.TEL, name: 'YARDTEL' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.companyname, name: 'FACTRYNAME' }] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'textareafield', grow: true, flex: 2, fieldLabel: Zi.LAN.FACTRYADDR, height: 60, name: 'FACTRYADDR', anchor: '100%' }, { fieldLabel: Zi.LAN.FACTRYTIME, labelWidth: 80, format: 'Y-m-d', flex: 1, xtype: 'datetimefield', name: 'FACTRYTIME' }] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.FACTRYATTN, name: 'FACTRYATTN' }, { fieldLabel: Zi.LAN.FACTRYTEL, name: 'FACTRYTEL' }, { fieldLabel: Zi.LAN.RETRUNYARDTIME, name: 'RETRUNYARDTIME' }] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.RETURNYARD, name: 'RETURNYARD' }, { fieldLabel: Zi.LAN.YARDATTN, name: 'RETURNATTN' }, { fieldLabel: Zi.LAN.TEL, name: 'RETURNTEL' }] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.CLOSINGDATE, //format: 'Y-m-d', //flex: 1, //xtype: 'datetimefield', name: 'CLOSINGDATE' }, , { fieldLabel: Zi.LAN.CARGODATE, format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'CARGODATE' }, { fieldLabel: Zi.LAN.TRUCKSTATUS, name: 'TRUCKSTATUS' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'container', layout: 'anchor', flex: 1, defaultType: 'textfield', items: [{ xtype: 'textareafield', grow: true, flex: 1, fieldLabel: Zi.LAN.TRUCKDETAIL, height: 60, name: 'TRUCKDETAIL', anchor: '100%' }, { xtype: 'textareafield', grow: true, fieldLabel: Zi.LAN.REMARK, height: 60, name: 'REMARK', anchor: '100%' }] } ] }, { xtype: 'textfield', hidden: true, fieldLabel: '件数', name: 'PKGS', anchor: '100%' }, { xtype: 'textfield', hidden: true, fieldLabel: '尺码', name: 'CBM', anchor: '100%' }, { xtype: 'button', width: 90, text: Zi.LAN.QueDingYinRU, iconCls: "btnrefresh", handler: function (button, event) { this.Import(button, event); }, scope: this }]//end items(fieldset 1) }); //end this.formEdit //#endregion this.panelpage = new Ext.Panel({ title: Zi.LAN.PCDETAIL, layout: "border", region: 'center', animate: true, autoScroll: true, // containerScroll: true, frame: false, items: [this.formEdit] }); //#endregion //#region 固定费用明细表 //#region formSearch //#region formSearch枚举参照相关 //#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: Zi.LAN.BSNO, name: 'MblNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.ETD, format: 'Y-m-d', xtype: 'datefield', name: 'CustDate_Min', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { fieldLabel: Zi.LAN.ETD, 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: Zi.LAN.ZHIXINGCHAXUN, iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this } ] }] }] }); //#endregion formSearch //#region 按钮ToolBar //#endregion //#region 布局 this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 55, items: [this.formSearch] }); Ext.apply(this, { items: [this.panelTop, this.gridList, this.panelpage] }); //#endregion parentWin = window.parent.opener._this; if (parentWin) { this.storeBodyList = parentWin.storeBodyList; this.PEditRecord = parentWin.MainEditRecord; } //#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 自动刷新(已经提交但是尚未审核的业务,哪怕一票货中有一笔费用没审核也显示) this.onAutoRefresh(); //#endregion // this.SetBtnRight(); }, //end initUIComponents LoadData: function (opstatus, condition) { this.serialNo = 0; //this.bodyDel = []; this.opStatus = opstatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsOpLetter/GetTruckData', params: { handle: opstatus, condition: condition }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: Zi.LAN.TiShi, msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } data = result.data; this.EditRecord = data; this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); // this.GetEditStatus(); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, // end LoadDate onAutoRefresh: function () { var sql = ''; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, onRefreshClick: function (button, event) { var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, Import: function (button, event) { parentWin.formEdit.getForm().reset(); parentWin.formEdit.getForm().setValues(this.EditRecord); parentWin.formEdit.getForm().findField('CTNS').setValue(this.PEditRecord.get('CNTRTOTAL')); //parentWin.opStatus = "add"; //parentWin.Save("0"); window.closeAction = 'destroy'; window.close(); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert(Zi.LAN.TiShi, Zi.LAN.FUZHICUOWU); return ''; } var sql = ''; var mblNo = form.findField('MblNo').getValue(); sql = sql + getAndConSql(sql, mblNo, " (B.MBLNO like '%" + mblNo + "%' or B.HBLNO like '%" + mblNo + "%') "); var custDate_Min = form.findField('CustDate_Min').getRawValue(); sql = sql + getAndConSql(sql, custDate_Min, "B.ETD >= '" + custDate_Min + "'"); var custDate_Max = form.findField('CustDate_Max').getRawValue(); sql = sql + getAndConSql(sql, custDate_Max, "B.ETD<= '" + custDate_Max + " 23:59:59'"); return sql; } });