no message

main
이범준 1 year ago
parent 812fe8d74b
commit b4214d051b

@ -39,6 +39,8 @@
<script type="text/javascript" src="${ctx}/resources/js/fims/framework/cmm/cmmPopup.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/fims/framework/cmm/cmmDateUtil.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/fims/framework/cmm/cmmUtil.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/base/base-fims.js"></script>
<script type="text/javascript" src="${ctx}/resources/js/base/dataset-fims.js"></script>
<%--TODO: 보완 필요 : 공통 ajax 호출 모듈과 통합 필요 --%>

@ -0,0 +1,113 @@
class FimsFormFields extends FormFields {
/**
* form json data set
* element tag에 data-fmt-type 으로 데이타 format이 지정된 경우 해당 포맷으로 출력
* @param {object} formObj document.querySelector('form')
* @param {object} jsonData json type data
*/
set(obj){
document.querySelectorAll(this.children).forEach(input => {
let prop = input.getAttribute("data-map")
|| input.name
|| input.id;
if (!prop) return;
let dataItem = obj instanceof DataItem,
value = dataItem ? obj.getValue(prop) : obj[prop];
if ("radio" == input.type) {
if (value && value == input.value)
input.checked = true;
} else if("checkbox" == input.type) {
if (value && value == input.value)
input.checked = ("Y" === value);
} else if(input.tagName == "SELECT") {
for(let option of input.options) {
if(option.value == value){
option.selected = true;
} else {
option.selected = false;
}
}
} else {
if(value == null){
value = "";
}
// element data-fmt-type에 정의된 format 적용
// dt - yyyy-mm-dd HH:mm:ss, day - yyyy-mm-dd, time - HH:mm:ss, number - #,###
if(input.dataset.fmtType){
const fmtType = input.dataset.fmtType;
switch (fmtType) {
case 'dt' :
value = StrDateTimeFormat.format(value);
break;
case 'day' :
value = StrDateFormat.format(value);
break;
case 'time' :
value = StrTimeFormat.format(value);
break;
case 'number' :
value = CommaNumberFormat.format(value);
break;
default:
break;
}
}
if(input.name){
input.value = value;
//보안모드 마스킹 항목
if(input.tagName === 'INPUT' && input.id && input.classList.contains("privacy")){
let maskVal = value.replace(/[0-9a-zA-Z]/g, "*");
document.getElementById(input.id+"$mask").value = maskVal;
}
}
}
});
}
get() {
let obj = {};
document.querySelectorAll(this.children).forEach(input => {
let property = input.name || input.id;
let value = input.value;
if ("radio" == input.type) {
if (input.checked)
obj[property] = value;
} else {
if(input.dataset.fmtType){
const fmtType = input.dataset.fmtType;
switch (fmtType) {
case 'dt' :
value = value.replaceAll("-","").replaceAll(":","").replaceAll(" ","");
break;
case 'day' :
value = value.replaceAll("-","");
break;
case 'time' :
value = value.replaceAll(":","");
break;
case 'number' :
value = value.replaceAll(",","");
break;
default:
break;
}
}
obj[property] = value;
}
});
return obj;
}
}

@ -411,119 +411,7 @@ String.prototype.isEmail = function() {
};
class FimsFormFields extends FormFields {
/**
* form json data set
* element tag에 data-fmt-type 으로 데이타 format이 지정된 경우 해당 포맷으로 출력
* @param {object} formObj document.querySelector('form')
* @param {object} jsonData json type data
*/
set(obj){
document.querySelectorAll(this.children).forEach(input => {
let prop = input.getAttribute("data-map")
|| input.name
|| input.id;
if (!prop) return;
let dataItem = obj instanceof DataItem,
value = dataItem ? obj.getValue(prop) : obj[prop];
if ("radio" == input.type) {
if (value && value == input.value)
input.checked = true;
} else if("checkbox" == input.type) {
if (value && value == input.value)
input.checked = ("Y" === value);
} else if(input.tagName == "SELECT") {
for(let option of input.options) {
if(option.value == value){
option.selected = true;
} else {
option.selected = false;
}
}
} else {
if(value == null){
value = "";
}
// element data-fmt-type에 정의된 format 적용
// dt - yyyy-mm-dd HH:mm:ss, day - yyyy-mm-dd, time - HH:mm:ss, number - #,###
if(input.dataset.fmtType){
const fmtType = input.dataset.fmtType;
switch (fmtType) {
case 'dt' :
value = StrDateTimeFormat.format(value);
break;
case 'day' :
value = StrDateFormat.format(value);
break;
case 'time' :
value = StrTimeFormat.format(value);
break;
case 'number' :
value = CommaNumberFormat.format(value);
break;
default:
break;
}
}
if(input.name){
input.value = value;
//보안모드 마스킹 항목
if(input.tagName === 'INPUT' && input.id && input.classList.contains("privacy")){
let maskVal = value.replace(/[0-9a-zA-Z]/g, "*");
document.getElementById(input.id+"$mask").value = maskVal;
}
}
}
});
}
get() {
let obj = {};
document.querySelectorAll(this.children).forEach(input => {
let property = input.name || input.id;
let value = input.value;
if ("radio" == input.type) {
if (input.checked)
obj[property] = value;
} else {
if(input.dataset.fmtType){
const fmtType = input.dataset.fmtType;
switch (fmtType) {
case 'dt' :
value = value.replaceAll("-","").replaceAll(":","").replaceAll(" ","");
break;
case 'day' :
value = value.replaceAll("-","");
break;
case 'time' :
value = value.replaceAll(":","");
break;
case 'number' :
value = value.replaceAll(",","");
break;
default:
break;
}
}
obj[property] = value;
}
});
return obj;
}
}

Loading…
Cancel
Save