fix: 매크로 문자 기능 및 미리보기 기능 추가

main
sjh88 2 years ago
parent 11ebea3486
commit 76e1260818

@ -43,7 +43,7 @@ public class CmmAnsTmplService implements ICmmAnsTmplService {
RowBounds rowBounds = new RowBounds();
Map<String, Object> 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);
}
}

@ -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;

@ -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

@ -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"
}
}

@ -63,21 +63,22 @@
</c:choose>
>
<option value="">선택</option>
<option <c:if test="${cmmAnsTmpl.answerSeCode == 'FIM028'}">selected="selected"</c:if> value="FIM028">부과 답변</option>
<option <c:if test="${cmmAnsTmpl.answerSeCode == 'FIM025'}">selected="selected"</c:if> value="FIM025">계도</option>
<option <c:if test="${cmmAnsTmpl.answerSeCode == 'FIM021'}">selected="selected"</c:if> value="FIM021">서손</option>
</select>
</td>
<th class="required" scope="row" nowrap>
<label for="clCode">사유</label>
<label for="clCode1">사유</label>
</th>
<td>
<p></p>
<select name="clCode" id="clCode" class="select" title="계도코드"
<select name="clCode1" id="clCode1" class="select" title="부과코드"
<c:choose>
<c:when test="${isUpdate && cmmAnsTmpl.answerSeCode == 'FIM021'}">
<c:when test="${isUpdate && cmmAnsTmpl.answerSeCode == 'FIM028'}">
onFocus='this.initialSelect = this.selectedIndex;' onChange='this.selectedIndex = this.initialSelect;' style='background-color:#ababab'
</c:when>
<c:when test="${isUpdate && cmmAnsTmpl.answerSeCode != 'FIM021'}">
<c:when test="${isUpdate && cmmAnsTmpl.answerSeCode != 'FIM028'}">
style="display:none;"
</c:when>
<c:otherwise>
@ -86,11 +87,12 @@
</c:choose>
>
<option value="">전체</option>
<c:forEach var="result" items="${codeList25}" varStatus="status">
<c:forEach var="result" items="${codeList28}" varStatus="status">
<option <c:if test="${cmmAnsTmpl.resnCode == result.code}">selected="selected"</c:if> value='<c:out value="${result.code}"/>' ><c:out value="${result.code_nm}"/></option>
</c:forEach>
</select>
<select name="clCode1" id="clCode1" class="select" title="서손코드"
<select name="clCode2" id="clCode2" class="select" title="서손코드"
<c:choose>
<c:when test="${isUpdate && cmmAnsTmpl.answerSeCode == 'FIM025'}">
onFocus='this.initialSelect = this.selectedIndex;' onChange='this.selectedIndex = this.initialSelect;' style='background-color:#ababab'
@ -102,7 +104,25 @@
onchange="fnBiz.onSearchCodeChange(this)"
</c:otherwise>
</c:choose>
<c:if test="${cmmAnsTmpl.answerSeCode == 'FIM025'}">style="display:none;"</c:if>
>
<option value="">전체</option>
<c:forEach var="result" items="${codeList25}" varStatus="status">
<option <c:if test="${cmmAnsTmpl.resnCode == result.code}">selected="selected"</c:if> value='<c:out value="${result.code}"/>' ><c:out value="${result.code_nm}"/></option>
</c:forEach>
</select>
<select name="clCode3" id="clCode3" class="select" title="계도코드"
<c:choose>
<c:when test="${isUpdate && cmmAnsTmpl.answerSeCode == 'FIM021'}">
onFocus='this.initialSelect = this.selectedIndex;' onChange='this.selectedIndex = this.initialSelect;' style='background-color:#ababab'
</c:when>
<c:when test="${isUpdate && cmmAnsTmpl.answerSeCode != 'FIM021'}">
style="display:none;"
</c:when>
<c:otherwise>
onchange="fnBiz.onSearchCodeChange(this)"
</c:otherwise>
</c:choose>
>
<option value="">전체</option>
<c:forEach var="result" items="${codeList21}" varStatus="status">
@ -111,7 +131,7 @@
</select>
</td>
</tr>
<tr>
<tr class="prfaceTr">
<th class="required" scope="row" nowrap>
<label for="prface">머리말</label>
</th>
@ -129,7 +149,7 @@
<form:errors path="answerCn" />
</td>
</tr>
<tr>
<tr class="tlfaceTr">
<th class="required" scope="row" nowrap>
<label for="tlface">꼬리말</label>
</th>
@ -141,6 +161,30 @@
</tbody>
</table>
</form:form>
<table class="tbl02" style="white-space:normal;">
<caption>민원 답변내용 미리보기</caption>
<colgroup>
<col style="width: 15%;"/>
<col style="width: 35%;"/>
<col style="width: 15%;"/>
<col style="width: 35%;"/>
</colgroup>
<tbody>
<td colspan="4">
<textarea id="ansPreview" cols="70" rows="17" readonly></textarea>
</td>
</tbody>
</table>
<div class="other_btn" style="position:absolute; bottom:0px;">
<span class="other_btn_02"> [매크로 문자 삽입]:
<a href="#" class="btn blue" id="btnKey" onclick="fnBiz.onMacroInsert(this);">일련번호</a>
<a href="#" class="btn blue" id="btnPhone" onclick="fnBiz.onMacroInsert(this);">전화번호</a>
<a href="#" class="btn blue" id="btnCar" onclick="fnBiz.onMacroInsert(this);">차량번호</a>
</span>
<span class="other_btn_03"> [미리보기]:
<a href="#" class="btn green" id="btnPreview">미리보기</a>
</span>
</div>
<%@include file="/WEB-INF/jsp/framework/biz-popup-use-btn.jsp" %>
<!-- //등록버튼 -->
</div>
@ -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');
<c:if test="${!isUpdate}">
fnBiz.onInitChange();
</c:if>
<c:if test="${isUpdate}">
if($('#answerSeCode').val() != 'FIM028'){
$('.prfaceTr').css('display', 'none');
$('.tlfaceTr').css('display', 'none');
}
</c:if>
});
</script>

Loading…
Cancel
Save