fix: 폐기 접수 신청 상세 분리

dev
Jonguk. Lim 5 months ago
parent 5b51c28fec
commit 438727c56e

@ -282,9 +282,24 @@
let dialogTitle = "폐기 신청서 접수";
if(dscdmngId) dialogTitle = "폐기 신청서 접수 상세";
let params = {};
if(dscdmngId) {
let row = $P.control.dataset.getCurrent();
params = {
dscdmngId: row.DSCDMNG_ID,
bsshNm: row.BSSH_NM,
bsshCd: row.BSSH_CD,
rprsntvNm: row.RPRSNTV_NM,
prmisnNo: row.PRMISN_NO,
bizrno: row.BIZR_NO,
dsusePrvCd: row.DSUSE_PRV_CD,
};
}
ajax.get({
url : wctx.url("/adds/nims/dsuseMgtReceipt-info.do")
, data : dscdmngId? {dscdmngId: dscdmngId} : {}
, data : params
, success : resp => {
dialog.open({
id : "dsuseMgtReceiptDialog"

@ -22,7 +22,6 @@
<label for="bsshCd--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">식별번호</label>
<input type="text" class="form-control w-60" id="bsshNm--${pageName}" name="bsshCd" data-map="bsshCd" readonly>
</div>
<button type="button" class="btn btn-search w-px-120" id="btnBsshSearch--${pageName}" title="검색">검색</button>
<div class="col-md-4">
<label for="rprsntvNm--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">대표자명</label>
<input type="text" class="form-control w-60" id="rprsntvNm--${pageName}" name="rprsntvNm" data-map="rprsntvNm" readonly>
@ -74,7 +73,6 @@
// FormFields
$P.bsshFormFields = new AddsFormFields("#bssh--${pageName}");
$P.productFormFields = new AddsFormFields("#product--${pageName}");
/**************************************************************************
* DatasetControl
@ -87,75 +85,6 @@
, infoSize: "xl"
});
$P.bsshList = new Dataset({
prefix: "dsuseMgtReceiptBsshList"
, prefixName: "마약류 취급업체 조회"
, keymapper: info => info ? info.bsshCd : ""
, dataGetter: obj => obj
, infoSize: "xl"
});
$P.productControl = new DatasetControl({
prefix: "dsuseMgtReceiptProduct"
, prefixName: "마약류 제품 조회"
, keymapper: info => info ? info.prductCd : ""
, dataGetter: obj => obj.${infoPrefix}Info
, infoSize: "xl"
});
$P.productList = new Dataset({
prefix: "dsuseMgtReceiptProductList"
, prefixName: "마약류 제품 조회"
, keymapper: info => info ? info.prductCd : ""
, dataGetter: obj => {
if (!obj.success){
dialog.alert(obj.message);
return false;
}
return obj.data;
}
, infoSize: "xl"
, formats: {
prdValidDe: dateFormat
}
});
$P.detailControl = new DatasetControl({
urls : {
load : wctx.url("/adds/nims/dsuseMgtDetail-list.do")
}
, prefix : "dsuseMgtDetail"
, prefixName : "신청서접수상세"
, keymapper : info => info ? info.DSCDMNG_SN : ""
, dataGetter : obj => obj.dsuseMgtDetailList
, formats : {
PRD_VALID_DE: dateFormat
}
});
$P.detailControl.query = { "schDscdmngId" : ${DSCDMNG_ID}};
$P.detailControl.load(1);
/**************************************************************************
* DatasetControl 이벤트
**************************************************************************/
// 현재 선택 자료 변경 이벤트
$P.control.onCurrentChange = item => {
if (!item) return;
$P.bsshFormFields.set($P.control, item);
// 업무구분에 따른 URL 변경
//$P.fnSetURL(item.data.bsshCd);
}
$P.productControl.onCurrentChange = item => {
if (!item) return;
// Dataset 셋팅
$P.productFormFields.set($P.productControl, item);
// 업무구분에 따른 URL 변경
//$P.fnSetURL(item.data.bsshCd);
}
// 저장 callback
$P.control.onSave = (resp) => {
let dialogTitle = $("#" + $P.control.prefix + "Dialog--${openerPageName}").find("h5.modal-title").html();
@ -173,54 +102,13 @@
}
}
$P.control.getBsshInfo = () => {
let dialogTitle = "마약류 취급업체 조회";
let params = {openPage : "bssh--${pageName}"};
ajax.get({
url : wctx.url("/adds/nims/bssh-popup.do")
, data : params
, success : resp => {
dialog.open({
id : "bsshPopupDialog"
, title : dialogTitle
, content : resp
, size : $P.control.infoSize
, onClose : () => { $P.control.setData(); }
});
}
});
}
$P.productControl.getProductInfo = () => {
let dialogTitle = "마약류 제품 조회";
let params = {openPage : "product--${pageName}"};
ajax.get({
url : wctx.url("/adds/nims/product-popup.do")
, data : params
, success : resp => {
dialog.open({
id : "productMainDialog"
, title : dialogTitle
, content : resp
, size : $P.productControl.infoSize
, onClose : () => { $P.productControl.setData(); }
});
}
});
}
// 저장
$P.control.save = (jsonBssh, datasetListPrd, fileArr) => {
$P.control.save = (jsonBssh) => {
let saveBsshData = {
...jsonBssh,
rndDtlRptCnt: datasetListPrd.length,
userId: "${currentUser.account}"
}
let create = (jsonBssh.dscdmngId == "");
upload({
url: '<c:url value="${apiHost}/api/biz/nims/v1/saveDsuseMgtReceipt" />'
, data: {
@ -245,61 +133,6 @@
});
}
$P.productList.onDatasetChange = item => {
if (!item) return;
let empty = $P.productList.empty;
// 업무별 DataTables(그리드) tr, td
let foundContent = document.getElementById("productListRow--productList").content;
let foundTr = $(foundContent).find("tr")[0].cloneNode(false);
let foundTds = $(foundContent).find("td");
foundTds.each(function() {
foundTr.appendChild(this.cloneNode(true));
});
//
let replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].productList.setCurrent('" + dataItem.getValue("prductCd") + "');");
let trs = empty ? [document.getElementById("$productListNotFound--productList").content.outerHTML]
: $P.productList.inStrings(foundTr.outerHTML, replacer);
$("#table-responsive--${pageName}")[0].changeContent(trs.join(), true, true);
fnMakeGridImageViewer($("#tbody--productList").find("td.prdDsuseImg").get(), "dsusePrdImgFiles");
}
/**************************************************************************
* DataTables 이벤트
**************************************************************************/
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
// 검색 자료 재조회
$P.fnRefreshList = () => {
$P.control.untilPageNum = $P.control.query.pageNum;
$P.control.query.fetchSize = $P.control.defaultFetchSize * $P.control.query.pageNum;
$P.control.load(1);
}
// 업무구분에 따른 URL 설정
$P.fnSetURL = (taskSeCd) => {
// $P.control.urls.create = wctx.url("/" + taskSeCd + "${infoPrefixUrl}" + "/040/create.do"); // 등록
// $P.control.urls.update = wctx.url("/" + taskSeCd + "${infoPrefixUrl}" + "/040/update.do"); // 수정
}
// 전자우편 안내문 등록 버튼 이벤트
$P.fnSearchBssh = (title) => {
$P.control.getBsshInfo();
}
$P.fnSearchProduct = (title) => {
$P.productControl.getProductInfo();
}
/**************************************************************************
* 버튼 clickEvent
**************************************************************************/
@ -316,77 +149,11 @@
return false;
}
let dsProd = $P.productList.getDataset();
if(dsProd.length == 0){
dialog.alert({
content: "폐기 제품 정보를 입력해주세요."
});
return false;
}
let fileArr = [];
$("#tbody--productList").find("input[type='file'][name='dsusePrdImgFiles']").each(function() {
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, fileArr); // formFields
}
});
}
//추가
$P.fnAdd = () => {
if(!$P.productFormFields.get().prductCd){
dialog.alert({
content: "제품 정보를 입력해주세요."
});
return false;
}
if(!$P.productFormFields.get().dsuseQy){
dialog.alert({
content: "폐기수량을 입력해 주세요"
});
return false;
}
let isDup = $P.productList
.getDataset()
.filter(item => item.prductCd == $P.productFormFields.get().prductCd)
.length > 0;
if(isDup){
dialog.alert({
content: "등록한 상품[" + $P.productFormFields.get().prductCd + "]입니다"
});
return false;
}
$P.productList.addData([$P.productFormFields.get()]);
// FIXME: 상품필드 초기화 코드 추가
//
}
$P.fnDel = () => {
// validate 확인
if (!customValidate($("#frmEdit--${pageName}").find("input, select, textarea"))) return;
dialog.alert({
content: "현재 " + $P.control.prefixName + " 정보를 저장하시겠습니까?"
, init: () => { setDialogZindex(); }
, onOK: () => {
$P.control.save($P.bsshFormFields.get()); // formFields
$P.control.save(bsshData); // formFields
}
});
}
@ -396,28 +163,9 @@
**************************************************************************/
// 이벤트 설정
$P.setEvent = () => {
// 안내문 등록 버튼 이벤트
$("#btnBsshSearch--${pageName}").on("click", function() {
$P.fnSearchBssh($(this).attr("title"));
});
$("#btnProductSearch--${pageName}").on("click", function() {
$P.fnSearchProduct($(this).attr("title"));
});
// 버튼 이벤트
$("#btnSave--${pageName}").on("click", () => $P.fnSave()); // 저장
$("#btnAdd--${pageName}").on("click", () => $P.fnAdd()); // 추가
$("#btnDel--${pageName}").on("click", () => $P.fnDel()); // 추가
}
// 초기 화면 설정
$P.initForm = () => {
fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollDataList);
}
@ -428,11 +176,10 @@
$P.setEvent();
// 2. 초기 화면 설정
$P.initForm();
//$P.initForm();
// 3. Dataset 설정
$P.control.setData([${dsuseReceptInfo}]);
$P.productControl.setData([${opnnDlbrMbrInfo}]);
$P.control.setData([${dsuseRsltInfo}]);
});
</script>

Loading…
Cancel
Save