Ext.namespace('DsTruck'); DsTruck.FeeInputIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.DsTruck.FeeInputIndex.superclass.constructor.call(this); }; Ext.extend(DsTruck.FeeInputIndex, Ext.Panel, { PageSize: 500, OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, BSNO: "", initUIComponents: function () { _this = this; //定义数据集 this.storeList = Ext.create('Ext.data.Store', { model: 'Settlementmb', remoteSort: true, pageSize: this.PageSize, proxy: { type: 'ajax', url: '/OA/FeeInput/GetVWSettlement', reader: { idProperty: 'BSNO', root: 'data', totalProperty: 'totalCount' } } }); this.formname = "FeeInput"; //枚举参照 //表参照 this.storeBuyer = Ext.create('DsExt.ux.RefTableStore', { model: 'DsTruckMng.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeBuyer.load({ params: { condition: " ISCONTROLLER=1 "} }); this.comboxBuyer = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '委托单位', store: this.storeBuyer, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.storeUser = Ext.create('DsExt.ux.RefTableStore', { model: 'DsTruckMng.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' } }); this.storeUser.load({ params: { condition: ""} }); this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '操作人', store: this.storeUser, name: 'OP', valueField: 'UserName', displayField: 'UserName', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } }); this.comboxINPUTBY = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '录入人', store: this.storeUser, name: 'INPUTBY', id: "INPUTBY", valueField: 'UserName', displayField: 'UserName', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } /*, value: SHOWNAME*/ }); this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '销售/揽货人', store: this.storeUser, name: 'SALER', id: "SALER", valueField: 'UserName', displayField: 'UserName', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } /*, value: SHOWNAME*/ }); this.column = [{ sortable: true, hidden: true, dataIndex: 'BSNO', header: 'BSNO', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CORPID', header: 'CORPID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'OPLB', header: 'OPLB', width: 120 }, { sortable: true, dataIndex: 'OPLBNAME', header: '业务类型', width: 90 }, { sortable: true, dataIndex: 'CUSTOMERNAME', header: '委托单位', width: 120 }, { sortable: true, dataIndex: 'CUSTNO', header: '委托编号', width: 80 }, { sortable: true, dataIndex: 'MBLNO', header: '主提单号', width: 80 }, { sortable: true, dataIndex: 'VESSEL', header: '船名', width: 80 }, { sortable: true, dataIndex: 'VOYNO', header: '航次', width: 80 }, { sortable: true, dataIndex: 'OP', header: '操作人', width: 80 }, { sortable: true, dataIndex: 'INPUTBY', header: '录入人', width: 80 }, { sortable: true, hidden: true, dataIndex: 'CUSTOMNO', header: '合同号', width: 80 }, { sortable: true, dataIndex: 'ETD', header: 'ETD', width: 80 }, { sortable: true, dataIndex: 'ETA', header: 'ETA', width: 80 }, { sortable: true, dataIndex: 'ORDERNO', header: '订舱编号', width: 80 }, { sortable: true, dataIndex: 'SALEINFO', header: '销售摘要', width: 300 } ]; Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, { width: 50 }); //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, stripeRows: true, //collapsed: false, //collapsible: true, viewConfig: { autoFill: true, enableTextSelection: true }, 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, 1); //使用者id,表名 ,中间column数组,跳过一开始的几列 this.gridList.reconfigure(this.storeList, this.column); this.gridList.columns[0] = new Ext.grid.RowNumberer(); //////////////////////////// //#region formSearch //#region formSearch枚举参照相关 //#endregion this.formSearch = Ext.widget('form', { frame: true, region: 'north', 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: [ //////// ] }] }, //end items(fieldset 1) {//fieldset 2 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ //this.comboxCargoinfo, //this.comboxCargociq//, this.comboxCountry ] }] }, //end fieldset 2 {//fieldset 3 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxBuyer, this.comboxOP, this.comboxINPUTBY, this.comboxSALE/* { fieldLabel: 'hiddenfield', xtype: 'hiddenfield', name: 'hidden3', flex: 1 }*/ ] }] }, //end items(fieldset 3) {//fieldset 4 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [] }] }, //end items(fieldset 4) {//fieldset 5 xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ ] }] } //end items(fieldset 5) ]//end root items }); //#endregion formSearch //费用列表 this.CBMSearch = new Ext.form.Checkbox({ fieldLabel: '高级查询', listeners: { change: function (newValue, oldValue, eOpts)//change事件 { //alert(newValue.checked); if (newValue.checked) { Ext.getCmp("panelSearch").show(); } else { Ext.getCmp("panelSearch").hide(); } } } }); //查询工具条 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: "保存列表样式", id: "btntest", handler: function (button, event) { this.column = DsTruck.SaveGridPanel(USERID, this.formname, this.gridList.columns, this.column, 1, false); //alert(this.column[0].id); }, scope: this }, '-', { text: "导出Excel", id: "btnExportExcel", iconCls: 'btnexportexcel', handler: function (button, event) { this.onExportClick(button, event); }, scope: this }, '-', this.CBMSearch, '-', { id: "BSNO", fieldLabel: "编号", labelWidth: 55, xtype: 'textfield', name: 'BSNO', listeners: { specialkey: function (field, e) { if (e.getKey() == e.ENTER) { _this.onRefreshClick(); } } } } ] }); this.InitData(); //集中绑定事件 /* this.gridListChFee.on('edit', function (editor, e, eOpts) { this.gridListChFeeAfterEdit(editor, e, eOpts); }, this); this.gridListChFee_YF.on('edit', function (editor, e, eOpts) { this.gridListChFeeAfterEdit(editor, e, eOpts); }, this); this.cellEditingChFee.on('beforeedit', function (editor, e) { //Ext.getCmp("zongshu").setText("1234"); return this.cellEditingChFeeBeforeEdit(editor, e); }, this); this.cellEditingChFee_YF.on('beforeedit', function (editor, e) { //Ext.getCmp("zongshu").setText("1234"); return this.cellEditingChFeeBeforeEdit(editor, e); }, this); this.gridListChFee.getSelectionModel().on('select', function (button, event) { //Ext.getCmp("zongshu").setText("1234"); this.onSelectFee(button, event); }, this); this.gridListChFee_YF.getSelectionModel().on('select', function (button, event) { //Ext.getCmp("zongshu").setText("1234"); this.onSelectFee(button, event); }, this); this.gridListChFee.on('cellclick', function (button, event) { //Ext.getCmp("zongshu").setText("1234"); this.onSelectFee(button, event); }, this); this.gridListChFee_YF.on('cellclick', function (button, event) { //Ext.getCmp("zongshu").setText("1234"); this.onSelectFee(button, event); }, this); */ //选择load this.gridList.getSelectionModel().on('select', function (model, record, index) { this.BSNO = record.data.BSNO; OPLB = record.data.OPLB; this.storebill.load({ params: { condition: " BsNo='" + this.BSNO + "' " }, callback: function (r, options, success) { if (success) { //if (r.length == 1) { //this.formEdit.getForm().loadRecord(this.storebill.getAt(0)); this.panelFee.EditRecord = this.storebill.getAt(0); this.panelFee.strBSNO = this.BSNO; this.panelFee.StoreDateCurr.load({ params: { optype: OPLB, bsno: this.BSNO} }); this.panelFee.StoreUnit.load({ params: { bsno: this.BSNO} }); this.panelFee.storeBodySum.load({ params: { bsno: this.BSNO} }); this.panelFee.storeDrChFee.load({ params: { billno: this.BSNO, type: 1, optype: OPLB} }); this.panelFee.storeCrChFee.load({ params: { billno: this.BSNO, type: 2, optype: OPLB} }); //} } }, scope: this }); }, this); this.panelFee = new Shipping.FeeEditGrid({ region: 'center', layout: 'border' }); /////////////////////////////////////// this.storebill = Ext.create('Ext.data.Store', { model: 'MsSeai', remoteSort: false, proxy: { type: 'ajax', url: '/MvcShipping/MsSeaiFee/GetBLData', reader: { id: 'GId', root: 'data', totalProperty: 'totalCount' } } }); //var condition = " BsNo='" + this.BSNO + "'"; // this.panelFee.StoreBill = this.storebill; //this.panelFee.strBSNO = this.BSNO; this.panelFee.stroplb = 'op_Seai'; this.panelFee.StoreCustType.add({ "SCUSTTYPE": "WTDW-委托单位", "CUSTTYPE": "委托单位", "CUSTNAME": "CUSTOMERNAME" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CGS-船公司", "CUSTTYPE": "船公司", "CUSTNAME": "CARRIER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DCDL-订舱代理", "CUSTTYPE": "订舱代理", "CUSTNAME": "FORWARDER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "BGH-报关行", "CUSTTYPE": "报关行", "CUSTNAME": "CUSTOMSER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CD-车队", "CUSTTYPE": "车队", "CUSTNAME": "TRUCKER" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "FHR-发货人", "CUSTTYPE": "发货人", "CUSTNAME": "SHIPPERID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "SHR-收货人", "CUSTTYPE": "收货人", "CUSTNAME": "CONSIGNEEID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "TZR-通知人", "CUSTTYPE": "通知人", "CUSTNAME": "NOTIFYPARTYID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "DL-代理", "CUSTTYPE": "代理", "CUSTNAME": "AGENTID" }); this.panelFee.StoreCustType.add({ "SCUSTTYPE": "CZ-场站", "CUSTTYPE": "场站", "CUSTNAME": "YARD" }); this.panelFee.StoreDrOpRange.load({ params: { optype: "modSeaiRecvFeeManagement"} }); this.panelFee.StoreCrOpRange.load({ params: { optype: "modSeaiPayFeeManagement"} }); this.panelFee.storeFeeNameRef.load({ params: { condition: " ISSEA='1' "} }); this.panelChFee = new Ext.Panel({ // layout: "border", region: 'south', margin: '0 0', height: 450, //width: 450, split: true, items: [/*this.panelChFee_YS, this.panelChFee_YF*/ this.panelFee ] }); this.panelgridList = new Ext.Panel({ // layout: "border", region: 'north', margin: '0 0', //height: 200, //width: 450, split: true, items: [this.gridList] }); this.panelContract = new Ext.Panel({ //title: '', layout: "border", region: 'center', //height: 550, margin: '1 2', split: true, items: [this.gridList, this.panelChFee] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 30, items: [this.panelBtn] }); this.panelSearch = new Ext.Panel({ layout: "border", id: "panelSearch", region: "north", height: 40, hidden: true, items: [this.formSearch] }); Ext.apply(this, { items: [this.panelTop, this.panelSearch, this.panelContract] }); this.storeList.on('beforeload', function (store) { var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); }, //end initUIComponents InitData: function () { /* Ext.Ajax.request({ waitMsg: '正在查询用户权限...', url: '/CommMng/BasicDataRef/GetAuthorityRange', params: { modName: "modXXH_CWAudit", USERID: USERID }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); rec = result.data; //alert(rec.VISIBLERANGE); //alert(rec.OPERATERANGE); //可操作为0则全都可见,1可以审核可以通过可以修改无法完成,2无法审核无法通过无法修改可以完成 var VISIBLERANGE = rec.VISIBLERANGE; if (VISIBLERANGE == '0') { Ext.getCmp("btnFeeAuditPass").enable(); Ext.getCmp("btnFeeAuditReject").enable(); Ext.getCmp("btnSave").enable(); Ext.getCmp("ZDPASS").enable(); Ext.getCmp("ContractOver").enable(); } else if (VISIBLERANGE == '1') { Ext.getCmp("btnFeeAuditPass").enable(); Ext.getCmp("btnFeeAuditReject").enable(); Ext.getCmp("btnSave").enable(); Ext.getCmp("ZDPASS").enable(); Ext.getCmp("ContractOver").disable(); } else if (VISIBLERANGE == '2') { Ext.getCmp("btnFeeAuditPass").disable(); Ext.getCmp("btnFeeAuditReject").disable(); Ext.getCmp("btnSave").disable(); Ext.getCmp("ZDPASS").disable(); Ext.getCmp("ContractOver").enable(); } else { Ext.getCmp("btnFeeAuditPass").disable(); Ext.getCmp("btnFeeAuditReject").disable(); Ext.getCmp("btnSave").disable(); Ext.getCmp("ZDPASS").disable(); Ext.getCmp("ContractOver").disable(); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); //request over */ }, //end InitData onRefreshClick: function (button, event) { var sql = this.getCondition(); this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql }, waitMsg: "正在查询数据...", scope: this }); }, onDeleteClick: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/Import/XXH/Delete', params: { data: Ext.JSON.encode(record.data) }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeList.remove(record); 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); }, //onDeleteClick getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert('提示', '查询条件赋值错误,请检查。'); return ''; } var sql = ''; var HTH = Ext.getCmp("BSNO").getValue(); sql = sql + getAndConSql(sql, HTH, " (V.MBLNO like '%" + HTH + "%' or V.CUSTNO like '%" + HTH + "%' or V.ORDERNO like '%" + HTH + "%') "); var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue(); sql = sql + getAndConSql(sql, CUSTOMERNAME, "V.CUSTOMERNAME = '" + CUSTOMERNAME + "'"); var OP = form.findField('OP').getValue(); sql = sql + getAndConSql(sql, OP, "V.OP = '" + OP + "'"); var INPUTBY = form.findField('INPUTBY').getValue(); sql = sql + getAndConSql(sql, INPUTBY, "V.INPUTBY = '" + INPUTBY + "'"); var SALER = form.findField('SALER').getValue(); sql = sql + getAndConSql(sql, SALER, "(V.SALE = '" + SALER + "' or exists (select 1 from import_sales where saler='" + SALER + "' and salesno in(select salesno from import_saledetail where bsno=v.bsno) )) "); return sql; }, onGetremind: function (field, newValue, oldValue) { if (newValue != null) { this.storeList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: newValue }, waitMsg: "正在查询数据...", scope: this }); } }, OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; }, // alert(this.OprationStatus.ToString()); // alert(this.storeList.toString()); // alert(this.SelectedRecord.toString()); Save: function (type) { //费用 var bodyChFeeDatas = []; for (i = 0; i < this.storeBodyChFee.getCount(); i += 1) { var memberyf = this.storeBodyChFee.getAt(i); bodyChFeeDatas.push(memberyf); var amount = memberyf.data.Amount; if (amount == 0) { Ext.Msg.show({ title: '警告', msg: '费用的金额不允许为0,请修改后再保存', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } }; for (i = 0; i < this.storeBodyChFee_YF.getCount(); i += 1) { var memberyf = this.storeBodyChFee_YF.getAt(i); bodyChFeeDatas.push(memberyf); var amount = memberyf.data.Amount; if (amount == 0) { Ext.Msg.show({ title: '警告', msg: '费用的金额不允许为0,请修改后再保存', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } }; var jsonChFeeBody = ConvertRecordsToJson(bodyChFeeDatas); if (jsonChFeeBody == "") { return; } Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/Import/CWAudit/Save', scope: this, params: { chfeebody: jsonChFeeBody }, 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.storeBodyChFee.getForm().setValues(returnData); this.storeBodyChFee.commitChanges(); this.storeBodyChFee_YF.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'); } }); }, OprationSwap: function () { var ret = new Array(); ret[0] = 'edit'; ret[1] = ""; ret[2] = this.SelectedRecord; return ret; }, onExportClick: function (button, event) { GridExportExcelPage(this.gridList); } });