Ext.namespace('Shipping'); Shipping.MsOpAuditDetailAUIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpAuditDetailAUIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpAuditDetailAUIndex, Ext.Panel, { PageSize: 500, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, EditRecord: null, BsNo: "", stroplb: "", initUIComponents: function () { //定义数据集 // var mainform = window.parent._this; this.BsNo = getUrlParam('bsno'); this.oplb = getUrlParam('oplb'); this.isamend = getUrlParam('isamend'); this.formname = 'MsOpAuditDetailIndex'; this.ischange = 0; this.storeSalesCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserActionRefListRm' } }); this.storeSalesCode.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { MODULENAME: 'modBLFeeAudit' }); }, this); this.storeSalesCode.load(); this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, model: 'MsOpAuditDetail', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsOpAuditDetail/GetListData', reader: { id: 'ADID', root: 'data', totalProperty: 'totalCount' } } }); this.girdcolums = [{ sortable: true, dataIndex: 'ADID', header: 'ADID', hidden: true, width: 150 }, { sortable: true, dataIndex: 'BSNO', header: '业务编号', hidden: true, width: 150 }, { sortable: true, dataIndex: 'ERRMSG', header: '审核描述', width: 300 }, { sortable: true, dataIndex: 'OPREMARK', header: '操作说明', editor: { xtype: 'textfield', selectOnFocus: true }, width: 250 }, { sortable: true, dataIndex: 'ERRDATA', header: '错误数据', width: 320 }, { sortable: true, dataIndex: 'AUDITTYPE', header: '是否匹配', //'是否机密', renderer: function (value, cellmeta) { if (value == '1') { return "匹配异常"; } else return "匹配一致"; }, width: 60 } // , { // sortable: true, // dataIndex: 'CREATETIME', // header: '提交时间', // renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'), // width: 120 //}, { // sortable: true, // dataIndex: 'CREATEUSERREF', // header: '提交人', // width: 80 //} ]; 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, viewConfig: { autoFill: true, enableTextSelection: true }, plugins: [this.gridListCellEditing], selModel: this.CheckBoxModel, selType: 'cellmodel', tbar: [{ xtype: 'label', labelAlign: 'right', width: 60, html: "未匹配列表" } ], columns: this.girdcolums, bbar: Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); this.storeList.on('beforeload', function (store) { var sql = "BSNO='" + this.BsNo + "'"; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); this.comboxSalesCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel:'审核人', //揽货人 store: this.storeSalesCode, //forceSelection: true, name: 'PS_AUDIT', id: 'PS_AUDIT', valueField: 'GID', displayField: 'CodeAndName', enableKeyEvents: true }); this.storeAUDITTYPE = Ext.create('Ext.data.Store', { fields: ['FSTATUS', 'NAME'] }); this.storeAUDITTYPE.add({ "FSTATUS": "", "NAME": "全部" }); this.storeAUDITTYPE.add({ "FSTATUS": "1", "NAME": "未匹配" }); this.storeAUDITTYPE.add({ "FSTATUS": "0", "NAME": "已匹配" }); _this = this; this.comboxAUDITTYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '匹配状态', //是否开垫付 store: this.storeAUDITTYPE, valueField: 'FSTATUS', displayField: 'NAME', forceSelection: true, name: 'AUDITTYPE', id:'PS_AUDITTYPE', value: '1', // flex: 0.7, enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } }, //change: function (field, e) { // if (this.ischange == 1) _this.onRefreshClick(); //}, 'select': function (combo, records, eOpts) { if (records.length > 0) { _this.onRefreshClick(); } } } }); this.ischange = 1; this.CheckSaveQuery = new Ext.form.Checkbox({ fieldLabel:'记住查询', //记忆查询条件 checked: true, width: 120 }); //查询工具条 //this.panelBtn = new Ext.Panel({ // region: "north", // tbar: [ // this.comboxSalesCode,{ // text: "确认提交", // iconCls: "btnsave", // handler: function (button, event) { // this.onPostDetailClick(button, event); // }, // scope: this // }, this.comboxAUDITTYPE, this.CheckSaveQuery // ] //}); this.formSearch = Ext.widget('form', { frame: true, region: 'north', height:40, bodyPadding: 0, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container', defaultType: 'textfield', layout: 'hbox', defaults: { anchor: '100%' }, items: [this.comboxSalesCode, { text: "确认提交", xtype: 'button', width: 90, iconCls: "btnsave", handler: function (button, event) { this.onPostDetailClick(button, event); }, scope: this }, this.comboxAUDITTYPE, this.CheckSaveQuery ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery, this.onRefreshClick()); //this.panelTop = new Ext.Panel({ // layout: "border", // region: "north", // height: 50, // items: [this.panelBtn] //}); Ext.apply(this, { items: [this.formSearch,this.gridList ] }); this.storeList.on('beforeload', function (store) { var AUDITTYPE = Ext.getCmp('PS_AUDITTYPE').getValue(); var sql = "BSNO='" + this.BsNo + "'"; if (AUDITTYPE != '') sql = sql + " and AUDITTYPE='" + AUDITTYPE + "'"; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcShipping/MsBaseInfo/GetUserQuerySetting', params: { formname: _this.formname }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.success) { return false; } data = result.data; if (data.ISSAVEVALUE == true) { _this.formSearch.getForm().reset(); if (data.FIELDVALUES !== "") { _this.formSearch.getForm().setValues(Ext.JSON.decode(data.FIELDVALUES)); } _this.CheckSaveQuery.setValue(true); } else { _this.CheckSaveQuery.setValue(false); } _this.onRefreshClick(); return true; } else { //Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); return false; } }, scope: this }); //this.onRefreshClick(); }, onRefreshClick: function (button, event) { var AUDITTYPE = Ext.getCmp('PS_AUDITTYPE').getValue(); var issavevalue = false; if (this.CheckSaveQuery.checked) issavevalue = true saveQuerySetting(this.formname, this.formSearch, true, issavevalue); var sql = "BSNO='" + this.BsNo + "'"; if (AUDITTYPE != '') sql = sql + " and AUDITTYPE='" + AUDITTYPE+"'"; this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, onPostDetailClick: function (button, event) { var issavevalue = false; if (this.CheckSaveQuery.checked) issavevalue = true saveQuerySetting(this.formname, this.formSearch, true, issavevalue); var PS_AUDIT = Ext.getCmp('PS_AUDIT').getValue(); if (PS_AUDIT == undefined || PS_AUDIT == '') { Ext.Msg.show({ title:'提示', msg:'审核人不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } //for (i = 0; i < this.storeList.getCount(); i += 1) { // var memberyf = this.storeList.getAt(i); // if (memberyf.data.AUDITTYPE == '1' && memberyf.data.OPREMARK == '') { // Ext.Msg.show({ title: '提示', msg: '未匹配信息,错误说明不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } //}; var bodyDrChFeeDatas = []; var i; for (i = 0; i < this.storeList.getCount(); i += 1) { var memberyf = this.storeList.getAt(i); bodyDrChFeeDatas.push(memberyf); }; var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas); _this = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsOpAuditDetail/SaveAndAudit', scope: this, params: { bsno: _this.BsNo, body: jsonChFeeBody, audit: PS_AUDIT, oplb: _this.oplb, isamend: _this.isamend }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { window.closeAction = 'destroy'; window.close(); } 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 }); } } }); }, //end save OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; } });