//集运管理-路单查询 Ext.namespace('DsTruck'); DsTruck.ReceiptNeedIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.DsTruck.ReceiptNeedIndex.superclass.constructor.call(this); }; //201403060002 //13号 Ext.extend(DsTruck.ReceiptNeedIndex, Ext.Panel, { PageSize: 500, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, initUIComponents: function () { this.bodyDel = []; //定义数据集 this.storeList = Ext.create('Ext.data.Store', { pageSize: this.PageSize, idProperty: 'GID', model: 'ReceiptNeedmb', remoteSort: true, proxy: { type: 'ajax', url: '/Import/ReceiptNeed/GetDataList', reader: { //id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); Ext.define('TFmb', { extend: 'Ext.data.Model', fields: [ { name: 'TFID', type: 'string' }, { name: 'TFName', type: 'string' } ] }); var TFData = [{ "TFID": "0", "TFName": "否" }, { "TFID": "1", "TFName": "是"}/*, { "PayTypeID": "2", "PayTypeName": "原单原转"}*/]; this.storeTF = Ext.create('Ext.data.Store', { model: 'TFmb', data: TFData }); this.storeTF2 = Ext.create('Ext.data.Store', { model: 'TFmb', data: TFData }); this.storeTF3 = Ext.create('Ext.data.Store', { model: 'TFmb', data: TFData }); this.storeTF4 = Ext.create('Ext.data.Store', { model: 'TFmb', data: TFData }); this.comboxTF = Ext.create('DsExt.ux.RefEnumCombox', { //fieldLabel: '是否', forceSelection: true, store: this.storeTF, name: 'Need_Recv', valueField: 'TFID', displayField: 'TFName' }); this.comboxTF2 = Ext.create('DsExt.ux.RefEnumCombox', { //fieldLabel: '已经完成', forceSelection: true, store: this.storeTF2, name: 'Need_Send', valueField: 'TFID', displayField: 'TFName' }); this.comboxTF3 = Ext.create('DsExt.ux.RefEnumCombox', { //fieldLabel: '是否', forceSelection: true, store: this.storeTF3, name: 'Need_Repeat', valueField: 'TFID', displayField: 'TFName' }); this.comboxTF4 = Ext.create('DsExt.ux.RefEnumCombox', { //fieldLabel: '已经完成', forceSelection: true, store: this.storeTF4, name: 'Need_Return', valueField: 'TFID', displayField: 'TFName' }); this.formname = "ReceiptNeed"; this.storeFStatus = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeFStatus.load({ params: { enumTypeId: 96005} }); this.comboxFStatus = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '业务类型', forceSelection: true, store: this.storeFStatus, name: 'TypeName', valueField: 'EnumValueName', displayField: 'EnumValueName' }); this.storeCrmKeyCodeCode4 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CrmKeyCodeModel', proxy: { url: '/CommMng/BasicDataRef/GetCrmKeyCodeList' } }); this.storeCrmKeyCodeCode4.load({ params: { condition: " and KEYTYPE='单据类型'"} }); this.comboxBSTYPE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '单据类型', store: this.storeCrmKeyCodeCode4, forceSelection: true, name: 'ReceiptName', valueField: 'KEYVALUE', displayField: 'KEYVALUE' }); this.column = [{ sortable: true, dataIndex: 'ReceiptName', header: '单据名称', width: 80 }, { sortable: true, dataIndex: 'TypeName', header: '业务类型', width: 80 }, { sortable: true, dataIndex: 'Need_Recv', header: '需要收单', width: 80, editor: this.comboxTF }, { sortable: true, dataIndex: 'Need_Send', header: '需要送单', width: 80, editor: this.comboxTF2 }, { sortable: true, dataIndex: 'Need_Repeat', header: '需要回单', width: 80, editor: this.comboxTF3 }, { sortable: true, dataIndex: 'Need_Return', header: '需要还单', width: 80, editor: this.comboxTF4 }, { sortable: true, hidden: true, dataIndex: 'inserted', header: 'string', width: 80 }]; this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', trackResetOnLoad: true, //height: 160, title: '', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.cellEditing], stateful: false, //selModel: this.ProjectCBModel, selType: 'cellmodel', columns: [new Ext.grid.RowNumberer()], bbar: Ext.create('Ext.PagingToolbar', { store: this.storeList, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); /////////////以下部分为获取存储的gridpanel显示样式 this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column); this.column.unshift(new Ext.grid.RowNumberer()); this.gridList.reconfigure(this.storeList, this.column); //////////////////////////// //#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: [ this.comboxFStatus, this.comboxBSTYPE, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' } ] } ]//end items(fieldset 1) }, //end fieldset 1 {//fieldset 2 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [] } ]//end items(fieldset 2) }//end fieldset 2 , {//fieldset 2 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [] }]//end items(fieldset 2) }//end fieldset 2 ]//end root items }); //查询工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "执行查询", iconCls: "btnrefresh", handler: function (button, event) { this.onRefreshClick(button, event); }, scope: this }, { text: "导出Excel", id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this }, { text: "保存列表样式", id: "btntest", handler: function (button, event) { this.column = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.column, 1, true); //alert(this.column[0].id); }, scope: this }, '-', /*{ text: '增加明细', tooltip: '增加明细', iconCls: "btnadddetail", handler: function (button, event) { this.onAddProjectClick(button, event); }, scope: this }, { text: '删除明细', tooltip: '删除明细', iconCls: "btndeletedetail", handler: function (button, event) { this.onDelProjectClick(button, event); }, scope: this },*/{ id: "btnSave", text: '保存更改', tooltip: '保存更改', iconCls: "btnsave", handler: function (button, event) { this.Save(); //alert(USERID); }, scope: this }, '-' ] }); //#endregion this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 100, items: [this.formSearch, this.panelBtn] }); 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.gridList.on('edit', function (editor, e, eOpts) { //this.ProjectAfterEdit(editor, e, eOpts); }, this); }, //end initUIComponents onRefreshClick: function (button, event) { var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: this.PageSize, condition: sql }, waitMsg: "正在查询数据...", scope: this }); this.bodyDel = []; }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; var ReceiptName = form.findField('ReceiptName').getValue(); sql = sql + getAndConSql(sql, ReceiptName, "ReceiptName like '%" + ReceiptName + "%'"); var TypeName = form.findField('TypeName').getValue(); sql = sql + getAndConSql(sql, TypeName, "TypeName like '%" + TypeName + "%'"); return sql; }, Save: function (type) { var bodyList = []; for (i = 0; i < this.storeList.getCount(); i += 1) { var member = this.storeList.getAt(i); bodyList.push(member); }; var jsonBody = ConvertRecordsToJson(bodyList); var jsonDelBody = ''; if (jsonBody == '' && jsonDelBody == '') { return; } Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/Import/ReceiptNeed/Save', scope: this, params: { CBBody: jsonBody, CBDelBody: jsonDelBody }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { //alert("保存成功"); var returnData = jsonresult.Data; this.storeList.commitChanges(); } 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 }); } //alert('03'); } }); } });