fix: 폐기결과[통보] 처리 이미지 처리

-> 폐기일자 & 폐기방법별로 단 한개의 폐기보고에서만 이미지 업로드 및 변경 처리하도록 변경
dev
Jonguk. Lim 4 months ago
parent b6d173324b
commit 47e8a24e45

@ -210,7 +210,7 @@ public class AddsNimsController extends ApplicationController {
mav.addObject(
"dsuseRsltImgList",
toJson(
addsNimsService.getDsuseMgtRsltImgList(
getDsuseMgtRsltImgDscdmngList(
new DsuseMgtRsltQuery()
.setDscdmngId(dsuseRsltInfo.getDscdmngId())
.setDeptCd(dsuseRsltInfo.getDeptCd())
@ -229,6 +229,11 @@ public class AddsNimsController extends ApplicationController {
.addObject("dsuseRsltInfo", toJson(dsuseRsltInfo)) // View(jsp)에서 사용할 id 뒤에 붙일 suffix
.addObject("apiHost", apiHost);
}
@RequestMapping(value = "/getDsuseMgtRsltImgDscdmngList.do", name="결과[통보] 처리 등록 이미지 폐기관리 목록 조회")
public @ResponseBody List<DataObject> getDsuseMgtRsltImgDscdmngList(DsuseMgtRsltQuery query) {
return addsNimsService.getDsuseMgtRsltImgList(query);
}
//-------------------------------------------------------------------------------------------------
// 결과[통보] 처리
//-------------------------------------------------------------------------------------------------
@ -248,10 +253,7 @@ public class AddsNimsController extends ApplicationController {
return mav
.addObject("pageName", "dsuseMgtMappingInfo") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
.addObject("apiHost", apiHost)
.addObject("dsuseMappingInfo", toJson(dsuseMappingInfo)) // View(jsp)에서 사용할 id 뒤에 붙일 suffix
// .addObject("infoPrefix", "dsuseMgtReceipt") // prefix
// .addObject("infoPrefixUrl", "/adds/nims") // prefixUrl
;
.addObject("dsuseMappingInfo", toJson(dsuseMappingInfo)) /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */;
}
@RequestMapping(value = "/updatePrgsSttusOfDsuseMgt.do", name = "페기 보고 확인 등록")
public ModelAndView updatePrgsSttusOfDsuseMgt(DsuseMgtReceiptQuery qry) {
@ -339,11 +341,7 @@ public class AddsNimsController extends ApplicationController {
List<DataObject> deptList = sggDeptService.getDepartmentList(new DepartmentQuery());
mav.addObject("DEPTList", deptList);
return mav
.addObject("pageName", "dsuseMgtReceipt") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
// .addObject("infoPrefix", "dsuseMgtReceipt") // prefix
// .addObject("infoPrefixUrl", "/adds/nims") // prefixUrl
;
return mav.addObject("pageName", "dsuseMgtReceipt") /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */;
}
@RequestMapping(value = "dsuseMgtRslt.do", name="결과[통보] 처리 메인")
@ -353,11 +351,7 @@ public class AddsNimsController extends ApplicationController {
List<DataObject> deptList = sggDeptService.getDepartmentList(new DepartmentQuery());
mav.addObject("DEPTList", deptList);
return mav
.addObject("pageName", "dsuseMgtRslt") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
// .addObject("infoPrefix", "dsuseMgtReceipt") // prefix
// .addObject("infoPrefixUrl", "/adds/nims") // prefixUrl
;
return mav.addObject("pageName", "dsuseMgtRslt") /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */;
}
@RequestMapping(value = "/dsuseMgtMapping.do", name="폐기 보고 확인 메인")
@ -367,11 +361,7 @@ public class AddsNimsController extends ApplicationController {
List<DataObject> deptList = sggDeptService.getDepartmentList(new DepartmentQuery());
mav.addObject("DEPTList", deptList);
return mav
.addObject("pageName", "dsuseMgtMapping") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
// .addObject("infoPrefix", "dsuseMgtReceipt") // prefix
// .addObject("infoPrefixUrl", "/adds/nims") // prefixUrl
;
return mav.addObject("pageName", "dsuseMgtMapping") /* View(jsp)에서 사용할 id 뒤에 붙일 suffix */;
}
@RequestMapping(name = "폐기보고 문서 관리 메인", value = {"/dsuseMgtDoc.do"})
@ -525,7 +515,7 @@ public class AddsNimsController extends ApplicationController {
//3.DB 저장, 스토리지 저장
List<String> dscdmngIds = IntStream.rangeClosed(1, dataForDoc.size()).boxed().map(i -> {
return dataForDoc.get(i-1).string("dscdmngId");
}).collect(Collectors.toList());
}).toList();
boolean allEqual = dscdmngIds.stream().distinct().count() <= 1;
if(allEqual) {
String resultFilePath = form.andGetPath();

@ -51,12 +51,12 @@
<input type="text" class="form-control w-45 form-date" id="hdrDe--${pageName}" name="hdrDe" data-fmt-type="day" data-map="hdrDe" autocomplete="off" title="종료 날짜 선택" />
<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
</div>
<div class="col-md-4">
<div class="col-md-8">
<label for="dsuseDe--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">폐기일자</label>
<input type="text" class="form-control w-45 form-date" id="dsuseDe--${pageName}" name="dsuseDe" data-fmt-type="day" data-map="dsuseDe" autocomplete="off" title="종료 날짜 선택" />
<input type="text" class="form-control w-px-130 form-date" id="dsuseDe--${pageName}" name="dsuseDe" data-fmt-type="day" data-map="dsuseDe" autocomplete="off" title="종료 날짜 선택" />
<button type="button" class="bx bx-lg bx-calendar bg-white"></button>
<span style="padding-left: 10px; font-weight: bold; color: red; align-items: center" id="spnDsuseDe">폐기일자는 등록후 변경이 불가 합니다</span>
</div>
<div class="col-md-4"></div>
<div class="col-md-4">
<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">
@ -65,13 +65,14 @@
</c:forEach>
</select>
</div>
<div class="col-md-4">
<div class="col-md-8">
<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">
<c:forEach items="${ADDS05}" var="item">
<option value="${item.code}">${item.value}</option>
</c:forEach>
</select>
<span style="padding-left: 10px; font-weight: bold; color: red; align-items: center" id="spnDsuseMthCd">폐기방법은 등록후 변경이 불가 합니다</span>
</div>
<div class="col-md-8">
<label for="dsuseLoc--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">폐기장소</label>
@ -80,8 +81,8 @@
<div class="col-md-12">
<span class="d-inline-flex">
<label for="dsuseImg--${pageName}" class="w-px-130 h-px-30 bg-lighter pe-2 col-form-label text-sm-end">폐기(진행) 사진</label>
<button type="button" class="btn btn-primary mx-1" id="btnImgAdd" onclick="$('#inputUploadSet--${pageName}').trigger('click');">추가</button>
<button type="button" class="btn btn-primary mx-1" id="btnImageDel--${pageName}" hidden>삭제</button>
<button type="button" class="btn btn-primary mx-1" id="btnImgAdd--${pageName}" onclick="$('#inputUploadSet--${pageName}').trigger('click');">추가</button>
<button type="button" class="btn btn-primary mx-1" id="btnImgDel--${pageName}" hidden>삭제</button>
<span style="padding-left: 10px; font-weight: bold; color: #696cff; align-items: center" id="rsltImgList"></span>
</span>
</div>
@ -137,23 +138,29 @@
* script 진입
**************************************************************************/
$(document).ready(function() {
// 최초(load) 여부
let initDataset = false;
// 변경 화면
let isEditData = false;
const searchRsltImgList = () => {
alert('ddd');
return;
document.getElementById("rsltImgList").innerHTML = "";
$('#btnImgAdd--${pageName}').prop('disabled', false);
$('#btnImgDel--${pageName}').prop('disabled', false);
let param = {
dscdmngId: $("#dscdmngId--${pageName}").val(),
dsuseDe: $("#dsuseDe--${pageName}").val(),
dsuseDe: $("#dsuseDe--${pageName}").val().replace(/-/g, ""),
dsuseMthCd: $("#dsuseMthCd--${pageName}").val(),
deptCd: "${currentUser.deptCode}"
};
$.ajax({
url :wctx.url("/adds/nims/getDsuseMgtRsltImgList.do")
,type:"post"
,data:{ dtls : JSON.stringify(dtls) }
url :wctx.url("/adds/nims/getDsuseMgtRsltImgDscdmngList.do")
,type: "get"
,data: param
,dataType:"json"
,success:function(jsonStr){
fnRsltImgList(jsonStr);
}
});
@ -166,7 +173,8 @@
let isSelf = list.filter(item => item.SEL_YN == 'Y')
if(isSelf.length > 0) return;
$('#btnImgAdd').prop('disabled', true);
$('#btnImgAdd--${pageName}').prop('disabled', true);
$('#btnImgDel--${pageName}').prop('disabled', true);
let tagsTextArr = [];
for(let idx = 0; idx < list.length; idx++){
@ -223,19 +231,16 @@
$P.control.onCurrentChange = item => {
if (!item) return;
//$("#dsuseDe--${pageName}, #dsuseMthCd--${pageName}").on("change", () => {
alert("item : "+item.data.dsuseDe)
alert($("#dsuseDe--${pageName}").val())
//});
if(!initDataset && item.data.dsuseDe){
isEditData = true;
$('#dsuseDe--${pageName}').prop('disabled', true);
$('#dsuseMthCd--${pageName}').prop('disabled', true);
$('#spnDsuseDe').hide();
$('#spnDsuseMthCd').hide();
}
// Dataset 셋팅
$P.formFields.set($P.control, item);
alert("item : "+item.data.dsuseDe)
alert($("#dsuseDe--${pageName}").val())
// 보고완료 상태인 경우 저장 버튼 비활성화
if($("input[name='prgrsSttsCd']").val() == '99') {
$("#btnSave--${pageName}").prop("disabled", true);
@ -280,13 +285,6 @@
// 저장
$P.control.save = (info, fileArr) => {
// if(fileArr.length == 0){
// dialog.alert({
// content: "폐기(진행) 사진을 1개 이상 등록해 주세요."
// });
// return;
// }
let saveData = {
...info,
prgrsSttsCd: "06",
@ -388,10 +386,10 @@
if($P.fileArr.length > 0){
let tagsText = $P.fnMakeImgTags($P.fileArr);
document.querySelector("#dragAndDrop--${pageName}").innerHTML = tagsText;
$("#btnImageDel--${pageName}").removeAttr("hidden");
$("#btnImgDel--${pageName}").removeAttr("hidden");
} else {
document.querySelector("#dragAndDrop--${pageName}").innerHTML = "";
$("#btnImageDel--${pageName}").attr("hidden","hidden");
$("#btnImgDel--${pageName}").attr("hidden","hidden");
}
}
@ -469,7 +467,7 @@
});
//이미지 삭제 버튼
$("#btnImageDel--${pageName}").on("click", function() {
$("#btnImgDel--${pageName}").on("click", function() {
let checkeds = $("#dragAndDrop--${pageName}").find(":checkbox[name='dsuseDsuseImgFilesSelector']:checked");
if(checkeds.length > 0){
let keys = [];
@ -486,7 +484,11 @@
$("#btnSave--${pageName}").on("click", () => $P.fnSave()); // 저장
$("#dsuseDe--${pageName}, #dsuseMthCd--${pageName}").on("change", () => {
if(initDataset) fnRsltImgList();
if(!initDataset){
initDataset = true;
return;
}
if(!isEditData) searchRsltImgList();
});
}

Loading…
Cancel
Save