@@ -204,6 +201,13 @@ $(document).ready(function(){
var $P = pageObject["${pageName}"];
$P.sggInfo = {};
$P.taskList = [];
+ $P.curSggCd = "";
+
+ if("${sggCd}" == ""){
+ $P.curSggCd = MY_INFO.info.sggCd;
+ } else {
+ $P.curSggCd = "${sggCd}";
+ }
$P.taskDatasets = {};
var taskCodes = Object.keys(ALL_TASK);
@@ -216,10 +220,12 @@ $(document).ready(function(){
$P.getSggInfo = async function(){
return new Promise((resolve, reject) => {
ajax.get({
- url: wctx.url("user/stngInfo.do"),
- data: { type : "sgg" },
+ url: wctx.url("mngt/mngt03/010/getSggInfo.do"),
+ data: {
+ sggCd : $P.curSggCd
+ },
success : function(resp, textStatus, jqXHR) {
- $P.sggInfo = resp.stngInfo;
+ $P.sggInfo = resp.sggInfo;
$("#mainForm--${pageName}").find("[name='sggCd']").val($P.sggInfo.SGG_CD);
$("#mainForm--${pageName}").find("[name='sggNm']").val($P.sggInfo.SGG_NM);
@@ -230,18 +236,20 @@ $(document).ready(function(){
$("#mainForm--${pageName}").find("[name='instAddr']").val($P.sggInfo.INST_ADDR);
$("#mainForm--${pageName}").find("[name='instDaddr']").val($P.sggInfo.INST_DADDR);
- if(!isEmpty($P.sggInfo.OFFCS_FILE_PATH)){
- $("#offcs--${pageName}").attr("alt", $P.sggInfo.OFFCS_FILE_NM);
- $("#offcs--${pageName}").attr("src", $P.sggInfo.OFFCS_FILE_PATH);
- }
- if(!isEmpty($P.sggInfo.SYMBOL_FILE_PATH)){
- $("#symbol--${pageName}").attr("alt", $P.sggInfo.SYMBOL_FILE_NM);
- $("#symbol--${pageName}").attr("src", $P.sggInfo.SYMBOL_FILE_PATH);
- }
- if(!isEmpty($P.sggInfo.LOGO_FILE_PATH)){
- $("#logo--${pageName}").attr("alt", $P.sggInfo.LOGO_FILE_NM);
- $("#logo--${pageName}").attr("src", $P.sggInfo.LOGO_FILE_PATH);
- }
+ $("#offcsImage--${pageName}")
+ .attr("data-orgn-name", $P.sggInfo.OFFCS_FILE_NM)
+ .attr("data-orgn-path", $P.sggInfo.OFFCS_FILE_PATH);
+ $("#offcs--${pageName}").trigger("change");
+
+ $("#symbolImage--${pageName}")
+ .attr("data-orgn-name", $P.sggInfo.SYMBOL_FILE_NM)
+ .attr("data-orgn-path", $P.sggInfo.SYMBOL_FILE_PATH);
+ $("#symbol--${pageName}").trigger("change");
+
+ $("#logoImage--${pageName}")
+ .attr("data-orgn-name", $P.sggInfo.LOGO_FILE_NM)
+ .attr("data-orgn-path", $P.sggInfo.LOGO_FILE_PATH);
+ $("#logo--${pageName}").trigger("change");
resolve({resp, textStatus, jqXHR});
},
@@ -255,8 +263,11 @@ $(document).ready(function(){
$P.getSggTaskInfo = async function(){
return new Promise((resolve, reject) => {
ajax.get({
- url: wctx.url("mngt/mngt03/getTasks.do"),
- data: { useYN : "Y", sggCd : MY_INFO.info.sggCd },
+ url: wctx.url("mngt/mngt03/010/getTasks.do"),
+ data: {
+ useYN : "Y",
+ sggCd : $P.curSggCd
+ },
success : function(resp, textStatus, jqXHR) {
$P.taskList = resp.taskList;
@@ -314,12 +325,15 @@ $(document).ready(function(){
});
});
};
-
+
$P.getVltnInfo = async function(){
return new Promise((resolve, reject) => {
ajax.get({
- url: wctx.url("mngt/mngt03/getVltns.do"),
- data: { useYN : "Y", sggCd : MY_INFO.info.sggCd },
+ url: wctx.url("mngt/mngt03/010/getVltns.do"),
+ data: {
+ useYN : "Y",
+ sggCd : $P.curSggCd
+ },
success : function(resp, textStatus, jqXHR) {
var datasetNames = Object.keys($P.taskDatasets);
@@ -342,7 +356,35 @@ $(document).ready(function(){
}
});
});
- }
+ };
+
+ fnMakeSingleImageViewer($("#offcsImage--${pageName}")[0] , $("#offcs--${pageName}")[0], "orgn-path", "orgn-name");
+ fnMakeSingleImageViewer($("#symbolImage--${pageName}")[0] , $("#symbol--${pageName}")[0], "orgn-path", "orgn-name");
+ fnMakeSingleImageViewer($("#logoImage--${pageName}")[0] , $("#logo--${pageName}")[0], "orgn-path", "orgn-name");
+
+ $("#btnSaveSgg--${pageName}").on("click", function(){
+
+ var formData = new FormData($("#mainForm--${pageName}")[0]);
+
+ ajax.post({
+ url: wctx.url("mngt/mngt03/010/updateSgg.do"),
+ data: formData,
+ contentType : false, processData : false,
+ success: (resp) => {
+ dialog.alert({
+ content : "저장됐습니다.",
+ init : function(){
+ setDialogZindex();
+ focusClose();
+ },
+ onClose : () => {
+ $P.getSggInfo();
+ }
+ });
+ }
+ });
+ });
+
$P.getSggInfo()
.then(() => {
@@ -350,11 +392,10 @@ $(document).ready(function(){
})
.then(() => {
return $P.getVltnInfo();
- })
- .then(() => {
- console.log('end...');
});
});
+
+
\ No newline at end of file
diff --git a/src/main/webapp/resources/js/fims/framework/cmm/componentization.js b/src/main/webapp/resources/js/fims/framework/cmm/componentization.js
index 21934d7b..0cd4a978 100644
--- a/src/main/webapp/resources/js/fims/framework/cmm/componentization.js
+++ b/src/main/webapp/resources/js/fims/framework/cmm/componentization.js
@@ -246,4 +246,37 @@ function fnMakeScrollableTable(tableScrollEl, thisScrollendEvent){
}
};
+}
+
+/**************************************************************************
+* 단일 업로드 이미지 뷰어
+**************************************************************************/
+function fnMakeSingleImageViewer(imgEl, fileInputEl, dataAttributeForFilePath, dataAttributeForFileName){
+
+ $(imgEl).on("click", function(){
+ $(fileInputEl).click();
+ });
+
+ $(fileInputEl).on("change", function(){
+
+ if(this.files != null && this.files.length > 0){
+ $(imgEl).attr("alt", this.files[0].name);
+ $(imgEl).attr("src", (window.URL || window.webkitURL).createObjectURL(this.files[0]));
+
+ } else {
+
+ var orgnName = $(imgEl).attr("data-"+dataAttributeForFileName);
+ var orgnPath = $(imgEl).attr("data-"+dataAttributeForFilePath);
+
+ if(orgnPath != undefined && orgnPath != null && orgnPath != ""){
+ $(imgEl).attr("alt", orgnName);
+ $(imgEl).attr("src", orgnPath);
+ } else {
+ $(imgEl).attr("alt", "파일이 없습니다.");
+ $(imgEl).attr("src", "/resources/image/no-image.png");
+ }
+
+ }
+
+ });
}
\ No newline at end of file