Ext.namespace('Shipping'); Shipping.MsSoftRequireEdit = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsSoftRequireEdit.superclass.constructor.call(this); }; Ext.extend(Shipping.MsSoftRequireEdit, 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.storeSOFTVER = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeSOFTVER.load({ params: { enumTypeId: 81001} }); this.comboxSOFTVER = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '软件版本', store: this.storeSOFTVER, forceSelection: true, name: 'SOFTVER' }); this.storeMODULENAME = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeMODULENAME.load({ params: { enumTypeId: 81002} }); this.comboxMODULENAME = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '模块名称', store: this.storeMODULENAME, forceSelection: true, name: 'MODULENAME' }); this.StoreBLNUM = Ext.create('Ext.data.Store', { fields: ['NUM'] }); this.StoreBLNUM.add({ "NUM": "0" }); this.StoreBLNUM.add({ "NUM": "1" }); this.StoreBLNUM.add({ "NUM": "2" }); this.StoreBLNUM.add({ "NUM": "3" }); this.StoreBLNUM.add({ "NUM": "4" }); this.StoreBLNUM.add({ "NUM": "5" }); this.StoreBLNUM.add({ "NUM": "6" }); this.StoreBLNUM.add({ "NUM": "7" }); this.StoreBLNUM.add({ "NUM": "8" }); this.StoreBLNUM.add({ "NUM": "9" }); this.comboxBLNUM = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '重要等级', store: this.StoreBLNUM, flex: 0.4, labelWidth: 60, forceSelection: true, name: 'EMERGENCYCLASS', valueField: 'NUM', displayField: 'NUM' }); this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.CustomRefModel', proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' } }); this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} }); this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '客户名称', store: this.storeCustCode, forceSelection: true, queryMode: 'remote', minChars: 1, queryParam: 'CODENAME', lazyRender: false, name: 'CUSTOMERNAME', valueField: 'CustName', displayField: 'CodeAndName' }); this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' } }); this.storeOpCode.load(); this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '程序修改人', store: this.storeOpCode, forceSelection: true, name: 'MODIFYBY', valueField: 'GID', displayField: 'CodeAndName' }); this.storeSaleCode = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserRefModel', proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' } }); this.storeSaleCode.load(); this.comboxSALE = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '销售', store: this.storeSaleCode, forceSelection: true, name: 'SALE', valueField: 'GID', displayField: 'CodeAndName' }); this.storeProject = Ext.create('DsExt.ux.RefTableStore', { model: 'MsSoftProject', proxy: { url: '/SoftMng/MsSoftRequire/GetSoftProject' } }); this.storeProject.load({ params: { condition: ""} }); this.comboxProject = Ext.create('DsExt.ux.RefTableCombox', { fieldLabel: '项目名称', store: this.storeProject, forceSelection: true, name: 'PROJECTID', valueField: 'GID', displayField: 'PROJECTNAME' }); this.storeREQUIRETYPE = Ext.create('DsExt.ux.RefEnumStore', {}); this.storeREQUIRETYPE.load({ params: { enumTypeId: 81003} }); this.comboxREQUIRETYPE = Ext.create('DsExt.ux.RefEnumCombox', { fieldLabel: '修改类型', flex: 0.6, store: this.storeREQUIRETYPE, forceSelection: true, name: 'REQUIRETYPE' }); //表参照相关(编辑form) //#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", id: 'btnEDelDoc', handler: function (button, event) { this.onDelFileClick(button, event); }, scope: this }, '-', { text: '上传附件', tooltip: '上传附件', iconCls: "btnadddetail", id: 'btnEAddDoc', 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 }, { xtype: 'actioncolumn', width: 50, text: '图片预览', //操作 items: [{ icon: '/images/icons/btnSearch.gif', // Use a URL in the icon config tooltip: '预览', handler: function (grid, rowIndex, colIndex) { var rec = grid.getStore().getAt(rowIndex); var filePath = rec.get('Driect_URL') + '?a=' + Math.random(); var imgView = new Shipping.FileView({ filePath: filePath }); imgView.show(); } }] }, { 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: "north", height: 150, flex: 1.5, title: '需求附件', //autoScroll: true, frame: false, split: true, items: [this.gridDocList] }); //#endregion //编辑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: 'INPUTBY', name: 'INPUTBY', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'AUDITBY', name: 'AUDITBY', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'OVERBY', name: 'OVERBY', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '需求编号', allowBlank: true, readOnly: true, flex: 1, name: 'BSNO' }, { fieldLabel: '状态', readOnly: true, name: 'BSSTATUS' }, { fieldLabel: '销售审核状态', readOnly: true, name: 'SALESTATUS' }, this.comboxProject, { fieldLabel: '录入人', flex: 1, readOnly: true, name: 'INPUTBYREF' }, { fieldLabel: '录入时间', flex: 1, readOnly: true, name: 'INPUTTIME' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxCustCode, this.comboxSALE,{ fieldLabel: '客户要求日期', format: 'Y-m-d', flex: 1, xtype: 'datefield', name: 'CUSTDATE' }, this.comboxSOFTVER, this.comboxMODULENAME, this.comboxREQUIRETYPE, this.comboxBLNUM ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'textareafield', grow: true, flex: 3.5, fieldLabel: '需求详细描述', height: 150, name: 'REQUIREDETAIL', anchor: '100%' }, this.panelDoc] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: '销售审核时间', flex: 1, readOnly: true, name: 'SALEAUDITTIME' },{ fieldLabel: '审核人', flex: 1, readOnly: true, name: 'AUDITBYREF' }, { fieldLabel: '审核时间', flex: 1, readOnly: true, name: 'AUDITTIME' }, this.comboxCUSTSERVICE, { fieldLabel: '确认修改时间', flex: 1, readOnly: true, name: 'MODIFYSTTIME' }, { fieldLabel: '修改完成时间', flex: 1, readOnly: true, name: 'MODIFYEDTIME' }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'textareafield', grow: true, flex: 2, fieldLabel: '审核意见', height: 100, name: 'AUDITRESULT', anchor: '100%' }, { xtype: 'textareafield', grow: true, flex: 3, fieldLabel: '修改描述', height: 100, name: 'MODIFYDETAIL', 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: [ { text: "保存", iconCls: "btnsave", id: "btnESave", handler: function (button, event) { this.Save('0'); }, scope: this }, { text: "保存并关闭", id: "btnESaveAndClose", handler: function (button, event) { this.Save('1'); }, scope: this }, '-', { text: "保存并新建", id: "btnESaveAndNew", handler: function (button, event) { this.Save('2'); }, scope: this }, '-', { text: "提交审核", id: "btnSubmitAudit", handler: function (button, event) { _this.onSubmitAuditClick(1); }, scope: this }, '-', { text: "撤销提交", id: "btnSubmitAuditBack", handler: function (button, event) { _this.onSubmitAuditClick(0); }, scope: this }, '-', { text: "销售审核", id: "btnSaleAudit", handler: function (button, event) { _this.onSaleAuditClick(1); }, scope: this }, '-', { text: "销售驳回", id: "btnSaleAuditBack", handler: function (button, event) { _this.onSaleAuditClick(0); }, scope: this }, '-', { text: "审核通过", id: "btnAudit", handler: function (button, event) { _this.onAuditClick(1); }, scope: this }, '-', { text: "驳回审核", id: "btnAuditBack", handler: function (button, event) { _this.onAuditClick(0); }, scope: this }, '-', { text: '修 改', tooltip: '修 改', id: 'btnModify', menu: [ { text: "确认修改", handler: function (menu, event) { _this.onModifyClick(1); } }, { text: "撤销修改", handler: function (menu, event) { _this.onModifyClick(0); } }, { text: "修改完成", handler: function (menu, event) { _this.onModifyClick(2); } }], scope: this }, '-', { text: '确 认', tooltip: '确 认', id: 'btnOver', menu: [ { text: "确认完成", handler: function (menu, event) { _this.onOverClick(1); } }, { text: "撤销确认", handler: function (menu, event) { _this.onOverClick(0); } }], scope: this } ] }); //end 按钮Toolbar //#endregion this.storeListDetail = Ext.create('Ext.data.Store', { model: 'MsSoftRequireDetail', remoteSort: true, proxy: { type: 'ajax', url: '/SoftMng/MsSoftRequire/GetDetailList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.girdcolums = [{ sortable: true, hidden: true, dataIndex: 'GID', header: 'GID', width: 80 }, { sortable: true, hidden: true, dataIndex: 'LINKGID', header: 'LINKGID', width: 80 }, { sortable: true, dataIndex: 'MODIFYTIME', header: '提交时间', width: 150 }, { sortable: true, dataIndex: 'MODIFYFILE', header: '文件名及路径', width: 150 }, { sortable: true, dataIndex: 'MODIFYDETAIL', header: '修改详细描述', width: 250 } ]; //定义Grid this.gridListDetail = new Ext.grid.GridPanel({ store: this.storeListDetail, enableHdMenu: false, region: 'west', width: 500, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, columns: this.girdcolums, bbar: Ext.create('Ext.PagingToolbar', { store: this.storeListDetail, displayInfo: true, displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录', emptyMsg: "没有数据" }) }); _this = this; this.gridListDetail.addListener('itemclick', function (dataview, record, item, index, e, b) { _this.editFactryRecord = record; _this.FactryStatus = 'edit'; _this.LoadDetailData("edit", "GID='" + record.data.GID + "'"); }, this); //编辑form this.formDetail = 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: 'LINKGID', name: 'LINKGID', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'INPUTBY', name: 'INPUTBY', flex: 0, hidden: true, margins: '0' }, { fieldLabel: 'INPUTTIME', name: 'INPUTTIME', flex: 0, hidden: true, margins: '0' }, { fieldLabel: '文件名及路径', flex: 2, name: 'MODIFYFILE' } , { fieldLabel: '提交时间', format: 'Y-m-d', flex: 1, xtype: 'datetimefield', name: 'MODIFYTIME' } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ xtype: 'textareafield', grow: true, fieldLabel: '修改详细描述', height: 80, name: 'MODIFYDETAIL', anchor: '100%' }] }, { xtype: 'textareafield', grow: true, fieldLabel: '备注', height: 30, name: 'REMARKS', anchor: '100%' } ]//end items(fieldset 1) }//end fieldset 1 ]//end root items }); //end this.formDetail this.panelBtnDetail = new Ext.Panel({ region: "north", tbar: [{ text: "新建", id: 'btnENewDetail', handler: function (button, event) { this.LoadDetailData('add', ''); }, scope: this }, '-', { id: 'btnESaveDetail', text: "保存", iconCls: "btnsave", handler: function (button, event) { this.SaveDetail('0'); }, scope: this }, { id: 'btnESaveAndNewDetail', text: "保存并新建", handler: function (button, event) { this.SaveDetail('2'); }, scope: this }, '-', { text: "删除", id: 'btnEDelDetail', iconCls: "btndelete", handler: function (button, event) { this.onDeleteDetailClick(button, event); }, scope: this }] }); //end 按钮Toolbar //#endregion this.panelfactry = new Ext.Panel({ title: '修改详细记录', layout: "border", region: 'center', animate: true, autoScroll: true, // containerScroll: true, frame: false, items: [this.panelBtnDetail, this.gridListDetail, this.formDetail] }); //#region 布局 //控件布局 this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 418, items: [this.panelBtn, this.formEdit] }); this.tabWTpanel = new Ext.TabPanel({ activeTab: 0, autoWidth: true, border: true, frame: false, region: 'center', enableTabScroll: true, items: [ this.panelfactry ] }); Ext.apply(this, { items: [this.panelTop, this.tabWTpanel] }); //#endregion this.storeListDetail.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.ParentWin = window.parent.opener; //初始化数据 this.InitData(); //绑定事件 }, //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 = " 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: '/SoftMng/MsSoftRequire/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.GetEditStatus(); var acondition = " LINKGID='" + this.editRecord.get('GID') + "'"; this.storeListDetail.load({ params: { condition: acondition }, callback: function (r, options, success) { if (success) { if (this.storeListDetail.getCount() > 0) { var member = this.storeListDetail.getAt(0); this.LoadDetailData("edit", "GID='" + member.data.GID + "'"); } else { this.LoadDetailData('add', ''); } } }, scope: this }); var xcondition = " BSNO='" + this.editRecord.get('GID') + "'"; _this.Loading = true; _this.storeDocList.load({ params: { condition: xcondition }, waitMsg: "正在查询数据...", scope: this, callback: function () { _this.Loading = false; } }); } 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); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/SoftMng/MsSoftRequire/Save', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data) }, 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.GetEditStatus(); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.insert(0, returnData); this.editRecord = this.StoreList.getAt(0); } else if (this.opStatus == 'edit') { var editp = Ext.create('MsSoftRequire', 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); } else if (type == '1') { 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 onSubmitAuditClick: function (type) { var GID = this.formEdit.getForm().findField('GID').getValue(); var billstatus = this.formEdit.getForm().findField('BSSTATUS').getValue(); var REQUIRETYPE = this.formEdit.getForm().findField('REQUIRETYPE').getValue(); if (type == '1') { if ((billstatus != '新建') && (billstatus != '驳回提交')) { Ext.Msg.show({ title: '提示', msg: '当前状态无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } if (type == '0') { if ((billstatus != '提交审核')) { Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } if (type == '1' && REQUIRETYPE != 'BUG修改') { var SALE = this.formEdit.getForm().findField('SALE').getValue(); if (SALE == '') { Ext.Msg.show({ title: '提示', msg: '销售为空无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } var basicForm = this.formEdit.getForm(); if (!basicForm.isValid()) { return; } basicForm.findField('GID').setDisabled(false); var data = basicForm.getValues(); basicForm.findField('GID').setDisabled(true); Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/SoftMng/MsSoftRequire/SaveSubmit', scope: this, params: { opstatus: this.opStatus, data: Ext.JSON.encode(data), type: type }, 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.GetEditStatus(); if (this.opStatus == 'add') { var arrNewRecords = this.StoreList.add(returnData); this.editRecord = arrNewRecords[0]; } else if (this.opStatus == 'edit') { var editp = Ext.create('MsSoftRequire', 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(); } this.opStatus = 'edit'; basicForm.findField('GID').setDisabled(true); } 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 }); } } }); }, onSaleAuditClick: function (type) { var GID = this.formEdit.getForm().findField('GID').getValue(); var billstatus = this.formEdit.getForm().findField('BSSTATUS').getValue(); var MODIFYBY = this.formEdit.getForm().findField('MODIFYBY').getValue(); var REQUIRETYPE = this.formEdit.getForm().findField('REQUIRETYPE').getValue(); var SALESTATUS = this.formEdit.getForm().findField('SALESTATUS').getValue(); if (type == '1') { if ((billstatus != '提交审核' || SALESTATUS=='审核通过')) { Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } if (type == '0') { if ((SALESTATUS != '审核通过' && billstatus != '提交审核')) { Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } var AUDITRESULT = this.formEdit.getForm().findField('AUDITRESULT').getValue(); _this = this; Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/SoftMng/MsSoftRequire/SaleAudit', params: { GID: GID, type: type, auditstr: AUDITRESULT }, 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 }); }, onAuditClick: function (type) { var GID = this.formEdit.getForm().findField('GID').getValue(); var billstatus = this.formEdit.getForm().findField('BSSTATUS').getValue(); var MODIFYBY = this.formEdit.getForm().findField('MODIFYBY').getValue(); var REQUIRETYPE = this.formEdit.getForm().findField('REQUIRETYPE').getValue(); var SALESTATUS = this.formEdit.getForm().findField('SALESTATUS').getValue(); if (type == '1') { if ((billstatus != '提交审核')) { Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } if (MODIFYBY == '') { Ext.Msg.show({ title: '提示', msg: '请选择修改人!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } if (type == '0') { if ((billstatus != '审核通过')) { Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } //if (type == '1' && REQUIRETYPE != 'BUG修改') { // var SALESTATUS = this.formEdit.getForm().findField('SALESTATUS').getValue(); // if (SALESTATUS != '审核通过') { // Ext.Msg.show({ title: '提示', msg: '销售审核后才能进行修改审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } //} var AUDITRESULT = this.formEdit.getForm().findField('AUDITRESULT').getValue(); var MODIFYBY = this.formEdit.getForm().findField('MODIFYBY').getValue(); _this = this; Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/SoftMng/MsSoftRequire/Audit', params: { GID: GID, type: type, auditstr: AUDITRESULT, modify: MODIFYBY }, 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 }); }, onModifyClick: function (type) { var GID = this.formEdit.getForm().findField('GID').getValue(); var billstatus = this.formEdit.getForm().findField('BSSTATUS').getValue(); if (type == '1') { if ((billstatus != '审核通过')) { Ext.Msg.show({ title: '提示', msg: '当前状态无法确认修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } if (type == '0') { if ((billstatus != '确认修改')) { Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销确认修改!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } if (type == '2') { if ((billstatus != '确认修改')) { Ext.Msg.show({ title: '提示', msg: '当前状态无法修改完成!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } var MODIFYDETAIL = this.formEdit.getForm().findField('MODIFYDETAIL').getValue(); _this = this; Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/SoftMng/MsSoftRequire/modify', params: { GID: GID, type: type, modifystr: MODIFYDETAIL }, 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 }); }, onOverClick: function (type) { var GID = this.formEdit.getForm().findField('GID').getValue(); var billstatus = this.formEdit.getForm().findField('BSSTATUS').getValue(); if (type == '1') { if ((billstatus != '修改完成')) { Ext.Msg.show({ title: '提示', msg: '当前状态确认完成!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } if (type == '0') { if ((billstatus != '确认完成')) { Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销确认完成!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } } _this = this; Ext.Ajax.request({ waitMsg: '正在添加数据...', url: '/SoftMng/MsSoftRequire/Over', params: { GID: GID, type: type }, 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 }); }, LoadDetailData: function (opstatus, condition) { this.serialNo = 0; this.FactryStatus = opstatus; // if (this.FactryStatus == 'add') { // var MSDSID = this.formEdit.getForm().findField('GID').getValue(); // this.formDetail.getForm().reset(); // this.formDetail.getForm().findField('MSDSID').setValue(MSDSID); // } else { Ext.Ajax.request({ waitMsg: '正在查询主表数据...', url: '/SoftMng/MsSoftRequire/GetDetailData', 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; } data = result.data; this.formDetail.getForm().reset(); this.formDetail.getForm().setValues(data); } else { Ext.MessageBox.alert('请求出现错误,请重试', response.responseText); } }, scope: this }); // } }, // end LoadDate //#region 保存 SaveDetail: function (type) { var basicForm = this.formDetail.getForm(); if (!basicForm.isValid()) { return; } this.formDetail.getForm().findField('GID').setDisabled(false); this.formDetail.getForm().findField('LINKGID').setDisabled(false); var data = this.formDetail.getForm().getValues(false, false, false); this.formDetail.getForm().findField('GID').setDisabled(true); this.formDetail.getForm().findField('LINKGID').setDisabled(true); var MSDSID = this.formEdit.getForm().findField('GID').getValue(); // Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/SoftMng/MsSoftRequire/SaveDetail', scope: this, params: { opstatus: this.FactryStatus, data: Ext.JSON.encode(data), PID: MSDSID }, 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.formDetail.getForm().reset(); this.formDetail.getForm().setValues(returnData); // if (this.FactryStatus == 'add') { var arrNewRecords = this.storeListDetail.add(returnData); this.editFactryRecord = arrNewRecords[0]; } else if (this.FactryStatus == 'edit') { var editp = Ext.create('MsSoftRequireDetail', returnData); this.editFactryRecord.fields.each(function (field) { if (field.persist) { name = field.name; if (name != 'id') this.editFactryRecord.set(name, editp.get(name)); } }, this); this.editFactryRecord.commit(); } if (type == '0') { this.FactryStatus = 'edit'; } else if (type == '2') { this.LoadDetailData('add', ''); } } 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 //#endregion onDeleteDetailClick: function () { var selections = this.gridListDetail.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: '/SoftMng/MsSoftRequire/DeleteDetail', 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.storeListDetail.load({ params: { condition: acondition} }); this.storeListDetail.remove(record); if (this.storeListDetail.getCount() > 0) { var member = this.storeListDetail.getAt(0); this.editFactryRecord = member; this.LoadDetailData("edit", "GID='" + member.data.GID + "'"); } else { this.LoadDetailData('add', ''); } 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); }, // //#region 上传图片 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.formEdit.getForm().findField('GID').getValue(); 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: billno, 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 GetEditStatus: function () { var canedit = false; var BSSTATUS = this.formEdit.getForm().findField('BSSTATUS').getValue(); var SALESTATUS = this.formEdit.getForm().findField('SALESTATUS').getValue(); var INPUTBY = this.formEdit.getForm().findField('INPUTBY').getValue(); var MODIFYBY = this.formEdit.getForm().findField('MODIFYBY').getValue(); var AUDITBY = this.formEdit.getForm().findField('AUDITBY').getValue(); var OVERBY = this.formEdit.getForm().findField('OVERBY').getValue(); var SALE = this.formEdit.getForm().findField('SALE').getValue(); var btnESave = Ext.getCmp('btnESave'); var btnESaveAndClose = Ext.getCmp('btnESaveAndClose'); var btnESaveAndNew = Ext.getCmp('btnESaveAndNew'); var btnSubmitAudit = Ext.getCmp('btnSubmitAudit'); var btnSubmitAuditBack = Ext.getCmp('btnSubmitAuditBack'); var btnAudit = Ext.getCmp('btnAudit'); var btnAuditBack = Ext.getCmp('btnAuditBack'); var btnSaleAudit = Ext.getCmp('btnSaleAudit'); var btnSaleAuditBack = Ext.getCmp('btnSaleAuditBack'); var btnModify = Ext.getCmp('btnModify'); var btnOver = Ext.getCmp('btnOver'); var btnENewDetail = Ext.getCmp('btnENewDetail'); var btnESaveDetail = Ext.getCmp('btnESaveDetail'); var btnESaveAndNewDetail = Ext.getCmp('btnESaveAndNewDetail'); var btnEDelDetail = Ext.getCmp('btnEDelDetail'); var btnEDelDoc = Ext.getCmp('btnEDelDoc'); var btnEAddDoc = Ext.getCmp('btnEAddDoc'); btnESave.disable(); btnESaveAndClose.disable(); btnESaveAndNew.disable(); btnSubmitAudit.disable(); btnSubmitAuditBack.disable(); btnAudit.disable(); btnAuditBack.disable(); btnModify.disable(); btnENewDetail.disable(); btnESaveDetail.disable(); btnESaveAndNewDetail.disable(); btnEDelDetail.disable(); btnEDelDoc.disable(); btnEAddDoc.disable(); btnOver.disable(); btnSaleAudit.disable(); btnSaleAuditBack.disable(); _this = this; if ((BSSTATUS == '新建') || (BSSTATUS == '驳回提交')) { if (USERID == INPUTBY) { btnESave.enable(); btnESaveAndClose.enable(); btnESaveAndNew.enable(); btnSubmitAudit.enable(); btnEDelDoc.enable(); btnEAddDoc.enable(); } else { SetFormReadOnly(this.formEdit, true); } } else if ((BSSTATUS == '提交审核')) { if (SALESTATUS == '审核通过') { if (USERID == SALE) { btnSaleAuditBack.enable(); btnSaleAudit.disable(); } } else { if (USERID == SALE) { btnSaleAudit.enable(); btnSaleAuditBack.enable(); } } Ext.Ajax.request({ waitMsg: '', url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable', params: { modulename: "modsoftModifyAudit" }, callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (result.Success != true) { } else { SetFormReadOnly(this.formEdit, true); btnAudit.enable(); btnAuditBack.enable(); this.formEdit.getForm().findField('MODIFYBY').setReadOnly(false); this.formEdit.getForm().findField('AUDITRESULT').setReadOnly(false); } } else { } }, scope: this }); if (USERID == INPUTBY) { btnSubmitAuditBack.enable(); } } else if ((BSSTATUS == '审核通过') || (BSSTATUS == '确认修改') || (BSSTATUS == '修改完成')) { if (BSSTATUS == '审核通过') { if (USERID == AUDITBY) { btnAudit.enable(); btnAuditBack.enable(); this.formEdit.getForm().findField('MODIFYBY').setReadOnly(false); this.formEdit.getForm().findField('AUDITRESULT').setReadOnly(false); } } if (USERID == MODIFYBY) { btnModify.enable(); btnENewDetail.enable(); btnESaveDetail.enable(); btnESaveAndNewDetail.enable(); btnEDelDetail.enable(); SetFormReadOnly(this.formEdit, true); this.formEdit.getForm().findField('MODIFYDETAIL').setReadOnly(false); } else { SetFormReadOnly(this.formEdit, true); } if (BSSTATUS == '审核通过') { if (USERID != MODIFYBY) { btnOver.enable(); } } } else if ((BSSTATUS == '确认完成')) { if (USERID == OVERBY) { btnOver.enable(); } } }, getIsModify: function () { return ''; } // });