Ext.namespace('Shipping'); Shipping.MsOpCtnApplyGoodsAuditEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsOpCtnApplyGoodsAuditEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsOpCtnApplyGoodsAuditEdit, Ext.Panel, { ParentWin: null, OpStatus: 'add', StoreList: null, editRecord: null, editFactryRecord: null, FactryStatus: 'add', initUIComponents: function () { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; //#region 编辑form //枚举参照相关(编辑form) //权限范围 this.storeListGood = Ext.create('Ext.data.Store', { model: 'MsCodeMSDS', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsCodeMSDS/GetData', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.storeListGood.load({ params: { handle: 'edit', condition: ""} }); //表参照相关(编辑form) this.formGoodsAudit = Ext.widget('form', { region: 'north', title: '适货审核', region: 'north', frame: true, bodyPadding: 5, autoScroll: true, collapsed: false, collapsible: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'anchor', defaultType: 'textfield', items: [{ xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '货物是否与MSDS一致', inputValue: true, labelWidth: 180, xtype: 'checkboxfield', name: 'ISGOODSNAMESAME' }, { fieldLabel: '工厂其他产品', flex: 3, name: 'PRODUCTGOODSNAME' }, { fieldLabel: 'PH', readOnly: true, name: 'PH' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '密度', readOnly: true, name: 'DENSITY' }, { fieldLabel: 'UN', readOnly: true, name: 'UNNO' }, { fieldLabel: '危险品等级', readOnly: true, name: 'DCLASS' }, { fieldLabel: '副危险品等级', readOnly: true, name: 'SDCLASS' }, { fieldLabel: 'PACKING GROUP', labelWidth: 110, readOnly: true, name: 'PACKINGGROUP' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '是否海洋污染物', inputValue: true, readOnly: true, xtype: 'checkboxfield', name: 'ISPOLLUTEOCEAN' }, { fieldLabel: '是否存在危险', inputValue: true, readOnly: true, xtype: 'checkboxfield', name: 'ISDANGEROUS' }, { fieldLabel: '熔点', readOnly: true, name: 'MELTINGPOINT' }, { fieldLabel: '沸点', readOnly: true, name: 'BOILINGPOINT' }, { fieldLabel: '闪点', readOnly: true, name: 'FLASHPOINT' }, { fieldLabel: 'IMDG', readOnly: true, name: 'IMDG' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '提交时间', readOnly: true, name: 'SUBMITTIME' }, { fieldLabel: '审核状态', readOnly: true, name: 'AUDITSTATUS' }, { fieldLabel: '审核人', readOnly: true, name: 'AUDITBYREF' }, { fieldLabel: '审核时间', readOnly: true, name: 'AUDITTIME' }, { fieldLabel: '审核反馈', flex: 2, name: 'AUDITRESULT' }] }]//end items(fieldset 1) }] }); //end this.formEdit this.formCostAudit = Ext.widget('form', { region: 'north', title: '成本核算及审批', region: 'north', frame: true, bodyPadding: 5, // autoScroll: true, trackResetOnLoad: true, collapsed: false, collapsible: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'anchor', defaultType: 'textfield', items: [{ xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '审核状态', readOnly: true, name: 'COSTAUDITSTATUS' }, { fieldLabel: '审核人', readOnly: true, name: 'COSTAUDITBYREF' }, { fieldLabel: '审核时间', readOnly: true, name: 'COSTAUDITTIME' }, { fieldLabel: '审核反馈', readOnly: true, flex: 2, name: 'COSTAUDITRESULT' }, { fieldLabel: 'OWNERCTN', name: 'OWNERCTN', flex: 0, hidden: true, margins: '0' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [] }]//end items(fieldset 1) }] }); //end this.formEdit //编辑form this.formEdit = Ext.widget('form', { region: 'center', frame: true, bodyPadding: 5, // height: 160, // autoScroll: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 90, msgTarget: 'qtip' }, items: [ {//fieldset 1 xtype: 'container',//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: 'INPUTBY', name: 'INPUTBY', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '申请编号', readOnly: true, allowBlank: true, name: 'BSNO' }, { fieldLabel: '申请日期', readOnly: true, name: 'BSDATE' }, { fieldLabel: '揽货人', readOnly: true, name: 'SALE' }, { fieldLabel: '操作', readOnly: true, name: 'OP' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '委托单位', readOnly: true, name: 'CUSTOMERNAME' }, { fieldLabel: '品名', readOnly: true, name: 'GOODSNAME', listeners: { 'render': function (_field, eOpts) {//自定义函数,定义双击事件 var _this = this; _field.getEl().on('dblclick', function (e, t, eOpts) { var openSet = "height=700, width=1224, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2 var openType = "_blank"; var openUrl = ""; openUrl = "../MsCodeMSDS/MsdsView?handle=check&goodsname=" + t.value; window.open(openUrl, openType, openSet); }); } } }, { fieldLabel: '货物类别', readOnly: true, name: 'GOODTYPE' }, { fieldLabel: '起运港', readOnly: true, name: 'PORTLOAD' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '目的港', readOnly: true, name: 'PORTDISCHARGE' }, { fieldLabel: '是否我司订舱', inputValue: true, readOnly: true, xtype: 'checkboxfield', name: 'ISOWNERBOOKING' }, { fieldLabel: '箱型', readOnly: true, name: 'CTNALL' }, { fieldLabel: '箱量', readOnly: true, name: 'CTNNUM' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [, { fieldLabel: '计划用箱日期', format: 'Y-m-d', readOnly: true, flex: 1, xtype: 'datefield', name: 'PLANCTNDATE' }, { fieldLabel: '工厂名称', readOnly: true, name: 'FACTORYNAME' }, { fieldLabel: '工厂地址', readOnly: true, name: 'FACTORYADDR' }, { fieldLabel: '申请状态', readOnly: true, name: 'BSSTATUS' }] }, { xtype: 'container', layout: 'hbox', flex: 1, defaultType: 'textfield', items: [{ fieldLabel: '起运港免箱使天数', readOnly: true, labelWidth: 110, name: 'SLOAD_FREE_USECTNE_DAY' }, { fieldLabel: '起运港超期箱使费', readOnly: true, labelWidth: 110, name: 'SLOAD_OVER_USECTNE_RATE' }, { fieldLabel: '目的港免箱使天数', readOnly: true, labelWidth: 110, name: 'SDEST_FREE_USECTNE_DAY' }, { fieldLabel: '目的港超期箱使费', readOnly: true, labelWidth: 110, name: 'SDEST_OVER_USECTNE_RATE' }, { fieldLabel: '目的港还箱堆场', readOnly: true, labelWidth: 110, name: 'DESTPORT_STATOIN' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '录入人', readOnly: true, disabled: true, name: 'INPUTBYREF' }, { fieldLabel: '录入日期', readOnly: true, disabled: true, name: 'INPUTTIME' },{ fieldLabel: '按进港日计算超期箱使', inputValue: true, labelWidth: 140, flex: 1, readOnly: true, xtype: 'checkboxfield', name: 'ISPORTLOADDATE' },{ fieldLabel: '运输条款', flex: 1, readOnly: true, name: 'SERVICE' }, { fieldLabel: '代理维护人', flex: 1, readOnly: true, name: 'AGENTINPUTBY' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [ { fieldLabel: '是否加热', flex: 1, readOnly: true, inputValue: true, xtype: 'checkboxfield', name: 'NEEDBEHEATED' }, { fieldLabel: '重量', flex: 1, readOnly: true, xtype: 'numberfield', allowDecimals: true, //允许输入小数 decimalPrecision: 3, name: 'WEIGHT' }, { fieldLabel: '预计开船日期', format: 'Y-m-d', allowBlank: true, flex: 1, readOnly: true, xtype: 'datefield', name: 'PREI_ETD' }, { fieldLabel: '空箱调拨', flex: 1, readOnly: true, inputValue: true, xtype: 'checkboxfield', name: 'EMPTYCTNALLOCATION' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '备注', readOnly: true, name: 'REMARKS' }] } ]//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", id: 'btnsave', handler: function (button, event) { this.SaveAuditGoods('0'); }, scope: this }, '-', { text: "审核通过", iconCls: "btnadd", id: 'btnAuditPass', handler: function (button, event) { this.onAuditGoodsPassClick(); }, scope: this }, '-', { text: "驳回提交", iconCls: "btndelete", id: 'btnAuditBack', handler: function (button, event) { this.onAuditGoodsBackClick(); }, scope: this } ] }); //end 按钮Toolbar //#endregion //#region 明细 this.storeBodyList = Ext.create('Ext.data.Store', { model: 'MsOpCtnApplySaleItems', remoteSort: true, proxy: { type: 'ajax', url: '/MvcContainer/MsOpCtnApply/GetCtnApplySaleItemsList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); //明细表表格 this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListBody = new Ext.grid.GridPanel({ store: this.storeBodyList, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCellEditing], selType: 'cellmodel', columns: [{ sortable: true, dataIndex: 'GID', header: '编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'LINKGID', header: '业务编号', hidden: true, width: 0 }, { sortable: true, dataIndex: 'ITEMSNO', header: '序号', renderer: Ext.util.Format.numberRenderer('00'), align: 'right', width: 60 }, { sortable: true, dataIndex: 'ITEMNAME', header: '项目名称', width: 140 }, { sortable: true, dataIndex: 'REMARK', header: '备注', width: 250 }] }); this.gridListBody.on('edit', function (editor, e, eOpts) { this.gridListAfterEdit(editor, e, eOpts); }, this); this.panelBody = new Ext.Panel({ title: '改装要求', layout: "border", region: 'east', width: 200, animate: true, // autoScroll: true, // containerScroll: true, frame: false, items: [this.gridListBody] }); this.panelEDIpage = new Ext.Panel({ title: '申请内容', layout: "border", region: 'north', animate: true, autoScroll: true, collapsed: false, collapsible: true, height: 250, // containerScroll: true, frame: false, items: [this.formEdit, this.panelBody] }); //#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', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.DocListCellEditing], selModel: this.DocCM, selType: 'cellmodel', 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, minHeight: 80, split: true, items: [this.gridDocList] }); //#endregion //#endregion this.panelBodyAll = new Ext.Panel({ layout: "border", region: 'center', animate: true, autoScroll: true, containerScroll: true, frame: false, items: [this.panelEDIpage, this.formGoodsAudit, this.formCostAudit, this.panelDoc, this.panelDoc] }); //#region 布局 //控件布局 // this.panelTop = new Ext.Panel({ // layout: "border", // region: "north", // height: 190, // items: [this.panelBtn, this.formEdit] // }); Ext.apply(this, { items: [this.panelBtn, this.panelBodyAll] }); //#endregion //绑定查询窗体 this.storeBodyList.on('beforeload', function (store) { var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; Ext.apply(store.proxy.extraParams, { condition: acondition }); }, this); this.ParentWin = window.parent.opener; //初始化数据 this.InitData(); //绑定事件 }, //end initUIComponents InitData: function () { this.opStatus = '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 = " 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/MsOpCtnApply/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); this.formGoodsAudit.getForm().reset(); this.formGoodsAudit.getForm().setValues(data); this.formCostAudit.getForm().reset(); this.formCostAudit.getForm().setValues(data); var acondition = ""; if (this.opStatus == 'edit') { var Xcondition = " BSNO='" + this.editRecord.get('GID') + "'"; _this.Loading = true; _this.storeDocList.load({ params: { condition: Xcondition }, waitMsg: "正在查询数据...", scope: this, callback: function () { _this.Loading = false; } }); acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; } else acondition = " LINKGID='11111'"; this.storeBodyList.load({ params: { condition: acondition} }); this.GetEditStatus(); this.LoadGoodsData("CHEMICALCGOODSNAME='" + data.GOODSNAME + "'"); document.title = MODULENAME + "-" + data.BSNO; } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, // end LoadDate LoadGoodsData: function (condition) { this.serialNo = 0; this.workSerialNo = 0; this.bodyDel = []; Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/MvcContainer/MsCodeMSDS/GetData', params: { handle: 'edit', 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.formGoodsAudit.getForm().reset(); this.formGoodsAudit.getForm().setValues(data); this.formGoodsAudit.getForm().findField('MELTINGPOINT').setValue(data.MELTINGPOINTB + '~' + data.MELTINGPOINTE); this.formGoodsAudit.getForm().findField('BOILINGPOINT').setValue(data.BOILINGPOINTB + '~' + data.BOILINGPOINTE); this.formGoodsAudit.getForm().findField('FLASHPOINT').setValue(data.FLASHPOINTB + '~' + data.FLASHPOINTE); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, // 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 j = 0; var bodydatas = []; for (var i = 0; i < this.storeBodyList.getCount(); i += 1) { var member = this.storeBodyList.getAt(i); j = j + 1; bodydatas.push(member); } if (j == 0) { Ext.Msg.show({ title: '提示', msg: '费用信息不能为空,请先录入费用信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } // var jsonBody = ConvertRecordsToJsonAll(bodydatas); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcContainer/MsOpCtnApply/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), body: jsonBody }, 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); this.formGoodsAudit.getForm().reset(); this.formGoodsAudit.getForm().setValues(returnData); this.formCostAudit.getForm().reset(); this.formCostAudit.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('MsOpCtnApply', 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(); }; } else if (type == '1') { 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(); }; 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 addDetail: function () { // if (this.opStatus == "add") { // Ext.Msg.show({ title: '提示', msg: '商品信息未保存,无法添加工厂信息!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } var MSDSID = this.formEdit.getForm().findField('GID').getValue(); var SerialNo = this.GetHandleSerialNo(this.storeBodyList); //var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo); var record = Ext.create('MsOpCtnApplySaleItems', { GID: NewGuid(), LINKGID: '*', ITEMSNO: SerialNo, ITEMNAME: '', REMARKS: '' }); this.storeBodyList.add(record); var n = this.storeBodyList.getCount(); this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 1 }); }, GetHandleSerialNo: function (store) { var result = 0; if (result == 0) { for (var i = 0; i < store.getCount(); i += 1) { var member = store.getAt(i); if (parseInt(member.data.ITEMSNO) > parseInt(result)) { result = member.data.ITEMSNO; } } } result = parseInt(result) + 1; return result; }, gridListAfterEdit: function (editor, e, eOpts) { if (e.value == e.originalValue) return; if (e.field == 'REJECTID') { } }, onDeletePriceItemsClick: function () { var selections = this.gridListBody.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') { var bodyAddDatas = []; for (var i = 0; i < selections.length; i++) { var rec = selections[i]; bodyAddDatas.push(rec); } var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas); Ext.Msg.wait('正在删除数据...'); Ext.Ajax.request({ waitMsg: '正在删除数据...', url: '/MvcContainer/MsOpCtnApply/DeleteOpCtnApplySaleItems', 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.storeBodyList.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); }, SaveAuditGoods: function () { var Duino = this.formEdit.getForm().findField('BSNO').getValue(); var GID = this.formEdit.getForm().findField('GID').getValue(); var basicForm = this.formEdit.getForm(); basicForm.findField('GID').setDisabled(false); var data = basicForm.getValues(false, false, false); basicForm.findField('GID').setDisabled(true); var data2 = this.formGoodsAudit.getForm().getValues(false, false, false); _this = this; Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/MvcContainer/MsOpCtnApply/SaveAuditGoods', params: { data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2) }, 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; } else { this.LoadData('edit', " GID='" + GID + "'"); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, onAuditGoodsPassClick: function () { var Duino = this.formEdit.getForm().findField('BSNO').getValue(); var GID = this.formEdit.getForm().findField('GID').getValue(); var billstatus = this.formGoodsAudit.getForm().findField('AUDITSTATUS').getValue(); if (billstatus != '提交审核') { Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var basicForm = this.formEdit.getForm(); basicForm.findField('GID').setDisabled(false); var data = basicForm.getValues(false, false, false); basicForm.findField('GID').setDisabled(true); var data2 = this.formGoodsAudit.getForm().getValues(false, false, false); _this = this; Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/MvcContainer/MsOpCtnApply/AuditGoodsPass', params: { data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2) }, 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; } else { this.LoadData('edit', " GID='" + GID + "'"); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, onAuditGoodsBackClick: function () { var Duino = this.formEdit.getForm().findField('BSNO').getValue(); var GID = this.formEdit.getForm().findField('GID').getValue(); var billstatus = this.formGoodsAudit.getForm().findField('AUDITSTATUS').getValue(); if (Duino == '*') { Ext.Msg.show({ title: '提示', msg: '请先保存申请,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; }; var AUDITRESULT = this.formGoodsAudit.getForm().findField('AUDITRESULT').getValue(); if (AUDITRESULT == '') { Ext.Msg.show({ title: '提示', msg: '驳回提交时,请把驳回原因录入审核反馈中!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } _this = this; var basicForm = this.formEdit.getForm(); basicForm.findField('GID').setDisabled(false); var data = basicForm.getValues(false, false, false); basicForm.findField('GID').setDisabled(true); var data2 = this.formGoodsAudit.getForm().getValues(false, false, false); Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/MvcContainer/MsOpCtnApply/AuditGoodsBack', params: { data: Ext.JSON.encode(data), data2: Ext.JSON.encode(data2) }, 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; } else { this.LoadData('edit', " GID='" + GID + "'"); } } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); }, 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 = "GID='" + this.editRecord.get('GID') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.LoadData(this.opStatus, condition); }, // #region 编辑时按钮等的状态 GetEditStatus: function () { var canedit = false; var op = this.formEdit.getForm().findField('INPUTBY').getValue(); var modustr = "modOpCtnApply"; this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', { model: 'MsOP', proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' } }); _this = this; this.StoreOpRange.load({ params: { optype: modustr }, callback: function (r, options, success) { if (success) { if (r.length != 0) { var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op); if (records.getCount() > 0) { canedit = true; } else { canedit = false; } } else { canedit = false; } _this.setSaveBtnStatus(canedit); } } }); }, setSaveBtnStatus: function (enable) { var btnAuditPass = Ext.getCmp('btnAuditPass'); var btnAuditBack = Ext.getCmp('btnAuditBack'); if (enable) { btnAuditPass.enable(); btnAuditBack.enable(); } else { btnAuditPass.disable(); btnAuditBack.disable(); } }, //#endregion 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 = "GID='" + this.editRecord.get('GID') + "'"; //this.storeBodyList.load({ params: { condition: condition} }); } this.LoadData(this.opStatus, condition); }, getIsModify: function () { var drmodify = this.storeBodyList.getModifiedRecords(); if (drmodify.length != 0) return '改装要求'; if (panelEdit.formEdit.getForm().isDirty() == true) return '申请信息'; else return ''; } // });