Ext.namespace('Shipping'); Shipping.MsInfoClientMinIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsInfoClientMinIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsInfoClientMinIndex, Ext.Panel, { PageSize: 20, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, isShowAdvancedQuery: 0, //是否显示高级查询面板 sqlcontext: '', editype: '', selectbsno: '', sortfield: '', sortdire: '', //需求编号:SR2017061200005-1 initUIComponents: function () { this.formname = "formInfoClientMinIndex"; //页面名称 //定义数据集 this.storectndisp = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CtnDispModel', proxy: { url: '/CommMng/BasicDataRef/GetCtnDisp' } }); this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsInfoClientModel', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsInfoClient/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: '每页记录数', labelAlign: 'right', value: this.PageSize, maxValue: 100000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); //#region List列表显示信息 Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 30 }); _this = this; this.initgirdcolums = [{ sortable: true, id: '', dataIndex: '', header: '', width: 0 }, { sortable: true, id: '', dataIndex: 'GID', header: Zi.LAN.GID, //'编号', hidden: true, width: 0 }, { sortable: true, id: '', dataIndex: 'CODENAME', header: Zi.LAN.CODENAME, //'客户代码', width: 120 }, { sortable: true, id: '', dataIndex: 'SHORTNAME', header: Zi.LAN.SHORTNAME, //'客户简称', width: 120 }, { sortable: true, id: '', dataIndex: 'DESCRIPTION', header: Zi.LAN.DESCRIPTION, //'客户全称', width: 200 }, { sortable: true, id: '', dataIndex: 'ADDR', header: Zi.LAN.ADDR, //'地址', width: 250 }, { sortable: true, id: '', dataIndex: 'TEL', header: Zi.LAN.TEL, //'电话', width: 120 }, { sortable: true, id: '', dataIndex: 'FAX', header: Zi.LAN.FAX, //'传真', width: 80 } ]; this.girdcolums = this.initgirdcolums; this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: Zi.LAN.ShuJuJiaZaiZhong }, //"数据加载中,请稍等..." trackMouseOver: true, disableSelection: false, selModel: this.GridCheckBoxModel, viewConfig: { enableTextSelection: true, //允许复制数据 autoFill: true }, listeners: { cellclick: function (thisTab, record, item, index, e, eOpts) { if (index == 10) {//设置按钮列 // alert('用户编号=' + this.getStore().getAt(rowIndex).data.usercode); } } }, columns: this.girdcolums, // paging bar on the bottom bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, displayMsg: Zi.LAN.displayMsg, //'当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: Zi.LAN.emptyMsg, //"没有数据" displayInfo: true }), this.Pagenum] }); /////////////以下部分为获取存储的gridpanel显示样式 this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id,表名,中间column数组,跳过一开始的几列 this.gridList.columns[0] = new Ext.grid.RowNumberer(); this.gridList.reconfigure(this.storeList, this.girdcolums); //////////////////////////////////////////////// this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) { //this.SelectedRecord = record; //this.OprationStatus = 'edit'; //var openSet = "height=700, width=1200, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 //var openType = "_blank"; //var openUrl = "/MvcShipping/MsInfoClient/Edit"; //window.open(openUrl, openType, openSet); }, this); this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) { this.sortfield = column.dataIndex; this.sortdire = direction; }, this); //#region formSearch 下拉框信息加载 //权限范围 //#endregion //#region formSearch 查询面板 _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: '代码或简称、全称', //'代码或简称', labelWidth: 120, name: 'MblNo', enableKeyEvents: true, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } , { xtype: 'button', width: 90, text: Zi.LAN.btnRefresh, //"执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { xtype: 'button', width: 45, // text: Zi.LAN.btnMore, //"高级查询", iconCls: "btnmore", handler: function (button, event) { var sql = this.getCondition(); var winAccess = new Shipping.DsQuery({ }); winAccess.StoreList = this.storeList; winAccess.formname = this.formname; winAccess.condition = sql; winAccess.show(); return; }, scope: this }] } ]//end items(fieldset 1) }]//end root items }); //#endregion formSearch _this = this; //按钮工具条_ this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 60, items: [this.formSearch] }); Ext.apply(this, { items: [this.panelTop, this.gridList] }); //this.storeList.load({ // params: { start: 0, limit: this.PageSize, sort: '', condition: '', load: 'true' }, // waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, // scope: this //}); this.storeList.on('beforeload', function (store) { // var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: _this.sqlcontext }); }, this); }, //end initUIComponents onRefreshClick: function (button, event) { //var girdcolums = this.gridList.getColumnMode(); var sql = this.getCondition(); this.sqlcontext = sql; this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, scope: this }); }, onDsQuery: function () { //var girdcolums = this.gridList.getColumnMode(); var sql = this.sqlcontext; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: Zi.LAN.ZhengZaiChaXunShuJu, scope: this }); }, //end initUIComponents onClearSql: function () { var form = this.formSearch.getForm(); form.reset(); }, //onDeleteClick getCondition: function () { var form = this.formSearch.getForm(); // var form2 = this.formSearch2.getForm(); if (!form.isValid()) { Ext.Msg.alert(Zi.LAN.TiShi, Zi.LAN.ChaXunTiaoJianFuZhiCuoWu); //'查询条件赋值错误,请检查。' return ''; } this.isShowAdvancedQuery = 0; // var sql = ''; //#region formSearch 查询面板 var MblNo = form.findField('MblNo').getValue(); sql = sql + getAndConSql(sql, MblNo, "(CODENAME like '%" + MblNo + "%' or SHORTNAME like '%" + MblNo + "%' or DESCRIPTION like '%" + MblNo + "%')"); return sql; }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.selectbsno; ret[4] = 'info_client'; return ret; } });