Ext.namespace('DsTruck'); DsTruck.FuelDateListIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.DsTruck.FuelDateListIndex.superclass.constructor.call(this); }; //#region Date.prototype.format = function (format) { var o = { "M+": this.getMonth() + 1, //month "d+": this.getDate(), //day "h+": this.getHours(), //hour "m+": this.getMinutes(), //minute "s+": this.getSeconds(), //second "q+": Math.floor((this.getMonth() + 3) / 3), //quarter "S": this.getMilliseconds() //millisecond } if (/(y+)/.test(format)) format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(format)) format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)); return format; } var xhr = new XMLHttpRequest(); var currdate = new Date(); if (!xhr) { //...其他生成xmlhttprequest方法 } xhr.open("HEAD", location.href, true); xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { var datestr = xhr.getResponseHeader("Date"); currdate = new Date(datestr); // alert(currdate.format('yyyy-MM-dd')); } } xhr.send(null); //#endregion Ext.extend(DsTruck.FuelDateListIndex, Ext.Panel, { PageSize: 500, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, remind: null, initUIComponents: function () { this.FuelDateDel = []; this.FuelPriceDel = []; //定义数据集 this.storeList = Ext.create('Ext.data.Store', { model: 'FuelTruckListmb', remoteSort: false, pageSize: this.PageSize, proxy: { type: 'ajax', url: '/TruckMng/MsWl_Port_FuelTruckList/GetFuelTruckList', reader: { idProperty: 'TRUCKNO', root: 'data', totalProperty: 'totalCount' } } }); this.storeList_single = Ext.create('Ext.data.Store', { model: 'FuelDatemb', remoteSort: false, pageSize: this.PageSize, proxy: { type: 'ajax', url: '/TruckMng/MsWl_Port_FuelTruckList/GetFuelDate', reader: { idProperty: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeList_price = Ext.create('Ext.data.Store', { model: 'FuelPricemb', remoteSort: false, pageSize: this.PageSize, proxy: { type: 'ajax', url: '/TruckMng/MsWl_Port_FuelTruckList/GetFuelPrice', reader: { idProperty: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.MainCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true }); this.MainCB_single = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true }); this.MainCB_price = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true }); Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 50 }); Ext.grid.RowNumberer_single = Ext.extend(Ext.grid.RowNumberer, { width: 50 }); Ext.grid.RowNumberer_price = Ext.extend(Ext.grid.RowNumberer, { width: 50 }); //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, layout: "border", region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, stripeRows: true, viewConfig: { enableTextSelection: true }, features: [{ ftype: 'summary' }], stateful: true, //selModel: this.MainCB, stateId: '', columns: [new Ext.grid.RowNumberer(), { sortable: true, dataIndex: 'TRUCKNO', header: '车号', width: 80 }, { sortable: true, dataIndex: 'DRVCODE', header: '驾驶员', width: 80 }, { sortable: true, dataIndex: 'FuelType', header: '燃油类型', width: 80 }, { sortable: true, dataIndex: 'FuelQty', header: '数量', width: 80, summaryType: 'sum', summaryRenderer: function (value) { return Ext.util.Format.number(value, '0.00'); } }, { sortable: true, dataIndex: 'Amount', header: '金额', width: 80 }, { sortable: true, dataIndex: 'begindate', header: '初次加油日期', width: 80 }, { sortable: true, dataIndex: 'enddate', header: '末次加油日期', width: 80 } ], bbar: Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); //#region 枚举类型参照 //加油录入 this.storeTruckNo = Ext.create('DsExt.ux.RefTableStore', { model: 'MsWlBsHeadRefMsWlTruck', proxy: { url: '/TruckMng/MsWlPc/GetTruckNoList' } }); this.storeTruckNo.load({ params: { condition: ""} }); this.comboxTruckNo = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '车牌号', store: this.storeTruckNo, name: 'TRUCKNO', valueField: 'TruckNo', displayField: 'TruckNo', listeners: { change: function (field, newValue, oldValue) { //this.tonAndTruckNoChange(field, newValue, oldValue); }, scope: this } }); this.storeDrvName = Ext.create('DsExt.ux.RefTableStore', { model: 'MsWlBsHeadRefMsWlDriver', proxy: { url: '/TruckMng/MsWlPc/GetDrvNameList' } }); this.storeDrvName.load({ params: { condition: ""} }); this.comboxDrvName = Ext.create('DsExt.ux.RefTableCombox', { //fieldLabel: '司机', store: this.storeDrvName, name: 'DRVCODE', valueField: 'DrvCode', displayField: 'CodeAndName', listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { //this.setDrvName(records[0].data.DrvCode); } } } }); var _this = this; this.storeCompany = Ext.create('DsExt.ux.RefTableStore', { model: 'DsTruckMng.ux.CompanyModel', proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' } }); this.storeCompany.load({ params: { condition: "" } , callback: function (options, success, response) { if (success) { var record = Ext.create('DsTruckMng.ux.CompanyModel', { 'gid': '', 'code': '', 'name': '' }); _this.storeCompany.add(record); } } }); this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '分公司', store: this.storeCompany, name: 'COMPANYID', valueField: 'code', displayField: 'name' }); //#endregion this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridList_single = new Ext.grid.GridPanel({ store: this.storeList_single, enableHdMenu: false, layout: "border", region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.cellEditing], stripeRows: true, viewConfig: { enableTextSelection: true }, stateful: true, selModel: this.MainCB_single, stateId: '', columns: [new Ext.grid.RowNumberer_single(), { sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, dataIndex: 'TRUCKNO', header: '车号', editor: this.comboxTruckNo, width: 80 }, { sortable: true, dataIndex: 'DRVCODE', header: '驾驶员', width: 80, renderer: function (value, p, record) { if (value == null || value == '') return ''; else return record.data.DRVNAME; }, width: 80, editor: this.comboxDrvName }, { sortable: true, hidden: true, dataIndex: 'DRVNAME', header: 'DRVNAME', width: 80 }, { sortable: true, dataIndex: 'FuelType', header: '燃油类型', editor: { xtype: 'combo', name: 'FuelType', store: ['汽油', '柴油'] }, width: 80 }, { sortable: true, dataIndex: 'FuelQty', header: '数量', editor: { xtype: 'numberfield', //numberfield textfield selectOnFocus: true }, width: 80 }, { sortable: true, dataIndex: 'FuelDate', header: '加油日期', width: 80, renderer: Ext.util.Format.dateRenderer('Y-m-d'), editor: { format: 'Y-m-d', xtype: 'datefield', selectOnFocus: true } } ], bbar: Ext.create('Ext.PagingToolbar', { store: this.storeList_single, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); this.cellEditing_price = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridList_price = new Ext.grid.GridPanel({ store: this.storeList_price, enableHdMenu: false, layout: "border", region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.cellEditing_price], stripeRows: true, viewConfig: { enableTextSelection: true }, stateful: true, selModel: this.MainCB_price, stateId: '', columns: [new Ext.grid.RowNumberer_price(), { sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'inserted', header: 'inserted', width: 80 }, { sortable: true, dataIndex: 'FuelDate', header: '日期', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 80 }, { sortable: true, dataIndex: 'FuelType', header: '燃油类型', width: 80 }, { sortable: true, dataIndex: 'Price', header: '价格', editor: { xtype: 'numberfield', //numberfield textfield selectOnFocus: true }, width: 80 }, { sortable: true,hidden:true, dataIndex: 'COMPANYID', header: 'COMPANYID', width: 80 }, { sortable: true, //hidden: true, dataIndex: 'COMPANYNAME', header: '分公司', width: 120 } ], bbar: Ext.create('Ext.PagingToolbar', { store: this.storeList_price, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); this.storeList_single2 = Ext.create('Ext.data.Store', { model: 'FuelDatemb2', remoteSort: false, pageSize: this.PageSize, proxy: { type: 'ajax', url: '/TruckMng/MsWl_Port_FuelTruckList/GetFuelDate', reader: { idProperty: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeList_price2 = Ext.create('Ext.data.Store', { model: 'FuelPricemb2', remoteSort: false, pageSize: this.PageSize, proxy: { type: 'ajax', url: '/TruckMng/MsWl_Port_FuelTruckList/GetFuelPrice', reader: { idProperty: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.gridList_single2 = new Ext.grid.GridPanel({ store: this.storeList_single2, //hidden: true, enableHdMenu: false, width: 1, height: 1, layout: "border", region: 'south', loadMask: { msg: "数据加载中,请稍等..." }, columns: [ { sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, dataIndex: 'TRUCKNO', header: '车号', width: 80 }, { sortable: true, dataIndex: 'DRVCODE', header: '驾驶员', width: 80 }, { sortable: true, hidden: true, dataIndex: 'DRVNAME', header: 'DRVNAME', width: 80 }, { sortable: true, dataIndex: 'FuelType', header: '燃油类型', width: 80 }, { sortable: true, dataIndex: 'FuelQty', header: '数量', width: 80 }, { sortable: true, dataIndex: 'FuelDate', header: '加油日期', width: 80 }] }); this.gridList_price2 = new Ext.grid.GridPanel({ store: this.storeList_price2, //hidden: true, enableHdMenu: false, width: 1, height: 1, layout: "border", region: 'south', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, stripeRows: true, stateful: true, stateId: '', columns: [ { sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'inserted', header: 'inserted', width: 80 }, { sortable: true, dataIndex: 'FuelDate', header: '日期', width: 80 }, { sortable: true, dataIndex: 'FuelType', header: '燃油类型', width: 80 }, { sortable: true, dataIndex: 'Price', header: '价格', width: 80 }] }); this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { //this.SelectedRecord = record; var truckno = record.get('TRUCKNO') //this.OprationStatus = 'edit'; //DsOpenEditWin('/Import/PortOperate/Edit', "", "650", "1000"); Ext.getCmp('S_TRUCKNO').setValue(truckno); this.MainTab.setActiveTab(1); var sql = this.getCondition(); this.storeList_single.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, this); //#region formSearch 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: [ this.comboxCompany, { fieldLabel: '从..加油日期', format: 'Y-m-d', xtype: 'datefield', name: 'FuelDate_min' }, { fieldLabel: '到..加油日期', format: 'Y-m-d', xtype: 'datefield', name: 'FuelDate_max' }, { xtype: 'hiddenfield', flex: 2}] }] }, //end items(fieldset 1) {//fieldset 2 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ ] }] }, //end fieldset 2 {//fieldset 3 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ ] }] }, //end items(fieldset 4) {//fieldset 4 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [] }] }, //end items(fieldset 4) {//fildset 5 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [] }] } //end items(fieldset 5) ]//end root items }); //#endregion _this = this; this.CBMSearch = new Ext.form.Checkbox({ fieldLabel: '高级查询', listeners: { change: function (newValue, oldValue, eOpts)//change事件 { //alert(newValue.checked); if (newValue.checked) { _this.panelSearch.show(); } else { _this.panelSearch.hide(); } } } }); //查询工具条 this.panelBtn = new Ext.Panel({ region: "center", tbar: [ { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { this.onResetClick(button, event); }, scope: this }, '-', { text: '增加明细', tooltip: '增加明细', iconCls: "btnadddetail", handler: function (button, event) { this.onAddFuelDateClick(button, event); }, scope: this }, { text: '删除明细', tooltip: '删除明细', iconCls: "btndeletedetail", handler: function (button, event) { this.onDelFuelDateClick(button, event); }, scope: this }, { id: "btnSave", text: '保存更改', tooltip: '保存更改', iconCls: "btnsave", handler: function (button, event) { this.Save_FuelDate(); //alert(USERID); }, scope: this }, '-', { text: "导出Excel", id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this }, { id: "S_TRUCKNO", fieldLabel: "车号", labelWidth: 55, xtype: 'textfield', name: 'S_TRUCKNO' }, '-', //this.comboxport this.CBMSearch //this.basicBoxselect ] }); //布局 this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 30, items: [this.panelBtn] }); this.panelSearch = new Ext.Panel({ layout: "border", region: "north", height: 50, autoSize: true, hidden: true, items: [this.formSearch] }); this.page_1 = new Ext.Panel({ id: "page_1", layout: "border", region: "center", title: "单车加油统计", items: [this.gridList ] }); this.page_2 = new Ext.Panel({ id: "page_2", layout: "border", region: "center", title: "加油管理", items: [ this.gridList_single, this.gridList_single2 ] }); this.page_3 = new Ext.Panel({ id: "page_3", layout: "border", region: "center", title: "油价管理", items: [ this.gridList_price, this.gridList_price2 ] }); /* this.page_4 = new Ext.Panel({ id: "page_4", layout: "border", region: "center", title: "导入加油记录", items: [ this.gridList_ADL ] });*/ this.MainTab = new Ext.tab.Panel({ layout: "border", id: "tablepnl", region: "center", items: [this.page_1, this.page_2, this.page_3 //, this.page_4 ] }) Ext.apply(this, { items: [this.panelTop, this.panelSearch, this.MainTab] }); this.storeList.on('beforeload', function (store) { var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.gridList_single.on('edit', function (editor, e, eOpts) { this.FuelDateAfterEdit(editor, e, eOpts); }, this); }, //end initUIComponents onRefreshClick: function (button, event) { //var sql = this.getCondition(); var _p = this.MainTab.getActiveTab().id; if (_p == "page_1") { var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); } if (_p == "page_2") { var sql = this.getCondition(); this.storeList_single.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); this.storeList_single2.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); } if (_p == "page_3") { var sql = this.getPriceCondition(); var sql2 = this.getPriceCondition2(); this.storeList_price.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, condition2: sql2 }, waitMsg: "正在查询数据...", scope: this }); this.storeList_price2.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); } if (_p == "page_4") { var sql = this.getCondition_ADL(); this.storeList_ADL.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); } }, onAddFuelDateClick: function (button, event, type) { var store = null; var _p = this.MainTab.getActiveTab().id; if (_p == "page_1") { return; } if (_p == "page_2") { store = this.storeList_single; var truckno = Ext.getCmp('S_TRUCKNO').getValue(); record = Ext.create('FuelDatemb', { GID: newGuid(), TRUCKNO: truckno, DRVCODE: "", DRVNAME: "", FuelType: "柴油", FuelQty: "0", FuelDate: "2015-01-01", inserted: "" }); store.add(record); cellediting = this.cellEditing; var n = store.getCount(); cellediting.startEditByPosition({ row: n - 1, column: 2 }); } if (_p == "page_3") { } }, onDelFuelDateClick: function (button, event) { var _p = this.MainTab.getActiveTab().id; if (_p == "page_2") { var selectedRecords = this.gridList_single.selModel.getSelection(); Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) { if (btn == 'yes') { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.inserted != "" || rec.inserted != "*") //如果是新增但没有保存的数据,没有必要提交到后台 { this.FuelDateDel.push(rec); } this.storeList_single.remove(selectedRecords[i]); } } }, this); } if (_p == "page_3") { var selectedRecords = this.gridList_pricee.selModel.getSelection(); Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) { if (btn == 'yes') { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.inserted != "" || rec.inserted != "*") //如果是新增但没有保存的数据,没有必要提交到后台 { this.FuelPriceDel.push(rec); } this.storeList_price.remove(selectedRecords[i]); } } }, this); } }, FuelDateAfterEdit: function (editor, e, eOpts) { if (e.field == 'DRVCODE') { var BSrecords = DsStoreQueryBy(this.storeDrvName, 'DrvCode', e.value); if (BSrecords.getCount() > 0) { var BSdata = BSrecords.getAt(0).data; e.record.set('DRVNAME', BSdata.DrvName); //e.record.set('Mobile', BSdata.Mobile); } else { e.record.set('DRVNAME', ''); } } }, getCondition: function () { var sql = ''; var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var S_TRUCKNO = Ext.getCmp('S_TRUCKNO').getValue(); sql = sql + getAndConSql(sql, S_TRUCKNO, " TRUCKNO like '%" + S_TRUCKNO + "%' "); var COMPANYID = form.findField('COMPANYID').getValue(); sql = sql + getAndConSql(sql, COMPANYID, " TRUCKNO in(select truckno from tmswltruck where orgcode='" + COMPANYID + "')"); var FuelDate_min = form.findField('FuelDate_min').getRawValue(); sql = sql + getAndConSql(sql, FuelDate_min, "Fueldate >= '" + FuelDate_min + "'"); var FuelDate_max = form.findField('FuelDate_max').getRawValue(); sql = sql + getAndConSql(sql, FuelDate_max, "Fueldate <= '" + FuelDate_max + " 23:59:59'"); return sql; }, getCondition_ADL: function () { var sql = ""; var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ""; } var S_TRUCKNO = Ext.getCmp('S_TRUCKNO').getValue(); sql = sql + getAndConSql(sql, S_TRUCKNO, " (CH like '%" + S_TRUCKNO + "%' or CKR like '%" + S_TRUCKNO + "%')"); var COMPANYID = form.findField('COMPANYID').getValue(); sql = sql + getAndConSql(sql, COMPANYID, " TRUCKNO in(select truckno from tmswltruck where orgcode='" + COMPANYID + "')"); var FuelDate_min = form.findField('FuelDate_min').getRawValue(); sql = sql + getAndConSql(sql, FuelDate_min, "JYTIME >= '" + FuelDate_min + "'"); var FuelDate_max = form.findField('FuelDate_max').getRawValue(); sql = sql + getAndConSql(sql, FuelDate_max, "JYTIME <= '" + FuelDate_max + " 23:59:59'"); return sql; }, getPriceCondition: function () { var sql = ''; var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var FuelDate = form.findField('FuelDate_min').getRawValue(); if (FuelDate == "") { FuelDate = currdate.format('yyyy-MM') } sql = sql + getAndConSql(sql, FuelDate, "'" + FuelDate.substr(0, 4) + "','" + FuelDate.substr(5, 2) + "'"); return sql; }, getPriceCondition2: function () { var sql = ''; var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var COMPANYID = form.findField('COMPANYID').getValue(); sql = sql + getAndConSql(sql, COMPANYID, " #t1.companyid=(select gid from company where codename='" + COMPANYID + "')"); return sql; }, getStrValue: function (list) { var _list = []; for (var _i = 0; _i < list.length; _i++) { _list.push("'" + list[_i] + "'"); } return _list; }, onGetremind: function (field, newValue, oldValue) { if (newValue != null) {/* this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: newValue }, waitMsg: "正在查询数据...", scope: this });*/ this.remind = newValue; } }, onResetClick: function (button, event) { this.formSearch.getForm().reset(); Ext.getCmp('S_TRUCKNO').setValue(""); }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; }, Save_FuelDate: function (type) { if (COMPANYID == "") { alert("登录信息不全,请退出重新登录"); return; } var FuelDates = []; for (var i = 0; i < this.storeList_single.getCount(); i += 1) { var member = this.storeList_single.getAt(i); FuelDates.push(member); } var FuelDateList = ConvertRecordsToJson(FuelDates); var FuelDateDelList = ConvertRecordsToJsonAll(this.FuelDateDel); var FuelPrices = []; for (var i = 0; i < this.storeList_price.getCount(); i += 1) { var member = this.storeList_price.getAt(i); FuelPrices.push(member); } var FuelPriceList = ConvertRecordsToJson(FuelPrices); var FuelPriceDelList = ConvertRecordsToJsonAll(this.FuelPriceDel); if (FuelDateList == "" && FuelDateDelList == "" && FuelPriceList == "" && FuelPriceDelList == "") { return; } var _this = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsWl_Port_FuelTruckList/SaveFuelDate', scope: this, async: false, params: { FuelDate: FuelDateList, FuelDateDel: FuelDateDelList, FuelPrice: FuelPriceList, FuelPriceeDel: FuelPriceDelList }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeList_single.commitChanges(); this.storeList_price.commitChanges(); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } //alert('03'); } }); } //end save , onExportClick: function (button, event) { var _p = this.MainTab.getActiveTab().id; if (_p == "page_1") { GridExportExcelPage(this.gridList); } if (_p == "page_2") { GridExportExcelPage(this.gridList_single2); } if (_p == "page_3") { GridExportExcelPage(this.gridList_price2); } } , onAddADLClick: function (button, event) { var selectedRecords = this.gridList_ADL.selModel.getSelection(); var FeeList = ""; selectedRecords = this.gridList_ADL.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (FeeList == "") { FeeList = "'" + rec.get('GID') + "'"; } else { FeeList = FeeList + ",'" + rec.get('GID') + "'"; } } if (FeeList == "") { return; } var _this = this; Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsWl_Port_FuelTruckList/AddADLFuel', scope: this, params: { FeeList: FeeList }, callback: function (options, success, response) { if (success) { var _this = this; //this.Save('0'); } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, onDelADLClick: function (button, event) { var selectedRecords = this.gridList_ADL.selModel.getSelection(); var FeeList = ""; selectedRecords = this.gridList_ADL.selModel.getSelection(); for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (FeeList == "") { FeeList = "'" + rec.get('GID') + "'"; } else { FeeList = FeeList + ",'" + rec.get('GID') + "'"; } } if (FeeList == "") { return; } var _this = this; Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/TruckMng/MsWl_Port_FuelTruckList/DelADLFuel', scope: this, params: { FeeList: FeeList }, callback: function (options, success, response) { if (success) { var _this = this; //this.Save('0'); } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); } });