Ext.namespace('Shipping'); Shipping.MsOpSeaeCustCZJLIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpSeaeCustCZJLIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpSeaeCustCZJLIndex, Ext.Panel, { PageSize: 50, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, isShowAdvancedQuery: 0, //是否显示高级查询面板 IsAudit: false, BillType: 1, OrType: 2, editype: '', initUIComponents: function () { this.formname = "formMsOpSeaeCustCZIndex"; //页面名称 //定义数据集 this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsSeaeCustCZJLModel', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpSeaeCustCZJL/GetDataList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //#region 公司名 Ext.define('MsSeaeCustComModel', { extend: 'Ext.data.Model', idProperty: 'NAME', fields: [ { name: 'NAME', type: 'string' } ] }); this.storeComName = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.MsOpSeaeEdiTemplate', proxy: { url: '/MvcShipping/MsOpSeaeCustFee/GetComNameList' } }); this.storeComName.load(); this.comboxComName = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: "公司名称", store: this.storeComName, flex: 1, name: 'CZCOM', valueField: 'NAME', displayField: 'NAME', queryParam: 'NAME', queryMode: 'local' }); //#endregion //#region List列表显示信息 Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 30 }); this.Pagenum = Ext.create('Ext.form.field.Number', { name: 'bottles', fieldLabel: '每页记录数', labelAlign: 'right', value: this.PageSize, maxValue: 2000, width: 180, minValue: 0, listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.girdcolums = [{ sortable: true, id: '', dataIndex: '', header: '', width: 0 }, { sortable: false, dataIndex: 'GID', header: 'GID', width: 0 }, { sortable: false, dataIndex: 'GID', header: 'GID', width: 0 }, { sortable: false, dataIndex: 'CZCOM', header: '充值公司', width: 180 }, { sortable: false, dataIndex: 'CZJE', header: '充值金额', width: 120 }, { sortable: false, dataIndex: 'CZTIME', header: '充值时间', width: 120 }, { sortable: false, hidden:true, dataIndex: 'CZYE', header: '充值后余额', width: 120 }, { sortable: false, dataIndex: 'FPPath', header: '发票下载', width: 120, renderer: function (value, meta, record) { if (value != '' && value != null) { var link = "下载"; return link; } } }]; this.GridCheckBoxModel = 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, selModel: this.GridCheckBoxModel, viewConfig: { enableTextSelection: true }, columns: this.girdcolums, // paging bar on the bottom bbar: [Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }), this.Pagenum] }); //#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: 60, msgTarget: 'qtip' }, items: [{//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '50%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '充值日期', format: 'Y-m-d', xtype: 'datefield', name: 'CZTIMEbgn' }, { fieldLabel: '到', format: 'Y-m-d', xtype: 'datefield', name: 'CZTIMEend' }, { xtype: 'hidden' }, { xtype: 'hidden' }] }]//end items(fieldset 1) }]//end root items }); //#endregion formSearch _this = this; //按钮工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [{ text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 100, items: [this.panelBtn, this.formSearch] }); this.panelMainList = new Ext.Panel({ layout: "border", region: "north", title: "客户充值", items: [this.panelTop, this.gridList], listeners: { 'show': function (t, eOpts) { me.onRefreshClick(null, null); } } }); this.mainTab = new Ext.TabPanel({ id: 'mainTabPanel', enableTabScroll: true, closeAll: true, activeTab: 0, region: 'center', resizeTabs: true, items: [this.panelMainList] }); Ext.apply(this, { items: [this.mainTab] }); this.onRefreshClick(); this.storeList.on('beforeload', function (store) { var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: sql, billtype: this.BillType, ortype: this.OrType }); }, this); this.formDownloadShow = 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', id: 'downloadfile', defaults: { anchor: '100%' }, items: [{ xtype: 'label', html: '', width: 120, text: '' } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); }, //end initUIComponents onRefreshClick: function (button, event) { //var girdcolums = this.gridList.getColumnMode(); var sql = this.getCondition(); this.PageSize = this.Pagenum.getValue(); this.storeList.pageSize = this.PageSize; this.storeList.currentPage = 1; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, billtype: this.BillType, ortype: this.OrType }, waitMsg: "正在查询数据...", scope: this }); }, onDeleteClick: function (button, event) { var selectedRecords = this.gridList.getSelectionModel().getSelection(); if (selectedRecords.length === 0) { Ext.Msg.show({ title: '提示', msg: '请先选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var bsnos = ''; for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.ShenBaoZhuangTai === '已发送' || rec.data.ShenBaoZhuangTai === '已导出') { Ext.Msg.show({ title: '警告', msg: rec.data.MBLNO + ',此业务' + rec.data.ShenBaoZhuangTai + ',不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } else { var bsno = rec.data.GID; bsnos += "'" + bsno+"',"; } } bsnos = bsnos.substring(0, bsnos.length-1); Ext.MessageBox.confirm('提示', '确定删除选中记录吗?', function (btn) { if (btn === 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/MsOpSeaeCustCZ/DeletePiLiang', params: { bsnos: bsnos }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.onRefreshClick(); Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }, failure: function (response, options) { Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); }, success: function (response, options) { }, scope: this }); //end Ext.Ajax.request } }, this); }, onCreateEDIClick: function (type) { this.editype = type; this.winEDIShow.show(); }, 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 = "1=1 "; //#region formSearch 查询面板 ////申报状态 //var ShenBaoZhuangTai = form.findField('CZCOM').getRawValue(); //sql = sql + getAndConSql(sql, ShenBaoZhuangTai, "c.CZCOM = '" + ShenBaoZhuangTai + "'"); //充值时间 var CZTIMEbgn = form.findField('CZTIMEbgn').getRawValue(); sql = sql + getAndConSql(sql, CZTIMEbgn, "CZTIME >='" + CZTIMEbgn + " 00:00:00'"); var CZTIMEend = form.findField('CZTIMEend').getRawValue(); sql = sql + getAndConSql(sql, CZTIMEend, "CZTIME <='" + CZTIMEend + " 23:59:59'"); return sql; }, setIsShowAdvancedQuery: function () { if (this.isShowAdvancedQuery === 0) { this.panelSearch.show(); this.isShowAdvancedQuery = 1; } else { this.panelSearch.hide(); this.isShowAdvancedQuery = 0; } }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; ret[3] = this.IsAudit; ret[4] = this.BillType; ret[5] = this.OrType; return ret; } });