From 6e55c4e6786ac756cf4f54e1ac4f3a327b78be36 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Fri, 2 Feb 2024 17:30:18 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8B=9C=EA=B5=B0=EA=B5=AC=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=88=98=EC=A0=95=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80(=EC=A3=BC=EC=86=8C,=20=EC=A7=81=EC=9D=B8,=20=EC=8B=AC?= =?UTF-8?q?=EB=B3=BC,=20=EB=A1=9C=EA=B3=A0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/cokr/xit/fims/mngt/Sgg.java | 65 ++++++++++ .../cokr/xit/fims/mngt/dao/SggMapper.java | 71 +++++++++++ .../xit/fims/mngt/service/SggService.java | 34 +++++ .../xit/fims/mngt/service/bean/SggBean.java | 49 ++++++++ .../mngt/service/bean/SggServiceBean.java | 29 +++++ .../xit/fims/mngt/web/Mngt03Controller.java | 98 ++++++++++++++- .../xit/fims/sprt/web/Sprt01Controller.java | 2 +- .../cokr/xit/fims/task/web/CmnController.java | 13 ++ .../sql/mapper/fims/mngt/sgg-mapper.xml | 65 ++++++++++ .../WEB-INF/jsp/fims/mngt/mngt03010-main.jsp | 119 ++++++++++++------ .../js/fims/framework/cmm/componentization.js | 33 +++++ 11 files changed, 536 insertions(+), 42 deletions(-) create mode 100644 src/main/java/cokr/xit/fims/mngt/Sgg.java create mode 100644 src/main/java/cokr/xit/fims/mngt/dao/SggMapper.java create mode 100644 src/main/java/cokr/xit/fims/mngt/service/SggService.java create mode 100644 src/main/java/cokr/xit/fims/mngt/service/bean/SggBean.java create mode 100644 src/main/java/cokr/xit/fims/mngt/service/bean/SggServiceBean.java create mode 100644 src/main/resources/sql/mapper/fims/mngt/sgg-mapper.xml diff --git a/src/main/java/cokr/xit/fims/mngt/Sgg.java b/src/main/java/cokr/xit/fims/mngt/Sgg.java new file mode 100644 index 00000000..0cf27ba3 --- /dev/null +++ b/src/main/java/cokr/xit/fims/mngt/Sgg.java @@ -0,0 +1,65 @@ +package cokr.xit.fims.mngt; + +import cokr.xit.foundation.AbstractEntity; +import lombok.Getter; +import lombok.Setter; + +/** + * 시군구 정보 + * @author leebj + */ +@Getter +@Setter +public class Sgg extends AbstractEntity { + + /** + * 시군구 코드 + */ + private String sggCd; + + /** + * 기관 우편번호 + */ + private String instZip; + + /** + * 기관 기본 주소 + */ + private String instAddr; + + /** + * 기관 상세 주소 + */ + private String instDaddr; + + /** + * 상징 파일 경로 + */ + private String symbolFilePath; + + /** + * 상징 파일 명 + */ + private String symbolFileNm; + + /** + * 로고 파일 경로 + */ + private String logoFilePath; + + /** + * 로고 파일 명 + */ + private String logoFileNm; + + /** + * 직인 파일 경로 + */ + private String offcsFilePath; + + /** + * 직인 파일 명 + */ + private String offcsFileNm; + +} diff --git a/src/main/java/cokr/xit/fims/mngt/dao/SggMapper.java b/src/main/java/cokr/xit/fims/mngt/dao/SggMapper.java new file mode 100644 index 00000000..74d6d4b4 --- /dev/null +++ b/src/main/java/cokr/xit/fims/mngt/dao/SggMapper.java @@ -0,0 +1,71 @@ +package cokr.xit.fims.mngt.dao; + +import java.util.List; +import java.util.Map; + +import org.egovframe.rte.psl.dataaccess.mapper.Mapper; + +import cokr.xit.fims.cmmn.CmmnQuery; +import cokr.xit.fims.mngt.Sgg; +import cokr.xit.foundation.component.AbstractMapper; +import cokr.xit.foundation.data.DataObject; + +/** 시군구 정보 DAO +* +*

상세 설명: +* +*

+* ============ 변경 이력 ============
+* 2023-02-02	leebj 최초 작성
+* ================================
+* 
+*/ +@Mapper("sggMapper") +public interface SggMapper extends AbstractMapper { + + /**시군구 정보를 수정한다. + * @param params 파라미터 + * + * @return 저장된 정보수 + */ + int updateSgg(Map params); + + /**시군구 정보를 수정한다. + * @param sgg 시군구 + * @return 저장 여부 + * + */ + default boolean update(Sgg sgg) { + return sgg != null && updateSgg(params().set("sgg", sgg)) == 1; + } + + /**지정한 조건에 따라 시군구 객체들을 반환한다. + * @param req 시군구 조회 조건 + * @return 시군구 객체 목록 + */ + List selectSggs(CmmnQuery req); + + /**지정한 조건에 따라 시군구 객체를 반환한다. + * @param req 시군구 조회 조건 + * @return 시군구 객체 + */ + default DataObject selectSggInfo(CmmnQuery req) { + // 사용 여부 확인 + if (req.getUseYN() == null) { + req.setUseYN("Y"); + } + // 기본 정렬 + if (req.getOrderBy() == null) { + req.setOrderBy("S.SGG_CD DESC"); + } + + List sggs = selectSggs(req); + + return !sggs.isEmpty() ? sggs.get(0) : null; + } + +} diff --git a/src/main/java/cokr/xit/fims/mngt/service/SggService.java b/src/main/java/cokr/xit/fims/mngt/service/SggService.java new file mode 100644 index 00000000..3688f9d5 --- /dev/null +++ b/src/main/java/cokr/xit/fims/mngt/service/SggService.java @@ -0,0 +1,34 @@ +package cokr.xit.fims.mngt.service; + +import cokr.xit.fims.cmmn.CmmnQuery; +import cokr.xit.fims.mngt.Sgg; +import cokr.xit.foundation.data.DataObject; + +/**시군구 정보 관리 서비스 인터페이스. +* +*

상세 설명: +* +*

+* ============ 변경 이력 ============
+* 2024-02-02	leebj 최초 작성
+* ================================
+* 
+*/ +public interface SggService { + + /**시군구 정보를 수정한다. + * @param sgg 시군구 + * @return 저장 여부 + *
  • 저장됐으면 true
  • + *
  • 그렇지 않으면 false
  • + *
+ */ + boolean update(Sgg sgg); + + /**지정한 조건에 따라 시군구 객체를 반환한다. + * @param req 시군구 조회 조건 + * @return 시군구 객체 + */ + DataObject getSggInfo(CmmnQuery req); + +} diff --git a/src/main/java/cokr/xit/fims/mngt/service/bean/SggBean.java b/src/main/java/cokr/xit/fims/mngt/service/bean/SggBean.java new file mode 100644 index 00000000..e83fcb9c --- /dev/null +++ b/src/main/java/cokr/xit/fims/mngt/service/bean/SggBean.java @@ -0,0 +1,49 @@ +package cokr.xit.fims.mngt.service.bean; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Component; + +import cokr.xit.fims.cmmn.CmmnQuery; +import cokr.xit.fims.mngt.Sgg; +import cokr.xit.fims.mngt.dao.SggMapper; +import cokr.xit.foundation.AbstractComponent; +import cokr.xit.foundation.data.DataObject; + +/** 시군구 정보 관리 Bean +* +*

상세 설명: +* +*

+* ============ 변경 이력 ============
+* 2024-02-02	leebj 최초 작성
+* ================================
+* 
+*/ +@Component("sggBean") +public class SggBean extends AbstractComponent { + + /** 시군구 DAO */ + @Resource(name = "sggMapper") + private SggMapper sggMapper; + + /**시군구 정보를 수정한다. + * @param sgg 시군구 + * @return 저장 여부 + *
  • 저장됐으면 true
  • + *
  • 그렇지 않으면 false
  • + *
+ */ + public boolean update(Sgg sgg) { + return sggMapper.update(sgg); + } + + /**지정한 조건에 따라 시군구 객체를 반환한다. + * @param req 시군구 조회 조건 + * @return 시군구 객체 + */ + public DataObject getSggInfo(CmmnQuery req) { + return sggMapper.selectSggInfo(req); + } + +} diff --git a/src/main/java/cokr/xit/fims/mngt/service/bean/SggServiceBean.java b/src/main/java/cokr/xit/fims/mngt/service/bean/SggServiceBean.java new file mode 100644 index 00000000..1894375d --- /dev/null +++ b/src/main/java/cokr/xit/fims/mngt/service/bean/SggServiceBean.java @@ -0,0 +1,29 @@ +package cokr.xit.fims.mngt.service.bean; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import cokr.xit.fims.cmmn.CmmnQuery; +import cokr.xit.fims.mngt.Sgg; +import cokr.xit.fims.mngt.service.SggService; +import cokr.xit.foundation.component.AbstractServiceBean; +import cokr.xit.foundation.data.DataObject; + +@Service("sggService") +public class SggServiceBean extends AbstractServiceBean implements SggService { + + @Resource(name = "sggBean") + private SggBean sggBean; + + @Override + public boolean update(Sgg sgg) { + return sggBean.update(sgg); + } + + @Override + public DataObject getSggInfo(CmmnQuery req) { + return sggBean.getSggInfo(req); + } + +} diff --git a/src/main/java/cokr/xit/fims/mngt/web/Mngt03Controller.java b/src/main/java/cokr/xit/fims/mngt/web/Mngt03Controller.java index fccb5863..0c2125e0 100644 --- a/src/main/java/cokr/xit/fims/mngt/web/Mngt03Controller.java +++ b/src/main/java/cokr/xit/fims/mngt/web/Mngt03Controller.java @@ -1,14 +1,21 @@ package cokr.xit.fims.mngt.web; +import java.io.File; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.annotation.Resource; +import org.apache.commons.io.FilenameUtils; +import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import cokr.xit.base.web.ApplicationController; import cokr.xit.fims.cmmn.CmmnQuery; +import cokr.xit.fims.mngt.Sgg; import cokr.xit.fims.mngt.VltnQuery; +import cokr.xit.fims.mngt.service.SggService; import cokr.xit.fims.mngt.service.TaskService; import cokr.xit.fims.mngt.service.VltnService; import cokr.xit.fims.mngt.service.bean.FactionBean; @@ -26,11 +33,17 @@ public class Mngt03Controller extends ApplicationController { public class METHOD_URL { public static final String sggMngtMain = "/010/main.do", - getTasks = "/getTasks.do", - getVltns = "/getVltns.do" + getSggInfo = "/010/getSggInfo.do", + getTasks = "/010/getTasks.do", + getVltns = "/010/getVltns.do", + updateSgg = "/010/updateSgg.do" ; } + /** 시군구 정보 서비스 */ + @Resource(name = "sggService") + private SggService sggService; + /** 업무 정보 서비스 */ @Resource(name = "taskService") private TaskService taskService; @@ -72,14 +85,95 @@ public class Mngt03Controller extends ApplicationController { return mav; } + /**지정하는 시군구의 설정 정보를 가져온다.
+ * @param req + * @return jsonView + */ + public ModelAndView getSggInfo(CmmnQuery req) { + ModelAndView mav = new ModelAndView("jsonView"); + DataObject sggInfo = sggService.getSggInfo(req); + mav.addObject("sggInfo", sggInfo); + return mav; + } + + /**지정하는 시군구의 업무 설정 정보를 가져온다.
+ * @param req + * @return jsonView + */ public ModelAndView getTasks(CmmnQuery req) { List result = taskService.getTasks(req); return setCollectionInfo(new ModelAndView("jsonView"), result, "task"); } + /**지정하는 시군구와 업무의 위반 설정 정보를 가져온다.
+ * @return 위반 설정 정보 + */ public ModelAndView getVltns(VltnQuery req) { List result = vltnService.getVltns(req); return setCollectionInfo(new ModelAndView("jsonView"), result, "vltn"); } + + /**시군구 정보를 수정한다. + * @param sgg 시군구 정보, symbol 시군구 상징파일, logo 시군구 로고파일, offcs 시군구 직인파일 + * @return jsonView + *
 {
+	 *     "saved": 수정되었으면 true, 그렇지 않으면 false
+	 * }
+ */ + public ModelAndView updateSgg(Sgg sgg, MultipartFile symbol, MultipartFile logo, MultipartFile offcs) { + ModelAndView mav = new ModelAndView("jsonView"); + + String sggCd = sgg.getSggCd(); + + if(symbol != null && !symbol.isEmpty() && symbol.getSize() != 0) { + Map newSymbol = this.uploadForSgg(symbol, sggCd, "symbol"); + sgg.setSymbolFilePath(newSymbol.get("filePath")); + sgg.setSymbolFileNm(newSymbol.get("fileName")); + } + if(logo != null && !logo.isEmpty() && logo.getSize() != 0) { + Map newLogo = this.uploadForSgg(logo, sggCd, "logo"); + sgg.setLogoFilePath(newLogo.get("filePath")); + sgg.setLogoFileNm(newLogo.get("fileName")); + } + if(offcs != null && !offcs.isEmpty() && offcs.getSize() != 0) { + Map newOffcs = this.uploadForSgg(offcs, sggCd, "offcs"); + sgg.setOffcsFilePath(newOffcs.get("filePath")); + sgg.setOffcsFileNm(newOffcs.get("fileName")); + } + + boolean saved = sggService.update(sgg); + + mav.addObject("saved", saved); + return mav; + } + + private Map uploadForSgg(MultipartFile mf, String sggCd, String fileSe){ + Map newFileInfoMap = new HashMap<>(); + String workDirPath = "files/"+fileSe; + + String ext = FilenameUtils.getExtension(mf.getOriginalFilename()); + String fileName = sggCd+"."+ext; + + File workDir = new File(workDirPath); + workDir.mkdirs(); + String newFileFullPath = workDirPath + "/" + fileName; + + try { + + File newFile = new File(newFileFullPath); + if(newFile.exists()) { + newFile.delete(); + } + mf.transferTo(newFile); + + } catch (Exception e) { + throw new RuntimeException("[F]배경 이미지 업로드 중 오류가 발생하였습니다."); + } + + newFileInfoMap.put("filePath", newFileFullPath); + newFileInfoMap.put("fileName", mf.getOriginalFilename()); + return newFileInfoMap; + } + } diff --git a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java index cd0b3fcc..2d840304 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java @@ -638,7 +638,7 @@ public class Sprt01Controller extends ApplicationController { ModelAndView mav = new ModelAndView("jsonView"); boolean saved = false; - if(backgroundFile != null && !backgroundFile.isEmpty()) { + if(backgroundFile != null && !backgroundFile.isEmpty() && backgroundFile.getSize() != 0) { String institute = currentUser().getInstitute(); String account = currentUser().getAccount(); ManagedUser currentUser = userMapper.getUser(account, institute); diff --git a/src/main/java/cokr/xit/fims/task/web/CmnController.java b/src/main/java/cokr/xit/fims/task/web/CmnController.java index 9cc75fbe..3a97ff48 100644 --- a/src/main/java/cokr/xit/fims/task/web/CmnController.java +++ b/src/main/java/cokr/xit/fims/task/web/CmnController.java @@ -9,6 +9,7 @@ import org.springframework.web.servlet.ModelAndView; import cokr.xit.fims.cmmn.CmmnQuery; import cokr.xit.fims.crdn.Crdn; +import cokr.xit.fims.mngt.Sgg; import cokr.xit.fims.mngt.VltnQuery; import cokr.xit.fims.sprt.OtptForm; import cokr.xit.fims.sprt.OtptStngQuery; @@ -599,6 +600,12 @@ public class CmnController { return super.sggMngtMain(sggCd); } + @Override + @RequestMapping(name="시군구 조회", value=METHOD_URL.getSggInfo) + public ModelAndView getSggInfo(CmmnQuery req) { + return super.getSggInfo(req); + } + @Override @RequestMapping(name="업무 조회", value=METHOD_URL.getTasks) public ModelAndView getTasks(CmmnQuery req) { @@ -610,6 +617,12 @@ public class CmnController { public ModelAndView getVltns(VltnQuery req) { return super.getVltns(req); } + + @Override + @RequestMapping(name="시군구 정보 수정", value=METHOD_URL.updateSgg) + public ModelAndView updateSgg(Sgg sgg, MultipartFile symbol, MultipartFile logo, MultipartFile offcs) { + return super.updateSgg(sgg, symbol, logo, offcs); + } } @Controller diff --git a/src/main/resources/sql/mapper/fims/mngt/sgg-mapper.xml b/src/main/resources/sql/mapper/fims/mngt/sgg-mapper.xml new file mode 100644 index 00000000..60a8ac5e --- /dev/null +++ b/src/main/resources/sql/mapper/fims/mngt/sgg-mapper.xml @@ -0,0 +1,65 @@ + + + + + +SELECT S.SGG_CD + , S.SGG_NM + , S.INST_SE_CD + , S.INST_CD + , S.INST_NM + , (CASE + WHEN S.INST_DADDR IS NULL OR S.INST_DADDR = '' + THEN S.INST_ADDR + ELSE CONCAT(S.INST_ADDR,' ',S.INST_DADDR) + END) AS INST_FULL_ADDR + , S.INST_ADDR + , S.INST_DADDR + , S.INST_ZIP + , S.SYMBOL_FILE_PATH + , S.SYMBOL_FILE_NM + , S.LOGO_FILE_PATH + , S.LOGO_FILE_NM + , S.OFFCS_FILE_PATH + , S.OFFCS_FILE_NM + FROM TB_SGG S + + + + + +/* 시군구 설정정보 수정 (sggMapper.updateSgg) */ +UPDATE TB_SGG + SET MDFCN_DT = + , MDFR = #{sgg.modifiedBy} + , INST_ZIP = #{sgg.instZip} + , INST_ADDR = #{sgg.instAddr} + , INST_DADDR = #{sgg.instDaddr} + + , SYMBOL_FILE_PATH = #{sgg.symbolFilePath} + , SYMBOL_FILE_NM = #{sgg.symbolFileNm} + + + , LOGO_FILE_PATH = #{sgg.logoFilePath} + , LOGO_FILE_NM = #{sgg.logoFileNm} + + + , OFFCS_FILE_PATH = #{sgg.offcsFilePath} + , OFFCS_FILE_NM = #{sgg.offcsFileNm} + + WHERE SGG_CD = #{sgg.sggCd} + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/fims/mngt/mngt03010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/mngt/mngt03010-main.jsp index 60e1f8f1..8a0171b0 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/mngt/mngt03010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/mngt/mngt03010-main.jsp @@ -4,15 +4,15 @@
-
+
시군구 정보 - +
@@ -36,31 +36,28 @@
-
-
-
@@ -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