Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.js =================================================================== diff -u -r18590 -r18598 --- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.js (.../recycleForTouchScreen.js) (revision 18590) +++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.js (.../recycleForTouchScreen.js) (revision 18598) @@ -276,9 +276,10 @@ } }); } - -function deleteTousseItem(row){ - +/** + * 检查是否有丢失报损信息,如果有,返回提示信息。否则返回空字符 + */ +function checkHaveErrorDamage(row){ var returnMsg = ""; var recyclingErrorJsonArrayStr = $('#recyclingError'+row).val(); if(!isUndefinedOrNullOrEmpty(recyclingErrorJsonArrayStr)){ @@ -304,7 +305,11 @@ } } } - + return returnMsg; +} +function deleteTousseItem(row){ + var returnMsg = checkHaveErrorDamage(row); + if(!isUndefinedOrNullOrEmpty(returnMsg)){ alertDiv(returnMsg); return false; @@ -351,6 +356,7 @@ error:function(msg){ } }); + return true; } @@ -848,8 +854,7 @@ }else if(msg.orgUnit!= null){ //只更新科室名称及编码信息(since2015-12-16 SYF),添加新单时才更新部门 if(params_appId == null || params_appId == "null" || params_appId == ""){ - $("#depart").val(msg.orgUnit.name); - $("#departCode").val(msg.orgUnit.orgUnitCoding); + selectDepart(msg.orgUnit.name,msg.orgUnit.orgUnitCoding) }else{ alertDiv("已有回收单不可更改科室"); } @@ -2085,23 +2090,29 @@ }); return recyclingItemJsonArray; } - +/** + * 判断tousseItem表是否是空的。删除的项不算在内 + */ +function isTousseItemTableEmpty(){ + var isEmpty = true; + $("#tousseItemTable > tbody > tr").each(function() { + var style = $(this).attr("style"); + if (style != 'display: none;'){ + isEmpty = false; + return false; + } + }); + return isEmpty; +} function submitCheck(){ var isThereTousseItems = false; var isAllTousseInTheBasket = true; if($('#depart').val()== ''){ alertDiv('请先扫描科室条码。'); return false; } - var rowsAmount = 0; - $("#tousseItemTable > tbody > tr").each(function() { - var style = $(this).attr("style"); - if (style != 'display: none;'){ - rowsAmount++; - } - }); var recyclingRecordId = $('#recyclingApplicationId').val(); - if (rowsAmount == 0 && recyclingRecordId == ''){ + if (isTousseItemTableEmpty() && recyclingRecordId == ''){ alert("空白的回收单不能保存!"); return false; } @@ -2179,6 +2190,35 @@ paramJson.recyclingItemArray = getRecyclingItemInfo(); return JSON.stringify(paramJson); } +function dialogConfirm(text,yesCallback,nocallback){ + $("#dialogConfirm").dialog({ + resizable: false, + height:310, + width:600, + modal: true, + open: function() { + $("#confirmMsg").text(text); + }, + close: function() { + $("#confirmMsg").text(""); + }, + buttons: { + "是": function() { + $( this ).dialog( "close" ); + if(yesCallback){ + yesCallback(); + } + + }, + "否": function() { + $( this ).dialog( "close" ); + if(nocallback){ + nocallback(); + } + } + } + }); +} function submitFunction(confirmation,saveAndNew){ if(submitCheck()){ @@ -2196,26 +2236,8 @@ //部分入筐提示 if(isPartIntheBasket){ if(sstsConfig.enablePartRecycle == true){ - $("#dialogConfirm").dialog({ - resizable: false, - height:310, - width:600, - modal: true, - open: function() { - $("#confirmMsg").text("还有部分器械包未装入篮筐,是否继续保存?"); - }, - close: function() { - $("#confirmMsg").text(""); - }, - buttons: { - "是": function() { - submitFormFunction(confirmation,saveAndNew); - $( this ).dialog( "close" ); - }, - "否": function() { - $( this ).dialog( "close" ); - } - } + dialogConfirm("还有部分器械包未装入篮筐,是否继续保存?",function(){ + submitFormFunction(confirmation,saveAndNew); }); }else{ alertDiv('还有部分器械包未装入容器,不能保存。'); @@ -2278,6 +2300,7 @@ } }, error: function(x, t, m) { + closeDiv(); if(t == "timeout") { alert("提交超时,请重试"); } else { @@ -2622,46 +2645,86 @@ offset : [offsetTop+'px',''] }); } +/** + * 在清空器械包之前,要选删除篮筐 + */ +function emptyTousseItemTable(){ + $("#tousseItemTable").empty(); + $("#basketsUl").empty(); + tousseArray = []; +} +/** + * 判断是否可以清空器械包列表。如果有丢失报损,需要先删除才能清空。需要先提醒用户做删除操作 + */ +function canEmptyTousseItemTable(){ + var canEmpty = true; + $("#tousseItemTable > tbody > tr").each(function(row) { + var style = $(this).attr("style"); + if (style != 'display: none;'){ + var message = checkHaveErrorDamage(row); + if(!isUndefinedOrNullOrEmpty(message)){ + canEmpty = false; + return false; + } + } + }); + return canEmpty; +} function selectDepart(departName,departCode){ var oldValue = document.getElementById('departCode').value; - document.getElementById('depart').value = departName; - document.getElementById('departCode').value = departCode; //加载科室申领模板 if(params_id == '' && params_appId == '' && sstsConfig.isLoadApplyTemplateForAddRecycleRecord == true){ if(oldValue != departCode){ - $.ajax({ - type:'get', - url:WWWROOT + '/disinfectSystem/recyclingRecordAction!loadDepartmentAppTemplateForRecycle.do', - data:'orgUnitCoding=' + departCode, - dataType:'json', - success:function(dataArray){ - $("#tousseItemTable").empty(); - if(dataArray.length > 0){ - for(var i = (dataArray.length -1) ; i >= 0; i--){ - var timeStr = new Date().getTime(); - var errorDamageQmKey = dataArray[i].tousseDefinitionID + "_" + timeStr; - var toussItem = { - row: i, - tousseItemId: '', - tousseName: dataArray[i].tousseName, - tousseDefinitionID: dataArray[i].tousseDefinitionID, - applicationAmount: 0, - recycleAmount: 0, - loadedAmount: 0, - isCleanedEntirely: dataArray[i].isCleanedEntirely, - tousseType: dataArray[i].tousseType, - isThereIdentificationCard: dataArray[i].isThereIdentificationCard, - isApplyEntireTousse: dataArray[i].isApplyEntireTousse, - urgentAmount : 0, - tousseRemark : '', - errorDamageQmKey : errorDamageQmKey - }; - addToussItem(toussItem); - } - } - } - }); + if(!canEmptyTousseItemTable()){ + alertDiv('器械包有登记丢失报损信息,请先删除后再操作!'); + return false; + } + var processFun = function(){ + $.ajax({ + type:'get', + url:WWWROOT + '/disinfectSystem/recyclingRecordAction!loadDepartmentAppTemplateForRecycle.do', + data:'orgUnitCoding=' + departCode, + dataType:'json', + success:function(dataArray){ + document.getElementById('depart').value = departName; + document.getElementById('departCode').value = departCode; + emptyTousseItemTable(); +// $("#tousseItemTable").empty(); + if(dataArray.length > 0){ + for(var i = (dataArray.length -1) ; i >= 0; i--){ + var timeStr = new Date().getTime(); + var errorDamageQmKey = dataArray[i].tousseDefinitionID + "_" + timeStr; + var toussItem = { + row: i, + tousseItemId: '', + tousseName: dataArray[i].tousseName, + tousseDefinitionID: dataArray[i].tousseDefinitionID, + applicationAmount: 0, + recycleAmount: 0, + loadedAmount: 0, + isCleanedEntirely: dataArray[i].isCleanedEntirely, + tousseType: dataArray[i].tousseType, + isThereIdentificationCard: dataArray[i].isThereIdentificationCard, + isApplyEntireTousse: dataArray[i].isApplyEntireTousse, + urgentAmount : 0, + tousseRemark : '', + errorDamageQmKey : errorDamageQmKey + }; + addToussItem(toussItem); + } + } + } + }); + } + if(isTousseItemTableEmpty()){ + processFun(); + }else{ + dialogConfirm('切换科室将删除所有器械包,是否继续',processFun); + } } + }else{ + document.getElementById('depart').value = departName; + document.getElementById('departCode').value = departCode; } } /** Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/addDepart.jsp =================================================================== diff -u -r18153 -r18598 --- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/addDepart.jsp (.../addDepart.jsp) (revision 18153) +++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/addDepart.jsp (.../addDepart.jsp) (revision 18598) @@ -131,10 +131,12 @@ //待回收列表弹出窗 if(isFilterApplication){ window.parent.setApplyDepartment(departName,departCode); + closeLayer(); }else{ + closeLayer(); window.parent.selectDepart(departName,departCode); } - closeLayer(); + } function pageUp(){