Ext.namespace('Shipping'); Shipping.BulkStationKc = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.BulkStationKc.superclass.constructor.call(this); }; Ext.extend(Shipping.BulkStationKc, Ext.Panel, { PageSize: 30, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, initUIComponents: function () { //定义数据集 this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsOpBulkStationKc', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpBulk/GetStationKcList', reader: { id: 'STATION', root: 'data', totalProperty: 'totalCount' } } }); this.girdcolums = [ { sortable: true, dataIndex: 'STATION', header: '铁路站点', width: 100 }, { sortable: true, dataIndex: 'PKGS', header: '当前库存件数', width: 80 }, { sortable: true, dataIndex: 'KGS', header: '当前库存吨数', width: 80 } ]; //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, columns: this.girdcolums, // 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) { this.SelectedRecord = record; DsOpenEditWin('/MvcShipping/MsOpBulk/StationKcDetail'); }, this); //#region formSearch //#region formSearch枚举参照相关 //#endregion this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' } }); this.StoreOpRange.load({ params: { optype: "modOpBulkOpwt"} }); this.storeOurPort = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.PortRefModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetOurPortRefList' } }); this.storeOurPort.load(); this.comboxOurPortFr = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '铁路站点', store: this.storeOurPort, forceSelection: true, name: 'PORTLOAD', valueField: 'CNAME', displayField: 'PORTANDNAME' }); 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.comboxOurPortFr, { xtype: 'label', width: 120, text: '(双击列表查看明细)' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' } ] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //#endregion formSearch //查询工具条 _this = this; this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "添加站台调整", iconCls: "btnadd", handler: function (button, event) { this.OprationStatus = 'add'; DsOpenEditWin('/MvcShipping/MsOpBulk/StationKcModify'); }, scope: this }, '-', { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { var form = _this.formSearch.getForm(); form.reset(); }, scope: this } ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 80, items: [this.formSearch, this.panelBtn] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); this.onRefreshClick(); this.storeList.on('beforeload', function (store) { var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); }, //end initUIComponents onRefreshClick: function (button, event) { // var girdcolums = this.gridList.getColumnMode(); 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 PORTLOAD = form.findField('PORTLOAD').getValue(); sql = sql + getAndConSql(sql, PORTLOAD, "STATIONNO= '" + PORTLOAD + "'"); return sql; }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; } });