Ext.namespace('Shipping'); Shipping.AireHistryBill = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.AireHistryBill.superclass.constructor.call(this); }; Ext.extend(Shipping.AireHistryBill, 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: 'MsOpBillModel', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpAire/GetBillList', 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: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selModel: this.gridListCheckBoxModel, viewConfig: { autoFill: true, enableTextSelection: true }, columns: [{ sortable: true, dataIndex: 'MBLNO', header: '主单号', width: 130 }, { sortable: true, dataIndex: 'HBLNO', header: '分提单号', width: 130 }, { sortable: true, dataIndex: 'VESSEL', header: '航班', width: 130 }, { sortable: true, dataIndex: 'ETD', header: '开船日期', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 86 }, { sortable: true, dataIndex: 'PORTLOAD', header: '装货港', width: 130 }, { sortable: true, dataIndex: 'PORTDISCHARGE', header: '卸货港', width: 130 }, { sortable: true, dataIndex: 'SHIPPER', header: '发货人', width: 130 }, { sortable: true, dataIndex: 'CONSIGNEE', header: '收货人', width: 130 }, { sortable: true, dataIndex: 'AGENTID', header: '代理', width: 130 }, { sortable: true, dataIndex: 'INPUTBY', header: '录入人', width: 80 }, { sortable: true, dataIndex: 'CREATETIME', header: '录入日期', width: 86 }, { sortable: true, dataIndex: 'OP', header: '操作', width: 80 } ], // paging bar on the bottom bbar: Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { parentWin.formEdit.getForm().findField('PORTLOAD').setValue(record.data.PORTLOAD); parentWin.formEdit.getForm().findField('PORTLOADID').setValue(record.data.PORTLOADID); parentWin.formEdit.getForm().findField('PORTDISCHARGE').setValue(record.data.PORTDISCHARGE); parentWin.formEdit.getForm().findField('PORTDISCHARGEID').setValue(record.data.PORTDISCHARGEID); parentWin.formEdit.getForm().findField('ETA').setValue(record.data.ETA); parentWin.formEdit.getForm().findField('BLFRT').setValue(record.data.BLFRT); parentWin.formEdit.getForm().findField('OTFRT').setValue(record.data.OTFRT); parentWin.formEdit.getForm().findField('CUSTVALUE').setValue(record.data.CUSTVALUE); parentWin.formEdit.getForm().findField('CUSTOMVALUE').setValue(record.data.CUSTOMVALUE); parentWin.formEdit.getForm().findField('PKGS').setValue(record.data.PKGS); parentWin.formEdit.getForm().findField('KGS').setValue(record.data.KGS); parentWin.formEdit.getForm().findField('CBM').setValue(record.data.CBM); parentWin.formEdit.getForm().findField('KINDPKGS').setValue(record.data.KINDPKGS); parentWin.formEdit.getForm().findField('CLASS').setValue(record.data.CLASS); parentWin.formEdit.getForm().findField('FEEKGS').setValue(record.data.FEEKGS); parentWin.formEdit.getForm().findField('PRICE').setValue(record.data.PRICE); parentWin.formEdit.getForm().findField('TTLFREIGHT').setValue(record.data.TTLFREIGHT); parentWin.formEdit.getForm().findField('OTFEE1').setValue(record.data.OTFEE1); parentWin.formEdit.getForm().findField('OTFEE1AMOUNT').setValue(record.data.OTFEE1AMOUNT); parentWin.formEdit.getForm().findField('OTFEE2').setValue(record.data.OTFEE2); parentWin.formEdit.getForm().findField('OTFEE2AMOUNT').setValue(record.data.OTFEE2AMOUNT); parentWin.formEdit.getForm().findField('OTFEE3').setValue(record.data.OTFEE3); parentWin.formEdit.getForm().findField('OTFEE3AMOUNT').setValue(record.data.OTFEE3AMOUNT); parentWin.formEdit.getForm().findField('OTFEE4').setValue(record.data.OTFEE4); parentWin.formEdit.getForm().findField('OTFEE4AMOUNT').setValue(record.data.OTFEE4AMOUNT); parentWin.formEdit.getForm().findField('OTFEE5').setValue(record.data.OTFEE5); parentWin.formEdit.getForm().findField('OTFEE5AMOUNT').setValue(record.data.OTFEE5AMOUNT); parentWin.formEdit.getForm().findField('OTFEE6').setValue(record.data.OTFEE6); parentWin.formEdit.getForm().findField('OTFEE6AMOUNT').setValue(record.data.OTFEE6AMOUNT); parentWin.formEdit.getForm().findField('OTFEE7').setValue(record.data.OTFEE7); parentWin.formEdit.getForm().findField('OTFEE7AMOUNT').setValue(record.data.OTFEE7AMOUNT); parentWin.formEdit.getForm().findField('OTFEE8').setValue(record.data.OTFEE8); parentWin.formEdit.getForm().findField('OTFEE8AMOUNT').setValue(record.data.OTFEE8AMOUNT); parentWin.formEdit.getForm().findField('PFREIGHT').setValue(record.data.PFREIGHT); parentWin.formEdit.getForm().findField('CFREIGHT').setValue(record.data.CFREIGHT); parentWin.formEdit.getForm().findField('PCARRIEROT').setValue(record.data.PCARRIEROT); parentWin.formEdit.getForm().findField('CCARRIEROT').setValue(record.data.CCARRIEROT); parentWin.formEdit.getForm().findField('POTFREIGHT').setValue(record.data.POTFREIGHT); parentWin.formEdit.getForm().findField('COTFREIGHT').setValue(record.data.COTFREIGHT); parentWin.formEdit.getForm().findField('PTOTAL').setValue(record.data.PTOTAL); parentWin.formEdit.getForm().findField('CTOTAL').setValue(record.data.CTOTAL); parentWin.formEdit.getForm().findField('SHIPPER').setValue(record.data.SHIPPER); parentWin.formEdit.getForm().findField('CONSIGNEE').setValue(record.data.CONSIGNEE); parentWin.formEdit.getForm().findField('NOTIFYPARTY').setValue(record.data.NOTIFYPARTY); parentWin.formEdit.getForm().findField('AGENT').setValue(record.data.AGENT); parentWin.formEdit.getForm().findField('OTFEE').setValue(record.data.OTFEE); parentWin.formEdit.getForm().findField('MARKS').setValue(record.data.MARKS); parentWin.formEdit.getForm().findField('HSCODE').setValue(record.data.HSCODE); parentWin.formEdit.getForm().findField('DESCRIPTION').setValue(record.data.DESCRIPTION); parentWin.formEdit.getForm().findField('GOODSNAME').setValue(record.data.GOODSNAME); parentWin.formEdit.getForm().findField('ISSUEPLACE').setValue(record.data.ISSUEPLACE); parentWin.formEdit.getForm().findField('REMARK').setValue(record.data.REMARK); window.closeAction = 'destroy'; window.close(); }, this); //#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: '编号', name: 'MblNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }, { 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 //#endregion //#region 布局 this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 55, items: [this.formSearch] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); //#endregion parentWin = window.parent.opener._this; if (parentWin) { this.EditRecord = parentWin.EditRecord; } //#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 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 }); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; var mblNo = form.findField('MblNo').getValue(); sql = sql + getAndConSql(sql, mblNo, " (MBLNO like '%" + mblNo + "%' or HBLNO 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; } });