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("infoPrefixUrl", "/adds/nims") // prefixUrl
.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 = {
...jsonBssh,
rndDtlRptCnt: datasetListPrd.length,
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 == "");
upload({
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 => {
if(!resp.success){
dialog.alert({
@ -407,11 +400,23 @@
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({
content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { setDialogZindex(); }
, 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"%>
<%@ 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 -->
<div class="content-wrapper">
@ -13,7 +13,7 @@
<!-- 입력 영역 -->
<form id="frmEdit--${pageName}" name="frmEdit">
<!-- 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="col-md-4">
<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 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="col-md-4">
<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>
</div>
<div class="col-md-6">
<label for="addr--${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">
<label for="dsuseSeCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">폐기구분</label>
<select class="form-select" id="dsuseSeCd--${pageName}" name="dsuseSeCd">
<option value="1">보건소폐기</option>
<option value="2">공무원임회</option>
<option value="4">도난/분실/재해 발생 사고마약류</option>
</select>
</div>
<div class="col-md-6">
<label for="dsuseMth--${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">
<label for="dsuseMthCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">폐기방법</label>
<select class="form-select" id="dsuseMthCd--${pageName}" name="dsuseMthCd">
<option value="1">소각</option>
<option value="2">중화</option>
<option value="3">가수분해</option>
@ -150,7 +150,7 @@
load : wctx.url("/adds/nims/dsuseMgt-list.do")
}
, prefix: "dsuseMgt"
, prefixName: "신청서접수"
, prefixName: "폐기 결과[통보]"
, keymapper: info => info ? info.DSCDMNG_ID : ""
, dataGetter: obj => obj.dsuseMgtList
, appendData: true
@ -232,15 +232,33 @@
}
// 저장
$P.control.save = (info) => {
if (!info) return;
$P.control.save = (info, fileArr) => {
let saveData = {
...info,
userId: "${currentUser.account}"
}
let create = (info.mngId == "");
ajax.post({
url: !create ? $P.control.urls.update : $P.control.urls.create
, data: info || {}
, success: resp => $P.control.onSave(resp)
upload({
url: '<c:url value="${apiHost}/api/biz/nims/v1/saveDsuseMgtRslt" />'
, data: {
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 = () => {
// validate 확인
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({
content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { setDialogZindex(); }
, onOK: () => {
$P.control.save($P.formFields.get()); // formFields
$P.control.save(rsltData, fileArr); // formFields
}
});
}

Loading…
Cancel
Save