Leeyh1121 5 months ago
commit 3ae0c14712

@ -92,12 +92,19 @@
**************************************************************************/
$P.control = new DatasetControl({
urls : {
load : wctx.url("/adds/nims/bssh-list.do")
//load : wctx.url("/adds/nims/bssh-list.do")
load : '<c:url value="${apiHost}/api/biz/nims/v1/getNimsBsshInfoSt" />',
}
, prefix: "bsshMain"
, prefixName: "마약류 취급업체 조회"
, keymapper: info => info ? info.bsshCd : ""
, dataGetter : obj => obj.bsshMainList
, dataGetter : obj => obj => {
if (!obj.success){
dialog.alert(obj.message);
return false;
}
return obj.data;
}
, appendData: true
, infoSize: "xl"
});
@ -230,8 +237,7 @@
// 초기 화면 설정
$P.initForm = () => {
// Dialog 마우스로 드래그 할 수 있도록 설정.
fnMakeDraggableDialog(document.getElementById($P.control.prefix + "Dialog"));
}
/**************************************************************************

@ -386,8 +386,7 @@
// 초기 화면 설정
$P.initForm = () => {
// Dialog 마우스로 드래그 할 수 있도록 설정.
fnMakeDraggableDialog(document.getElementById($P.control.prefix + "Dialog"));
}

@ -175,29 +175,38 @@
/**************************************************************************
* DatasetControl
**************************************************************************/
$P.control = new DatasetControl({
prefix: "dsuseMgtReceiptBssh"
, prefixName: "마약류 취급업체 조회"
, keymapper: info => info ? info.bsshCd : ""
, dataGetter: obj => obj.${infoPrefix}Info
, infoSize: "xl"
});
$P.productControl = new DatasetControl({
prefix: "dsuseMgtReceiptProduct"
, prefixName: "마약류 제품 조회"
, keymapper: info => info ? info.prductCd : ""
, dataGetter: obj => obj.${infoPrefix}Info
, infoSize: "xl"
});
$P.control = new DatasetControl({
prefix: "dsuseMgtReceiptBssh"
, prefixName: "마약류 취급업체 조회"
, keymapper: info => info ? info.bsshCd : ""
, dataGetter: obj => obj.${infoPrefix}Info
, 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 => obj
, infoSize: "xl"
});
$P.productList = new Dataset({
prefix: "dsuseMgtReceiptProductList"
, prefixName: "마약류 제품 조회"
, keymapper: info => info ? info.prductCd : ""
, dataGetter: obj => obj
, infoSize: "xl"
});
/**************************************************************************
* DatasetControl 이벤트
**************************************************************************/
@ -403,8 +412,7 @@
// 초기 화면 설정
$P.initForm = () => {
fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollDataList);
// Dialog 마우스로 드래그 할 수 있도록 설정.
//fnMakeDraggableDialog(document.getElementById($P.control.prefix + "Dialog"));
}

