Ext.namespace('Shipping'); Shipping.MsCodeCtnTkEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsCodeCtnTkEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsCodeCtnTkEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, editFactryRecord: null, FactryStatus: 'add', InspectCanEdit: false, InsuranceCanEdit:false, initUIComponents: function () { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; this.Loading = true; //#region 编辑form //枚举参照相关(编辑form) this.storeCTNPROP = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeCTNPROP.load({ params: { enumTypeId: 97030} }); this.comboxCTNPROP = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeCTNPROP, fieldLabel: '箱属', name: 'CTNPROP', valueField: 'EnumValueName', displayField: 'EnumValueName' }); this.storeNAMEPLATE = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeNAMEPLATE.load({ params: { condition: "1=1"} }); this.comboxNAMEPLATE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '铭牌信息', store: this.storeNAMEPLATE, flex: 2, forceSelection: true, name: 'NAMEPLATE', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeOWNERCTN = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeOWNERCTN.load({ params: { condition: "1=1"} }); this.comboxOWNERCTN = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '罐东', store: this.storeOWNERCTN, flex: 2, forceSelection: true, name: 'OWNERCTN', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeMADEFACTORY = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); _this = this; this.storeMADEFACTORY.load({ params: { condition: "1=1"} }); this.comboxMADEFACTORY = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '生产厂家', store: this.storeMADEFACTORY, flex: 2, forceSelection: true, name: 'MADEFACTORY', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeTRAILPEDAL = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeTRAILPEDAL.load({ params: { enumTypeId: 97031} }); this.comboxTRAILPEDAL = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeTRAILPEDAL, fieldLabel: '步道踏板', name: 'TRAILPEDAL', valueField: 'EnumValueName', displayField: 'EnumValueName' }); this.storeAIRVALVE = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeAIRVALVE.load({ params: { enumTypeId: 97032} }); this.comboxAIRVALVE = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeAIRVALVE, fieldLabel: '空气阀', name: 'AIRVALVE', valueField: 'EnumValueName', displayField: 'EnumValueName' }); this.storeSAFETYVALVE = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeSAFETYVALVE.load({ params: { enumTypeId: 97033} }); this.comboxSAFETYVALVE = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeSAFETYVALVE, fieldLabel: '安全阀', name: 'SAFETYVALVE', valueField: 'EnumValueName', displayField: 'EnumValueName' }); this.storeTOPVALVE = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeTOPVALVE.load({ params: { enumTypeId: 97034} }); this.comboxTOPVALVE = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeTOPVALVE, fieldLabel: '顶阀', name: 'TOPVALVE', valueField: 'EnumValueName', displayField: 'EnumValueName' }); this.storeBOTTOMVALVE = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeBOTTOMVALVE.load({ params: { enumTypeId: 97035} }); this.comboxBOTTOMVALVE = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeBOTTOMVALVE, fieldLabel: '底阀', name: 'BOTTOMVALVE', valueField: 'EnumValueName', displayField: 'EnumValueName' }); this.storeSTEAMPIPE = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeSTEAMPIPE.load({ params: { enumTypeId: 97036} }); this.comboxSTEAMPIPE = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeSTEAMPIPE, fieldLabel: '蒸汽管', name: 'STEAMPIPE', valueField: 'EnumValueName', displayField: 'EnumValueName' }); this.StoreCTNSTATUS = Ext.create('Ext.data.Store', { fields: ['CTNSTATUS'] }); this.StoreCTNSTATUS.add({ "CTNSTATUS": "可用" }); this.StoreCTNSTATUS.add({ "CTNSTATUS": "不可用" }); this.comboxCTNSTATUS = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '箱状态', store: this.StoreCTNSTATUS, forceSelection: true, name: 'CTNSTATUS', valueField: 'CTNSTATUS', displayField: 'CTNSTATUS' }); this.storeCodeDisport = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CodeDisportModel', autoLoad: true, proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportList' } }); this.comboxPORTDISCHARGE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '当前地区', store: this.storeCodeDisport, name: 'CURPORT', valueField: 'PORT', displayField: 'PORT' }); //客户加载_场站 this.storeDESTPORT_STATOIN = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeDESTPORT_STATOIN.load({ params: { condition: "ISYARD='1'"} }); //场站 this.comboxDESTPORT_STATOIN = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '当前位置', store: this.storeDESTPORT_STATOIN, forceSelection: true, name: 'CURSTATOIN', valueField: 'CustName', displayField: 'CodeAndName' }); // this.storeListGood = Ext.create('Ext.data.Store', { // model: 'MsCodeMSDS', // remoteSort: true, // proxy: { // type: 'ajax', // url: '/MvcContainer/MsCodeMSDS/GetDataList', // reader: { // id: 'GID', // root: 'data', // totalProperty: 'totalCount' // } // } // }); // this.storeListGood.load({ params: { condition: ""} }); // this.comboxPREGOODNAME = Ext.create('DsExt.ux.RefTableCombox', { // store: this.storeListGood, // fieldLabel: '前装货', // flex: 2, forceSelection: true, // name: 'PREGOODNAME', // valueField: 'GOODNAME', // displayField: 'GOODNAME' // }); //表参照相关(编辑form) //编辑form this.formEdit = Ext.widget('form', { region: 'center', frame: true, bodyPadding: 5, autoScroll: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'fieldset', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: 'GID', name: 'GID', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'COMPANYID', name: 'COMPANYID', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '年检信息锁定', inputValue: true, flex: 1, xtype: 'checkboxfield', name: 'INSPECTLOCKSTATUS' ,hidden: true }, { fieldLabel: '保险信息锁定', inputValue: true, flex: 1, xtype: 'checkboxfield', name: 'INSURANCELOCKSTATUS' , hidden: true }, { fieldLabel: '箱号', allowBlank: true, flex: 1, name: 'CTNNO' }, this.comboxNAMEPLATE, this.comboxOWNERCTN] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCTNSTATUS, this.comboxPORTDISCHARGE, this.comboxDESTPORT_STATOIN, { fieldLabel: '前装货', readOnly: true, flex: 1, name: 'PREGOODNAME' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCTNPROP, this.comboxMADEFACTORY, { fieldLabel: '生产日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'MADEDATE' }, { fieldLabel: '停用此罐箱', inputValue: true, xtype: 'checkboxfield', name: 'ISSTOPUSE' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '罐壁厚度', name: 'TANKWALLTHICK', regex: /^(-?\d+)(\.\d+)?$/, regexText: '请输入正确的数值!', flex: 0.6 }, { xtype: 'label', text: 'mm' // html: "℃~" }, { fieldLabel: '封头厚度', name: 'HEADTHICK', regex: /^(-?\d+)(\.\d+)?$/, regexText: '请输入正确的数值!', flex: 0.6 }, { xtype: 'label', html: "mm" }, { fieldLabel: '容积', regex: /^(-?\d+)(\.\d+)?$/, regexText: '请输入正确的数值!', name: 'TANKVOLUMN', flex: 0.6 }, { xtype: 'label', html: "CBM" }, { fieldLabel: '皮重', regex: /^(-?\d+)(\.\d+)?$/, regexText: '请输入正确的数值!', name: 'TAREWEIGHT', flex: 0.6 }, { xtype: 'label', html: "KGS" }, { fieldLabel: '最大允许压力', name: 'MAXWORKINGGPRESSURE', regex: /^(-?\d+)(\.\d+)?$/, regexText: '请输入正确的数值!', flex: 0.6 }, { xtype: 'label', text: 'bar' // html: "℃~" }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '试验压力', name: 'TESTINGGPRESSURE', regex: /^(-?\d+)(\.\d+)?$/, regexText: '请输入正确的数值!', flex: 0.6 }, { xtype: 'label', html: "bar" }, { fieldLabel: '设计温度', name: 'DESIGNTEMPERATUREB', regex: /^(-?\d+)(\.\d+)?$/, regexText: '请输入正确的数值!', flex: 0.6 }, { xtype: 'label', html: "℃~" }, { name: 'DESIGNTEMPERATUREE', regex: /^(-?\d+)(\.\d+)?$/, regexText: '请输入正确的数值!', flex: 0.28 }, { xtype: 'label', html: "℃" }, { xtype: 'hiddenfield', flex: 1.7 }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxTRAILPEDAL, this.comboxAIRVALVE, this.comboxSAFETYVALVE, this.comboxTOPVALVE, this.comboxBOTTOMVALVE] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '虹吸管', inputValue: true, xtype: 'checkboxfield', name: 'EXSITSIPHONPIPE' }, { fieldLabel: '压力表', inputValue: true, xtype: 'checkboxfield', name: 'EXSITPRESSUREGAUGE' }, { fieldLabel: '顶部溢流盒盖', inputValue: true, xtype: 'checkboxfield', name: 'EXSITTOPOVERFLOWBOX' }, { fieldLabel: '人孔溢流盒盖', inputValue: true, xtype: 'checkboxfield', name: 'EXSITINTOOVERFLOWBOX' }, { fieldLabel: '底部阀门防尘罩', inputValue: true, xtype: 'checkboxfield', name: 'EXSITBOTTONVALVEDUSTCOVER' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxSTEAMPIPE, { fieldLabel: '录入人', readOnly: true, disabled: true, name: 'INPUTBYREF' }, { fieldLabel: '录入日期', readOnly: true, disabled: true, name: 'INPUTTIME' }, { fieldLabel: '箱租金 USD', flex: 1, name: 'CTNRENT' }, { xtype: 'label', html: "/天" }, { xtype: 'hiddenfield'}] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '提箱日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'TAKECTNDATE' }, { fieldLabel: '租赁箱到期日', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'EXPIREDATE' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'textareafield', grow: true, height: 40, fieldLabel: '备注', name: 'REMARKS', anchor: '100%' }] } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //end this.formEdit //#endregion //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { id: 'btnEPrev', text: "上一票", // iconCls: "btnsave", handler: function (button, event) { this.PrevRecord(); }, scope: this }, { id: 'btnENext', text: "下一票", // iconCls: "btnsave", handler: function (button, event) { this.NextRecord(); }, scope: this }, { text: "保存", iconCls: "btnsave", handler: function (button, event) { this.Save('0'); }, scope: this }, { text: "保存并关闭", handler: function (button, event) { this.Save('1'); }, scope: this }, '-', { text: "保存并新建", handler: function (button, event) { this.Save('2'); }, scope: this }, '-', { id: 'btnECopyNew', text: "复制新建", handler: function (button, event) { var basicForm = this.formEdit.getForm(); this.opStatus = 'add'; basicForm.findField('GID').setDisabled(false); var field = basicForm.findField('GID'); field.setValue(NewGuid()); basicForm.findField('GID').setDisabled(true); field = basicForm.findField('INPUTBYREF'); field.setValue(SHOWNAME); for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); memberbody.set("LINKGID", '*'); memberbody.commit(); }; this.storeDocList.removeAll(); }, scope: this } ] }); //end 按钮Toolbar //#endregion //#region 不能去航线 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'MsCodeCtnTkNoLaneItems', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsCodeCtnTk/GetCodeCtnTkNoLaneItemsList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeLANE = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.Lane', proxy: { url: '/CommMng/BasicDataRef/GetCodeLaneList' } }); this.storeLANE.load(); this.comboxLANE = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeLANE, // forceSelection: true, name: 'LANE', valueField: 'GID', displayField: 'LANE' }); //明细表表格 this.gridListNoLaneCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListNoLaneItems = new Ext.grid.GridPanel({ store: this.storeBodyList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListNoLaneCellEditing], selType: 'cellmodel', tbar: [{ text: '增加明细', tooltip: '增加明细', id: "btnadddetail", iconCls: "btnadddetail", handler: function (button, event) { this.addDetail(); }, scope: this }, '-', { text: '删除明细', tooltip: '删除明细', id: "btndeldetail", iconCls: "btndeletedetail", handler: function (button, event) { this.onDelDetailClick(); }, scope: this }], columns: [{ sortable: true, dataIndex: 'GID', header: '编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'LINKGID', header: '业务编号', hidden: true, width: 0 }, { dataIndex: 'LANEGID', header: '航线', width: 220, editor: this.comboxLANE, renderer: function (value, p, record) { return record.data.LANE; } }] }); this.gridListNoLaneItems.on('edit', function (editor, e, eOpts) { this.gridListAfterEdit(editor, e, eOpts); }, this); this.panelNoLaneItems = new Ext.Panel({ title: '不能去航线信息', layout: "border", region: 'west', width: 300, animate: true, frame: false, items: [this.gridListNoLaneItems] }); //#endregion //#region 年检 //客户加载_场站 this.storeYARD = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' } }); this.storeYARD.load({ params: { condition: "ISYARD='1'"} }); //场站 this.comboxYARD = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeYARD, forceSelection: true, name: 'DEPOT', valueField: 'CustName', displayField: 'CodeAndName' }); this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', { model: 'MsFeeCurr', proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' } }); this.StoreCurr.load({ params: { condition: ""} }); this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreCurr, forceSelection: true, name: 'CURRENCY', valueField: 'CURR', displayField: 'CURR' }); this.storeInspectList = Ext.create('Ext.data.Store', { model: 'MsCodeCtnTkInspect', remoteSort: false, proxy: { type: 'ajax', url: '/MvcContainer/MsCodeCtnTk/GetCodeCtnTkInspectItemsList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListInspectCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListInspectItems = new Ext.grid.GridPanel({ store: this.storeInspectList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListInspectCellEditing], selType: 'cellmodel', tbar: [{ text: '增加明细', tooltip: '增加明细', id: "btnaddInspect", iconCls: "btnadddetail", handler: function (button, event) { this.addInspect(); }, scope: this }, '-', { text: '删除明细', tooltip: '删除明细', id: "btndelInspect", iconCls: "btndeletedetail", handler: function (button, event) { this.onDelInspectClick(); }, scope: this }, '-', { text: '引入EXCEL数据', id: "btnInspectExcel", handler: function (button, event) { this.onImportInspectClick(button, event); }, scope: this }, '-', { text: '锁定', tooltip: '锁定年检数据', id: "btnlockInspect", iconCls: "btnlock", handler: function (button, event) { this.onLockInspectClick(1); //this.Save('0'); }, scope: this }, { text: '解除锁定', tooltip: '解除锁定年检数据', id: "btnunlockInspect", iconCls: "btnunlock", handler: function (button, event) { this.onLockInspectClick(0); //this.Save('0'); }, scope: this }], columns: [{ sortable: true, dataIndex: 'GID', header: '编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'LINKGID', header: '业务编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'ISLOCKREF', header: '是否锁定', width: 100 }, { sortable: true, dataIndex: 'DEPOT', header: '场站', editor: this.comboxYARD, width: 100 }, { sortable: true, dataIndex: 'DEPOTDATE', header: '入场时间', editor: { xtype: 'datefield', format: 'Y-m-d' }, renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { sortable: true, dataIndex: 'INSPECTDATE', header: '年检时间', editor: { xtype: 'datefield', format: 'Y-m-d' }, renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { sortable: true, dataIndex: 'INSPECTENDDATE', header: '年检结束时间', editor: { xtype: 'datefield', format: 'Y-m-d' }, renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { sortable: true, dataIndex: 'CYCLE', header: '周期', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true }, width: 100 }, { sortable: true, dataIndex: 'INSPECTCORP', header: '年检企业', editor: { xtype: 'textfield' }, width: 100 }, { sortable: true, dataIndex: 'DEPOTAMOUNT', header: '场站费用', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true }, width: 100 }, { sortable: true, dataIndex: 'DEPOTCURRENCY', header: '场站币别', editor: this.comboxCurr, width: 100 }, { sortable: true, dataIndex: 'INSPECTAMOUNT', header: '年检费用', editor: { xtype: 'numberfield', keyNavEnabled: false, selectOnFocus: true, hideTrigger: true, mouseWheelEnabled: false, enableKeyEvents: true }, width: 100 }, { sortable: true, dataIndex: 'INSPECTCURRENCY', header: '年检币别', editor: this.comboxCurr, width: 100 }] }); this.storeInspectList.on('beforeload', function (store) { var billno = _this.formEdit.getForm().findField('GID').getValue(); var sql = " BSNO='" + billno + "'"; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); //#endregion //#region 保险 this.storeInsuranceList = Ext.create('Ext.data.Store', { model: 'MsCodeCtnTkInsurance', remoteSort: false, proxy: { type: 'ajax', url: '/MvcContainer/MsCodeCtnTk/GetCodeCtnTkInsuranceItemsList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListInsuranceItems = new Ext.grid.GridPanel({ store: this.storeInsuranceList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCellEditing], selType: 'cellmodel', tbar: [{ text: '增加明细', tooltip: '增加明细', id: "btnaddInsurance", iconCls: "btnadddetail", handler: function (button, event) { this.addInsurance(); }, scope: this }, '-', { text: '删除明细', tooltip: '删除明细', id: "btndelInsurance", iconCls: "btndeletedetail", handler: function (button, event) { this.onDelInsuranceClick(); }, scope: this }, '-', { text: '引入EXCEL数据', handler: function (button, event) { this.onImportInsuranceClick(button, event); }, scope: this },'-', { text: '锁定', tooltip: '锁定保险数据', id: "btnlockInsurance", iconCls: "btnlock", handler: function (button, event) { this.onLockInsuranceClick(1); //this.Save('0'); }, scope: this }, { text: '解除锁定', tooltip: '解除锁定保险数据', id: "btnunlockInsurance", iconCls: "btnunlock", handler: function (button, event) { this.onLockInsuranceClick(0); //this.Save('0'); }, scope: this }], columns: [{ sortable: true, dataIndex: 'GID', header: '编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'LINKGID', header: '业务编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'ISLOCKREF', header: '是否锁定', width: 100 }, { sortable: true, dataIndex: 'BSNO', header: '保险编号', editor: { xtype: 'textfield' }, width: 200 }, { sortable: true, dataIndex: 'BEGINDATE', header: '开始时间', editor: { xtype: 'datefield', format: 'Y-m-d' }, renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { sortable: true, dataIndex: 'ENDDATE', header: '结束时间', editor: { xtype: 'datefield', format: 'Y-m-d' }, renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { sortable: true, dataIndex: 'CORPSNAME', editor: { xtype: 'textfield' }, header: '保险企业', width: 200 }] }); this.storeInsuranceList.on('beforeload', function (store) { var billno = _this.formEdit.getForm().findField('GID').getValue(); var sql = " BSNO='" + billno + "'"; Ext.apply(store.proxy.extraParams, { condition: sql }); }, this); //#endregion //#region 明细表-单据图片档案管理 _this = this; this.storeDocList = Ext.create('Ext.data.Store', { model: 'ReceiptDocmb', remoteSort: true, proxy: { type: 'ajax', url: '/Import/ReceiptDoc/GetDocList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.DocListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.DocCM = Ext.create('Ext.selection.CheckboxModel'); this.gridDocList = new Ext.grid.GridPanel({ store: this.storeDocList, enableHdMenu: false, region: 'center', // width: 350, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.DocListCellEditing], selModel: this.DocCM, selType: 'cellmodel', tbar: [{ text: '删除', tooltip: '删除', iconCls: "btndeletedetail", handler: function (button, event) { this.onDelFileClick(button, event); }, scope: this }, '-', { text: '上传附件', tooltip: '上传附件', iconCls: "btnadddetail", handler: function (button, event) { this.onUpLoadFileClick(button, event); }, scope: this }], columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'R_GID', header: 'R_GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'BSNO', header: 'BSNO', width: 80 }, { sortable: true, dataIndex: 'URL', header: '文件名', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, hidden: true, dataIndex: 'Driect_URL', header: 'Driect_URL', width: 80 }, { sortable: true, hidden: true, dataIndex: 'MODIFIEDUSER', header: 'MODIFIEDUSER', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDUSERRef', header: '上传人', width: 80 }, { sortable: true, dataIndex: 'MODIFIEDTIME', header: '上传时间', width: 135 } ] }); this.panelDoc = new Ext.Panel({ id: "panelDoc", layout: "border", region: "center", title: '相关图片', //autoScroll: true, frame: false, split: true, items: [this.gridDocList] }); //#endregion //#region 维修 this.storeListRepair = Ext.create('Ext.data.Store', { model: 'MsOpCtnRepair', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnBsCard/GetOpCtnRepairList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeListRepairImg = Ext.create('Ext.data.Store', { model: 'MsOpCtnRepairImg', remoteSort: false, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnBsCard/GetOpCtnRepairListImg', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.gridListRepair = new Ext.grid.GridPanel({ store: this.storeListRepair, enableHdMenu: false, layout: "border", region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selType: 'cellmodel', columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LINKID', header: 'LINKID', width: 80 }, { sortable: true, dataIndex: 'AUDITSTATUS', header: '状态', width: 60 }, { sortable: true, dataIndex: 'REPAIRITEMS', header: '维修改装项目', width: 150 }, { sortable: true, dataIndex: 'REPAIRTIME', header: '维修改装日期', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 100 }, { sortable: true, dataIndex: 'CURSTATOIN', header: '场站', width: 100 }, { sortable: true, dataIndex: 'FEENAME', header: '费用名称', width: 100 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', width: 50 }, { sortable: true, dataIndex: 'AMOUNT', header: '金额', width: 60 }, { sortable: true, dataIndex: 'IMAGE1', hidden: true, header: '改装前照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'IMAGE2', hidden: true, header: '改装后照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'REMARKS', header: '备注', width: 150 }] }); this.gridListRepair.getSelectionModel().on('select', function (model, record, index) { this.BILL = record.data; this.GID = record.data.GID; if (this.GID != "" || this.GID != "*") { this.storeListRepairImg.load({ params: { start: "0", limit: "999", sort: "", condition: " LINKGID='" + this.GID + "'"} }); } else { this.storeListRepairImg.removeAll(); } // }, this); this.gridListRepairImg = new Ext.grid.GridPanel({ store: this.storeListRepairImg, enableHdMenu: false, layout: "border", region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selType: 'cellmodel', columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LINKID', header: 'LINKID', width: 80 }, { sortable: true, dataIndex: 'IMAGE1', header: '改装前照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'IMAGE2', header: '改装后照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'REMARKS', header: '备注', width: 150 }] }); this.panelRepairItemImg = new Ext.Panel({ title: '照片明细', layout: "border", region: 'east', animate: true, width: 550, split: true, // autoScroll: true, // containerScroll: true, frame: false, items: [this.gridListRepairImg ] }); this.panelRepairItem = new Ext.Panel({ title: '改装明细', layout: "border", region: 'center', animate: true, // autoScroll: true, // containerScroll: true, frame: false, items: [this.gridListRepair , this.panelRepairItemImg ] }); this.panelRepair = new Ext.Panel({ title: '维修改装', layout: "border", region: 'center', animate: true, split: true, frame: false, items: [this.panelRepairItem] }); //#endregion //#region 清洗 this.storeListClearing = Ext.create('Ext.data.Store', { model: 'MsOpCtnClearing', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnBsCard/GetOpCtnClearingList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListClearing = new Ext.grid.GridPanel({ store: this.storeListClearing, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, selType: 'cellmodel', columns: [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LINKID', header: 'LINKID', width: 80 }, { sortable: true, dataIndex: 'AUDITSTATUS', header: '状态', width: 150 }, { sortable: true, dataIndex: 'INSTATOINTIME', header: '进场时间', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 120 }, { sortable: true, dataIndex: 'IMAGE1', header: '进场照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'EIR', header: 'EIR照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'CLEARINGMODE', header: '清洗方式', width: 120 }, { sortable: true, dataIndex: 'PREGOODSNAME', header: '前装货', width: 150 }, { sortable: true, dataIndex: 'ISCLEAR_CERT', header: '是否有清洁证', hidden: true, editor: { xtype: 'checkboxfield', inputValue: '1', uncheckedValue: '0' // selectOnFocus: true }, renderer: function (value, cellmeta) { if (value == 'true' || value == '1') { return "√"; } else return ""; }, width: 60 }, { sortable: true, dataIndex: 'CHECKGOV', header: '检测机构', width: 120 }, { sortable: true, dataIndex: 'ISCLEAR_PLAN', header: '发送清洗计划', hidden: true, renderer: function (value, cellmeta) { if (value == 'true' || value == '1') { return "√"; } else return ""; }, width: 60 }, { sortable: true, dataIndex: 'CLEARTIME', header: '清洗时间', renderer: Ext.util.Format.dateRenderer('Y-m-d'), width: 120 }, { sortable: true, dataIndex: 'IMAGE_CLEAR', header: '清洗照片', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'IMAGE_CHECKGOV', header: '清洁证', width: 140, renderer: function (value, p, record) { return '' + value + ''; } }, { sortable: true, dataIndex: 'ISCOMPLETE', header: '是否完成', hidden: true, renderer: function (value, cellmeta) { if (value == 'true' || value == '1') { return "√"; } else return ""; }, width: 60 }, { sortable: true, dataIndex: 'FEENAME', header: '费用名称', width: 150 }, { sortable: true, dataIndex: 'CURRENCY', header: '币别', width: 150 }, { sortable: true, dataIndex: 'AMOUNT', header: '金额', width: 150 }, { sortable: true, dataIndex: 'REMARKS', header: '备注', width: 150 }] }); this.panelClearing = new Ext.Panel({ title: '清洗信息', layout: "border", region: 'center', animate: true, // autoScroll: true, // containerScroll: true, frame: false, items: [this.gridListClearing] }); //#endregion this.panelDetail = new Ext.Panel({ layout: "border", region: "center", title : "航线及图片", frame: false, split: true, items: [this.panelNoLaneItems, this.panelDoc] }); this.panelYearInspection = new Ext.Panel({ layout: "border", region: "center", title: "年检", frame: false, split: true, items: [this.gridListInspectItems] }); this.panelInsurance = new Ext.Panel({ layout: "border", region: "center", title: "保险", frame: false, split: true, items: [this.gridListInsuranceItems] }); //#region 布局 //控件布局 this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 310, items: [this.panelBtn, this.formEdit] }); this.tabWTpanel = new Ext.TabPanel({ activeTab: 0, autoWidth: true, border: true, frame: false, region: 'center', enableTabScroll: true, items: [ this.panelDetail, this.panelYearInspection, this.panelInsurance, this.panelRepair, this.panelClearing ] }); Ext.apply(this, { items: [this.panelTop, this.tabWTpanel] }); //#endregion //绑定查询窗体 this.storeBodyList.on('beforeload', function (store) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; Ext.apply(store.proxy.extraParams, { condition: acondition }); }, this); this.storeDocList.on('beforeload', function (store) { var xcondition = " BSNO='" + this.editRecord.get('GID') + "'"; Ext.apply(store.proxy.extraParams, { condition: xcondition }); }, this); this.storeListRepair.on('beforeload', function (store) { if (this.editRecord != null) var acondition = " LINKGID in (select GID from op_ctnbscard where CTNNO='" + this.editRecord.get('CTNNO') + "')"; else var acondition = " LINKGID='11111'"; Ext.apply(store.proxy.extraParams, { condition: acondition }); }, this); this.storeListRepairImg.on('beforeload', function (store) { if (this.editRecord != null) var acondition = " LINKGID in (select GID from op_ctnbscard where CTNNO='" + this.editRecord.get('CTNNO') + "')"; else var acondition = " LINKGID='11111'"; Ext.apply(store.proxy.extraParams, { condition: acondition }); }, this); this.storeListClearing.on('beforeload', function (store) { if (this.editRecord != null) var acondition = " LINKGID in (select GID from op_ctnbscard where CTNNO='" + this.editRecord.get('CTNNO') + "')"; else var acondition = " LINKGID='11111'"; Ext.apply(store.proxy.extraParams, { condition: acondition }); }, this); this.ParentWin = window.parent.opener; //初始化数据 this.InitData(); //绑定事件 this.gridListInspectCellEditing.on('beforeedit', function (editor, e) { return this.cellEditingInspectBeforeEdit(editor, e); }, this); this.gridListCellEditing.on('beforeedit', function (editor, e) { return this.cellEditingInspectBeforeEdit(editor, e); }, this); }, //end initUIComponents InitData: function () { this.opStatus = 'add'; this.FactryStatus = 'add'; var condition = ''; if (this.ParentWin) { var ret = this.ParentWin.OprationSwap(); this.opStatus = ret[0]; this.StoreList = ret[1]; this.editRecord = ret[2]; } if (this.opStatus == 'edit') condition = " c.GID='" + this.editRecord.get('GID') + "'"; this.LoadData(this.opStatus, condition); }, //end InitData LoadData: function (opstatus, condition) { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; this.opStatus = opstatus; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcContainer/MsCodeCtnTk/GetData', params: { handle: opstatus, condition: condition }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }); return; } var data = result.data; this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); if (this.opStatus == 'add') { //this.editRecord.set('INSPECTLOCKSTATUS', false); //this.editRecord.set('INSURANCELOCKSTATUS', false); } if (this.opStatus == 'edit') { var acondition = " BSNO='" + this.editRecord.get('GID') + "'"; _this.Loading = true; _this.storeDocList.load({ params: { condition: acondition }, waitMsg: "正在查询数据...", scope: this, callback: function () { _this.Loading = false; } }); acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; this.storeInspectList.load({ params: { condition: acondition} }); this.storeInsuranceList.load({ params: { condition: acondition} }); this.storeBodyList.load({ params: { condition: acondition} }); var bcondition = " LINKGID in (select GID from op_ctnbscard where CTNNO='" + this.editRecord.get('CTNNO') + "')"; this.storeListRepair.load({ params: { condition: bcondition} }); this.storeListRepairImg.load({ params: { condition: bcondition} }); this.storeListClearing.load({ params: { condition: bcondition} }); } this.OnLockInspect(isTrue( this.editRecord.get('INSPECTLOCKSTATUS'))); this.OnLockInsurance(isTrue(this.editRecord.get('INSURANCELOCKSTATUS'))); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); var _r1 = CheckAuthority('range_CTNTK_INSPECT'); if (isTrue(_r1)) { this.SetINSPECCanLock(true); } else { this.SetINSPECCanLock(false); } var _r2 = CheckAuthority('range_CTNTK_INSURANCE'); if (isTrue(_r2)) { this.SetINSURANCECanLock(true); } else { this.SetINSURANCECanLock(false); } }, // end LoadDate Save: function (type) { var basicForm = this.formEdit.getForm(); if (!basicForm.isValid()) { return; } basicForm.findField('GID').setDisabled(false); var data = basicForm.getValues(); basicForm.findField('GID').setDisabled(true); if (this.opStatus == 'add') { data.GID = NewGuid(); } var bodydatas = []; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); bodydatas.push(member); } var jsonBody = ConvertRecordsToJsonAll(bodydatas); var bodydatasInspect = []; for (var j = 0; j < this.storeInspectList.getCount(); j += 1) { var memberyf = this.storeInspectList.getAt(j); var DEPOTDATE = memberyf.data.DEPOTDATE; var INSPECTDATE = memberyf.data.INSPECTDATE; if (DEPOTDATE != '') DEPOTDATE = Ext.util.Format.date(DEPOTDATE, 'Y-m-d'); if (INSPECTDATE != '') INSPECTDATE = Ext.util.Format.date(INSPECTDATE, 'Y-m-d'); memberyf.data.DEPOTDATE = DEPOTDATE; memberyf.data.INSPECTDATE = INSPECTDATE; bodydatasInspect.push(memberyf); }; var jsonBodyInspect = ConvertRecordsToJsonAll(bodydatasInspect); var bodydatasInsurance = []; for (var j = 0; j < this.storeInsuranceList.getCount(); j += 1) { var memberyf = this.storeInsuranceList.getAt(j); var BEGINDATE = memberyf.data.BEGINDATE; var ENDDATE = memberyf.data.ENDDATE; if (BEGINDATE != '') BEGINDATE = Ext.util.Format.date(BEGINDATE, 'Y-m-d'); if (ENDDATE != '') ENDDATE = Ext.util.Format.date(ENDDATE, 'Y-m-d'); memberyf.data.BEGINDATE = BEGINDATE; memberyf.data.ENDDATE = ENDDATE; bodydatasInsurance.push(memberyf); }; var jsonBodyInsurance = ConvertRecordsToJsonAll(bodydatasInsurance); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcContainer/MsCodeCtnTk/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), body: jsonBody, Inspectbody: jsonBodyInspect, Insurancebody: jsonBodyInsurance }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var returnData = jsonresult.Data; this.formEdit.getForm().setValues(returnData); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { var editp = Ext.create('MsCodeCtnTk', returnData); this.editRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editRecord.set(name, editp.get(name)); } }, this); this.editRecord.commit(); } if (type == '0') { this.opStatus = 'edit'; basicForm.findField('GID').setDisabled(true); for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); memberbody.set("LINKGID", this.editRecord.get('GID')); memberbody.commit(); }; for (var j = 0; j < this.storeInspectList.getCount(); j += 1) { var memberbody = this.storeInspectList.getAt(j); memberbody.set("LINKGID", this.editRecord.get('GID')); memberbody.commit(); }; for (var j = 0; j < this.storeInsuranceList.getCount(); j += 1) { var memberbody = this.storeInsuranceList.getAt(j); memberbody.set("LINKGID", this.editRecord.get('GID')); memberbody.commit(); }; } else if (type == '1') { for (var j = 0; j < this.storeBodyList.getCount(); j += 1) { var memberbody = this.storeBodyList.getAt(j); memberbody.set("LINKGID", this.editRecord.get('GID')); memberbody.commit(); }; for (var j = 0; j < this.storeInspectList.getCount(); j += 1) { var memberbody = this.storeInspectList.getAt(j); memberbody.set("LINKGID", this.editRecord.get('GID')); memberbody.commit(); }; for (var j = 0; j < this.storeInsuranceList.getCount(); j += 1) { var memberbody = this.storeInsuranceList.getAt(j); memberbody.set("LINKGID", this.editRecord.get('GID')); memberbody.commit(); }; window.close(); } else { this.LoadData('add', ''); basicForm.findField('GID').setDisabled(false); } } 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 gridListAfterEdit: function (editor, e, eOpts) { if (e.value == e.originalValue) return; if (e.field == 'LANEGID') { var selectrecords = DsStoreQueryBy(this.storeLANE, 'GID', e.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; e.record.set('LANE', selectdata.LANE); } else { e.record.set('LANE', ''); } } }, addDetail: function () { var MSDSID = this.formEdit.getForm().findField('GID').getValue(); //var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo); var record = Ext.create('MsCodeCtnTkNoLaneItems', { GID: NewGuid(), LINKGID: '*', LANEGID: '', LANE: '', REMARKS: '' }); this.storeBodyList.add(record); var n = this.storeBodyList.getCount(); this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 }); }, addInspect: function () { var MSDSID = this.formEdit.getForm().findField('GID').getValue(); var record = Ext.create('MsCodeCtnTkInspect', { GID: NewGuid(), LINKGID: '*', DEPOT: '', CYCLE: '0', DEPOTAMOUNT: '0', INSPECTAMOUNT: '0' }); this.storeInspectList.add(record); var n = this.storeInspectList.getCount(); this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 }); }, onDelInspectClick: function () { var selections = this.gridListInspectItems.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (rec.data.ISLOCKREF == '未锁定') { bodyAddDatas.push(rec); } else { Ext.Msg.show({ title: '提示', msg: '已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } } Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcContainer/MsCodeCtnTk/DeleteCodeCtnTkInspectItems', params: { data: jsonbodyAddDatas }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; this.storeInspectList.load({ params: { condition: acondition} }); 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); }, onLockInspectClick: function (islock) { var selections = this.gridListInspectItems.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var lockstr = '锁定'; var record = selections[0]; var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (islock == 1) { if (rec.data.ISLOCKREF == '未锁定') { bodyAddDatas.push(rec); } } else { lockstr = '取消锁定'; if (rec.data.ISLOCKREF == '锁定') { bodyAddDatas.push(rec); } } } Ext.MessageBox.confirm('提示', '确定' + lockstr+'该记录吗?', function (btn) { if (btn == 'yes') { var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在' + lockstr +'数据...'); Ext.Ajax.request({ waitMsg: '正在' + lockstr +'数据...', url: '/MvcContainer/MsCodeCtnTk/LockCodeCtnTkINSPECTItems', params: { data: jsonbodyAddDatas, islock: islock }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; this.storeInspectList.load({ params: { condition: acondition } }); 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); }, onImportInspectClick: function () { var GID = this.formEdit.getForm().findField('GID').getValue(); var condition = " LINKGID='" + GID + "'"; me = this; var imgform = new Ext.FormPanel({ region: 'center', labelWidth: 20, frame: true, autoScroll: false, border: false, fileUpload: true, items: [{ xtype: 'fileuploadfield', id: 'LoadExcel', name: 'LoadExcel', emptyText: '请选择EXCEL文件', fieldLabel: 'EXCEL', buttonText: '选择文件', allowBlank: false, width: 200, buttonCfg: { iconCls: 'uploaddialog' }, anchor: '98%' }], buttons: [{ text: '上传', type: 'submit', handler: function () { var UserFilePath = Ext.getCmp('LoadExcel').getValue(); if (!CheckFileExt(UserFilePath, /.xls|.xlsx/i)) { Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为EXCEL文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } if (!imgform.form.isValid()) { return; } imgform.form.submit({ url: '/MvcContainer/MsCodeCtnTk/ImportCtnTkInspect', waitMsg: '正在上传', method: 'POST', params: { bsno: GID }, success: function (form, action) { win.close(this); Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); me.storeInspectList.load({ params: { condition: condition} }); }, failure: function (form, action) { form.reset(); if (action.failureType == Ext.form.Action.SERVER_INVALID) Ext.MessageBox.alert('警告', action.result.errors.msg); } }); } }, { text: '关闭', type: 'submit', handler: function () { win.close(this); } }] }); var win = new Ext.Window({ title: "上传EXCEL", width: 380, height: 120, modal: true, resizable: false, border: false, items: imgform }); win.show(); return; }, addInsurance: function () { var MSDSID = this.formEdit.getForm().findField('GID').getValue(); var record = Ext.create('MsCodeCtnTkInsurance', { GID: NewGuid(), LINKGID: '*', CORPSNAME: '' }); this.storeInsuranceList.add(record); var n = this.storeInsuranceList.getCount(); this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 }); }, onDelInsuranceClick: function () { var selections = this.gridListInsuranceItems.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (rec.data.ISLOCKREF == '未锁定') { bodyAddDatas.push(rec); } else { Ext.Msg.show({ title:'提示', msg:'已锁定,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK }); return; } } Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) { if (btn == 'yes') { var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcContainer/MsCodeCtnTk/DeleteCodeCtnTkInsuranceItems', params: { data: jsonbodyAddDatas }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; this.storeInsuranceList.load({ params: { condition: acondition} }); 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); }, onLockInsuranceClick: function (islock) { var selections = this.gridListInsuranceItems.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要锁定的信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var lockstr = '锁定'; var record = selections[0]; var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; if (islock == 1) { if (rec.data.ISLOCKREF == '未锁定') { bodyAddDatas.push(rec); } } else { lockstr = '取消锁定'; if (rec.data.ISLOCKREF == '锁定') { bodyAddDatas.push(rec); } } } Ext.MessageBox.confirm('提示', '确定' + lockstr+'该记录吗?', function (btn) { if (btn == 'yes') { var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在' + lockstr +'数据...'); Ext.Ajax.request({ waitMsg: '正在' + lockstr +'数据...', url: '/MvcContainer/MsCodeCtnTk/LockCodeCtnTkInsuranceItems', params: { data: jsonbodyAddDatas, islock: islock }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeInsuranceList.reload(); 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); }, onImportInsuranceClick: function () { var GID = this.formEdit.getForm().findField('GID').getValue(); var condition = " LINKGID='" + GID + "'"; me = this; var imgform = new Ext.FormPanel({ region: 'center', labelWidth: 20, frame: true, autoScroll: false, border: false, fileUpload: true, items: [{ xtype: 'fileuploadfield', id: 'LoadExcel', name: 'LoadExcel', emptyText: '请选择EXCEL文件', fieldLabel: 'EXCEL', buttonText: '选择文件', allowBlank: false, width: 200, buttonCfg: { iconCls: 'uploaddialog' }, anchor: '98%' }], buttons: [{ text: '上传', type: 'submit', handler: function () { var UserFilePath = Ext.getCmp('LoadExcel').getValue(); if (!CheckFileExt(UserFilePath, /.xls|.xlsx/i)) { Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为EXCEL文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } if (!imgform.form.isValid()) { return; } imgform.form.submit({ url: '/MvcContainer/MsCodeCtnTk/ImportCtnTkInsurance', waitMsg: '正在上传', method: 'POST', params: { bsno: GID }, success: function (form, action) { win.close(this); Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); me.storeInsuranceList.load({ params: { condition: condition} }); }, failure: function (form, action) { form.reset(); if (action.failureType == Ext.form.Action.SERVER_INVALID) Ext.MessageBox.alert('警告', action.result.errors.msg); } }); } }, { text: '关闭', type: 'submit', handler: function () { win.close(this); } }] }); var win = new Ext.Window({ title: "上传EXCEL", width: 380, height: 120, modal: true, resizable: false, border: false, items: imgform }); win.show(); return; }, //#region 上传图片 cellEditingInspectBeforeEdit: function (editor, e) { var ISLOCKREF = e.record.get('ISLOCKREF'); if (ISLOCKREF == '锁定') { Ext.Msg.show({ title:'提示', msg:'已锁定无法修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//当前费用已対帐无法修改! return false; } }, onDelFileClick: function (button, event) { var feeGidSql = ''; var selectedRecords = []; selectedRecords = this.DocCM.selected.items; if (selectedRecords.length == 0) { Ext.Msg.show({ title: '提示', msg: '请先选择要删除的附件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } Ext.MessageBox.confirm('提示', '确定要删除选中的附件吗?', function (btn) { if (btn == 'yes') { if (selectedRecords.length > 0) { for (var i = 0; i < selectedRecords.length; i++) { var rec = selectedRecords[i]; if (rec.data.GID == "*") //如果是新增但没有保存的数据,没有必要提交到后台 { this.storeDocList.remove(selectedRecords[i]); } else { var feeGId = "'" + rec.data.GID + "'"; if (feeGidSql == '') { feeGidSql = feeGId; } else { feeGidSql = feeGidSql + "," + feeGId; } } } } _this = this; Ext.Msg.wait('正在删除数据...'); if (feeGidSql != '') { Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcShipping/MsOpReceipt/DeleteUploadFile', params: { data: feeGidSql }, callback: function (options, success, response) { if (success) { var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { for (var i = 0; i < selectedRecords.length; i++) { this.storeDocList.remove(selectedRecords[i]); } 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 } else { Ext.Msg.show({ title: '提示', msg: "删除成功!", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); } } }, this); } , onUpLoadFileClick: function (button, event) { var billno = this.editRecord.get("GID"); var custno = this.editRecord.get("CTNNO"); me = this; var imgform = new Ext.FormPanel({ region: 'center', labelWidth: 40, frame: true, bodyStyle: 'padding:5px 5px 0', autoScroll: true, border: false, fileUpload: true, items: [{ xtype: 'fileuploadfield', id: 'LoadFile', name: 'LoadFile', emptyText: '请选择文件', fieldLabel: '文件', buttonText: '选择文件', allowBlank: false, buttonCfg: { iconCls: 'uploaddialog' }, anchor: '98%' }], buttons: [{ text: '上传', type: 'submit', handler: function () { var UserFilePath = Ext.getCmp('LoadFile').getValue(); // if (!CheckFileExt(UserFilePath, /.jpg|.gif|.png|.bmp|.pdf/i)) { // Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为图片文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } if (!imgform.form.isValid()) { return; } imgform.form.submit({ url: '/MvcShipping/MsOpReceipt/UploadFile', waitMsg: '正在上传', method: 'POST', submitEmptyText: false, async: false, params: { CUSTNO: custno, BSNO: billno }, success: function (form, action) { win.close(this); Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); var condition = billno; var condition2 = " BSNO='" + condition + "' "; me.Loading = true; me.storeDocList.load({ params: { condition: condition2 }, waitMsg: "正在查询数据...", scope: this, callback: function () { me.Loading = false; } }); }, failure: function (form, action) { form.reset(); if (action.failureType == Ext.form.Action.SERVER_INVALID) Ext.MessageBox.alert('警告', action.result.errors.msg); } }); } }, { text: '关闭', type: 'submit', handler: function () { win.close(this); } }] }); var win = new Ext.Window({ title: "上传文件", width: 360, height: 120, modal: true, resizable: false, border: false, items: imgform }); win.show(); } , //#endregion PrevRecord: function () { var modifystr = this.getIsModify(); if (modifystr != "") { Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var j = this.StoreList.indexOf(this.editRecord); if (j == 0) { Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } if (j == this.StoreList.count) { Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var condition = ''; j = j - 1; this.editRecord = this.StoreList.getAt(j); if (this.opStatus == 'edit') { condition = "c.GID='" + this.editRecord.get('GID') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.LoadData(this.opStatus, condition); }, NextRecord: function () { var modifystr = this.getIsModify(); if (modifystr != "") { Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var j = this.StoreList.indexOf(this.editRecord); if (j == (this.StoreList.data.length - 1)) { Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); return; } var condition = ''; j = j + 1; this.editRecord = this.StoreList.getAt(j); if (this.opStatus == 'edit') { condition = "c.GID='" + this.editRecord.get('GID') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.LoadData(this.opStatus, condition); }, getIsModify: function () { if (panelEdit.formEdit.getForm().isDirty() == true) { return '罐箱信息'; } else return ''; } // , //锁定年检信息 OnLockInspect: function (lock) { var basicForm = this.formEdit.getForm(); var field = basicForm.findField('INSPECTLOCKSTATUS'); field.setValue(lock); lockbtn = Ext.getCmp("btnlockInspect"); unlockbtn = Ext.getCmp("btnunlockInspect"); btnaddInspect = Ext.getCmp("btnaddInspect"); btndelInspect = Ext.getCmp("btndelInspect"); btnInspectExcel = Ext.getCmp("btnInspectExcel"); this.editRecord.set('INSPECTLOCKSTATUS', lock); //this.InspectCanEdit = !lock; //if (!lock) { // lockbtn.enable(); // unlockbtn.disable(); // btnaddInspect.enable(); // btndelInspect.enable(); // btnInspectExcel.enable(); //} //if (lock) { // lockbtn.disable(); // unlockbtn.enable(); // btnaddInspect.disable(); // btndelInspect.disable(); // btnInspectExcel.disable(); //} } // , SetINSPECCanLock: function (show) { lockbtn = Ext.getCmp("btnlockInspect"); unlockbtn = Ext.getCmp("btnunlockInspect"); if (isTrue(show)) { lockbtn.show(); unlockbtn.show(); } else{ lockbtn.hide(); unlockbtn.hide(); } } , //锁定保险信息 OnLockInsurance: function (lock) { var basicForm = this.formEdit.getForm(); var field = basicForm.findField('INSURANCELOCKSTATUS'); field.setValue(lock); lockbtn = Ext.getCmp("btnlockInsurance"); unlockbtn = Ext.getCmp("btnunlockInsurance"); btnaddInsurance = Ext.getCmp("btnaddInsurance"); btndelInsurance = Ext.getCmp("btndelInsurance"); this.editRecord.set('INSURANCELOCKSTATUS', lock); //this.InsuranceCanEdit = !lock; //if (!lock) { // lockbtn.enable(); // unlockbtn.disable(); // btnaddInsurance.enable(); // btndelInsurance.enable(); //} //if (lock) { // lockbtn.disable(); // unlockbtn.enable(); // btnaddInsurance.disable(); // btndelInsurance.disable(); //} } // , SetINSURANCECanLock: function (show) { lockbtn = Ext.getCmp("btnlockInsurance"); unlockbtn = Ext.getCmp("btnunlockInsurance"); if (isTrue(show)) { lockbtn.show(); unlockbtn.show(); } else { lockbtn.hide(); unlockbtn.hide(); } } });