From a4fe729d93674c236fc17da6cb08c0fa0afb77a0 Mon Sep 17 00:00:00 2001 From: leebj Date: Tue, 20 Aug 2024 15:27:29 +0900 Subject: [PATCH] =?UTF-8?q?=EC=86=8C=EC=8A=A4=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/js/fims/cmmn/fims-cmmnUtil.js | 68 ------------------- .../resources/js/fims/cmmn/fims-support.js | 29 ++++++++ .../resources/js/fims/cmmn/objectInspector.js | 38 +++++++++++ 3 files changed, 67 insertions(+), 68 deletions(-) create mode 100644 src/main/webapp/resources/js/fims/cmmn/objectInspector.js diff --git a/src/main/webapp/resources/js/fims/cmmn/fims-cmmnUtil.js b/src/main/webapp/resources/js/fims/cmmn/fims-cmmnUtil.js index 0c4d5999..fc99955c 100644 --- a/src/main/webapp/resources/js/fims/cmmn/fims-cmmnUtil.js +++ b/src/main/webapp/resources/js/fims/cmmn/fims-cmmnUtil.js @@ -85,39 +85,6 @@ function setCurrentRow(et){ } -/************************************************************************** -* HTML요소 어트리뷰트(프로퍼티,이벤트) 등록 -**************************************************************************/ -function ObjectInspector(doctx, data){ - let objectInspector = {}; - - if(data == null){ - objectInspector = JSON.parse(document.querySelector("[data-doctx='"+doctx+"']").querySelector("script.objectInspector").text); - } else if(data instanceof HTMLScriptElement){ - objectInspector = JSON.parse(data.text); - } else if(typeof data == "string"){ - let curlyBracketsOpen = String.fromCharCode(123); //중괄호시작 - if(!data.trim().startsWith(curlyBracketsOpen)){ - objectInspector = JSON.parse(document.querySelector("script[id='"+data+"'").text); - } else { - objectInspector = JSON.parse(data); - } - } else { - objectInspector = data; - } - - let keys = Object.keys(objectInspector); - for(let key of keys){ - let elem = document.querySelector("[data-doctx='"+doctx+"'] [name='"+key+"']"); - let attrs = objectInspector[key]; - let attrNames = Object.keys(attrs); - for(let attrName of attrNames){ - elem.setAttribute(attrName,attrs[attrName]); - } - } -}; - - /************************************************************************** @@ -269,14 +236,6 @@ const Apply = { }; - - - - - - - - const GRID = { checkbox : { sync : function(checkboxElement, bool){ @@ -362,30 +321,3 @@ const GRID = { -/************************************************************************** -* 프로그레스바 표시 -**************************************************************************/ -const SSE_SUBSCRIBE_URL = wctx.url("/subscribe.do"); -function fnProgress(sseKey, progressContent, progressEvent){ - var eventSource = new EventSource(SSE_SUBSCRIBE_URL+"?sseKey="+sseKey); - - eventSource.onopen = function(e) { - $.blockUI({ - message : ""+progressContent+"", - css: { backgroundColor: "lightgrey", padding : "10px" } - }); - }; - - eventSource.onerror = function(e) { - $.unblockUI(); - }; - - eventSource.onmessage = function(e) { - if (e.data == 'FIN'){ - eventSource.close(); - $.unblockUI(); - } else { - progressEvent(e.data); - } - }; -} \ No newline at end of file diff --git a/src/main/webapp/resources/js/fims/cmmn/fims-support.js b/src/main/webapp/resources/js/fims/cmmn/fims-support.js index e4037d98..ecbb5844 100644 --- a/src/main/webapp/resources/js/fims/cmmn/fims-support.js +++ b/src/main/webapp/resources/js/fims/cmmn/fims-support.js @@ -18,6 +18,7 @@ class FimsSupport { console.log("fnJsonArrayToFormData(json배열,배열이름) : jsonArray를 FormData형식의 키를 갖는 json으로 치환한다."); console.log("getCellDefsForPrivacyCell(TD태그의 제이쿼리 객체) : 엑셀다운로드시 개인정보 포함된 셀의 컬럼명을 추출하는 함수"); console.log("openPDF(blob객체,새 창 이름) : PDF파일 미리보기 창 열기"); + console.log("fnProgress(sse키, progress팝업화면 내용, progress응답시 처리 메소드) : 프로그레스바 표시"); } /************************************************************************** @@ -465,8 +466,36 @@ class FimsSupport { }; } + /************************************************************************** + * 프로그레스바 표시 + **************************************************************************/ + static fnProgress(sseKey, progressContent, progressEvent){ + var eventSource = new EventSource(SSE_SUBSCRIBE_URL+"?sseKey="+sseKey); + + eventSource.onopen = function(e) { + $.blockUI({ + message : ""+progressContent+"", + css: { backgroundColor: "lightgrey", padding : "10px" } + }); + }; + + eventSource.onerror = function(e) { + $.unblockUI(); + }; + + eventSource.onmessage = function(e) { + if (e.data == 'FIN'){ + eventSource.close(); + $.unblockUI(); + } else { + progressEvent(e.data); + } + }; + } } +const SSE_SUBSCRIBE_URL = wctx.url("/subscribe.do"); + const BOOTSTRAP_COLS = [ "col-1","col-2","col-3","col-4","col-5","col-6","col-7","col-8","col-9","col-10","col-11","col-12", "col-sm-1","col-sm-2","col-sm-3","col-sm-4","col-sm-5","col-sm-6","col-sm-7","col-sm-8","col-sm-9","col-sm-10","col-sm-11","col-sm-12", diff --git a/src/main/webapp/resources/js/fims/cmmn/objectInspector.js b/src/main/webapp/resources/js/fims/cmmn/objectInspector.js new file mode 100644 index 00000000..a0fd0351 --- /dev/null +++ b/src/main/webapp/resources/js/fims/cmmn/objectInspector.js @@ -0,0 +1,38 @@ +/************************************************************************** +* HTML요소 어트리뷰트(프로퍼티,이벤트) 등록 +**************************************************************************/ +class ObjectInspector { + + static help(){ + console.log("regist(doctx명, 어트리뷰트정보) : HTML요소에 어트리뷰트(프로퍼티,이벤트) 등록"); + } + + static regist(doctx, data){ + let objectInspector = {}; + + if(data == null){ + objectInspector = JSON.parse(document.querySelector("[data-doctx='"+doctx+"']").querySelector("script.objectInspector").text); + } else if(data instanceof HTMLScriptElement){ + objectInspector = JSON.parse(data.text); + } else if(typeof data == "string"){ + let curlyBracketsOpen = String.fromCharCode(123); //중괄호시작 + if(!data.trim().startsWith(curlyBracketsOpen)){ + objectInspector = JSON.parse(document.querySelector("script[id='"+data+"'").text); + } else { + objectInspector = JSON.parse(data); + } + } else { + objectInspector = data; + } + + let keys = Object.keys(objectInspector); + for(let key of keys){ + let elem = document.querySelector("[data-doctx='"+doctx+"'] [name='"+key+"']"); + let attrs = objectInspector[key]; + let attrNames = Object.keys(attrs); + for(let attrName of attrNames){ + elem.setAttribute(attrName,attrs[attrName]); + } + } + } +} \ No newline at end of file