fix: 폐기 결과 처리

dev
Jonguk. Lim 5 months ago
parent e2ed1e528a
commit 0ae2bd5ed2

@ -66,7 +66,7 @@ public class AddsNimsController extends AbstractController {
.addObject("infoPrefix", "dsuseMgtRsltInfo") // prefix .addObject("infoPrefix", "dsuseMgtRsltInfo") // prefix
.addObject("infoPrefixUrl", "/adds/nims") // prefixUrl .addObject("infoPrefixUrl", "/adds/nims") // prefixUrl
.addObject("usrRptIdNo", usrRptIdNo) // View(jsp)에서 사용할 id 뒤에 붙일 suffix .addObject("usrRptIdNo", usrRptIdNo) // View(jsp)에서 사용할 id 뒤에 붙일 suffix
; .addObject("apiHost", apiHost);
} }
//------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------
// 결과[통보] 처리 // 결과[통보] 처리

@ -288,30 +288,23 @@
} }
// 저장 // 저장
$P.control.save = (jsonBssh, datasetListPrd) => { $P.control.save = (jsonBssh, datasetListPrd, fileArr) => {
let saveBsshData = { let saveBsshData = {
...jsonBssh, ...jsonBssh,
rndDtlRptCnt: datasetListPrd.length, rndDtlRptCnt: datasetListPrd.length,
userId: "${currentUser.account}" userId: "${currentUser.account}"
} }
let fileArr = [];
$("#tbody--productList").find("input[type='file'][name='dsusePrdImgFiles']").each(() => {
fileArr.push(this.files[0]);
});
let saveData = {
dsuseMgtJsonStr: JSON.stringify(saveBsshData),
dsuseMgtDtlsJsonStr: JSON.stringify(datasetListPrd),
// 폐기상품이미지목록
dsusePrdImgFiles: fileArr
};
let create = (jsonBssh.dscdmngId == ""); let create = (jsonBssh.dscdmngId == "");
upload({ upload({
url: '<c:url value="${apiHost}/api/biz/nims/v1/saveDsuseMgtReceipt" />' url: '<c:url value="${apiHost}/api/biz/nims/v1/saveDsuseMgtReceipt" />'
, data: saveData || {} , data: {
dsuseMgtJsonStr: JSON.stringify(saveBsshData),
dsuseMgtDtlsJsonStr: JSON.stringify(datasetListPrd),
// 폐기상품이미지목록
dsusePrdImgFiles: fileArr
}
, success: resp => { , success: resp => {
if(!resp.success){ if(!resp.success){
dialog.alert({ dialog.alert({
@ -407,11 +400,23 @@
return false; return false;
} }
let fileArr = [];
$("#tbody--productList").find("input[type='file'][name='dsusePrdImgFiles']").each(() => {
fileArr.push(this.files[0]);
});
if(dsProd.length != fileArr.length){
dialog.alert({
content: "입력되지 않은 폐기 제품 이미지가 있습니다."
});
return false;
}
dialog.alert({ dialog.alert({
content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?" content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { setDialogZindex(); } , init: () => { setDialogZindex(); }
, onOK: () => { , onOK: () => {
$P.control.save(bsshData, dsProd); // formFields $P.control.save(bsshData, dsProd, fileArr); // formFields
} }
}); });
} }

@ -1,7 +1,7 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%> <%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">신청서 정보 상세</c:set> <c:set var="prefixName" scope="request">폐기 결과[통보] 상세</c:set>
<!-- inner page html --> <!-- inner page html -->
<div class="content-wrapper"> <div class="content-wrapper">
@ -13,7 +13,7 @@
<!-- 입력 영역 --> <!-- 입력 영역 -->
<form id="frmEdit--${pageName}" name="frmEdit"> <form id="frmEdit--${pageName}" name="frmEdit">
<!-- hidden --> <!-- hidden -->
<label for="bssh--${pageName}">마약류 취급업체 정보</label> <label for="bssh--${pageName}">업체 정보</label>
<div class="row my-1 mx-4 g-1 border-card rounded-3"> <div class="row my-1 mx-4 g-1 border-card rounded-3">
<div class="col-md-4"> <div class="col-md-4">
<label for="bsshNm--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">업체명</label> <label for="bsshNm--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">업체명</label>
@ -37,7 +37,7 @@
</div> </div>
</div> </div>
<div class="row my-1 mx-1 g-1 border-card rounded"></div> <div class="row my-1 mx-1 g-1 border-card rounded"></div>
<label for="bssh--${pageName}">폐기 공통 정보</label> <label for="bssh--${pageName}">폐기 정보</label>
<div class="row my-1 mx-4 g-1 border-card rounded-3"> <div class="row my-1 mx-4 g-1 border-card rounded-3">
<div class="col-md-4"> <div class="col-md-4">
<label for="hdrDe--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">취급일자</label> <label for="hdrDe--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">취급일자</label>
@ -50,16 +50,16 @@
<button type="button" class="bx bx-sm bx-calendar bg-white"></button> <button type="button" class="bx bx-sm bx-calendar bg-white"></button>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<label for="addr--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">폐기구분</label> <label for="dsuseSeCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">폐기구분</label>
<select class="form-select" id="schVltnCd--${pageName}" name="schVltnCd"> <select class="form-select" id="dsuseSeCd--${pageName}" name="dsuseSeCd">
<option value="1">보건소폐기</option> <option value="1">보건소폐기</option>
<option value="2">공무원임회</option> <option value="2">공무원임회</option>
<option value="4">도난/분실/재해 발생 사고마약류</option> <option value="4">도난/분실/재해 발생 사고마약류</option>
</select> </select>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<label for="dsuseMth--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">폐기방법</label> <label for="dsuseMthCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">폐기방법</label>
<select class="form-select" id="dsuseMth--${pageName}" name="dsuseMth"> <select class="form-select" id="dsuseMthCd--${pageName}" name="dsuseMthCd">
<option value="1">소각</option> <option value="1">소각</option>
<option value="2">중화</option> <option value="2">중화</option>
<option value="3">가수분해</option> <option value="3">가수분해</option>
@ -150,7 +150,7 @@
load : wctx.url("/adds/nims/dsuseMgt-list.do") load : wctx.url("/adds/nims/dsuseMgt-list.do")
} }
, prefix: "dsuseMgt" , prefix: "dsuseMgt"
, prefixName: "신청서접수" , prefixName: "폐기 결과[통보]"
, keymapper: info => info ? info.DSCDMNG_ID : "" , keymapper: info => info ? info.DSCDMNG_ID : ""
, dataGetter: obj => obj.dsuseMgtList , dataGetter: obj => obj.dsuseMgtList
, appendData: true , appendData: true
@ -232,15 +232,33 @@
} }
// 저장 // 저장
$P.control.save = (info) => { $P.control.save = (info, fileArr) => {
if (!info) return; let saveData = {
...info,
userId: "${currentUser.account}"
}
let create = (info.mngId == ""); let create = (info.mngId == "");
ajax.post({ upload({
url: !create ? $P.control.urls.update : $P.control.urls.create url: '<c:url value="${apiHost}/api/biz/nims/v1/saveDsuseMgtRslt" />'
, data: info || {} , data: {
, success: resp => $P.control.onSave(resp) dsuseMgtRsltJsonStr: JSON.stringify(saveData),
dsuseDsuseImgFiles: fileArr
}
, success: resp => {
if(!resp.success){
dialog.alert({
content: resp.message
});
return;
}
//$P.control.onSave(resp)
dialog.alert("저장됐습니다.");
dialog.close("dsuseMgtRsltDialog");
//this._load();
}
}); });
} }
@ -355,12 +373,39 @@
$P.fnSave = () => { $P.fnSave = () => {
// validate 확인 // validate 확인
if (!customValidate($("#frmEdit--${pageName}").find("input, select, textarea"))) return; if (!customValidate($("#frmEdit--${pageName}").find("input, select, textarea"))) return;
let rsltData = $P.formFields.get();
if(rsltData.hdrDe == ""){
dialog.alert({
content: "취급일자를 선택해 주세요."
});
return false;
}
if(rsltData.dsuseDe == ""){
dialog.alert({
content: "폐기일자를 선택해 주세요."
});
return false;
}
if(rsltData.dsuseLoc == ""){
dialog.alert({
content: "폐기장소를 입력해 주세요."
});
return false;
}
// FIXME: 파일
let fileArr = [];
// $("#tbody--productList").find("input[type='file'][name='dsusePrdImgFiles']").each(() => {
// fileArr.push(this.files[0]);
// });
dialog.alert({ dialog.alert({
content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?" content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { setDialogZindex(); } , init: () => { setDialogZindex(); }
, onOK: () => { , onOK: () => {
$P.control.save($P.formFields.get()); // formFields $P.control.save(rsltData, fileArr); // formFields
} }
}); });
} }

Loading…
Cancel
Save