Index: ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js =================================================================== diff -u -r16000 -r16118 --- ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js (.../goodsTemplateApplicationView.js) (revision 16000) +++ ssts-web/src/main/webapp/disinfectsystem/recyclingApplication/goodsTemplateApplicationView.js (.../goodsTemplateApplicationView.js) (revision 16118) @@ -2015,7 +2015,36 @@ return result; } + /** + * 添加物品时校验 + * @returns {boolean} + */ + function checkAdd() { + var package1 = top.Ext4.getCmp('package1'); + if (top.Ext4.isEmpty(package1.getValue())){ + showResult("物品不能为空!"); + return true; + } + var count = top.Ext4.getCmp('count1'); + if(Ext4.isEmpty(count.getValue())||count.getValue()<=0){ + showResult("申请数量必须大于0!"); + count.focus(); + return true; + } + var urgentAmount = top.Ext4.getCmp('urgentAmount'); + if (handleUrgentAmount.handleUaAndCount(urgentAmount.getValue(),count.getValue())){ + urgentAmount.focus(); + return true; + } + var tousseType = top.Ext4.getCmp('tousseType').getValue(); + var isApplyEntireTousse = top.Ext4.getCmp('isApplyEntireTousse').getValue(); + if (handleUrgentAmount.handleApplyEntireTousse(tousseType,isApplyEntireTousse,urgentAmount.getValue())){ + urgentAmount.focus(); + return true; + } + } + /** * 加载申请单物品 * @param para 里面属性可以有applicationType,id,reloadTemplate @@ -2544,11 +2573,15 @@ listeners : { specialkey : function(field, ee) { if (ee.getKey() == Ext.EventObject.ENTER) { - if(Ext.isEmpty(field.getValue())||field.getValue()<=0){ - showResult("申请数量必须大于0"); - field.focus(); - return false; - } + // if(Ext.isEmpty(field.getValue())||field.getValue()<=0){ + // showResult("申请数量必须大于0"); + // field.focus(); + // return false; + // } + + if (checkAdd()){ + return; + } addRecyclingApplicationItem(); } } @@ -2584,24 +2617,9 @@ id : 'addTousseBt', iconCls : 'btn_ext_add', handler : function() { - var count = top.Ext4.getCmp('count1'); - if(Ext4.isEmpty(count.getValue())||count.getValue()<=0){ - showResult("申请数量必须大于0!"); - count.focus(); - return ; + if (checkAdd()){ + return; } - var urgentAmount = top.Ext4.getCmp('urgentAmount'); - if (handleUrgentAmount.handleUaAndCount(urgentAmount.getValue(),count.getValue())){ - urgentAmount.focus(); - return ; - } - - var tousseType = top.Ext4.getCmp('tousseType').getValue(); - var isApplyEntireTousse = top.Ext4.getCmp('isApplyEntireTousse').getValue(); - if (handleUrgentAmount.handleApplyEntireTousse(tousseType,isApplyEntireTousse,urgentAmount.getValue())){ - urgentAmount.focus(); - return ; - } addRecyclingApplicationItem(); } },{