Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recyclingErrors.js =================================================================== diff -u -r31023 -r32949 --- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recyclingErrors.js (.../recyclingErrors.js) (revision 31023) +++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recyclingErrors.js (.../recyclingErrors.js) (revision 32949) @@ -1,40 +1,32 @@ //增加数量 function add(row) { - var materialName = $('#materialName' + row).val(); + var materialName = $('#materialName' + row).html(); var errorAmount = parseInt($('#errorAmount' + row).html(), 10) var errorCount = parseInt($('#errorCount' + row).val()); //编辑回收记录时不允许修改标志牌丢失数量 if (materialName == '器械包标识牌' && isEditIDCardError == 'false') { return; } else { - //应该回收的数量 var totalCount = parseInt($('#totalCount' + row).html(), 10); if (errorAmount < totalCount) { - if (errorCount == 0) { - $('#trIndex_' + row).addClass(color); - } - var resultAmount = parseInt($('#errorAmount' + row).html(), 10) + 1; - $('#errorAmount' + row).html(resultAmount); + $('#errorAmount' + row).html(parseInt($('#errorAmount' + row).html(), 10) + 1); $('#unconfirmedAmount' + row).val(errorAmount - errorCount); - //添加一个备注记录 - addRemark(row, resultAmount); } } + } //减少数量 function reduce(row) { - var materialName = $('#materialName' + row).val(); + var materialName = $('#materialName' + row).html(); var unconfirmedAmount = parseInt($('#unconfirmedAmount' + row).val(), 10); var errorAmount = parseInt($('#errorAmount' + row).html(), 10); if (materialName == '器械包标识牌' && !isEditIDCardError == 'false') { return; } else { if (errorAmount > 0) { - if (errorAmount == 1) { - $('#trIndex_' + row).removeClass(color); - } - deleteRemark(row, errorAmount, unconfirmedAmount); + $('#errorAmount' + row).html(errorAmount - 1); + $('#unconfirmedAmount' + row).val(unconfirmedAmount - 1) } } } @@ -63,85 +55,96 @@ } } -//获取备注信息 -function getRemarkInfos(row, errorAmount) { - var result = []; - if ($('#errorRemark_' + row).val() !== '' || $('#id' + row).val() !== '') { - result = [{ - materialDefinitionId: $('#materialDefinitionId' + row).val(), - tousseDefinitionId: tousseDefinitionID, - serialNumber: 1, - recyclingItemId: $('#recyclingItemId' + row).val(), - id: $('#id' + row).val(), - materialErrorDamageDetailId: $('#materialErrorDamageDetailId' + row).val(), - remarkInfo: $('#errorRemark_' + row).val() - }] - } - if (errorAmount > 1) { - for (var i = 2; i <= errorAmount; i++) { - if ($('#errorRemark_' + row + '_' + i).val() !== '' || $('#id' + row + '_' + i).val() !== '') { - result.push({ - materialDefinitionId: $('#materialDefinitionId' + row + '_' + i).val(), - tousseDefinitionId: tousseDefinitionID, - serialNumber: i, - recyclingItemId: $('#recyclingItemId' + row + '_' + i).val(), - id: $('#id' + row + '_' + i).val(), - materialErrorDamageDetailId: $('#materialErrorDamageDetailId' + row + '_' + i).val(), - remarkInfo: $('#errorRemark_' + row + '_' + i).val() - }) - } - } - } - return result -} - //保存 function submit() { + var isErrorExist = false; + var newJsonArray = new Array(); + var newDamageJsonArray = []; + + var recyclingErrorJson = window.parent.getTousseItemRecyclingError(row); + var recyclingDamageJson = window.parent.getTousseItemRecyclingDamage(row); + var isErrorAmountZero = true; + if (recyclingErrorJson != "") { + newJsonArray = JSON.parse(recyclingErrorJson); + } + if (recyclingDamageJson != "") { + newDamageJsonArray = JSON.parse(recyclingDamageJson); + } var length = $("#recyclingErrorTable tbody tr").length; - var newJsonArray = []; - var amountSum = 0; for (var i = 0; i < length; i++) { - var id = $("#recyclingErrorTable tbody tr").eq(i).attr('id'); - if (id.split('_').length == 2) { - var serialNumber = 0; - if (row.split('_').length == 1) { - serialNumber = parseInt(row); - } else { - serialNumber = parseInt(row.split('_')[1]); + if ($('#errorAmount' + i).html() != '0') { + isErrorExist = true; + isErrorAmountZero = false; + } + var amountSum = parseInt($('#errorAmount' + i).html()); + var errorCount = parseInt($('#errorCount' + i).val()); + var errorAmount = parseInt($('#errorAmount' + i).val()); + var unconfirmedAmount = parseInt($('#unconfirmedAmount' + i).val()); + var materialDefinitionId = $('#materialDefinitionId' + i).attr('value'); + var tousseBarcode = $('#tousseBarcode' + i).val(); + var materialName = $('#materialName' + i).attr('value'); + var errorType = $('#errorType' + i).val(); + var detailId = $('#detailId' + i).val(); + var amountPerTousse = $('#amountPerTousse' + i).val(); + var exist = false; + var newUnconfirmedAmount = 0; + var amountNotNull = false; + for (var j = 0; j < newJsonArray.length; j++) { + if (newJsonArray[j].materialDefinitionId == materialDefinitionId) { + newUnconfirmedAmount += newJsonArray[j].amount; } - var indexs = id.split('_'); - var errorAmount = $('#errorAmount' + indexs[1]).html(); - var materialDefinitionId = $('#materialDefinitionId' + indexs[1]).val(); - var tousseBarcode = $('#tousseBarcode' + indexs[1]).val(); - var materialName = $('#materialName' + indexs[1]).val(); - var detailId = $('#detailId' + indexs[1]).val(); + } + if (amountSum !== newUnconfirmedAmount) { var item = { - detailId: detailId, - tousseDefinitionID: tousseDefinitionID, - materialDefinitionId: materialDefinitionId, - lastTousseInstanceId: '', - itemType: itemType, - errorType: '缺失', + detailId: "", + tousseDefinitionID: parseInt(tousseDefinitionID), + materialDefinitionId: parseInt(materialDefinitionId), materialName: materialName, + errorType: errorType, + status: 2, tousseBarcode: tousseBarcode, - errorDamageQmKey: newErrorDamageQmKey, - amount: parseInt(errorAmount), - serialNumber: serialNumber, - materialRemark: getRemarkInfos(indexs[1], parseInt(errorAmount)) + amount: amountSum - newUnconfirmedAmount, + errorDamageQmKey: errorDamageQmKey, + unconfirmedAmount: 0, + intoBasketAmount: 0, + amountPerTousse: amountPerTousse }; - - if (parseInt(errorAmount) > 0) { - amountSum++; - } - newJsonArray.push(item); } } - if (windowType == 'recyclingError') { - window.parent.setTousseItemRecyclingError(row, JSON.stringify(newJsonArray), amountSum); + if (isErrorAmountZero && $("#errorRemark").val() != "") { + alert("填写了备注,请选择丢失的材料!"); + return; + } + var maxAmount = 0; + for (var i = 0; i < newJsonArray.length; i++) { + var materialName = newJsonArray[i].materialName; + if (materialName == '器械包标识牌') { + maxAmount += parseInt(newJsonArray[i].amount); + } + } + if (window.parent.isDeleteErrors(row, tousseDefinitionID, maxAmount)) { + alert('该物品已入筐,不能直接改小标识牌的丢失数量,请先将物品从篮筐中移除后再进行修改!'); + return; + } + if (isErrorExist) { + window.parent.document.getElementById('showTousseName' + row).className = 'input-a-yellow'; + window.parent.document.getElementById('recyclingErrorButton' + row).className = 'btn-b-edit'; } else { - window.parent.setTousseItemRecyclingDamage(row, JSON.stringify(newJsonArray), amountSum); + var sumAmount = 0; + if (newDamageJsonArray.length > 0) { + for (var i = 0; i < newDamageJsonArray.length; i++) { + sumAmount += newDamageJsonArray[i].amount; + } + } + if (sumAmount == 0) { + window.parent.document.getElementById('showTousseName' + row).className = 'input-a'; + } else { + window.parent.document.getElementById('showTousseName' + row).className = 'input-a-brown'; + } + window.parent.document.getElementById('recyclingErrorButton' + row).className = 'btn-b'; } + window.parent.setTousseItemRecyclingError(row, JSON.stringify(newJsonArray), $('#errorRemark').val()); closeLayer(); } @@ -151,7 +154,9 @@ var length = $("#recyclingErrorTable tbody tr").length; for (var i = 0; i < length; i++) { var amount = parseInt($('#errorAmount' + i).html()); - var materialName = $('#sourceMaterialName' + i).val(); + var materialDefinitionId = $('#materialDefinitionId' + i).attr('value'); + var tousseBarcode = $('#tousseBarcode' + i).val(); + var materialName = $('#sourceMaterialName' + i).attr('value'); var errorType = $('#errorType' + i).val(); if (amount > 0) { var item = { @@ -165,8 +170,8 @@ return retArray; } -// 添加质量监测记录 -function addQM() { +//获取窗口的大小 +function getWindowObj() { var width = 780; var height = 650; var designedTousseWidth = 1080; @@ -185,16 +190,31 @@ var size = calculateSizeAfterZoom(designedTousseWidth, designedTousseHeight, zoomRatio); width = size.width; - height = size.height; + height = size.height + heightExtra; offsetTop = offsetTop * zoomRatio; + + return { + width: width, + height: height, + offsetTop: offsetTop + } +} + +// 添加质量监测记录 +function addQM() { + var obj = getWindowObj(); + var width = obj.width; + var height = obj.height; + var offsetTop = obj.offsetTop; + var mMsg = getMaterialMsg(); parent.setMaterialMsg(mMsg); - var url = 'addQualityMonitoring.jsp?resolution=' + resolution + '&width=' + width + '&height=' + height + '&errorDamageQmKey=' + newErrorDamageQmKey + '&tousseName=' + tousseName + '&depart=' + depart + '&recyclingUser=' + recyclingUser + '&circuitNurse=' + circuitNurse + '&operationRoom=' + operationRoom + var url = 'addQualityMonitoring.jsp?resolution=' + resolution + '&width=' + width + '&height=' + height + '&errorDamageQmKey=' + errorDamageQmKey + '&tousseName=' + tousseName + '&depart=' + depart + '&recyclingUser=' + recyclingUser + '&circuitNurse=' + circuitNurse + '&operationRoom=' + operationRoom var index = parent.layer.open({ type: 2, title: ['添加质量监测记录', true], content: encodeURI(url), - area: [width + 'px', height + heightExtra + 'px'], + area: [width + 'px', height + 'px'], border: [5, 0.3, '#fff', true], closeBtn: [2, true], offset: [offsetTop + 'px', ''] @@ -240,146 +260,248 @@ }, type: 'image' // this is default type }); + }, + error: function (XMLHttpRequest, textStatus, errorThrown) { } }); } //创建节点 -function buildTableTR(item) { - var amontPerTousse = item.amontPerTousse; - var materialDefinitionId = item.materialDefinitionId; - var materialName = item.materialName; - var totalCount = item.totalCount; - var errorCount = parseInt(item.errorCount || 0); - var tousseBarcode = item.tousseBarcode; - var unconfirmedAmount = parseInt(item.unconfirmedAmount || 0); - var detailId = item.detailId; - var materialRemarks = item.materialRemarks; - +function buildTableTR(amontPerTousse, materialDefinitionId, materialName, totalCount, errorCount, tousseBarcode, unconfirmedAmount, detailId, status) { var i = $("#recyclingErrorTable tbody tr").length; var sourceMaterialName = materialName; if (tousseBarcode != "") { materialName += "
" + tousseBarcode; } - - var resultAmount = errorCount + unconfirmedAmount; - var trColor = (resultAmount == 0) ? '' : color; - var html = '' + errorCount = parseInt(errorCount || 0); + unconfirmedAmount = parseInt(unconfirmedAmount || 0); + var trColor = ((errorCount + unconfirmedAmount) == 0) ? '' : 'yellow'; + var html = '' + '' + '' + '' + '' + '' + '' + '' - + '' - + '' - + '' + + '' + '' + materialName + '' + '' + totalCount + '' - + '' + resultAmount + '' - + '+-' - + '' + + '' + + '
'; + if (param_errorType == '增加') { + html += ''; + } else if (param_errorType == '缺失') { + html += ''; + } else { + html += ''; + } + html += '
' + + '' + + '' + + (errorCount + unconfirmedAmount) + + '' + + '+-' + ''; var errorElement = $(html); $("#recyclingErrorTable").append(errorElement); - alertRemark('errorRemark_' + i); - for (var k = 1; k <= parseInt(resultAmount); k++) { - addRemark(i, k) +} + +var openElement; +var updateAmountIndex = null; +function openUpdateAmount(obj, row) { + obj.blur(); + var width = 550; + var height = 300; + if ('${param.resolution}' == '1980') { + width = 750; + height = 400; } - if (item.materialRemark) { - for (var m = 0; m < item.materialRemark.length; m++) { - var serialNumber = item.materialRemark[m].serialNumber; - if (serialNumber == 1) { - $('#errorRemark_' + i).val(item.materialRemark[m].remarkInfo); - $('#recyclingItemId' + i).val(item.materialRemark[m].recyclingItemId); - $('#materialErrorDamageDetailId' + i).val(item.materialRemark[m].materialErrorDamageDetailId); - $('#id' + i).val(item.materialRemark[m].id); + openElement = obj; + updateAmountIndex = layer.open({ + type: 2, + title: ['修改数量', true], + content: './updateAmount.jsp?from=errors&resolution=${param.resolution}&row=' + row, + area: [width + 'px', height + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: ['250px', ''] + }); +} + +function closeUpdateAmount() { + if (updateAmountIndex) { + layer.close(updateAmountIndex); + } +} + +function newArray(arr) { + var newArr = []; + var map = {}, dest = []; + var newArr2 = []; + var map2 = {}, dest2 = []; + for (var i = 0; i < arr.length; i++) { + var ai = arr[i]; + if (ai.status !== 2) { + newArr.push(arr[i]) + } else { + if (!map[ai.materialDefinitionId]) { + dest.push(ai); + map[ai.materialDefinitionId] = ai; } else { - $('#errorRemark_' + i + '_' + serialNumber).val(item.materialRemark[m].remarkInfo); - $('#recyclingItemId' + i + '_' + serialNumber).val(item.materialRemark[m].recyclingItemId); - $('#materialErrorDamageDetailId' + i + '_' + serialNumber).val(item.materialRemark[m].materialErrorDamageDetailId); - $('#id' + i + '_' + serialNumber).val(item.materialRemark[m].id); + for (var j = 0; j < dest.length; j++) { + var dj = dest[j]; + if (dj.materialDefinitionId == ai.materialDefinitionId) { + var amount = parseInt(ai.amount); + dj.amount += amount; + } + } } } } + for (var i = 0; i < newArr.length; i++) { + var ai = newArr[i]; + if (!map2[ai.materialDefinitionId]) { + dest2.push(ai); + map2[ai.materialDefinitionId] = ai; + } else { + for (var j = 0; j < dest2.length; j++) { + var dj = dest2[j]; + if (dj.materialDefinitionId == ai.materialDefinitionId) { + var amount = parseInt(ai.amount); + dj.amount += amount; + } + } + } + } + for (var i = 0, k = 0; i < dest.length; i++) { + if (dest[i].amount !== 0) { + newArr2[k] = dest[i]; + k++ + } + } + for (var i = 0; i < dest2.length; i++) { + for (var j = 0; j < newArr2.length; j++) { + if (dest2[i].materialDefinitionId == newArr2[j].materialDefinitionId) { + dest2[i].unconfirmedAmount += newArr2[j].amount; + newArr2.splice(j, 1); + } + } + } + dest2 = dest2.concat(newArr2); + return dest2; } -//增加数量时添加备注 -function addRemark(row, resultAmount) { - if (resultAmount == 1) { - $('#errorRemark_' + row).show(); +function closeErrorWin(returnValue) { + if (returnValue == '') { return; } - var i = row + '_' + resultAmount; - var amountPerTousse = $('#amountPerTousse' + row).val(); - var materialDefinitionId = $('#materialDefinitionId' + row).val(); - var tousseBarcode = $('#tousseBarcode' + row).val(); - var sourceMaterialName = $('#sourceMaterialName' + row).val(); - var materialName = $('#materialName' + row).val(); - var errorCount = $('#errorCount' + row).val(); - var unconfirmedAmount = $('#unconfirmedAmount' + row).val(); - var detailId = $('#detailId' + row).val(); - errorCount = parseInt(errorCount || 0); - unconfirmedAmount = parseInt(unconfirmedAmount || 0); - var html = '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + ''; - var errorElement = $(html); - if (resultAmount == 2) { - $("#trIndex_" + row).after(errorElement); - } else if (resultAmount > 2) { - $("#trIndex_" + row + '_' + (resultAmount - 1)).after(errorElement); + if (!isUndefinedOrNullOrEmpty(returnValue)) { + $('#errorRemark').val(returnValue); + } else if (returnValue == "") { + $('#errorRemark').val(""); } - alertRemark('errorRemark_' + i); + + layer.close(errorIndex); } -//减少数量时删除备注 -function deleteRemark(row, resultAmount, unconfirmedAmount) { - if (resultAmount == 1) { - $('#errorRemark_' + row).hide(); - $('#errorAmount' + row).html(resultAmount - 1); - $('#unconfirmedAmount' + row).val(unconfirmedAmount - 1); - } else { - if ($('#errorRemark_' + row + '_' + resultAmount).val() == '') { - $('#trIndex_' + row + '_' + resultAmount).remove(); - $('#errorAmount' + row).html(resultAmount - 1); - $('#unconfirmedAmount' + row).val(unconfirmedAmount - 1); - } else { - alert('最后一个备注框已经填写了内容,不允许减少,请删除备注内容后再操作!') - return +var selects = null; +var errorIndex = null; +$(document).ready(function () { + $.ajax({ + type: 'post', + url: WWWROOT + '/disinfectSystem/recyclingRecordAction!getRecyclingErrorJson.do', + data: { tousseDefinitionID: tousseDefinitionID, tousseAmount: tousseCount, type: 'recyclingError' }, + dataType: 'json', + success: function (msg) { + var recyclingErrorJson = window.parent.getTousseItemRecyclingError(row); + var json = []; + if (recyclingErrorJson != "") { + json = JSON.parse(recyclingErrorJson); + json = newArray(json); + } + for (var i = 0; i < msg.length; i++) { + //缺失数量 + var errorCount = 0; + var unconfirmedAmount = 0; + //有丢失的器械包数量 + var totalCount = msg[i].totalCount; + for (var j = 0; j < json.length; j++) { + if (msg[i].materialDefinitionId == json[j].materialDefinitionId) { + if (json[j].tousseBarcode != "" || json[j].status == 0) { + buildTableTR(msg[i].amontPerTousse, msg[i].materialDefinitionId, msg[i].name, totalCount, json[j].amount, json[j].tousseBarcode, json[j].unconfirmedAmount, json[j].id, json[j].status); + totalCount = 0; + } else { + errorCount += json[j].amount; + unconfirmedAmount += json[j].unconfirmedAmount; + } + } + } + if (totalCount > 0) { + buildTableTR(msg[i].amontPerTousse, msg[i].materialDefinitionId, msg[i].name, totalCount, errorCount, "", unconfirmedAmount, '', 2); + } + } + selects = document.getElementsByTagName('select'); + rSelects(); + bodyclick = document.getElementsByTagName('body').item(0); + bodyclick.onclick = function () { + for (i = 0; i < selects.length; i++) { + document.getElementById('select_info_' + selects[i].name).className = 'tag_select'; + document.getElementById('options_' + selects[i].name).style.display = 'none'; + } + }; + }, + error: function () { } - } -} + }); + //实现对字符码的截获,keypress中屏蔽了这些功能按键 + document.onkeypress = banBackSpace; + //对功能按键的获取 + document.onkeydown = banBackSpace; + //触发备注事件 + $('#errorRemark').click(function () { + if (params_recordType != 'history') { + var width = document.body.clientWidth - 100; + var height = document.body.clientHeight - 100; + var offsetTop = 50; -//触发弹出备注的事件 -function alertRemark(remarkId) { - document.getElementById(remarkId).addEventListener('click', function () { - if (recordType != 'history1') { + var url = WWWROOT + '/disinfectsystem/recyclingApplication/selectEndCause.jsp?time=' + new Date().getTime() + '&optionType=error'; + errorIndex = layer.open({ + type: 2, + title: ['丢失备注', true], + content: url, + area: [width + 'px', height + 'px'], + border: [5, 0.3, '#fff', true], + closeBtn: [2, true], + offset: [offsetTop + 'px', ''] + }); + return var params = { time: new Date().getTime(), - optionType: optionType + optionType: 'error' } - var endCase = openModalWindow(WWWROOT + "/disinfectsystem/recyclingApplication/selectEndCause.jsp", params, title, "760", "400"); + + var endCase = openModalWindow(WWWROOT + "/disinfectsystem/recyclingApplication/selectEndCause.jsp", params, "选择报损备注", "760", "400"); + if (endCase == undefined) { return; } else { @@ -389,72 +511,22 @@ var returnValue = endCase.returnValue || ''; + if (returnValue == '') { + return; + } + if (!isUndefinedOrNullOrEmpty(returnValue)) { - document.getElementById(remarkId).value = returnValue; + $('#errorRemark').val(returnValue); } else if (returnValue == "") { - document.getElementById(remarkId).value = ''; + $('#errorRemark').val(""); } } }, 500); } } - }) -} - -$(document).ready(function () { - $.ajax({ - type: 'post', - url: WWWROOT + '/disinfectSystem/recyclingRecordAction!getRecyclingErrorJson.do', - data: { tousseDefinitionID: tousseDefinitionID, tousseAmount: tousseCount, type: windowType }, - dataType: 'json', - success: function (msg) { - var errorJson = window.parent.getTousseItemRecyclingError(row); - if (windowType == 'recyclingDamage') { - errorJson = window.parent.getTousseItemRecyclingDamage(row); - } - var json = {}; - if (errorJson !== '') { - json = JSON.parse(errorJson); - } - for (var i = 0; i < msg.length; i++) { - var amontPerTousse = msg[i].amontPerTousse; - var errorCount = msg[i].errorCount; - var id = msg[i].id; - var materialDefinitionId = msg[i].materialDefinitionId; - var name = msg[i].name; - var totalCount = msg[i].totalCount; - var params = { - amontPerTousse: amontPerTousse, - materialDefinitionId: materialDefinitionId, - materialName: name, - totalCount: totalCount, - errorCount: errorCount, - tousseBarcode: '', - unconfirmedAmount: 0, - detailId: id - } - for (var j = 0; j < json.length; j++) { - if (json[j].materialName == name) { - params = { - amontPerTousse: '', - materialDefinitionId: json[j].materialDefinitionId, - materialName: json[j].materialName, - totalCount: totalCount, - errorCount: json[j].amount, - tousseBarcode: '', - unconfirmedAmount: 0, - detailId: json[j].detailId, - materialRemark: json[j].materialRemark - } - } - } - - buildTableTR(params); - } - } }); - //实现对字符码的截获,keypress中屏蔽了这些功能按键 - document.onkeypress = banBackSpace; - //对功能按键的获取 - document.onkeydown = banBackSpace; + if (!sstsConfig.enableRecycleMaterialErrorDamageRemark) { + $('#errorRemarkBox').hide(); + } + $('#errorRemark').val(errorRemark); }); \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recyclingErrors.jsp =================================================================== diff -u -r32910 -r32949 --- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recyclingErrors.jsp (.../recyclingErrors.jsp) (revision 32910) +++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recyclingErrors.jsp (.../recyclingErrors.jsp) (revision 32949) @@ -51,487 +51,12 @@ var operationRoom = '${param.operationRoom}'; //动态加载JS和CSS document.write(''); - - function add(row) { - var materialName = $('#materialName' + row).html(); - var errorAmount = parseInt($('#errorAmount' + row).html(), 10) - var errorCount = parseInt($('#errorCount' + row).val()); - var unconfirmedAmount = $('#unconfirmedAmount' + row).val(); - //编辑回收记录时不允许修改标志牌丢失数量 - if(materialName == '器械包标识牌' && isEditIDCardError == 'false'){ - return; - }else{ - var totalCount = parseInt($('#totalCount' + row).html(), 10); - if (errorAmount < totalCount) { - $('#errorAmount' + row).html(parseInt($('#errorAmount' + row).html(), 10) + 1); - $('#unconfirmedAmount'+row).val(errorAmount-errorCount); - } - } - - } - - function reduce(row) { - var materialName = $('#materialName' + row).html(); - var errorCount = parseInt($('#errorCount' + row).val(),10); - var unconfirmedAmount = parseInt($('#unconfirmedAmount' + row).val(),10); - var errorAmount = parseInt($('#errorAmount' + row).html(), 10); - var status = parseInt($('#status' + row).val(),10); - if(materialName == '器械包标识牌' && !isEditIDCardError == 'false'){ - return; - }else{ - var totalCount = parseInt($('#totalCount' + row).html(), 10); - if(errorAmount > 0){ - $('#errorAmount' + row).html(errorAmount - 1); - $('#unconfirmedAmount'+row).val(unconfirmedAmount - 1) - } - } - } - - function closeLayer() { - if(typeof(LAYER) != 'undefined'){ - var layerIndex = LAYER.getFrameIndex(); - if(layerIndex){ - LAYER.close(layerIndex); - return; - } - } - - if(typeof parent.closeLayer == 'function'){ - //统一到父窗口 - parent.closeLayer(); - }else if(parent.LAYER){ - //layer库1.4版本的 - var index = parent.LAYER.getFrameIndex(); - parent.LAYER.close(index); - }else if(parent.layer){ - //新版本的layer库 - var index = parent.layer.getFrameIndex(window.name); - parent.layer.close(index); - } - } - - function newArray(arr){ - var newArr = []; - var map = {},dest = []; - var newArr2 = []; - var map2 = {},dest2 = []; - for(var i = 0; i < arr.length; i++){ - var ai = arr[i]; - if(ai.status !== 2){ - newArr.push(arr[i]) - }else { - if(!map[ai.materialDefinitionId]){ - dest.push(ai); - map[ai.materialDefinitionId] = ai; - }else { - for(var j = 0; j < dest.length; j++){ - var dj = dest[j]; - if(dj.materialDefinitionId == ai.materialDefinitionId){ - var amount = parseInt(ai.amount); - dj.amount += amount; - } - } - } - } - } - for(var i = 0; i < newArr.length; i++){ - var ai = newArr[i]; - if(!map2[ai.materialDefinitionId]){ - dest2.push(ai); - map2[ai.materialDefinitionId] = ai; - }else { - for(var j = 0; j < dest2.length; j++){ - var dj = dest2[j]; - if(dj.materialDefinitionId == ai.materialDefinitionId){ - var amount = parseInt(ai.amount); - dj.amount += amount; - } - } - } - } - for(var i=0,k=0;i 0){ - for(var i=0;i 0){ - var item = { - materialName: materialName, - amount: amount, - errorType: errorType - }; - retArray.push(item); - } - } - return retArray; - } - // 添加质量监测记录 - function addQM(){ - - var width = 780; - var height = 650; - var designedTousseWidth = 1080; - var designedTousseHeight = 770; - var designedWidth = 1920; - var designedHeight = 1080; - var actualWidth = window.screen.availWidth; - var actualHeight = window.screen.availHeight; - var offsetTop = 100; - var heightExtra = 10; - if(resolution == '1980'){ - width = 1380; - height = 830; - } - var zoomRatio = calculateZoomRatio(designedWidth,designedHeight,actualWidth,actualHeight); - var size = calculateSizeAfterZoom(designedTousseWidth,designedTousseHeight,zoomRatio); - - width = size.width; - height = size.height; - offsetTop = offsetTop*zoomRatio; - var mMsg = getMaterialMsg(); - parent.setMaterialMsg(mMsg); - var url = 'addQualityMonitoring.jsp?resolution='+resolution+'&width='+width+'&height='+height+'&errorDamageQmKey='+errorDamageQmKey+'&tousseName='+tousseName+'&depart='+depart+'&recyclingUser='+recyclingUser+'&circuitNurse='+circuitNurse+'&operationRoom='+operationRoom - var index= parent.layer.open({ - type : 2, - title : ['添加质量监测记录',true], - content : encodeURI(url), - area : [ width + 'px' , height +heightExtra+ 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : [offsetTop+'px',''] - }); - parent.setQmLayerIndex(index); - } - function openMaterialImage(materialName,materialDefinitionId) { - $.ajax({ - type : 'get', - url : WWWROOT + '/disinfectSystem/baseData/materialDefinitionAction!getMaterialPictureAmount.do', - data : 'name=' + encodeURIComponent(materialName), - dataType : 'text', - success : function(msg) { - var amount = parseInt(msg, 10); - var items = new Array(); - if(amount <= 0){ - items.push({ - src : 'tousseImage.jsp?materialName=' + encodeURIComponent(materialName) + '&materialDefinitionId=' + materialDefinitionId + "&number=" + 1, - type : 'iframe' - }); - }else{ - for ( var i = 0; i < amount; i++) { - items.push({ - src : 'tousseImage.jsp?materialName=' + encodeURIComponent(materialName) + '&materialDefinitionId=' + materialDefinitionId + "&number=" + (i+1), - type : 'iframe' - }); - } - } - - window.parent.$.magnificPopup.open({ - items : items, - mainClass : 'materialPicClass', - tClose: '关闭(Esc)', - gallery : { - enabled : true, - tPrev: '上一页 (左箭头)', // Alt text on left arrow - tNext: '下一页 (右箭头)' - }, - image : { - verticalFit : true - }, - type : 'image' // this is default type - }); - }, - error : function(XMLHttpRequest, textStatus, errorThrown) { - } - }); - } - - function buildTableTR(amontPerTousse,materialDefinitionId,materialName,totalCount,errorCount,tousseBarcode,unconfirmedAmount,detailId,status){ - var i = $("#recyclingErrorTable tbody tr").length; - var sourceMaterialName = materialName; - if(tousseBarcode != ""){ - materialName += "
" + tousseBarcode; - } - errorCount = parseInt(errorCount || 0); - unconfirmedAmount = parseInt(unconfirmedAmount || 0); - var trColor = ((errorCount+unconfirmedAmount) == 0)?'':'yellow'; - var html = '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' - + '' + materialName + '' - + '' + totalCount + '' - + '' - + '
'; - if(param_errorType == '增加'){ - html += ''; - }else if(param_errorType == '缺失'){ - html += ''; - }else { - html += ''; - } - html += '
' - + '' - + '' - + (errorCount+unconfirmedAmount) - + '' - + '+-' - + ''; - - var errorElement = $(html); - $("#recyclingErrorTable").append(errorElement); - } - //打开编辑数量页面 - var openElement; - var updateAmountIndex = null; - function openUpdateAmount(obj,row){ - obj.blur(); - var width = 550; - var height = 300; - if('${param.resolution}' == '1980'){ - width = 750; - height = 400; - } - openElement = obj; - updateAmountIndex = layer.open({ - type : 2, - title : ['修改数量',true], - content : './updateAmount.jsp?from=errors&resolution=${param.resolution}&row='+row, - area : [width + 'px' , height + 'px'], - border : [5, 0.3, '#fff', true], - closeBtn : [2 , true], - offset : ['250px',''] - }); - } - function closeUpdateAmount(){ - if(updateAmountIndex){ - layer.close(updateAmountIndex); - } - } - var selects = null; - $(document).ready(function() { - $.ajax({ - type : 'post', - url : WWWROOT + '/disinfectSystem/recyclingRecordAction!getRecyclingErrorJson.do', - data : {tousseDefinitionID : tousseDefinitionID,tousseAmount : tousseCount,type : 'recyclingError'}, - dataType : 'json', - success : function(msg) { - var recyclingErrorJson = window.parent.getTousseItemRecyclingError(row); - var json = []; - if(recyclingErrorJson != ""){ - json = JSON.parse(recyclingErrorJson); - json = newArray(json); - } - for ( var i = 0; i < msg.length; i++) { - //缺失数量 - var errorCount = 0; - var unconfirmedAmount = 0; - //有丢失的器械包数量 - var totalCount = msg[i].totalCount; - for ( var j = 0; j < json.length; j++) { - if (msg[i].materialDefinitionId == json[j].materialDefinitionId) { - if(json[j].tousseBarcode != "" || json[j].status == 0){ - buildTableTR(msg[i].amontPerTousse,msg[i].materialDefinitionId,msg[i].name,totalCount,json[j].amount,json[j].tousseBarcode,json[j].unconfirmedAmount,json[j].id,json[j].status); - totalCount = 0; - }else{ - errorCount += json[j].amount; - unconfirmedAmount += json[j].unconfirmedAmount; - } - } - } - if(totalCount > 0){ - buildTableTR(msg[i].amontPerTousse,msg[i].materialDefinitionId,msg[i].name,totalCount,errorCount,"",unconfirmedAmount,'',2); - } - } - selects = document.getElementsByTagName('select'); - rSelects(); - bodyclick = document.getElementsByTagName('body').item(0); - bodyclick.onclick = function() { - for (i = 0; i < selects.length; i++) { - document.getElementById('select_info_' + selects[i].name).className = 'tag_select'; - document.getElementById('options_' + selects[i].name).style.display = 'none'; - } - }; - }, - error : function() { - } - }); - $('#errorRemark').val(errorRemark); - if(!sstsConfig.enableRecycleMaterialErrorDamageRemark){ - $('#errorRemarkBox').hide(); - } - //实现对字符码的截获,keypress中屏蔽了这些功能按键 - document.onkeypress = banBackSpace; - //对功能按键的获取 - document.onkeydown = banBackSpace; - $('#errorRemark').click(function(){ - if(params_recordType != 'history'){ - var params = { - time:new Date().getTime(), - optionType:'error' - } - - var endCase = openModalWindow(WWWROOT+"/disinfectsystem/recyclingApplication/selectEndCause.jsp",params, "选择报损备注", "760", "400"); - - if(endCase == undefined){ - return; - }else { - var loop = setInterval(function() { - if(endCase.hidden) { - clearInterval(loop); - - var returnValue = endCase.returnValue || ''; - - if(returnValue == ''){ - return; - } - - if(!isUndefinedOrNullOrEmpty(returnValue)){ - $('#errorRemark').val(returnValue); - }else if(returnValue == ""){ - $('#errorRemark').val(""); - } - } - },500); - } - } - }); - + layer.config({ + extend: 'myskin/style.css', //加载您的扩展样式 + skin: 'layer-ext-myskin' }); +