Merge remote-tracking branch 'origin/main'

dev
Jonguk. Lim 5 months ago
commit ed27429f47

@ -0,0 +1,19 @@
package cokr.xit.adds.cmm.model;
import lombok.Data;
@Data
public class DsuseReceiptDtl {
private String dscdmngSn;
private String prductNm;
private String prductCd;
private String prdValidDe;
private String mnfNo;
private String mnfSeq;
private String minDistbQy;
private String minDistbUnit;
private String pceQy;
private String pceUnit;
private String dsuseQy;
}

@ -16,6 +16,7 @@ import org.springframework.web.servlet.ModelAndView;
import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.adds.cmm.model.DsuseMappingInfo;
import cokr.xit.adds.cmm.model.DsuseReceiptDtl;
import cokr.xit.adds.cmm.model.DsuseRsltInfo;
import cokr.xit.adds.cmmn.hwp.format.DisposeProcessDetails;
import cokr.xit.adds.cmmn.hwp.format.DisposeResultReport;
@ -68,14 +69,27 @@ public class AddsNimsController extends ApplicationController {
@RequestMapping(value = "/dsuseMgtReceipt-info.do", name="신청서 접수 상세")
public ModelAndView getDsuseMgtReceiptInfo(DsuseRsltInfo dsuseReceptInfo) {
public ModelAndView getDsuseMgtReceiptInfo(DsuseRsltInfo dsuseReceptInfo, String productList) {
ModelAndView mav = new ModelAndView("adds/nims/dsuseMgtReceipt-info");
setCmmCode("ADDS04", mav);
List<DataObject> fileInfo = new ArrayList<DataObject>();
if(!isEmpty(dsuseReceptInfo) && !isEmpty(dsuseReceptInfo.getDscdmngId())){
mav.addObject("dsuseReceptInfo", toJson(dsuseReceptInfo));
FileQuery fileQuery = new FileQuery().setInfoType("100").setInfoKeys(dsuseReceptInfo.getDscdmngId()).setOrderBy("SUB_TYPE");
fileInfo = fileService.getFileList(fileQuery);
}
if(productList != null) {
List<DsuseReceiptDtl> DsuseReceiptDtls = fromJson(productList, new TypeReference<List<DsuseReceiptDtl>>() {});
mav.addObject("dsuseReceptDtlInfo", toJson(DsuseReceiptDtls));
} else {
mav.addObject("dsuseReceptDtlInfo", toJson(new ArrayList<DsuseReceiptDtl>()));
}
mav.addObject("fileInfo", toJson(fileInfo));
return mav
.addObject("pageName", "dsuseMgtReceiptInfo") // View(jsp)에서 사용할 id 뒤에 붙일 suffix
.addObject("apiHost", apiHost);

@ -330,7 +330,8 @@
$P.productList.onAppend = item => {
if (!item) return;
if (item.length < 1) return;
// 업무별 DataTables(그리드) tr, td
let foundContent = document.getElementById("productListRow--productList").content;
let foundTr = $(foundContent).find("tr")[0].cloneNode(false);
@ -344,13 +345,20 @@
let replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].productList.setCurrent('" + dataItem.getValue("keyCnt") + "');");
let di = $P.productList.getData(item[0].keyCnt, "item");
let tr = di.inString(foundTr.outerHTML, replacer);
$("#tbody--productList").append(tr);
fnMakeGridImageViewer($("#tbody--productList").find("td.prdDsuseImg").last()[0], "dsusePrdImgFiles");
for(let i=0; i<item.length; i++){
let di = $P.productList.getData(item[i].keyCnt, "item");
let tr = di.inString(foundTr.outerHTML, replacer);
$("#tbody--productList").append(tr);
fnMakeGridImageViewer(
$("#tbody--productList").find("td.prdDsuseImg").last()[0],
"dsusePrdImgFiles",
di.data.fileInfo
);
}
}
$P.productList.onRemove = item => {
@ -400,7 +408,7 @@
* 버튼 clickEvent
**************************************************************************/
// 저장
$P.fnSave = () => {
$P.fnSave = async() => {
// validate 확인
if (!customValidate($("#frmEdit--${pageName}").find("input, select, textarea"))) return;
@ -420,23 +428,46 @@
return false;
}
let fileArr = [];
let fileCount = 0;
$("#tbody--productList").find("input[type='file'][name='dsusePrdImgFiles']").each(function() {
fileArr.push(this.files[0]);
if(this.dataset.url != null){
fileCount++;
} else if(this.files[0] != null){
fileCount++;
}
});
if(dsProd.length != fileArr.length){
if(dsProd.length != fileCount){
dialog.alert({
content: "입력되지 않은 폐기 제품 이미지가 있습니다."
});
return false;
}
dialog.alert({
content: "현재 폐기 신청서 접수 정보를 저장 하시겠습니까?"
, init: () => { setDialogZindex(); }
, onOK: () => {
$P.control.save(bsshData, dsProd, fileArr); // formFields
let promiseArr = [];
$("#tbody--productList").find("input[type='file'][name='dsusePrdImgFiles']").each(function() {
if(this.files[0] != null){
let elementFile = this.files[0];
promiseArr.push( new Promise(resolve => { resolve(elementFile); }) );
} else {
let fileInfo = {};
fileInfo.URL = this.dataset.url;
fileInfo.MIME_TYPE = this.dataset.mimeType;
fileInfo.FILE_NM = this.dataset.fileNm;
fileInfo.FILE_ID = this.dataset.fileId;
promiseArr.push(fnCreateFileFromFileInfo(fileInfo));
}
});
Promise.all(promiseArr).then((values) => {
$P.control.save(bsshData, dsProd, values);
}).catch((error) => {});
}
});
}
@ -533,7 +564,20 @@
// 3. Dataset 설정
$P.control.setData([${dsuseReceptInfo}]);
//$P.productControl.setData([${opnnDlbrMbrInfo}]);
let productInfo = ${dsuseReceptDtlInfo};
let fileInfo = ${fileInfo};
for(let p of productInfo){
p.keyCnt = (""+prdRowKey++);
for(let f of fileInfo){
if(p.dscdmngSn == f.SUB_TYPE){
p.fileInfo = f;
}
}
}
$P.productList.append(productInfo);
});
</script>

@ -286,7 +286,7 @@
let dialogTitle = "폐기 신청서 접수";
if(dscdmngId) dialogTitle = "폐기 신청서 접수 상세";
let formData = new FormData();
let params = {};
if(dscdmngId) {
let row = $P.control.dataset.getCurrent();
@ -297,10 +297,31 @@
rprsntvNm: row.RPRSNTV_NM,
prmisnNo: row.PRMISN_NO,
bizrno: row.BIZR_NO,
dsusePrvCd: row.DSUSE_PRV_CD,
dsusePrvCd: row.DSUSE_PRV_CD
};
let productDS = $P.detailControl.dataset.getDataset();
if(productDS.length > 0){
let newArr = [];
for(let product of productDS){
let newObj = {};
newObj.dscdmngSn = product.DSCDMNG_SN;
newObj.prductNm = product.PRDUCT_NM;
newObj.prductCd = product.PRDUCT_CD;
newObj.prdValidDe = product.PRD_VALID_DE;
newObj.mnfNo = product.MNF_NO;
newObj.mnfSeq = product.MNF_SEQ;
newObj.minDistbQy = product.MIN_DISTB_QY;
newObj.minDistbUnit = product.MIN_DISTB_UNIT;
newObj.pceQy = product.PCE_QY;
newObj.pceUnit = product.PCE_UNIT;
newObj.dsuseQy = product.DSUSE_QY;
newArr.push(newObj);
}
params.productList = JSON.stringify(newArr);
}
}
ajax.get({
url : wctx.url("/adds/nims/dsuseMgtReceipt-info.do")
, data : params

@ -489,12 +489,10 @@
}
try{
fnCreateFileFromFileInfo(f)
promiseArr.push(fnCreateFileFromFileInfo(f));
}catch(e){
console.log(e);
}
//promiseArr.push(fnCreateFileFromFileInfo(f));
});
Promise.all(promiseArr).then((values) => {

@ -1,7 +1,7 @@
/**************************************************************************
* 그리드 내부 이미지 첨부
**************************************************************************/
function fnMakeGridImageViewer(tdEl, fileInputElName){
function fnMakeGridImageViewer(tdEl, fileInputElName, fileInfo){
let fileInputEl = document.createElement("input");
fileInputEl.name = fileInputElName;
@ -10,6 +10,13 @@ function fnMakeGridImageViewer(tdEl, fileInputElName){
fileInputEl.setAttribute("accept","image/*")
tdEl.appendChild(fileInputEl);
if(fileInfo != null){
fileInputEl.dataset.url = fileInfo.URL;
fileInputEl.dataset.fileNm = fileInfo.FILE_NM;
fileInputEl.dataset.mimeType = fileInfo.MIME_TYPE;
fileInputEl.dataset.fileId = fileInfo.FILE_ID;
}
let uploadButtonEl = document.createElement("button");
uploadButtonEl.type = "button";
uploadButtonEl.classList.add("btn","btn-primary","w-px-50", "mx-1");
@ -27,6 +34,9 @@ function fnMakeGridImageViewer(tdEl, fileInputElName){
if(this.files != null && this.files.length > 0){
$(uploadButtonEl).text("수정");
$(viewButtonEl).removeAttr("hidden");
} else if(this.dataset.url != null){
$(uploadButtonEl).text("수정");
$(viewButtonEl).removeAttr("hidden");
} else {
$(uploadButtonEl).text("등록");
$(viewButtonEl).attr("hidden","hidden");
@ -38,11 +48,15 @@ function fnMakeGridImageViewer(tdEl, fileInputElName){
});
$(viewButtonEl).on("click", function(){
let viewUrl = (window.URL || window.webkitURL).createObjectURL(fileInputEl.files[0]);
let viewUrl = "";
if(fileInputEl.files.length != 0){
viewUrl = (window.URL || window.webkitURL).createObjectURL(fileInputEl.files[0]);
} else {
viewUrl = fileInputEl.dataset.url;
}
window.open(viewUrl, "이미지", "width=500, height=500");
});
$(fileInputEl).trigger("change");
}
Loading…
Cancel
Save