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: '主提单号', width: 130 }, { sortable: true, dataIndex: 'VESSEL', header: '船名', width: 130 }, { sortable: true, dataIndex: 'VOYNO', header: '航次', width: 50 }, { 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 }, { dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 120 }, { dataIndex: 'SALE', header: '销售', width: 70 }, { sortable: true, dataIndex: 'ACCDATE', header: '会计期间', width: 80 }, { dataIndex: 'CARRIER', header: '船公司', width: 100 }, { dataIndex: 'BSSOURCE', header: '业务来源', width: 80 }, { dataIndex: 'TRUCK', header: '车队', width: 80 }, { dataIndex: 'YARD', header: '提箱场站', width: 80 }, { dataIndex: 'RETURNYARD', header: '入货场站', width: 80 }, { dataIndex: 'CTNS', 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('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: '箱型箱量', readOnly: true, name: 'CTNS' }, { fieldLabel: '吨数', name: 'KGS' } , { fieldLabel: '陆运费', xtype: 'numberfield', name: 'TRUCKFEE', value: 0 } , { fieldLabel: '支付方式', name: 'PAYTYPE' }, { fieldLabel: '派车日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'TRUCKDATE' } ] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '提箱场站', name: 'YARD' }, { fieldLabel: '联系人', name: 'YARDATTN' }, { fieldLabel: '电话', name: 'YARDTEL' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '工厂', name: 'FACTRYNAME' }] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'textareafield', grow: true, flex: 2, fieldLabel: '工厂地址', height: 60, name: 'FACTRYADDR', anchor: '100%' }, { fieldLabel: '要求到达时间', labelWidth: 80, format: 'Y-m-d', flex: 1, xtype: 'datetimefield', name: 'FACTRYTIME' }] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '工厂联系人', name: 'FACTRYATTN' }, { fieldLabel: '联系方式', name: 'FACTRYTEL' }, { fieldLabel: '返场时间', name: 'RETRUNYARDTIME' }] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '入货场站', name: 'RETURNYARD' }, { fieldLabel: '联系人', name: 'RETURNATTN' }, { fieldLabel: '电话', name: 'RETURNTEL' }] } , { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '截港日期', //format: 'Y-m-d', //flex: 1, //xtype: 'datetimefield', name: 'CLOSINGDATE' }, , { fieldLabel: '提货日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'CARGODATE' }, { fieldLabel: '派车状态', 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: '注意事项', height: 60, name: 'TRUCKDETAIL', anchor: '100%' }, { xtype: 'textareafield', grow: true, fieldLabel: '备注', 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: "确定引入", 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: '派车通知详细信息', 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: '编号', 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, 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: '提示', 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('提示', '查询条件赋值错误,请检查。'); 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; } });