Index: ssts-web/src/main/webapp/disinfectsystem/interfere/splitRecyclingApplicationView.js =================================================================== diff -u -r23852 -r30154 --- ssts-web/src/main/webapp/disinfectsystem/interfere/splitRecyclingApplicationView.js (.../splitRecyclingApplicationView.js) (revision 23852) +++ ssts-web/src/main/webapp/disinfectsystem/interfere/splitRecyclingApplicationView.js (.../splitRecyclingApplicationView.js) (revision 30154) @@ -6,118 +6,118 @@ var rightStore; var addSplitMaterial; -function toRightGrid(){ +function toRightGrid() { var records = leftGridPanel.getSelectionModel().getSelections(); if (records.length == 0) { showResult("请选择!"); return false; } - //添加 - for ( var j = 0; j < records.length; j++) { - var tousseItemId = records[j].data['id']; - var left_tousseName = records[j].data['tousseName']; - var amount = records[j].data['amount']; - var maxSplitAmount = records[j].data['maxSplitAmount']; - if(amount > maxSplitAmount){ - showResult("申请数量不能大于" + maxSplitAmount + "!"); - return false; - } - if(amount == 0){ - continue; - } - var isExist = false; - for ( var n = 0; n < rightStore.getCount(); n++) { - var record = rightStore.getAt(n); - var right_id =record.get('id'); - var right_amount = record.get('amount'); - if(right_id == tousseItemId){ - isExist = true; - var num = Number(amount) + Number(right_amount); - record.set('amount', num); - } - } - if(!isExist){ - var record = new addSplitMaterial({ - id : tousseItemId, - tousseName : left_tousseName, - amount : amount - }); - rightStore.addSorted(record); - } + //添加 + for (var j = 0; j < records.length; j++) { + var tousseItemId = records[j].data['id']; + var left_tousseName = records[j].data['tousseName']; + var amount = records[j].data['amount']; + var maxSplitAmount = records[j].data['maxSplitAmount']; + if (amount > maxSplitAmount) { + showResult("申请数量不能大于" + maxSplitAmount + "!"); + return false; + } + if (amount == 0) { + continue; + } + var isExist = false; + for (var n = 0; n < rightStore.getCount(); n++) { + var record = rightStore.getAt(n); + var right_id = record.get('id'); + var right_amount = record.get('amount'); + if (right_id == tousseItemId) { + isExist = true; + var num = Number(amount) + Number(right_amount); + record.set('amount', num); + } + } + if (!isExist) { + var record = new addSplitMaterial({ + id: tousseItemId, + tousseName: left_tousseName, + amount: amount + }); + rightStore.addSorted(record); + } } - //删除 + //删除 var rows = top.Ext.getCmp('splitMaterialGrid2').getSelectionModel().getSelections();// 返回值为 if (rows) { - for ( var i = 0; i < rows.length; i++) { - var amount = rows[i].data['amount']; - var maxSplitAmount = rows[i].data['maxSplitAmount']; - if(amount == maxSplitAmount){ - leftStore.remove(rows[i]); - }else{ - var num = Number(maxSplitAmount) - Number(amount); - rows[i].set('amount', num); - rows[i].set('maxSplitAmount', num); - } + for (var i = 0; i < rows.length; i++) { + var amount = rows[i].data['amount']; + var maxSplitAmount = rows[i].data['maxSplitAmount']; + if (amount == maxSplitAmount) { + leftStore.remove(rows[i]); + } else { + var num = Number(maxSplitAmount) - Number(amount); + rows[i].set('amount', num); + rows[i].set('maxSplitAmount', num); } + } } } -function toLeftGrid(){ +function toLeftGrid() { var records = rightGridPanel.getSelectionModel().getSelections(); if (records.length == 0) { showResult("请选择!"); return false; } - for ( var j = 0; j < records.length; j++) { - var tousseItemId = records[j].data['id']; - var right_tousseName = records[j].data['tousseName']; - var right_amount = records[j].data['amount']; - - var isExist = false; - for ( var n = 0; n < leftStore.getCount(); n++) { - var record = leftStore.getAt(n); - var left_id =record.get('id'); - var amount = record.get('amount'); - if(left_id == tousseItemId){ - isExist = true; - var num = Number(right_amount) + Number(amount); - record.set('amount', num); - record.set('maxSplitAmount', num); - } - } - if(!isExist){ - var record = new addSplitMaterial({ - id : tousseItemId, - tousseName : right_tousseName, - amount : right_amount, - maxSplitAmount : right_amount - }); - leftStore.add(record); - } + for (var j = 0; j < records.length; j++) { + var tousseItemId = records[j].data['id']; + var right_tousseName = records[j].data['tousseName']; + var right_amount = records[j].data['amount']; + + var isExist = false; + for (var n = 0; n < leftStore.getCount(); n++) { + var record = leftStore.getAt(n); + var left_id = record.get('id'); + var amount = record.get('amount'); + if (left_id == tousseItemId) { + isExist = true; + var num = Number(right_amount) + Number(amount); + record.set('amount', num); + record.set('maxSplitAmount', num); + } + } + if (!isExist) { + var record = new addSplitMaterial({ + id: tousseItemId, + tousseName: right_tousseName, + amount: right_amount, + maxSplitAmount: right_amount + }); + leftStore.add(record); + } } - //删除 - var rows = top.Ext.getCmp('splitMaterialGrid3').getSelectionModel().getSelections();// 返回值为 + //删除 + var rows = top.Ext.getCmp('splitMaterialGrid3').getSelectionModel().getSelections();// 返回值为 if (rows) { - for ( var i = 0; i < rows.length; i++) { + for (var i = 0; i < rows.length; i++) { rightStore.remove(rows[i]); } } } -function loadReviewerByBarcode(barcodeField){ +function loadReviewerByBarcode(barcodeField) { var peopleOfBarcode = barcodeField.getValue(); - if(peopleOfBarcode){ - UserTableManager.getUserByBarcode(peopleOfBarcode,function(responseText){ - if(responseText){ + if (peopleOfBarcode) { + UserTableManager.getUserByBarcode(peopleOfBarcode, function (responseText) { + if (responseText) { var result = Ext.decode(responseText); - if(!result.success){ - showResult("输入的条码有误!"); + if (!result.success) { + showResult("输入的条码有误!"); return; - }else{ - top.Ext.getCmp('reviewer2').setValue(result.fullName); - top.Ext.getCmp('reviewerCode2').setValue(result.name); - } - }else{ + } else { + top.Ext.getCmp('reviewer2').setValue(result.fullName); + top.Ext.getCmp('reviewerCode2').setValue(result.name); + } + } else { showResult('找不到该条码所对应的人员信息'); top.Ext.getCmp('reviewer2').setValue(); } @@ -126,410 +126,523 @@ barcodeField.setValue(); } -function splitInvoicePlan(invoicePlanId,serialNum,depart,settleAccountsDepart,handleDepart){ - - var selectModel = new top.Ext.grid.CheckboxSelectionModel(); - - var handleDepartStore = new Ext.data.Store({ - autoLoad : false, - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/systemmanage/getCssdsByApplyDepartAndType.do', - method : 'POST' - }), - reader : new Ext.data.JsonReader({ - root : 'data' - }, [ - {name : 'cssdOrgUnitCode',mapping : 'cssdOrgUnitCode'}, - {name : 'name',mapping : 'cssdOrgUnitName'} - ]) - }); - handleDepartStore.load(); - - splitInvoicePlanPanel = new top.Ext.form.FormPanel( { - labelAlign : 'right', - buttonAlign : 'center', - collapsible : true, - collapseMode : 'mini', - split : true, - border : 0, - labelSeparator : ':', - frame : true, +function splitInvoicePlan(invoicePlanId, serialNum, depart, settleAccountsDepart, handleDepart) { + + var selectModel = new top.Ext.grid.CheckboxSelectionModel(); + + var departJsonStore = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/baseData/supplyRoomConfigAction!getAllOrgUnitName.do', + method: 'POST' + }), + baseParams: { + showDisableOrgUnit: false + }, + reader: new Ext.data.JsonReader({ + root: 'data' + }, [ + { name: 'id', mapping: 'id' }, + { name: 'name', mapping: 'name' } + ] + ) + }); + + var handleDepartStore = new Ext.data.Store({ + autoLoad: false, + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/systemmanage/getCssdsByApplyDepartAndType.do', + method: 'POST' + }), + reader: new Ext.data.JsonReader({ + root: 'data' + }, [ + { name: 'cssdOrgUnitCode', mapping: 'cssdOrgUnitCode' }, + { name: 'name', mapping: 'cssdOrgUnitName' } + ]) + }); + + handleDepartStore.load(); + + splitInvoicePlanPanel = new top.Ext.form.FormPanel({ + labelAlign: 'right', + buttonAlign: 'center', + collapsible: true, + collapseMode: 'mini', + split: true, + border: 0, + labelSeparator: ':', + frame: true, layout: 'column', - bodyStyle : 'padding:0px auto;margin:0px', - items : [{ - xtype : "fieldset", - title : '旧申请单', - layout:'column', - columnWidth : 0.5, - height:100, - items : [{ - layout : 'column', - items : [ - { - columnWidth : 0.5, - layout : 'form', - labelWidth : 60, - items : [{ - xtype : 'textfield', - fieldLabel : "申请科室", - name : "depart", - readOnly : true, - id : "depart", - anchor : '99%', - value:depart, - cls:'fieldReadOnlyNoRemove' - }] - },{ - columnWidth : 0.5, - layout : 'form', - labelWidth : 60, - items : [{ - xtype : 'textfield', - fieldLabel : "结算科室", - name : "settleAccountsDepart", - readOnly : true, - id : "settleAccountsDepart", - anchor : '99%', - value:settleAccountsDepart, - cls:'fieldReadOnlyNoRemove' - }] - },{ - columnWidth : 0.5, - layout : 'form', - labelWidth : 60, - items : [{ - xtype : 'textfield', - fieldLabel : "流水号", - name : "serialNumber", - readOnly : true, - id : "serialNumber", - anchor : '99%', - value:serialNum, - cls:'fieldReadOnlyNoRemove' - }] - },{ - columnWidth : 0.5, - layout : 'form', - labelWidth : 60, - items : [{ - xtype : 'textfield', - fieldLabel : "处理科室", - name : "handleDepart", - readOnly : true, - id : "handleDepart", - anchor : '99%', - value:handleDepart, - cls:'fieldReadOnlyNoRemove' - }] - } - ]} - ] - },{ + bodyStyle: 'padding:0px auto;margin:0px', + items: [{ + xtype: "fieldset", + title: '旧申请单', + layout: 'column', + columnWidth: 0.5, + height: 100, + items: [{ + layout: 'column', + items: [ + { + columnWidth: 0.5, + layout: 'form', + labelWidth: 60, + items: [{ + xtype: 'textfield', + fieldLabel: "申请科室", + name: "depart", + readOnly: true, + id: "depart", + anchor: '99%', + value: depart, + cls: 'fieldReadOnlyNoRemove' + }] + }, { + columnWidth: 0.5, + layout: 'form', + labelWidth: 60, + items: [{ + xtype: 'textfield', + fieldLabel: "结算科室", + name: "settleAccountsDepart", + readOnly: true, + id: "settleAccountsDepart", + anchor: '99%', + value: settleAccountsDepart, + cls: 'fieldReadOnlyNoRemove' + }] + }, { + columnWidth: 0.5, + layout: 'form', + labelWidth: 60, + items: [{ + xtype: 'textfield', + fieldLabel: "流水号", + name: "serialNumber", + readOnly: true, + id: "serialNumber", + anchor: '99%', + value: serialNum, + cls: 'fieldReadOnlyNoRemove' + }] + }, { + columnWidth: 0.5, + layout: 'form', + labelWidth: 60, + items: [{ + xtype: 'textfield', + fieldLabel: "处理科室", + name: "handleDepart", + readOnly: true, + id: "handleDepart", + anchor: '99%', + value: handleDepart, + cls: 'fieldReadOnlyNoRemove' + }] + } + ] + } + ] + }, { - xtype : "fieldset", - title : '新申请单', - layout:'column', - columnWidth : 0.5, - height:100, - items : [{ - layout : 'column', - items : [ - { - columnWidth : 1, - layout : 'form', - labelWidth : 100, - items : [{ - xtype : 'combo', - fieldLabel : '处理科室', - id : 'newHandleDepart', - name : 'newHandleDepart', - valueField : 'cssdOrgUnitCode', - displayField : 'name', - store : handleDepartStore, - forceSelection : true, - lazyInit : true, - triggerAction : 'all', - typeAhead : false, - editable : false, - allowBlank : false - }] - } - ]} - ] + xtype: "fieldset", + title: '新申请单', + layout: 'column', + columnWidth: 0.5, + height: 100, + items: [{ + layout: 'column', + items: [{ + xtype: 'hidden', + id: 'departCoding', + name: 'departCoding' + }, { + xtype: 'hidden', + id: 'newDepartCoding', + name: 'newDepartCoding' + }, { + xtype: 'hidden', + id: 'newSettleAccountsDepartCoding', + name: 'newSettleAccountsDepartCoding' + }, + { + columnWidth: .5, + layout: 'form', + labelWidth: 60, + items: [{ + xtype: 'combo', + id: 'newDepart', + name: 'newDepart', + queryParam: 'spell', + fieldLabel: '申请科室', + minChars: 0, + valueField: 'name', + displayField: 'name', + anchor: '95%', + store: departJsonStore, + forceSelection: true, + lazyInit: true, + triggerAction: 'all', + typeAhead: false, + allowBlank: false, + listeners: { + select: function (combo, record, index) { + top.Ext.getCmp("newDepartCoding").setValue(record.get('id')); + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/supplyRoomConfigAction!getDefaultSettleAccountDepart.do', + params: { + orgUnitCode: record.get('id') + }, + success: function (response, options) { + var result = Ext.decode(response.responseText); + if (!result.success) { + showResult(resultObj.errMsg); + return; + } + var orgUnitCode = result.data.orgUnitCode || ''; + var name = result.data.name || ''; + top.Ext.getCmp('newSettleAccountsDepartCoding').setValue(orgUnitCode); + top.Ext.getCmp('newSettleAccountsDepart').setValue(name); + } + }); + } + } + }] + }, { + columnWidth: .5, + layout: 'form', + labelWidth: 60, + items: [{ + xtype: 'combo', + fieldLabel: '结算科室', + id: 'newSettleAccountsDepart', + name: 'newSettleAccountsDepart', + queryParam: 'spell', + minChars: 0, + valueField: 'name', + displayField: 'name', + anchor: '95%', + store: departJsonStore, + forceSelection: true, + lazyInit: true, + triggerAction: 'all', + typeAhead: false, + allowBlank: false, + listeners: { + select: function (combo, record, index) { + top.Ext.getCmp("newSettleAccountsDepartCoding").setValue(record.get('id')); + } + } + }] + }, { + columnWidth: .5, + layout: 'form', + labelWidth: 60, + items: [{ + xtype: 'combo', + fieldLabel: '处理科室', + id: 'newHandleDepart', + name: 'newHandleDepart', + valueField: 'cssdOrgUnitCode', + displayField: 'name', + store: handleDepartStore, + forceSelection: true, + lazyInit: true, + triggerAction: 'all', + typeAhead: false, + editable: false, + anchor: '95%', + allowBlank: false + }] + }, { + columnWidth: .5, + layout: 'form', + labelWidth: 60, + items: [{ + xtype: 'textfield', + fieldLabel: '备注', + id: 'remark', + name: 'remark', + anchor: '95%', + allowBlank: false + }] + } + ] + } + ] }] }); - + /**********************待拆分区域**************************************************************/ - - var leftMaterialCm = new top.Ext.grid.ColumnModel( [selectModel, { - header : "id", - dataIndex : 'id', - width : 100, - hidden:true - },{ - header : "物品名称", - dataIndex : 'tousseName', - width : 100, - menuDisabled: true + + var leftMaterialCm = new top.Ext.grid.ColumnModel([selectModel, { + header: "id", + dataIndex: 'id', + width: 100, + hidden: true }, { - id:'amount', - header : "申请数量", - dataIndex : 'amount', - width : 40, - align : 'center', - menuDisabled: true, - editor : new top.Ext.form.NumberField({ - allowBlank : false, - listeners : { - focus : function(thiz){ - thiz.selectText(); - } + header: "物品名称", + dataIndex: 'tousseName', + width: 100, + menuDisabled: true + }, { + id: 'amount', + header: "申请数量", + dataIndex: 'amount', + width: 40, + align: 'center', + menuDisabled: true, + editor: new top.Ext.form.NumberField({ + allowBlank: false, + listeners: { + focus: function (thiz) { + thiz.selectText(); } - }) - }, { - header : "可拆分数量", - hidden:true, - dataIndex : 'maxSplitAmount', - width : 60, + } + }) + }, { + header: "可拆分数量", + hidden: true, + dataIndex: 'maxSplitAmount', + width: 60, + menuDisabled: true + }]); + + var rightMaterialCm = new top.Ext.grid.ColumnModel([selectModel, { + header: "id", + hidden: true, + dataIndex: 'id', + width: 200, menuDisabled: true - }]); - - var rightMaterialCm = new top.Ext.grid.ColumnModel( [selectModel, { - header : "id", - hidden : true, - dataIndex : 'id', - width : 200, - menuDisabled: true - },{ - header : "物品名称", - dataIndex : 'tousseName', - width : 200, - menuDisabled: true }, { - header : "数量", - dataIndex : 'amount', - width : 60, - menuDisabled: true - }]); - + header: "物品名称", + dataIndex: 'tousseName', + width: 200, + menuDisabled: true + }, { + header: "数量", + dataIndex: 'amount', + width: 60, + menuDisabled: true + }]); + //初始化加载器械包 leftStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/recyclingApplicationAction!loadTousseItems.do', - method : 'POST' + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/recyclingApplicationAction!loadTousseItems.do', + method: 'POST' }), - reader : new Ext.data.JsonReader({ - root : 'data' - }, [ - {name : 'id',mapping : 'id'}, - {name : 'tousseName',mapping : 'tousseName'}, - {name : 'amount',mapping : 'amount'}, - {name : 'maxSplitAmount',mapping : 'maxSplitAmount'} - ]) + reader: new Ext.data.JsonReader({ + root: 'data' + }, [ + { name: 'id', mapping: 'id' }, + { name: 'tousseName', mapping: 'tousseName' }, + { name: 'amount', mapping: 'amount' }, + { name: 'maxSplitAmount', mapping: 'maxSplitAmount' } + ]) }); - leftStore.load({params:{invoicePlanId : invoicePlanId}}); - - leftGridPanel = new top.Ext.grid.EditorGridPanel( { - id : 'splitMaterialGrid2', - height : 350, - store : leftStore, - cm : leftMaterialCm, - title : '待拆分的物品', - clicksToEdit : 1,// 设置点击几次才可编辑 - selModel : new top.Ext.grid.RowSelectionModel({ - singleSelect : false + leftStore.load({ params: { invoicePlanId: invoicePlanId } }); + + leftGridPanel = new top.Ext.grid.EditorGridPanel({ + id: 'splitMaterialGrid2', + height: 350, + store: leftStore, + cm: leftMaterialCm, + title: '待拆分的物品', + clicksToEdit: 1,// 设置点击几次才可编辑 + selModel: new top.Ext.grid.RowSelectionModel({ + singleSelect: false }), viewConfig: { - forceFit:true + forceFit: true }, - frame : false, - border : true, - bodyStyle : 'border:1px solid #afd7af;padding-left:5px' + frame: false, + border: true, + bodyStyle: 'border:1px solid #afd7af;padding-left:5px' }); - - - + /**************分类区*************/ - addSplitMaterial = Ext.data.Record.create( [{ - name : 'id' - },{ - name : 'tousseName' + addSplitMaterial = Ext.data.Record.create([{ + name: 'id' }, { - name : 'amount' - },{ - name : 'maxSplitAmount' + name: 'tousseName' + }, { + name: 'amount' + }, { + name: 'maxSplitAmount' }]); - + rightStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/packingAction!getTousseIncludeMaterials.do', - method : 'POST' + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/packingAction!getTousseIncludeMaterials.do', + method: 'POST' }), - reader : new Ext.data.JsonReader({ - root : 'data' - }, [ - {name : 'id',mapping : 'id'}, - {name : 'tousseName',mapping : 'tousseName'}, - {name : 'amount',mapping : 'amount'} - ]) + reader: new Ext.data.JsonReader({ + root: 'data' + }, [{ name: 'id', mapping: 'id' }, + { name: 'tousseName', mapping: 'tousseName' }, + { name: 'amount', mapping: 'amount' } + ]) }); - - rightGridPanel = new top.Ext.grid.GridPanel( { - id : 'splitMaterialGrid3', - height : 350, - store : rightStore, - cm : rightMaterialCm, - enableHdMenu : false, - clicksToEdit : 1,// 设置点击几次才可编辑 - selModel : new top.Ext.grid.RowSelectionModel({ - singleSelect : false + + rightGridPanel = new top.Ext.grid.GridPanel({ + id: 'splitMaterialGrid3', + height: 350, + store: rightStore, + cm: rightMaterialCm, + enableHdMenu: false, + clicksToEdit: 1,// 设置点击几次才可编辑 + selModel: new top.Ext.grid.RowSelectionModel({ + singleSelect: false }), viewConfig: { - forceFit:true + forceFit: true }, - title : '已拆分的物品', -// frame : false, -// border : true, - autoExpandColumn : 'materialAmount', - bodyStyle : 'border:1px solid #afd7af;padding-left:5px' + title: '已拆分的物品', + // frame : false, + // border : true, + autoExpandColumn: 'materialAmount', + bodyStyle: 'border:1px solid #afd7af;padding-left:5px' }); - - + /*************************已拆分区域*************************************************************************************/ - var window = new top.Ext.Window( { - id : 'invoiceWin', - layout : 'border', - title : '申请单拆单', - width : 850, - height:550, - autoHeight : false, - border : false, - plain : true, - modal :true, - items : [{ - region : 'north', - height : 130, - layout : 'fit', - items : [splitInvoicePlanPanel] + var window = new top.Ext.Window({ + id: 'invoiceWin', + layout: 'border', + title: '申请单拆单', + width: 850, + height: 550, + autoHeight: false, + border: false, + plain: true, + modal: true, + items: [{ + region: 'north', + height: 130, + layout: 'fit', + items: [splitInvoicePlanPanel] }, { - region : 'center', - height : 250, - layout : 'column', - items : [ - { - layout : 'form', - columnWidth : 0.47, - items : [ leftGridPanel ] - },{ - layout : 'form', - columnWidth : 0.06, - buttonAlign:'center', - height : 350, - items : [ - { height :100, - border:false + region: 'center', + height: 250, + layout: 'column', + items: [{ + layout: 'form', + columnWidth: 0.47, + items: [leftGridPanel] + }, { + layout: 'form', + columnWidth: 0.06, + buttonAlign: 'center', + height: 350, + items: [{ + height: 100, + border: false }, { - xtype :'button', - text : '>>', - minWidth:48, - handler : toRightGrid + xtype: 'button', + text: '>>', + minWidth: 48, + handler: toRightGrid }, { - xtype :'button', - text : '<<', - minWidth:48, - handler : toLeftGrid + xtype: 'button', + text: '<<', + minWidth: 48, + handler: toLeftGrid }] }, { - layout : 'form', - columnWidth : 0.47, - items : [ rightGridPanel ] - } ] - }], - buttonAlign:'center', - buttons:[{ - text:'保存', - handler:function(){ - var handleDepartCode = top.Ext.getCmp('newHandleDepart').getValue(); - if(handleDepartCode == ""){ - showResult("请选择处理科室!"); - return; - } - - var newHandleDepartName = top.Ext.getCmp('newHandleDepart').getRawValue(); - if(newHandleDepartName == handleDepart){ - showResult("旧申请单的处理科室不能与新申请单的结算科室一样!"); - return; - } - - var result = {}; - result.invoicePlanId = invoicePlanId; - result.newAppHandleDepartCode = handleDepartCode; - var oldInvoicePlanItems = new Array(); - var newInvoicePlanItems = new Array(); - var validPass = true; - for ( var i = 0; i < leftStore.getCount(); i++) { - var record = leftStore.getAt(i); - var tousseItemId = record.get('id'); - var tousseName = record.get('tousseName'); - var tousseType = record.get('tousseType'); - var amount = record.get("amount"); - var maxSplitAmount = record.get('maxSplitAmount'); - if(amount != maxSplitAmount){ - showResult(tousseName+",申请数量已修改但未拆分!"); - validPass = false; - break; - } - var json = { - tousseItemId : tousseItemId, - tousseType : tousseType, - amount : amount - }; - oldInvoicePlanItems.push(json); - } - if(validPass){ - for ( var i = 0; i < rightStore.getCount(); i++) { - var record = rightStore.getAt(i); - var tousseItemId = record.get('id'); - var tousseType = record.get('tousseType'); - var amount = record.get("amount"); - var json = { - tousseItemId : tousseItemId, - tousseType : tousseType, - amount : amount - }; - newInvoicePlanItems.push(json); - } - - result.oldInvoicePlanItems = oldInvoicePlanItems; - result.newInvoicePlanItems = newInvoicePlanItems; - - splitInvoicePlanPanel.form.submit( { - url : WWWROOT + '/disinfectSystem/recyclingApplicationAction!saveSplitInvoicePlan.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - params : { - result:JSON.stringify(result) - }, - success : function(form, action) { - showResult(action.result.message); - grid.dwrReload(); - window.close(); - }, - failure : function(form, action) { - showResult(action.result.message); - } - }); - } - } - }, - { - text:'取消', - handler:function(){ - window.close(); - } + layout: 'form', + columnWidth: 0.47, + items: [rightGridPanel] }] + }], + buttonAlign: 'center', + buttons: [{ + text: '保存', + handler: function () { + var handleDepartCode = top.Ext.getCmp('newHandleDepart').getValue(); + if (handleDepartCode == "") { + showResult("请选择处理科室!"); + return; + } + + var depart = top.Ext.getCmp('newDepart').getValue(); + var departCoding = top.Ext.getCmp('newDepartCoding').getValue(); + var settleAccountsDepart = top.Ext.getCmp('newSettleAccountsDepart').getValue(); + var settleAccountsDepartCoding = top.Ext.getCmp('newSettleAccountsDepartCoding').getValue(); + var remark = top.Ext.getCmp('newSettleAccountsDepartCoding').getValue(); + + var result = {}; + result.invoicePlanId = invoicePlanId; + result.newAppHandleDepartCode = handleDepartCode; + result.depart = depart; + result.departCoding = departCoding; + result.settleAccountsDepart = settleAccountsDepart; + result.settleAccountsDepartCoding = settleAccountsDepartCoding; + result.remark = remark; + var oldInvoicePlanItems = new Array(); + var newInvoicePlanItems = new Array(); + var validPass = true; + for (var i = 0; i < leftStore.getCount(); i++) { + var record = leftStore.getAt(i); + var tousseItemId = record.get('id'); + var tousseName = record.get('tousseName'); + var tousseType = record.get('tousseType'); + var amount = record.get("amount"); + var maxSplitAmount = record.get('maxSplitAmount'); + if (amount != maxSplitAmount) { + showResult(tousseName + ",申请数量已修改但未拆分!"); + validPass = false; + break; + } + var json = { + tousseItemId: tousseItemId, + tousseType: tousseType, + amount: amount + }; + oldInvoicePlanItems.push(json); + } + if (validPass) { + for (var i = 0; i < rightStore.getCount(); i++) { + var record = rightStore.getAt(i); + var tousseItemId = record.get('id'); + var tousseType = record.get('tousseType'); + var amount = record.get("amount"); + var json = { + tousseItemId: tousseItemId, + tousseType: tousseType, + amount: amount + }; + newInvoicePlanItems.push(json); + } + + result.oldInvoicePlanItems = oldInvoicePlanItems; + result.newInvoicePlanItems = newInvoicePlanItems; + splitInvoicePlanPanel.form.submit({ + url: WWWROOT + '/disinfectSystem/recyclingApplicationAction!saveSplitInvoicePlan.do', + method: 'POST', + waitMsg: '正在保存数据,请稍候', + waitTitle: '提交表单', + params: { + result: JSON.stringify(result) + }, + success: function (form, action) { + showResult(action.result.message); + grid.dwrReload(); + window.close(); + }, + failure: function (form, action) { + showResult(action.result.message); + } + }); + } + } + }, + { + text: '取消', + handler: function () { + window.close(); + } + }] }); - + window.show(); }