diff --git a/src/main/resources/sql/mapper/adds/nims/dsuseMgtRslt-mapper.xml b/src/main/resources/sql/mapper/adds/nims/dsuseMgtRslt-mapper.xml index cacd758..cb34202 100644 --- a/src/main/resources/sql/mapper/adds/nims/dsuseMgtRslt-mapper.xml +++ b/src/main/resources/sql/mapper/adds/nims/dsuseMgtRslt-mapper.xml @@ -10,13 +10,13 @@ , tdm.DSUSE_MTH_CD , tcc.CODE_VAL AS DSUSE_MTH_NM , tdm.DSUSE_DE - , IF(#{dscdmngId} = tdm.DSCDMNG_ID, 'Y', 'N') AS SEL_YN - , (SELECT count(dscdmng_id) - FROM tb_dsuse_mgt - WHERE use_yn = 'Y' + , IF(#{dscdmngId} = tdm.DSCDMNG_ID, 'Y', 'N') AS SELF_YN + , (SELECT GROUP_CONCAT(dscdmng_id SEPARATOR ',') + FROM tb_dsuse_mgt + WHERE use_yn = 'Y' AND dept_cd = #{deptCd} AND dsuse_mth_cd = #{dsuseMthCd} - AND dsuse_de = #{dsuseDe}) AS SAVE_CNT + AND dsuse_de = #{dsuseDe}) AS DSCDMNG_IDS FROM tb_dsuse_mgt tdm JOIN tb_cmn_code tcc ON (tdm.dsuse_mth_cd = tcc.code diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtRslt-info.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtRslt-info.jsp index 3f0bae3..3bf8d6a 100644 --- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtRslt-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtRslt-info.jsp @@ -183,19 +183,23 @@ */ const fnRsltImgList = (list, isOnload) => { // onload시 이미지가 있는지 여부 체크 - if(isOnload) isOnloadExistRsltImg = list.length > 0; + if(isOnload) isOnloadExistRsltImg = list[0].SELF_YN === 'Y'; if(!list || list.length === 0) return; // 폐기결과 이미지를 등록한 폐기관리 ID면 skip - 이미지 추가 삭제 가능 - let isSelf = list.filter(item => item.SEL_YN == 'Y') + let isSelf = list.filter(item => item.SELF_YN === 'Y') if(isSelf.length > 0){ // 등록된 폐기 관리가 2개 이상이면 폐기일자, 폐기방법 변경 불가 - if(list[0].SAVE_CNT > 1){ + let dscnmngIds = list[0].DSCDMNG_IDS.split(','); + if(dscnmngIds.length > 1){ $('#dsuseDe--${pageName}').prop('disabled', true); $('#dsuseMthCd--${pageName}').prop('disabled', true); $('#spnDsuseDe').show(); $('#spnDsuseMthCd').show(); + + + document.getElementById("rsltImgList").innerHTML = '총 ' + dscnmngIds.length + '건 에서 이미지 공유
이미지 공유 폐기관리번호 : [' + dscnmngIds.filter(item => item != $("#dscdmngId--${pageName}").val()).join(', ') + ']'; } return; } @@ -207,7 +211,7 @@ for(let idx = 0; idx < list.length; idx++){ let item = list[idx]; - tagsTextArr.push('폐기관리번호 : [ ' + item.DSCDMNG_ID + ' ]
폐기일자 : [ ' + item.DSUSE_DE + ' ] 폐기방법 : [ ' + item.DSUSE_MTH_NM + ' ] 의 폐기 이미지 공유(사용)'); + tagsTextArr.push('폐기관리번호 : [ ' + item.DSCDMNG_ID + ' ]
폐기일자 : [ ' + item.DSUSE_DE + ' ] 폐기방법 : [ ' + item.DSUSE_MTH_NM + ' ] 의 폐기 이미지 공유'); } document.getElementById("rsltImgList").innerHTML = tagsTextArr.join(""); if(isOnloadExistRsltImg && list.length > 0) isRsltImgRemove = true;