답변문구 매크로 문자삽입 기능 추가

main
이범준 1 year ago
parent 6be4e785f6
commit aa3fa1d0ac

@ -10,11 +10,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper;
import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.dao.GlobalStngMapper;
import cokr.xit.fims.cvlc.CrdnCvlcpt;
import cokr.xit.fims.cvlc.service.CrdnCvlcptService;
import cokr.xit.foundation.UserInfo;
import cokr.xit.foundation.data.DataObject;
/** .<br />
@ -29,6 +32,9 @@ public class Cvlc05Controller extends ApplicationController {
@Resource(name="globalStngMapper")
private GlobalStngMapper globalStngMapper;
@Resource(name="userMapper")
private UserMapper userMapper;
/** .
* @return fims/cvlc/cvlc05010-main
*/
@ -38,6 +44,10 @@ public class Cvlc05Controller extends ApplicationController {
mav.addObject("pageName", "cvlc05010-main");
mav.addObject("module", "type='module'");
mav.addObject("currentUserName", UserInfo.current().getName());
ManagedUser currentUser = userMapper.getUser(UserInfo.current().getAccount(), UserInfo.current().getInstitute());
mav.addObject("currentUserTelno", currentUser.getPhoneNo());
Map<String, List<CommonCode>> commonCodes = getCodesOf("FIM054");
mav.addObject("FIM054List", commonCodes.get("FIM054"));

@ -149,7 +149,7 @@
</ul>
</div>
<span class="container-window-btn-right">
<button class="btn btn-primary" id="btnInstLevyExcl--${pageName}" title="비부과 등록">비부과 등록</button>
<button type="button" class="btn btn-primary" id="btnInstLevyExcl--${pageName}" title="비부과 등록">비부과 등록</button>
<span slot="button">
<template class="pvs">
<slot>

@ -25,8 +25,8 @@
<div>
<span class="container-page-btn">
<span class="container-window-btn-right">
<button class="btn btn-primary" id="btnSave--${pageName}" title="금액 수정">금액 수정</button>
<button class="btn btn-primary" id="btnRestore--${pageName}" title="원금 복원">원금 복원</button>
<button type="button" class="btn btn-primary" id="btnSave--${pageName}" title="금액 수정">금액 수정</button>
<button type="button" class="btn btn-primary" id="btnRestore--${pageName}" title="원금 복원">원금 복원</button>
</span>
</span>
</div>

@ -147,7 +147,7 @@
<div>
<span class="container-page-btn">
<span class="container-window-btn-right">
<button class="btn btn-primary" id="btnCreate--${pageName}" title="확인">확인</button>
<button type="button" class="btn btn-primary" id="btnCreate--${pageName}" title="확인">확인</button>
</span>
</span>
</div>

@ -237,7 +237,9 @@
<div class="card ps-3 py-3 w-px-1300">
<div class="row">
<div class="col-12 btns">
<strong class="">[매크로 문자 삽입]</strong>
<strong>[매크로 문자 삽입]</strong>
<label id="macroTarget--${pageName}" for="" hidden></label>
<button type="button" id="btnInsertMacro1--${pageName}"
class="btn btn-primary" title="일련번호 삽입">일련번호</button>
<button type="button" id="btnInsertMacro2--${pageName}"
@ -268,7 +270,17 @@
<template id="previewDialogTemplate--${pageName}">
<form id="frmView--${pageName}">
<div class="card">
<textarea id="preview--${pageName}" rows="15"
></textarea>
</div>
<div>
<span class="container-page-btn">
<span class="container-window-btn-right">
<button type="button" class="btn btn-primary" id="btnClose--${pageName}" title="닫기">닫기</button>
</span>
</span>
</div>
</form>
</template>
@ -276,6 +288,7 @@
<script ${module}>
import {
AnswerBodyControl,
MACRO_STRING,
fnMacroStringInsert,
fnMacroWordsReplace
} from "<c:url value='/resources/js/fims/cvlc/answerWords.js?${ver}'/>";
@ -593,8 +606,6 @@ $(document).ready(function(){
content : confirmMessage,
onOK: () => {
console.log(info);
ajax.get({
url : $P.ansBodyControl.urls.update,
data : info,
@ -635,6 +646,26 @@ $(document).ready(function(){
//미리보기 팝업 호출
$P.fnOpenPreviewPop = () => {
var result = fnMacroWordsReplace(
$("#headerCn--${pageName}").val(),
$("#footerCn--${pageName}").val(),
$("#prcsRsltCn--${pageName}").val(),
"${currentUserTelno}",
"${currentUserName}"
);
dialog.open({
id : "previewDialog--${pageName}",
title : "답변 내용 미리보기",
content : document.getElementById("previewDialogTemplate--${pageName}").innerHTML,
size : "lg",
init : () => {
$("#preview--${pageName}").val(result);
$("#btnClose--${pageName}").on("click", () => dialog.close("previewDialog--${pageName}"));
},
onOk : () => {},
onClose : () => {}
});
}
/**************************************************************************
@ -651,6 +682,8 @@ $(document).ready(function(){
$("#wrapper--${pageName}").find(".area-answerbody").hide();
$P.currentDisplay = "ansBasic";
$("#macroTarget--${pageName}").attr("for","");
});
$('#btnLevyAnsBodyTab--${pageName}').on('click', (event) => {
@ -671,6 +704,8 @@ $(document).ready(function(){
$("#wrapper--${pageName}").find(":radio[name='levyRadio']:checked").focus();
$P.changeAnsBodyText();
$("#macroTarget--${pageName}").attr("for","");
});
$('#btnWarningAnsBodyTab--${pageName}').on('click', (event) => {
$(event.target).addClass("active");
@ -690,6 +725,8 @@ $(document).ready(function(){
$("#wrapper--${pageName}").find(":radio[name='warningRadio']:checked").focus();
$P.changeAnsBodyText();
$("#macroTarget--${pageName}").attr("for","");
});
$('#btnNonlevyAnsBodyTab--${pageName}').on('click', (event) => {
$(event.target).addClass("active");
@ -709,6 +746,8 @@ $(document).ready(function(){
$("#wrapper--${pageName}").find(":radio[name='nonlevyRadio']:checked").focus();
$P.changeAnsBodyText();
$("#macroTarget--${pageName}").attr("for","");
});
//업무처리 버튼
@ -717,6 +756,25 @@ $(document).ready(function(){
$("#btnRemove--${pageName}").on("click", () => $P.fnRemove());
$("#btnOpenPreviewPop--${pageName}").on("click", () => $P.fnOpenPreviewPop());
$("#headerCn--${pageName},#footerCn--${pageName},#prcsRsltCn--${pageName}").on("focus", (event) => {
$("#macroTarget--${pageName}").attr("for", event.target.id);
});
$("#btnInsertMacro1--${pageName}").on("click", () => {
var macroTarget = $("#macroTarget--${pageName}").attr("for");
if(macroTarget == ""){ return; }
fnMacroStringInsert(macroTarget, MACRO_STRING.MACRO_SEQ);
});
$("#btnInsertMacro2--${pageName}").on("click", () => {
var macroTarget = $("#macroTarget--${pageName}").attr("for");
if(macroTarget == ""){ return; }
fnMacroStringInsert(macroTarget, MACRO_STRING.MACRO_TELNO);
});
$("#btnInsertMacro3--${pageName}").on("click", () => {
var macroTarget = $("#macroTarget--${pageName}").attr("for");
if(macroTarget == ""){ return; }
fnMacroStringInsert(macroTarget, MACRO_STRING.MACRO_PIC_NM);
});
/**************************************************************************
* 초기화
**************************************************************************/

@ -6,11 +6,40 @@ export class AnswerBodyControl {
}
}
export function fnMacroStringInsert() {
//TODO : 매크로문자열 삽입
export const MACRO_STRING = {
MACRO_SEQ : "[@일련번호]",
MACRO_TELNO : "[@전화번호]",
MACRO_PIC_NM : "[@담당자성명]"
};
export function fnMacroStringInsert(objId, addText) {
var insertObj = document.getElementById(objId);
var textVal = insertObj.value;
var setPosition = insertObj.selectionStart;
var beforeTxt = textVal.substring(0, setPosition);
var afterTxt = textVal.substring(insertObj.selectionEnd, textVal.length);
insertObj.value = beforeTxt + addText + afterTxt;
setPosition = setPosition + addText.length;
insertObj.selectionStart = setPosition;
insertObj.selectionEnd = setPosition;
insertObj.focus();
}
export function fnMacroWordsReplace() {
//TODO : 매크로문자열치환
return "";
export function fnMacroWordsReplace(header, footer, body, telno, picNm) {
var result = header + "\n\n" + body + "\n\n" + footer;
result = result.replaceAll("", "@");
var seq = 1;
var splited = result.split(MACRO_STRING.MACRO_SEQ);
var seqCount = splited.length - 1;
if(seqCount > 0){
for(; seq <= seqCount; seq++){
result = result.replace(MACRO_STRING.MACRO_SEQ, seq);
}
}
result = result.replaceAll(MACRO_STRING.MACRO_TELNO, telno);
result = result.replaceAll(MACRO_STRING.MACRO_PIC_NM, picNm);
return result;
}
Loading…
Cancel
Save