|
|
|
|
@ -3,7 +3,7 @@ if(window.help !== undefined){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class AppSupport {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static help(){
|
|
|
|
|
console.log("initDatepicker(초기화영역) : 특정 영역의 datepicker를 초기화한다.");
|
|
|
|
|
console.log("initDetailSearchButton(초기화영역) : 특정 영역의 상세조회 버튼을 초기화한다.");
|
|
|
|
|
@ -15,9 +15,9 @@ class AppSupport {
|
|
|
|
|
console.log("customValidate(제이쿼리객체) : 커스텀 발리데이션");
|
|
|
|
|
console.log("getCellDefs(th제이쿼리객체, td제이쿼리객체, [컬럼명 구하는 메소드]) : 엑셀 파일 정보 생성");
|
|
|
|
|
console.log("sleep(마이크로초) : 지연 처리 함수");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* 특정 영역의 datepicker를 초기화한다.
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
@ -28,22 +28,22 @@ class AppSupport {
|
|
|
|
|
} else {
|
|
|
|
|
executionArea = $(elementEl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
executionArea.find(".form-date").datePicker();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* 특정 영역의 상세조회 버튼을 초기화한다.
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
static initDetailSearchButton(elementId){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var executionArea;
|
|
|
|
|
if(typeof elementId == "string"){
|
|
|
|
|
executionArea = $("#"+elementId);
|
|
|
|
|
} else {
|
|
|
|
|
executionArea = $(elementId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------- 상세검색 버튼 제어 ---------------------*/
|
|
|
|
|
executionArea.find(".btn-open-detail").on("click", function() {
|
|
|
|
|
$(this).find('i').toggleClass('bx-chevron-down');
|
|
|
|
|
@ -51,7 +51,7 @@ class AppSupport {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//마지막으로 열린 다이얼로그 영역을 반환한다.
|
|
|
|
|
static getLastOpenDialog(){
|
|
|
|
|
return $("div.modal.show").last()[0];
|
|
|
|
|
@ -60,27 +60,41 @@ class AppSupport {
|
|
|
|
|
static getLastDialog(){
|
|
|
|
|
return $("div.modal").last()[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static getSecondDialogFromLast(){
|
|
|
|
|
var dialogCount = $("div.modal").length;
|
|
|
|
|
if(dialogCount >= 2){
|
|
|
|
|
return $("div.modal").eq(dialogCount - 2)[0];
|
|
|
|
|
} else {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* 모달창 z-index 초기화
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
static setDialogZindex(){
|
|
|
|
|
var parentDialog = AppSupport.getLastOpenDialog();
|
|
|
|
|
var parentDialog = AppSupport.getSecondDialogFromLast();
|
|
|
|
|
var childDialog = AppSupport.getLastDialog();
|
|
|
|
|
|
|
|
|
|
if($(parentDialog).length == 0 || parentDialog == childDialog){
|
|
|
|
|
|
|
|
|
|
if(parentDialog == null){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(parentDialog == childDialog){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var parentZ = $(parentDialog).css("z-index");
|
|
|
|
|
$(childDialog).css("z-index", Number(parentZ)+10);
|
|
|
|
|
|
|
|
|
|
var backdrop = $(childDialog).next();
|
|
|
|
|
if(backdrop.hasClass("modal-backdrop")){
|
|
|
|
|
backdrop.css("z-index", Number(parentZ)+9);
|
|
|
|
|
|
|
|
|
|
var dNext = $(childDialog).next();
|
|
|
|
|
|
|
|
|
|
if(dNext.prop("tagName") == "SCRIPT"){
|
|
|
|
|
var dNextNext = $(childDialog).next().next();
|
|
|
|
|
dNextNext.css("z-index", Number(parentZ)+9);
|
|
|
|
|
} else if(dNext.hasClass("modal-backdrop")){
|
|
|
|
|
dNext.css("z-index", Number(parentZ)+9);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* 모달창 닫기 버튼 포커스
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
@ -102,8 +116,8 @@ class AppSupport {
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* validation
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
@ -115,11 +129,11 @@ class AppSupport {
|
|
|
|
|
if(!validInput(input)){
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!input.required && input.value == ""){
|
|
|
|
|
continue;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//입력값의 최대 바이트 수 체크
|
|
|
|
|
if(input.dataset.maxlengthb){
|
|
|
|
|
if(!StringSupport.isMaxByte(input.value, input.dataset.maxlengthb)){
|
|
|
|
|
@ -127,7 +141,7 @@ class AppSupport {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//입력값의 포맷형식 체크
|
|
|
|
|
if(input.dataset.fmtType){
|
|
|
|
|
if(input.dataset.fmtType == "day"){
|
|
|
|
|
@ -136,14 +150,14 @@ class AppSupport {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(input.dataset.fmtType == "time"){
|
|
|
|
|
if(!StringSupport.isTime(input.value)){
|
|
|
|
|
handler.typeMismatch(input);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(input.dataset.fmtType == "zeroLpadNumber"){
|
|
|
|
|
if(!StringSupport.isDigitString(input.value)){
|
|
|
|
|
handler.typeMismatch(input);
|
|
|
|
|
@ -152,52 +166,52 @@ class AppSupport {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* 엑셀 파일 작성 정보 생성
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
static getCellDefs($ths, $tds, fieldGetterOption){
|
|
|
|
|
var cellDefs = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(var i=0; i < $ths.length; i++){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var label = $ths.eq(i).text();
|
|
|
|
|
label = label.replace("\n", "");
|
|
|
|
|
label = label.replace("\t", "");
|
|
|
|
|
label = label.replace(" ", "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(label != ""){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var width = $ths.eq(i).outerWidth();
|
|
|
|
|
width = Math.ceil(width/10) + 2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var field = "";
|
|
|
|
|
if(fieldGetterOption != null){
|
|
|
|
|
field = fieldGetterOption($tds.eq(i));
|
|
|
|
|
} else {
|
|
|
|
|
field = $tds.eq(i).text();
|
|
|
|
|
field = $tds.eq(i).text();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
field = field.replace("{", "");
|
|
|
|
|
field = field.replace("}", "");
|
|
|
|
|
field = field.replace("\n", "");
|
|
|
|
|
field = field.replace("\t", "");
|
|
|
|
|
field = field.replace(" ", "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cellDef = {
|
|
|
|
|
label : label,
|
|
|
|
|
width : width,
|
|
|
|
|
field : field
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cellDefs.push(cellDef);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return JSON.stringify(cellDefs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -208,20 +222,20 @@ class AppSupport {
|
|
|
|
|
static sleep(ms) {
|
|
|
|
|
return new Promise((r) => setTimeout(r, ms));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
|
* PDF파일 미리보기 창 열기
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
static openPDF(blob, windowName){
|
|
|
|
|
let wctxpath = wctx.path;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var popup = window.open(
|
|
|
|
|
wctx.url("/webjars/applib/html/pdf.html")+"?wctxpath="+wctxpath
|
|
|
|
|
,windowName
|
|
|
|
|
,'top=10, left=10'
|
|
|
|
|
);
|
|
|
|
|
popup.onload = () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
popup.makePdfFromBlob(blob);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
@ -270,16 +284,16 @@ async function dialog2(msg, type, buttons){
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
dlg.find(".modal-footer").find(".btn-ok").remove();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(var i=0; i < buttons.length; i++){
|
|
|
|
|
dlg.find(".modal-footer").append(
|
|
|
|
|
'<button type="button" class="btn btn-primary btn-custom" data-key="'+buttons[i].key+'" >'
|
|
|
|
|
+buttons[i].value
|
|
|
|
|
+'</button>');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dlg.find(".modal-header").remove();
|
|
|
|
|
dlg.find(".modal-body").html(content).fadeIn();
|
|
|
|
|
dlg.on("hidden.bs.modal", function() {
|
|
|
|
|
@ -292,9 +306,9 @@ async function dialog2(msg, type, buttons){
|
|
|
|
|
backdrop.prop("id", backdropID);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AppSupport.setDialogZindex();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new Promise(resolve => {
|
|
|
|
|
if(type == "confirm" || type == "alert" || type == "prompt"){
|
|
|
|
|
if(type == "prompt"){
|
|
|
|
|
@ -308,7 +322,7 @@ async function dialog2(msg, type, buttons){
|
|
|
|
|
resolve(true);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(type == "confirm"){
|
|
|
|
|
dlg[0].querySelector(".btn-cancel").addEventListener("click", () => {
|
|
|
|
|
dlg.modal("hide");
|
|
|
|
|
@ -329,6 +343,6 @@ async function dialog2(msg, type, buttons){
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|