Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recyclingErrors.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recyclingErrors.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/recyclingErrors.js (revision 31023) @@ -0,0 +1,460 @@ +//增加数量 +function add(row) { + var materialName = $('#materialName' + row).val(); + 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); + $('#unconfirmedAmount' + row).val(errorAmount - errorCount); + //添加一个备注记录 + addRemark(row, resultAmount); + } + } +} + +//减少数量 +function reduce(row) { + var materialName = $('#materialName' + row).val(); + 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); + } + } +} + +//关闭窗口 +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 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 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]); + } + 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(); + var item = { + detailId: detailId, + tousseDefinitionID: tousseDefinitionID, + materialDefinitionId: materialDefinitionId, + lastTousseInstanceId: '', + itemType: itemType, + errorType: '缺失', + materialName: materialName, + tousseBarcode: tousseBarcode, + errorDamageQmKey: newErrorDamageQmKey, + amount: parseInt(errorAmount), + serialNumber: serialNumber, + materialRemark: getRemarkInfos(indexs[1], parseInt(errorAmount)) + }; + + if (parseInt(errorAmount) > 0) { + amountSum++; + } + + newJsonArray.push(item); + } + } + if (windowType == 'recyclingError') { + window.parent.setTousseItemRecyclingError(row, JSON.stringify(newJsonArray), amountSum); + } else { + window.parent.setTousseItemRecyclingDamage(row, JSON.stringify(newJsonArray), amountSum); + } + closeLayer(); +} + +// 获取丢失的材料信息,添加质量监测用 +function getMaterialMsg() { + var retArray = new Array(); + 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 errorType = $('#errorType' + i).val(); + if (amount > 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=' + newErrorDamageQmKey + '&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 + }); + } + }); +} + +//创建节点 +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; + + var i = $("#recyclingErrorTable tbody tr").length; + var sourceMaterialName = materialName; + if (tousseBarcode != "") { + materialName += "
" + tousseBarcode; + } + + var resultAmount = errorCount + unconfirmedAmount; + var trColor = (resultAmount == 0) ? '' : color; + var html = '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + materialName + '' + + '' + totalCount + '' + + '' + resultAmount + '' + + '+-' + + '' + + ''; + + var errorElement = $(html); + $("#recyclingErrorTable").append(errorElement); + alertRemark('errorRemark_' + i); + for (var k = 1; k <= parseInt(resultAmount); k++) { + addRemark(i, k) + } + 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); + } 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); + } + } + } +} + +//增加数量时添加备注 +function addRemark(row, resultAmount) { + if (resultAmount == 1) { + $('#errorRemark_' + row).show(); + 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); + } + alertRemark('errorRemark_' + i); +} + +//减少数量时删除备注 +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 + } + } +} + +//触发弹出备注的事件 +function alertRemark(remarkId) { + document.getElementById(remarkId).addEventListener('click', function () { + if (recordType != 'history1') { + var params = { + time: new Date().getTime(), + optionType: optionType + } + + var endCase = openModalWindow(WWWROOT + "/disinfectsystem/recyclingApplication/selectEndCause.jsp", params, title, "760", "400"); + + if (endCase == undefined) { + return; + } else { + var loop = setInterval(function () { + if (endCase.hidden) { + clearInterval(loop); + + var returnValue = endCase.returnValue || ''; + + if (!isUndefinedOrNullOrEmpty(returnValue)) { + document.getElementById(remarkId).value = returnValue; + } else if (returnValue == "") { + document.getElementById(remarkId).value = ''; + } + } + }, 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; +}); \ No newline at end of file Index: ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/addTousse.jsp =================================================================== diff -u -r30999 -r31023 --- ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/addTousse.jsp (.../addTousse.jsp) (revision 30999) +++ ssts-web/src/main/webapp/disinfectsystem/touchScreen/recycle/addTousse.jsp (.../addTousse.jsp) (revision 31023) @@ -132,7 +132,7 @@ function searchTousse(sign,pages,amount) { var appCode = '<%=request.getParameter("appCode") %>'; var tousseType = '<%=request.getParameter("tousseType") %>'; - var newRousseType = (tousseType == '消毒物品申请单')?'消毒物品':''; + var newTousseType = (tousseType == '消毒物品申请单')?'消毒物品':''; if(b) { return false; } @@ -147,7 +147,7 @@ inputObj.value = inputValue + sign; b=false; if(inputObj.value != null && inputObj.value != ''){ - TousseDefinitionTableManager.getInsideTousseAndDiposableGoods(inputObj.value,pages,amount,appCode,newRousseType,function(result){ + TousseDefinitionTableManager.getInsideTousseAndDiposableGoods(inputObj.value,pages,amount,appCode,newTousseType,function(result){ if(result != null && result.length > 0){ var tousseArray = JSON.parse(result); var htmlResultCode = "