From 76e1260818efb967d6aeb9fc09018b46cb5089e1 Mon Sep 17 00:00:00 2001 From: sjh88 Date: Mon, 6 Feb 2023 18:06:20 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=A7=A4=ED=81=AC=EB=A1=9C=20=EB=AC=B8?= =?UTF-8?q?=EC=9E=90=20=EA=B8=B0=EB=8A=A5=20=EB=B0=8F=20=EB=AF=B8=EB=A6=AC?= =?UTF-8?q?=EB=B3=B4=EA=B8=B0=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../biz/cmm/service/CmmAnsTmplService.java | 6 +- .../biz/cmm/web/CmmAnsTmplController.java | 11 +- .../cmm/cmm-ansTmpl-mysql-mapper.xml | 2 +- .../biz/cmm/answer/cmmAnsTmplForm.jsp | 4 +- .../biz/cmm/answer/cmmAnsTmplPopup.jsp | 184 +++++++++++++++--- 5 files changed, 174 insertions(+), 33 deletions(-) diff --git a/src/main/java/kr/xit/framework/biz/cmm/service/CmmAnsTmplService.java b/src/main/java/kr/xit/framework/biz/cmm/service/CmmAnsTmplService.java index 27ee03d4..36833bae 100644 --- a/src/main/java/kr/xit/framework/biz/cmm/service/CmmAnsTmplService.java +++ b/src/main/java/kr/xit/framework/biz/cmm/service/CmmAnsTmplService.java @@ -43,7 +43,7 @@ public class CmmAnsTmplService implements ICmmAnsTmplService { RowBounds rowBounds = new RowBounds(); Map paraMap = new HashMap<>(); paraMap.put("tmplatId", dto.getTmplatId()); - if(mapper.selectCmmAnsTmplList(paraMap, rowBounds).size() == 0){ + if(mapper.selectCmmAnsTmplList(paraMap, rowBounds).size() == 0 && "FIM028".equals(dto.getAnswerSeCode())){ mapper.insertCmmAnsTmpl(dto); } } @@ -54,7 +54,9 @@ public class CmmAnsTmplService implements ICmmAnsTmplService { @Transactional public void modifyCmmAnsTmpl(final CmmAnsTmplDTO.CmmAnsTmplDtl dto) { dto.setChanger(getUserUniqId()); - mapper.updateCmmAnsTmpl(dto); + if ("FIM028".equals(dto.getAnswerSeCode())){ + mapper.updateCmmAnsTmpl(dto); + } mapper.updateCmmAnsTmplDtl(dto); } } diff --git a/src/main/java/kr/xit/framework/biz/cmm/web/CmmAnsTmplController.java b/src/main/java/kr/xit/framework/biz/cmm/web/CmmAnsTmplController.java index ea8192fc..c5cd8780 100644 --- a/src/main/java/kr/xit/framework/biz/cmm/web/CmmAnsTmplController.java +++ b/src/main/java/kr/xit/framework/biz/cmm/web/CmmAnsTmplController.java @@ -37,8 +37,9 @@ public class CmmAnsTmplController { public ModelAndView cmmAnsTmplForm() { ModelAndView mav = new ModelAndView(); mav.addObject("codeList23", CacheServiceUtils.getComboCodes("FIM023", null)); //답변템플릿ID - mav.addObject("codeList21", CacheServiceUtils.getComboCodes("FIM021", null)); //서손 + mav.addObject("codeList28", CacheServiceUtils.getComboCodes("FIM028", null)); //부과 답변 mav.addObject("codeList25", CacheServiceUtils.getComboCodes("FIM025", null)); //계도 + mav.addObject("codeList21", CacheServiceUtils.getComboCodes("FIM021", null)); //서손 return mav; } @@ -50,14 +51,16 @@ public class CmmAnsTmplController { mav.addObject("cmmAnsTmpl", service.findCmmAnsTmpl(dto)); mav.addObject("pageTitle", "공통 답변 템플릿 변경"); mav.addObject("codeList23", CacheServiceUtils.getComboCodes("FIM023", null)); //답변템플릿ID - mav.addObject("codeList21", CacheServiceUtils.getComboCodes("FIM021", null)); //서손 + mav.addObject("codeList28", CacheServiceUtils.getComboCodes("FIM028", null)); //부과 답변 mav.addObject("codeList25", CacheServiceUtils.getComboCodes("FIM025", null)); //계도 + mav.addObject("codeList21", CacheServiceUtils.getComboCodes("FIM021", null)); //서손 } else { mav.addObject("cmmAnsTmpl", dto); mav.addObject("pageTitle", "공통 답변 템플릿 등록"); - mav.addObject("codeList23", service.findComboCodes("FIM023")); //서손 - mav.addObject("codeList21", service.findComboCodes("FIM021")); //서손 + mav.addObject("codeList23", service.findComboCodes("FIM023")); //답변템플릿ID + mav.addObject("codeList28", service.findComboCodes("FIM028")); //부과 답변 mav.addObject("codeList25", service.findComboCodes("FIM025")); //계도 + mav.addObject("codeList21", service.findComboCodes("FIM021")); //서손 } mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + "cmm/answer/cmmAnsTmplPopup.popup"); return mav; diff --git a/src/main/resources/sqlmapper/framework/cmm/cmm-ansTmpl-mysql-mapper.xml b/src/main/resources/sqlmapper/framework/cmm/cmm-ansTmpl-mysql-mapper.xml index 3380198f..bd4134a3 100644 --- a/src/main/resources/sqlmapper/framework/cmm/cmm-ansTmpl-mysql-mapper.xml +++ b/src/main/resources/sqlmapper/framework/cmm/cmm-ansTmpl-mysql-mapper.xml @@ -37,7 +37,7 @@ FROM xit_cmmn_code xcc LEFT JOIN xit_cmmn_detail_code xcdc ON xcc.code_id = xcdc.code_id - WHERE xcc.code_id IN ( 'FIM025', 'FIM021') + WHERE xcc.code_id IN ( 'FIM028', 'FIM025', 'FIM021') ) cdc ON tcatd.answer_se_code = cdc.code_id AND tcatd.resn_code = cdc.code diff --git a/src/main/webapp/WEB-INF/jsp/framework/biz/cmm/answer/cmmAnsTmplForm.jsp b/src/main/webapp/WEB-INF/jsp/framework/biz/cmm/answer/cmmAnsTmplForm.jsp index 2ddf36fd..3f6f9fc4 100644 --- a/src/main/webapp/WEB-INF/jsp/framework/biz/cmm/answer/cmmAnsTmplForm.jsp +++ b/src/main/webapp/WEB-INF/jsp/framework/biz/cmm/answer/cmmAnsTmplForm.jsp @@ -86,7 +86,7 @@ ,pagePopup: function(flag, params){ let url = frwkApiUrl.POPUP_ANS_TMPLS; let popTitle; - let popOption = {width: 950, height:550}; + let popOption = {width: 950, height:600}; switch (flag) { case "add": //등록 popTitle = "공통 답변 템플릿 등록"; @@ -168,7 +168,7 @@ options: { formatter: (props) => { return { - formatter: props.grid.getRow(props.rowKey).tmplatNm + formatter: props.grid.getRow(props.rowKey).tmplatNm + "-" + props.grid.getRow(props.rowKey).answerSeCodeNm + "-" + props.grid.getRow(props.rowKey).resnCodeNm ,element : "text" } } diff --git a/src/main/webapp/WEB-INF/jsp/framework/biz/cmm/answer/cmmAnsTmplPopup.jsp b/src/main/webapp/WEB-INF/jsp/framework/biz/cmm/answer/cmmAnsTmplPopup.jsp index bf431980..89c4e86b 100644 --- a/src/main/webapp/WEB-INF/jsp/framework/biz/cmm/answer/cmmAnsTmplPopup.jsp +++ b/src/main/webapp/WEB-INF/jsp/framework/biz/cmm/answer/cmmAnsTmplPopup.jsp @@ -63,21 +63,22 @@ > + - +

- - + + - + @@ -129,7 +149,7 @@ - + @@ -141,6 +161,30 @@ + + + + + + + + + + + +
민원 답변내용 미리보기
+ +
+
+ [매크로 문자 삽입]: + 일련번호 + 전화번호 + 차량번호 + + [미리보기]: + 미리보기 + +
<%@include file="/WEB-INF/jsp/framework/biz-popup-use-btn.jsp" %> @@ -152,6 +196,7 @@ * Global Variable **************************************************************************/ let orgData; + let tAreaSelect = null; /* ******************************* * Biz function @@ -190,19 +235,23 @@ const answerSeCode = $('#answerSeCode').val(); if($("input[name=resnCode]").val() === '') { alert('사유는 필수 입력입니다.'); - if(answerSeCode === 'FIM025') $('#clCode').focus(); - if(answerSeCode === 'FIM021') $('#clCode1').focus(); + if(answerSeCode === 'FIM028') $('#clCode1').focus(); + if(answerSeCode === 'FIM025') $('#clCode2').focus(); + if(answerSeCode === 'FIM021') $('#clCode3').focus(); return false; } return true; } - ,onInitChange: (e) => { + ,onInitChange: () => { const tmplatId = $('#tmplatId').val(); if(tmplatId === ''){ $('#answerSeCode').val(''); - $('#clCode').val(''); $('#clCode1').val(''); + $('#clCode2').val(''); + $('#clCode3').val(''); + $('.prfaceTr').css('display', 'none'); + $('.tlfaceTr').css('display', 'none'); fnBiz.onSearchChange(); }else{ $('#tmplatNm').val($('#tmplatId option:checked').text()); @@ -212,11 +261,10 @@ , type: "GET" , showSuccessMsg: false , success: (res) => { - if(res.data.contents.length > 0) - if(confirm("템플릿 유형에 대한 머리말 꼬리말이 존재합니다. 화면에 자동반영하시겠습니까?")){ - document.getElementById("prface").value = res.data.contents[0].prface; - document.getElementById("tlface").value = res.data.contents[0].tlface; - } + if(res.data.contents.length > 0){ + document.getElementById("prface").value = res.data.contents[0].prface; + document.getElementById("tlface").value = res.data.contents[0].tlface; + } } }); } @@ -224,10 +272,13 @@ ,onSearchChange: () => { if($('#answerSeCode').val() === ''){ $("input[name=resnCode]").val(''); - $('select[name="clCode"]') + $('select[name="clCode1"]') .css('display', 'none') .attr('disabled', true); - $('select[name="clCode1"]') + $('select[name="clCode2"]') + .css('display', 'none') + .attr('disabled', true); + $('select[name="clCode3"]') .css('display', 'none') .attr('disabled', true); }else{ @@ -236,26 +287,69 @@ $('#answerSeCode').val(''); document.getElementById("tmplatId").focus(); return false; - }else if($('#answerSeCode').val() === 'FIM025'){ - $('select[name="clCode"]') + }else if($('#answerSeCode').val() === 'FIM028'){ + $('select[name="clCode1"]') .css('display', 'inline-block') .attr('disabled', false); + $('select[name="clCode2"]') + .css('display', 'none') + .attr('disabled', true); + $('select[name="clCode3"]') + .css('display', 'none') + .attr('disabled', true); + $('.prfaceTr').css('display', 'table-row'); + $('.tlfaceTr').css('display', 'table-row'); + }else if($('#answerSeCode').val() === 'FIM025'){ $('select[name="clCode1"]') .css('display', 'none') .attr('disabled', true); - }else if($('#answerSeCode').val() === 'FIM021'){ - $('select[name="clCode"]') + $('select[name="clCode2"]') + .css('display', 'inline-block') + .attr('disabled', false); + $('select[name="clCode3"]') .css('display', 'none') .attr('disabled', true); + $('.prfaceTr').css('display', 'none'); + $('.tlfaceTr').css('display', 'none'); + }else if($('#answerSeCode').val() === 'FIM021'){ $('select[name="clCode1"]') + .css('display', 'none') + .attr('disabled', true); + $('select[name="clCode2"]') + .css('display', 'none') + .attr('disabled', true); + $('select[name="clCode3"]') .css('display', 'inline-block') .attr('disabled', false); + $('.prfaceTr').css('display', 'none'); + $('.tlfaceTr').css('display', 'none'); } } } ,onSearchCodeChange: (e) => { $("input[name=resnCode]").val($(e).val()); } + ,onMacroInsert: (e) => { + if(tAreaSelect === null){ + alert("텍스트 영역을 먼저 선택한 후에 눌러주세요."); + return false; + }else{ + const selectPos = tAreaSelect.line; + const txtArea = document.getElementById(tAreaSelect.id); + const beforeTxt = txtArea.value.substring(0, selectPos); + const afterTxt = txtArea.value.substring(selectPos, txtArea.value.length); + let addTxt = ''; + + if(e.id === 'btnKey') addTxt = "[" + $('#'+e.id).text() + "]"; + if(e.id === 'btnPhone') addTxt = "[" + $('#'+e.id).text() + "]"; + if(e.id === 'btnCar') addTxt = "[" + $('#'+e.id).text() + "]"; + txtArea.value = beforeTxt + addTxt + afterTxt; + + txtArea.selectionStart = selectPos + addTxt.length; + txtArea.selectionEnd = selectPos + addTxt.length; + txtArea.focus(); + } + } }; /************************************************************************** @@ -283,6 +377,41 @@ $('#btnRemove').on('click', () => { fnBiz.remove(); }); + + $('#btnPreview').on('click', (e) => { + const btnPre = e.target; + if(btnPre.text === '미리보기'){ + $('.tbl03').css('display', 'none'); + $('.tbl02').css('display', ''); + $('.other_btn_02').css('display', 'none'); + $('.popup_btn_02').css('display', 'none'); + btnPre.text = '입력화면'; + const pTxt = document.getElementById("prface").value + '\r\n \r\n' + document.getElementById("answerCn").value + '\r\n \r\n' + document.getElementById("tlface").value; + document.getElementById("ansPreview").value = pTxt.replaceAll('[일련번호]', '123456').replaceAll('[차량번호]', '11가1234').replaceAll('[전화번호]', '010-1234-5678'); + }else{ + $('.tbl03').css('display', ''); + $('.tbl02').css('display', 'none'); + $('.other_btn_02').css('display', ''); + $('.popup_btn_02').css('display', ''); + btnPre.text = '미리보기'; + document.getElementById("ansPreview").value = ""; + } + }); + + $('#prface').on('blur', (e) => { + tAreaSelect = null; + tAreaSelect = {id:e.target.id, line:$(e.target).prop("selectionStart")}; + }); + + $('#answerCn').on('blur', (e) => { + tAreaSelect = null; + tAreaSelect = {id:e.target.id, line:$(e.target).prop("selectionStart")}; + }); + + $('#tlface').on('blur', (e) => { + tAreaSelect = null; + tAreaSelect = {id:e.target.id, line:$(e.target).prop("selectionStart")}; + }); }); /************************************************************************** @@ -290,8 +419,15 @@ **************************************************************************/ $(document).ready(function () { orgData = $('form').serialize(); + $('.tbl02').css('display', 'none'); fnBiz.onInitChange(); + + if($('#answerSeCode').val() != 'FIM028'){ + $('.prfaceTr').css('display', 'none'); + $('.tlfaceTr').css('display', 'none'); + } + });