Ext.namespace('Shipping'); Shipping.MsRptCtnDueIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsRptCtnDueIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsRptCtnDueIndex, Ext.Panel, { PageSize: 1000, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, EditRecord: null, initUIComponents: function () { //定义数据集 this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsCtn', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpCtnStatus/GetRptCtnDueData', reader: { id: 'cntrid', root: 'data', totalProperty: 'totalCount' } } }); this.girdcolums = [{ sortable: true, dataIndex: 'cntrid', header: 'cntrid', hidden: true, width: 150 }, { sortable: true, dataIndex: 'cntrno', header: '箱号', width: 150 }, { sortable: true, dataIndex: 'cntrowner', header: '箱主', width: 120 }, { sortable: true, dataIndex: 'cntype', header: '箱型', width: 120 }, { sortable: true, dataIndex: 'cnsource', header: '箱源', width: 80 }, { sortable: true, dataIndex: 'buytime', header: '购买时间', width: 80 }, { sortable: true, dataIndex: 'statusref', header: '状态', width: 80 }, { sortable: true, dataIndex: 'dueday', header: '超期天数', width: 80 }, { sortable: true, dataIndex: 'positionname', header: '所在港口', width: 180 } ]; this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.CheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCellEditing], selModel: this.CheckBoxModel, selType: 'cellmodel', columns: this.girdcolums, 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; // this.OprationStatus = 'edit'; // window.open('/MvcShipping/MsOpCtnStatus/CtnEdit', "CTN EDIT", 'width=800,height=220,top=200,left=200,resizable=yes,status=yes,menubar=no,scrollbars=yes'); // }, 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: [{ fieldLabel: '箱号', name: 'CntrNo' }, { fieldLabel: '箱主', name: 'CntrOwner' }, { fieldLabel: '箱型', name: 'CntrSize' }] }]//end items(fieldset 1) }]//end root items }); //#endregion formSearch //查询工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { text: "重置条件", iconCls: "btnreset", handler: function (button, event) { }, scope: this }, { text: "导出Excel", id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this } ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 80, items: [this.panelBtn, this.formSearch] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); this.storeList.on('beforeload', function (store) { var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.onRefreshClick(); }, onRefreshClick: function (button, event) { var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); }, //onDeleteClick getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; var CntrNo = form.findField('CntrNo').getValue(); sql = sql + getAndConSql(sql, CntrNo, "(b.cntrno like '%" + CntrNo + "%' )"); var CntrOwner = form.findField('CntrOwner').getValue(); sql = sql + getAndConSql(sql, CntrOwner, " e.cntrowner in (select codename from info_client where shortname like '%" + CntrOwner + "%' )"); var CntrSize = form.findField('CntrSize').getValue(); sql = sql + getAndConSql(sql, CntrSize, "(e.cntype like '%" + CntrSize + "%' )"); return sql; }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; }, onExportClick: function (button, event) { GridExportExcelPage(this.gridList); }, onImportBsClick: function (button, event) { var winAccess = new Shipping.CtnFileImport({ }); winAccess.StoreList = this.storeList; winAccess.show(); return; } });