Index: ssts-web/src/main/webapp/disinfectsystem/common/terminateInvoicePlan.js =================================================================== diff -u -r16764 -r27250 --- ssts-web/src/main/webapp/disinfectsystem/common/terminateInvoicePlan.js (.../terminateInvoicePlan.js) (revision 16764) +++ ssts-web/src/main/webapp/disinfectsystem/common/terminateInvoicePlan.js (.../terminateInvoicePlan.js) (revision 27250) @@ -54,35 +54,65 @@ } var endCase = openModalWindow(WWWROOT+"/disinfectsystem/recyclingApplication/selectEndCause.jsp?time="+new Date(), "选择回收员", "760", "400"); - if(endCase != null && endCase !=undefined && endCase.length > 0){ - Ext.Ajax.request({ + + if(endCase == undefined){ + return; + }else if(endCase[0] != null&&endCase[0]!=undefined){ + Ext.Ajax.request({ url: WWWROOT + url, params: { recyclingAppId : id ,endCause:endCase}, success: function(response, options){ - var result = JSON.parse(response.responseText); - if(isUndefinedOrNull(result)){ - showResult("系统异常,请联系管理员!"); - }else{ - if(result.success){ - showResult("终止成功!"); - }else{ - showResult(result.errMsg); - } - } - if(refreshCallback){ - refreshCallback(); - }else{ - grid.dwrReload(); - } + var result = JSON.parse(response.responseText); + if(isUndefinedOrNull(result)){ + showResult("系统异常,请联系管理员!"); + }else{ + if(result.success){ + showResult("终止成功!"); + }else{ + showResult(result.errMsg); + } + } + if(refreshCallback){ + refreshCallback(); + }else{ + grid.dwrReload(); + } }, failure: function(response, options) { showResult("终止失败,请联系管理员!"); } }); - }else{ - //在选择终止原因的页面已经有判断原因是否为空,所以本处不需要再提示. - //showResult("请选择终止申请单原因。"); - return false; + }else { + var loop = setInterval(function() { + if(endCase.closed) { + clearInterval(loop); + + Ext.Ajax.request({ + url: WWWROOT + url, + params: { recyclingAppId : id ,endCause:endCase.returnValue}, + success: function(response, options){ + var result = JSON.parse(response.responseText); + if(isUndefinedOrNull(result)){ + showResult("系统异常,请联系管理员!"); + }else{ + if(result.success){ + showResult("终止成功!"); + }else{ + showResult(result.errMsg); + } + } + if(refreshCallback){ + refreshCallback(); + }else{ + grid.dwrReload(); + } + }, + failure: function(response, options) { + showResult("终止失败,请联系管理员!"); + } + }); + } + }); } }