@ -75,13 +75,28 @@
<label for="dsuseLoc--${pageName}" class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">폐기장소</label>
<input type="text" class="form-control w-80" id="dsuseLoc--${pageName}" name="dsuseLoc" data-map="DSUSE_LOC">
</div>
<div class="col-md-4">
<label for="dsuseImg--${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="dsuseImg--${pageName}" name="dsuseImg" data-map="DSUSE_IMG" readonly>
<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"
onclick="$('#inputUploadSet--${pageName}').trigger('click');">추가</button>
<button type="button" class="btn btn-primary mx-1"
id="btnImageDel--${pageName}" hidden>삭제</button>
</span>
</div>
<div class="col-md-12">
<div class="border-card rounded w-100 h-px-250 ox-scroll align-content-center">
<ul id="dragAndDrop--${pageName}" class="d-inline-flex">
</ul>
</div>
</div>
</div>
<div class="row my-1 mx-1 g-1 border-card rounded"></div>
</form> <!-- /입력 영역 -->
<input type="file" accept="image/*" id="inputUploadSet--${pageName}" hidden multiple />
</div> <!-- <div class="card"> -->
<!-- 업무 버튼 표시 -->
@ -98,6 +113,17 @@
</div> <!-- / Content <div class="container flex-grow-1 px-0"> -->
</div> <!-- / inner page html <div class="content-wrapper"> -->
<template id="imgRadioTemplate--${pageName}">
<li class="d-flex">
<label class='mx-1 d-flex flex-row'>
<input type="radio" name="{name}" class="form-check-input" value="{value}" checked="" />
<div class="position-relative">
<img src="{src}" width='200' height='200' />
</div>
</label>
</li>
</template>
<script>
/**************************************************************************
* Global Variable
@ -111,6 +137,8 @@
// pageObject
let $P = pageObject["${pageName}"];
$P.fileArr = [];
// FormFields
$P.formFields = new FimsFormFields("#frmEdit--${pageName}");
@ -164,8 +192,7 @@
// Dataset 셋팅
$P.formFields.set($P.control, item);
// 업무구분에 따른 URL 변경
$P.fnSetURL(item.data.TASK_SE_CD);
}
// 저장 callback
@ -217,6 +244,21 @@
});
}
//uploadSupport 생성
$P.uploadSet = uploadSupport("#inputUploadSet--${pageName}");
$P.uploadSet.onDatasetChange = () => {
var files = $P.uploadSet.getDataset();
if(files != null && files.length > 0){
for(var i=0;i < files.length; i++){
$P.fileArr.push(files[i]);
}
}
$P.fnDisplay();
};
/**************************************************************************
* DataTables 이벤트
@ -266,12 +308,44 @@
/**************************************************************************
* 사용자 함수(function)
**************************************************************************/
// 업무구분에 따른 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.fnDisplay = () => {
if($P.fileArr.length > 0){
var tagsText = $P.fnMakeImgTags($P.fileArr);
document.querySelector("#dragAndDrop--${pageName}").innerHTML = tagsText;
$("#btnImageDel--${pageName}").removeAttr("hidden");
} else {
document.querySelector("#dragAndDrop--${pageName}").innerHTML = "";
$("#btnImageDel--${pageName}").attr("hidden","hidden");
}
}
// HTML 태그(img,radio) 문자열 생성
$P.fnMakeImgTags = (fileArr) => {
var tagsTextArr = [];
for(var index = 0; index < fileArr.length; index++){
var item = fileArr[index];
var template = document.getElementById("imgRadioTemplate--${pageName}").innerHTML;
template = template.replace(/{name}/gi, "dsusePrdImgFilesSlector");
template = template.replace(/{value}/gi, item.id);
if(index != 0){
template = template.replace("checked=\"\"", "");
}
template = template.replace(/{src}/gi, item.url);
tagsTextArr.push(template);
}
return tagsTextArr.join("");
}
// 전자우편 안내문 등록 버튼 이벤트
$P.fnSearchBssh = (title) => {
$P.control.getBsshInfo();
@ -304,14 +378,37 @@
$P.fnSearchBssh($(this).attr("title"));
});
//이미지 삭제 버튼
$("#btnImageDel--${pageName}").on("click", function() {
var key = $("#dragAndDrop--${pageName}").find(":radio[name='dsusePrdImgFilesSlector']:checked").val();
$P.fileArr = $P.fileArr.filter((element) => element.id != key);
$P.fnDisplay();
});
// 버튼 이벤트
$("#btnSave--${pageName}").on("click", () => $P.fnSave()); // 저장
}
// 초기 화면 설정
$P.initForm = () => {
// Dialog 마우스로 드래그 할 수 있도록 설정.
// fnMakeDraggableDialog(document.getElementById($P.control.prefix + "Dialog"));
//드래그로 이미지 순서 변경
Sortable.create(document.getElementById("dragAndDrop--${pageName}"), {
onEnd : function(evt){
if(evt.oldIndex != evt.newIndex){
let tmp = $P.fileArr[evt.oldIndex];
$P.fileArr[evt.oldIndex] = $P.fileArr[evt.newIndex];
$P.fileArr[evt.newIndex] = tmp;
$P.fnDisplay();
}
}
});
console.log("#${usrRptIdNo}");

@ -100,7 +100,6 @@
$P.control = new DatasetControl({
urls : {
//load : wctx.url("/adds/nims/product-list.do")
//load : '<c:url value="${apiHost}/api/biz/nims/v1/getNimsProductInfoKd" />',
load : '<c:url value="${apiHost}/api/biz/nims/v1/getNimsProductInfoKdAndMnfSeqInfo" />',
}
, prefix: "productMain"
@ -136,22 +135,6 @@
, appendData: true
, infoSize: "xl"
});
/*
json.post({
url:'http://localhost:9076/api/biz/nims/v1/getNimsProductInfoKd',
data: { "k": "",
"fg": "1",
"pg": "1",
"ymd": "",
"fg2": "",
"p": "8806489012426",
"pn": "",
"dbSkipYn": "N",
"userId": "suji"
// "userId": "${currentUser.account}"
},
success: resp => $P.control.setData(resp)
});*/
// $P.control 설정
$P.control.defaultFetchSize = FETCH_XS; // 1 페이지당 조회되는 자료 건수 index.jsp에서 확인 FETCH_XS = 30
@ -241,20 +224,26 @@
**************************************************************************/
$P.fnSearchList = () => {
$P.control.query = { "k": "",
"fg": "1",
"pg": "1",
"ymd": "",
"fg2": "",
"p": $P.formFields.get().schProductCd,
// "p": '8806416009017',
"pn": $P.formFields.get().schProductNm,
"dbSkipYn": "N",
"userId": "suji"
// "userId": "${currentUser.account}"
};
// 검색조건
<%-- $P.control.query = {--%>
<%-- "p": $P.formFields.get().schProductCd,--%>
<%--// "p": '8806416009017',--%>
<%-- "pn": $P.formFields.get().schProductNm,--%>
<%-- "dbSkipYn": "N",--%>
<%-- "userId": "${currentUser.account}"--%>
<%-- };--%>
// 검색조건
// FIXME: 제품코드 또는 제품명중 하나는 필수
// $P.control.query = $P.formFields.get(); // 검색 조건
$P.control.query = {
... $P.formFields.get(),
p: $P.formFields.get().schProductCd,
pn: $P.formFields.get().schProductNm,
dbSkipYn: "N",
// FIXME: userId 는 현재 로그인한 사용자의 ID로 변경 - 공통 처리후
userId: "${currentUser.id}"
//userId: "suji"
};
debugger;
$P.control.query.fetchSize = $P.control.defaultFetchSize; // 한번에 조회되는 자료 건수
$P.control.query.delYn = "N"; // 삭제 여부
@ -267,7 +256,8 @@
dialog.alert({
content: "현재 " + $P.control.prefixName + " 정보를 선택 하시겠습니까?"
, init: () => { setDialogZindex(); }
, onOK: () => { var openPage = new FimsFormFields("#${openPage}");
, onOK: () => {
let openPage = new FimsFormFields("#${openPage}");
openPage.set (null,$P.control.getCurrent()); // formFields
dialog.close("productMainDialog");
}
@ -292,8 +282,7 @@
// 초기 화면 설정
$P.initForm = () => {
// Dialog 마우스로 드래그 할 수 있도록 설정.
fnMakeDraggableDialog(document.getElementById($P.control.prefix + "Dialog"));
}
/**************************************************************************

@ -33,6 +33,7 @@
<!-- 전체화면 비활성화 -->
<script src="<c:url value="/webjars/3rd-party/sneat/libs/block-ui/block-ui.js"/>"></script>
<script src="<c:url value="/webjars/3rd-party/sneat/libs/sortablejs/sortable.js"/>"></script>
<script src="<c:url value="/resources/js/base/fimsFormFields.js?${ver}"/>"></script>
@ -46,6 +47,7 @@
<script src="<c:url value="/webjars/applib/js/componentization.js?${ver}"/>"></script>
<script src="<c:url value="/resources/js/adds/cmmn/componentization.js?${ver}"/>"></script>
<!-- endbuild -->
<c:set var="functions" scope="request">
wctx.path = "${pageContext.request.contextPath}";

Loading…
Cancel
Save