feat: 업체조회 팝업 페이징 적용

업체조회 팝업 조건 유효성 체크 추가
      제품검색 팝업 페이징 적용
      제품조회 팝업 조건 유효성 체크 추가
main
Jonguk. Lim 4 weeks ago
parent b1995da72e
commit 2b7b836b1f

@ -1,79 +1,43 @@
package cokr.xit.adds.nims.web; package cokr.xit.adds.nims.web;
import java.io.ByteArrayOutputStream; import java.io.*;
import java.io.File; import java.net.*;
import java.io.IOException; import java.net.http.*;
import java.net.URI; import java.nio.charset.*;
import java.net.http.HttpClient; import java.text.*;
import java.net.http.HttpRequest; import java.util.*;
import java.net.http.HttpResponse; import java.util.stream.*;
import java.nio.charset.StandardCharsets;
import java.text.NumberFormat; import javax.annotation.*;
import java.util.ArrayList;
import java.util.HashMap; import org.apache.poi.hssf.util.*;
import java.util.List; import org.apache.poi.ss.usermodel.*;
import java.util.Map; import org.json.simple.*;
import java.util.Set; import org.springframework.beans.factory.annotation.*;
import java.util.UUID; import org.springframework.stereotype.*;
import java.util.stream.Collectors; import org.springframework.web.bind.annotation.*;
import java.util.stream.IntStream; import org.springframework.web.multipart.*;
import org.springframework.web.servlet.*;
import javax.annotation.Resource;
import com.fasterxml.jackson.core.type.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.CellStyle; import cokr.xit.adds.cmm.model.*;
import org.apache.poi.ss.usermodel.Font; import cokr.xit.adds.cmmn.hwp.format.*;
import org.apache.poi.ss.usermodel.HorizontalAlignment; import cokr.xit.adds.nims.*;
import org.apache.poi.ss.usermodel.VerticalAlignment; import cokr.xit.adds.nims.service.*;
import org.json.simple.JSONObject; import cokr.xit.applib.*;
import org.springframework.beans.factory.annotation.Value; import cokr.xit.applib.xls.*;
import org.springframework.stereotype.Controller; import cokr.xit.base.code.*;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.adds.cmm.model.ApiBaseResponse;
import cokr.xit.adds.cmm.model.ApiUtil;
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.cmm.model.NimsApiRequest;
import cokr.xit.adds.cmmn.hwp.format.DisposeProcessDetails;
import cokr.xit.adds.cmmn.hwp.format.DisposeResultReport;
import cokr.xit.adds.nims.ApiKeyQuery;
import cokr.xit.adds.nims.DsuseMgtDetailQuery;
import cokr.xit.adds.nims.DsuseMgtDocQuery;
import cokr.xit.adds.nims.DsuseMgtReceiptQuery;
import cokr.xit.adds.nims.DsuseMgtRsltQuery;
import cokr.xit.adds.nims.DsuseMgtStatisticsQuery;
import cokr.xit.adds.nims.DsuseProductAndSeqQuery;
import cokr.xit.adds.nims.service.AddsNimsService;
import cokr.xit.adds.nims.service.ApiKeyService;
import cokr.xit.adds.nims.service.DsuseMgtDocService;
import cokr.xit.adds.nims.service.DsuseMgtReceiptService;
import cokr.xit.applib.Print;
import cokr.xit.applib.PrintOption;
import cokr.xit.applib.xls.StyleMaker;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.docs.xls.CellDef;
import cokr.xit.base.docs.xls.Format; import cokr.xit.base.docs.xls.Format;
import cokr.xit.base.docs.xls.Style; import cokr.xit.base.docs.xls.*;
import cokr.xit.base.docs.xls.XLSWriter; import cokr.xit.base.file.*;
import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.FileInfo.*;
import cokr.xit.base.file.FileInfo.Relation; import cokr.xit.base.file.service.*;
import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.user.*;
import cokr.xit.base.file.service.FileService; import cokr.xit.base.user.service.*;
import cokr.xit.base.user.DepartmentQuery; import cokr.xit.base.web.*;
import cokr.xit.base.user.service.SigunguDepartmentService; import cokr.xit.foundation.data.*;
import cokr.xit.base.web.ApplicationController; import cokr.xit.foundation.web.*;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.data.JSON;
import cokr.xit.foundation.web.WebClient;
@Controller @Controller
@RequestMapping( @RequestMapping(
@ -616,6 +580,12 @@ public class AddsNimsController extends ApplicationController {
return json.parse(rslt, new TypeReference<>() {}); return json.parse(rslt, new TypeReference<>() {});
} }
@RequestMapping(value = "/getNimsBsshInfoSt2.do", name="업체(마약류취급자) 검색", produces = "application/json;charset=UTF-8")
public @ResponseBody ApiBaseResponse<List<JSONObject>> getNimsBsshInfoSt2(@ModelAttribute NimsApiRequest.BsshInfoReq dto) {
String rslt = ApiUtil.callNimsApi(apiHost + bsshInfoEndpoint, dto);
return json.parse(rslt, new TypeReference<>() {});
}
@RequestMapping(value = "/getNimsProductInfoKd.do", name="제품 검색", produces = "application/json;charset=UTF-8") @RequestMapping(value = "/getNimsProductInfoKd.do", name="제품 검색", produces = "application/json;charset=UTF-8")
public @ResponseBody ApiBaseResponse<List<JSONObject>> getNimsProductInfoKd(@ModelAttribute NimsApiRequest.ProductInfoReq dto) { public @ResponseBody ApiBaseResponse<List<JSONObject>> getNimsProductInfoKd(@ModelAttribute NimsApiRequest.ProductInfoReq dto) {
String rslt = ApiUtil.callNimsApi(apiHost + productInfoEndpoint, dto); String rslt = ApiUtil.callNimsApi(apiHost + productInfoEndpoint, dto);

@ -8,21 +8,17 @@
<!-- hidden --> <!-- hidden -->
<%-- <label for="bssh--${pageName}">마약류 취급업체 정보</label>--%> <%-- <label for="bssh--${pageName}">마약류 취급업체 정보</label>--%>
<div class="row my-1 mx-4 g-1" style="align-items: baseline"> <div class="row my-1 mx-4 g-1" style="align-items: baseline">
<div class="col-md-3"> <div class="col-md-6">
<label for="schBsshNm--${pageName}" class="w-px-90 bg-lighter pe-2 col-form-label text-sm-end">취급업체명</label> <label for="schBsshNm--${pageName}" class="w-px-140 bg-lighter pe-2 col-form-label text-sm-end">취급업체명/식별번호</label>
<input type="text" class="form-control w-50" id="schBsshNm--${pageName}" name="schBsshNm" data-map="schBsshNm" > <input type="text" class="form-control w-px-100" id="schBsshNm--${pageName}" name="schBsshNm" data-map="schBsshNm" >
<input type="text" class="form-control w-px-120" id="schBsshCd--${pageName}" name="schBsshCd" data-map="schBsshCd" >
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label for="schRprsntvNm--${pageName}" class="w-px-80 bg-lighter pe-2 col-form-label text-sm-end">대표자명</label> <label for="schRprsntvNm--${pageName}" class="w-px-80 bg-lighter pe-2 col-form-label text-sm-end">대표자명</label>
<input type="text" class="form-control w-50" id="schRprsntvNm--${pageName}" name="schRprsntvNm" data-map="schRprsntvNm" > <input type="text" class="form-control w-50" id="schRprsntvNm--${pageName}" name="schRprsntvNm" data-map="schRprsntvNm" >
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label for="schBsshCd--${pageName}" class="w-px-90 bg-lighter pe-2 col-form-label text-sm-end">취급자번호</label> <button type="button" class="btn btn-primary w-px-120" id="btnSearch--${pageName}" title="검색">NIMS 검색</button>
<input type="text" class="form-control w-50" id="schBsshCd--${pageName}" name="schBsshCd" data-map="schBsshCd" >
</div>
<div class="col-md-3">
<button type="button" class="btn btn-search w-px-120" id="btnSearch--${pageName}" title="검색">검색</button>&nbsp;
<button type="button" class="btn btn-primary w-px-120" id="btnSearch2--${pageName}" title="검색">NIMS 검색</button>
</div> </div>
</div> </div>
</div> </div>
@ -42,30 +38,24 @@
<div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_0_wrapper--${pageName}"> <div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_0_wrapper--${pageName}">
<div class="table-responsive ox-scroll oy-scroll h-px-500" id="table-responsive--${pageName}"> <div class="table-responsive ox-scroll oy-scroll h-px-500" id="table-responsive--${pageName}">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_0--${pageName}" aria-describedby="DataTables_Table_0_info"> <table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_0--${pageName}" aria-describedby="DataTables_Table_0_info">
<thead> <thead class="sticky-thead">
<tr> <tr>
<!-- <th style="width: 15.828px;text-align:center;" tabindex="0">No</th> -->
<th class="sorting" style="width: 140.156px;">취급자번호</th> <th class="sorting" style="width: 140.156px;">취급자번호</th>
<th class="sorting" style="width: 250.141px;">취급업체명</th> <th class="sorting" style="width: 250.141px;">취급업체명</th>
<th class="sorting" style="width: 160.141px;">업종명</th> <th class="sorting" style="width: 160.141px;">업종명</th>
<th class="sorting" style="width: 120.469px;">대표자</th> <th class="sorting" style="width: 120.469px;">대표자</th>
<th class="sorting" style="width: 250.469px;">허가번호</th> <th class="sorting" style="width: 250.469px;">허가번호</th>
<%-- <th class="sorting" style="width: 120.469px;">담당자명</th>--%>
<%-- <th class="sorting" style="width: 120.469px;">구분</th>--%>
</tr> </tr>
</thead> </thead>
<tbody id="tbody--${pageName}"> <tbody id="tbody--${pageName}">
</tbody> </tbody>
<template id="${infoPrefix}Row--${pageName}"> <template id="${infoPrefix}Row--${pageName}">
<tr data-key="{bsshCd}"> <tr data-key="{bsshCd}">
<!-- <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{bsshCd}</td> -->
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{bsshCd}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{bsshCd}</td>
<td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{bsshNm}</td> <td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{bsshNm}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{indutyNm}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{indutyNm}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{rprsntvNm}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{rprsntvNm}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prmisnNo}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prmisnNo}</td>
<%-- <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{chrgNm}</td>--%>
<%-- <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{hdntNm}</td>--%>
</tr> </tr>
</template> </template>
<template id="${infoPrefix}NotFound--${pageName}"> <template id="${infoPrefix}NotFound--${pageName}">
@ -131,15 +121,16 @@
**************************************************************************/ **************************************************************************/
// Dataset 변경 이벤트 // Dataset 변경 이벤트
$P.control.onDatasetChange = (obj) => { $P.control.onDatasetChange = (obj, option) => {
$P.renderList(obj.${infoPrefix}Total); $P.renderList(obj.totalCount, option);
$("#${infoPrefix}Paging--${pageName}").setPagingInfo({ $("#${infoPrefix}Paging--${pageName}").setPagingInfo({
list: $P.control.dataset list: $P.control.dataset
, prefix: "${infoPrefix}Paging--${pageName}" , prefix: "${infoPrefix}Paging--${pageName}"
, start: obj.${infoPrefix}Start , start: obj.${infoPrefix}Start
, totalSize: $P.control.dataset.length , totalSize: obj.totalCount
, fetchSize: obj.${infoPrefix}Fetch , fetchSize: obj.${infoPrefix}Fetch
, func: "pageObject['${pageName}'].control.load({index})" // , func: "pageObject['${pageName}'].control.load({index})"
}); });
}; };
@ -162,33 +153,22 @@
**************************************************************************/ **************************************************************************/
// DataTables에 click, dbclick 이벤트 // DataTables에 click, dbclick 이벤트
$P.renderList = (totalSize) => { $P.renderList = (totalSize, option) => {
let ${infoPrefix}List = $P.control.dataset; let ${infoPrefix}List = $P.control.dataset;
let empty = ${infoPrefix}List.empty; let empty = ${infoPrefix}List.empty;
// 업무별 DataTables(그리드) tr, td let trs = empty ?
let foundContent = document.getElementById("${infoPrefix}Row--${pageName}").content; [document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML]
let foundTr = $(foundContent).find("tr")[0].cloneNode(false); : ${infoPrefix}List.inStrings(
let foundTds = $(foundContent).find("td"); document.getElementById("${infoPrefix}Row--${pageName}").innerHTML,
(str, dataItem) => str
foundTds.each(function() { .replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("bsshCd") + "');")
foundTr.appendChild(this.cloneNode(true)); .replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnSave()"));
});
//
let replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("bsshCd") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnSave()");
let trs = empty ? [document.getElementById("${infoPrefix}NotFound--${pageName}").content.outerHTML]
: ${infoPrefix}List.inStrings(foundTr.outerHTML, replacer);
let noMore = (${infoPrefix}List.length >= totalSize); let noMore = (${infoPrefix}List.length >= totalSize);
let initScroll = ($P.control.query.pageNum < 2); let initScroll = ($P.control.query.pageNum < 2);
$("#tbody--${pageName}").html(trs.join()); $("#table-responsive--${pageName}")[0].changeContent(trs.join(), initScroll, noMore);
} }
/************************************************************************** /**************************************************************************
* 사용자 함수(function) * 사용자 함수(function)
@ -199,12 +179,25 @@
**************************************************************************/ **************************************************************************/
$P.fnSearchList = () => { $P.fnSearchList = () => {
if($P.formFields.get().schBsshCd.length + $P.formFields.get().schBsshNm.length === 0){
dialog.alert({
content: "취급업체명 또는 취급자식별번호중<br>하나는 필수입니다."
});
return false;
}
if($P.formFields.get().schBsshNm.length !== 0 && $P.formFields.get().schBsshNm.length < 2){
dialog.alert({
content: "취급업체명은 2자 이상으로 조회해 주세요."
});
return false;
}
$P.control.query = { $P.control.query = {
//... $P.formFields.get(), pg: 1,
bc: $P.formFields.get().schBsshCd, bc: $P.formFields.get().schBsshCd,
bn: $P.formFields.get().schBsshNm, bn: $P.formFields.get().schBsshNm,
rprsntvNm: $P.formFields.get().schRprsntvNm, rprsntvNm: $P.formFields.get().schRprsntvNm,
//dbSkipYn: dbSkipYn? dbSkipYn : "N",
userId: "${currentUser.account}" userId: "${currentUser.account}"
}; };
$P.control.query.fetchSize = FETCH_XXL; // 한번에 조회되는 자료 건수 $P.control.query.fetchSize = FETCH_XXL; // 한번에 조회되는 자료 건수
@ -213,6 +206,12 @@
$P.control.load(1); $P.control.load(1);
} }
$P.scrollDataList = () => {
$P.control.query.pg = $P.control.query.pageNum + 1;
$P.control.load($P.control.query.pageNum + 1);
}
// 저장 // 저장
$P.fnSave = () => { $P.fnSave = () => {
let openPage = new AddsFormFields("#${openPage}"); let openPage = new AddsFormFields("#${openPage}");
@ -228,13 +227,12 @@
// 버튼 이벤트 // 버튼 이벤트
$("#btnSave--${pageName}").on("click", () => $P.fnSave()); // 저장 $("#btnSave--${pageName}").on("click", () => $P.fnSave()); // 저장
$("#btnSearch--${pageName}").on("click", () => $P.fnSearchList()); $("#btnSearch--${pageName}").on("click", () => $P.fnSearchList());
$("#btnSearch2--${pageName}").on("click", () => $P.fnSearchList("Y"));
$("#frmSearch--${pageName} input").onEnterPress($P.fnSearchList); $("#frmSearch--${pageName} input").onEnterPress($P.fnSearchList);
} }
// DataTables width 변경 조정 (업무별 그리드가 존재 한다면.. crdn06010-main.jsp 참고) // DataTables width 변경 조정 (업무별 그리드가 존재 한다면.. crdn06010-main.jsp 참고)
Componentization.fnMakeResizableTable($("#table-responsive--${pageName}")[0]); Componentization.fnMakeScrollableTable($("#table-responsive--${pageName}")[0], $P.scrollDataList);
// 초기 화면 설정 // 초기 화면 설정
$P.initForm = () => {} $P.initForm = () => {}

@ -43,7 +43,7 @@
<input type="text" class="form-control w-70" id="bsshNm--${pageName}" name="bsshNm" data-map="bsshNm" readonly> <input type="text" class="form-control w-70" id="bsshNm--${pageName}" name="bsshNm" data-map="bsshNm" readonly>
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<label for="bsshCd--${pageName}" class="w-px-100 bg-lighter pe-2 col-form-label text-sm-end">식별번호</label> <label for="bsshCd--${pageName}" class="w-px-100 bg-lighter pe-2 col-form-label text-sm-end">업체식별번호</label>
<input type="text" class="form-control w-px-150" id="bsshNm--${pageName}" name="bsshCd" data-map="bsshCd" readonly> <input type="text" class="form-control w-px-150" id="bsshNm--${pageName}" name="bsshCd" data-map="bsshCd" readonly>
<button type="button" class="btn btn-search w-px-100" id="btnBsshSearch--${pageName}" title="업체 검색">업체 검색</button> <button type="button" class="btn btn-search w-px-100" id="btnBsshSearch--${pageName}" title="업체 검색">업체 검색</button>
</div> </div>

@ -30,7 +30,7 @@
<input type="text" class="form-control w-70" id="bsshNm--${pageName}" name="bsshNm" data-map="bsshNm" readonly> <input type="text" class="form-control w-70" id="bsshNm--${pageName}" name="bsshNm" data-map="bsshNm" readonly>
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<label for="bsshCd--${pageName}" class="w-px-100 bg-lighter pe-2 col-form-label text-sm-end">식별번호</label> <label for="bsshCd--${pageName}" class="w-px-100 bg-lighter pe-2 col-form-label text-sm-end">업체식별번호</label>
<input type="text" class="form-control w-px-150" id="bsshNm--${pageName}" name="bsshCd" data-map="bsshCd" readonly> <input type="text" class="form-control w-px-150" id="bsshNm--${pageName}" name="bsshCd" data-map="bsshCd" readonly>
<button type="button" class="btn btn-search w-px-100" id="btnBsshSearch--${pageName}" title="업체 검색">업체 검색</button> <button type="button" class="btn btn-search w-px-100" id="btnBsshSearch--${pageName}" title="업체 검색">업체 검색</button>
</div> </div>
@ -372,7 +372,7 @@
, data : params , data : params
, success : resp => { , success : resp => {
dialog.open({ dialog.open({
id : "productMainDialog" id : "productPopupDialog"
, title : dialogTitle , title : dialogTitle
, content : resp , content : resp
, size : $P.productControl.infoSize , size : $P.productControl.infoSize

@ -24,9 +24,9 @@
<!-- / 업무 버튼 표시 --> <!-- / 업무 버튼 표시 -->
<div class="card-datatable text-nowrap"> <div class="card-datatable text-nowrap">
<div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_0_wrapper--${pageName}"> <div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_0_wrapper--${pageName}">
<div class="table-responsive ox-scroll oy-scroll h-px-500" id="table-responsiv-0--${pageName}"> <div class="table-responsive ox-scroll oy-scroll h-px-600" id="table-responsive-0--${pageName}">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_0--${pageName}" aria-describedby="DataTables_Table_0_info"> <table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_0--${pageName}" aria-describedby="DataTables_Table_0_info">
<thead> <thead class="sticky-thead">
<tr> <tr>
<th class="sorting" style="width: 146.156px;">제품코드</th> <th class="sorting" style="width: 146.156px;">제품코드</th>
<th class="sorting" style="width: 350.141px;">제품명</th> <th class="sorting" style="width: 350.141px;">제품명</th>
@ -93,23 +93,21 @@
</div> </div>
<div class="card-datatable text-nowrap"> <div class="card-datatable text-nowrap">
<div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_1_wrapper--${pageName}"> <div class="dataTables_wrapper dt-bootstrap5 no-footer" id="DataTables_Table_1_wrapper--${pageName}">
<div class="table-responsive ox-scroll oy-scroll h-px-500" id="table-responsive-1--${pageName}"> <div class="table-responsive ox-scroll oy-scroll h-px-600" id="table-responsive-1--${pageName}">
<table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_1--${pageName}" aria-describedby="DataTables_Table_1_info"> <table class="table-layout-fixed dataTable datatables-ajax table table-bordered no-footer" id="DataTables_Table_1--${pageName}" aria-describedby="DataTables_Table_1_info">
<thead> <thead class="sticky-thead">
<tr> <tr>
<%-- <th class="sorting" style="width: 146.156px;">제품코드</th>--%> <th class="sorting" style="width: 146px;">제품코드</th>
<%-- <th class="sorting" style="width: 330.141px;">제품명</th>--%> <th class="sorting" style="width: 110px;">유효기간</th>
<th class="sorting" style="width: 120.469px;">유효기간</th> <th class="sorting" style="width: 155px;">제조번호</th>
<th class="sorting" style="width: 160.469px;">제조번호</th> <th class="sorting" style="width: 155px;">제조일련번호</th>
<th class="sorting" style="width: 160.469px;">제조일련번호</th>
</tr> </tr>
</thead> </thead>
<tbody id="tbody--${pageName}Detail"> <tbody id="tbody--${pageName}Detail">
</tbody> </tbody>
<template id="${infoPrefix}Row--${pageName}Detail"> <template id="${infoPrefix}Row--${pageName}Detail">
<tr data-key="{keyCnt}"> <tr data-key="{keyCnt}">
<%-- <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prductCd}</td>--%> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prductCd}</td>
<%-- <td class="cmn text-start" onclick="{onclick}" ondblclick="{ondblclick}">{prductNm}</td>--%>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prdValidDe}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{prdValidDe}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{mnfNo}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{mnfNo}</td>
<td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{mnfSeq}</td> <td class="cmn text-center" onclick="{onclick}" ondblclick="{ondblclick}">{mnfSeq}</td>
@ -234,15 +232,15 @@
// Dataset 변경 이벤트 // Dataset 변경 이벤트
$P.control.onDatasetChange = (obj, option) => { $P.control.onDatasetChange = (obj, option) => {
$P.renderList(obj.${infoPrefix}Total, option); $P.renderList(obj.totalCount, option);
$("#${infoPrefix}Paging--${pageName}").setPagingInfo({ $("#${infoPrefix}Paging--${pageName}").setPagingInfo({
list: $P.control.dataset list: $P.control.dataset
, prefix: "${infoPrefix}Paging--${pageName}" , prefix: "${infoPrefix}Paging--${pageName}"
, start: obj.${infoPrefix}Start , start: obj.${infoPrefix}Start
, totalSize: $P.control.dataset.length , totalSize: obj.totalCount
, fetchSize: obj.${infoPrefix}Fetch , fetchSize: obj.${infoPrefix}Fetch
, func: "pageObject['${pageName}'].control.load({index})" //, func: "pageObject['${pageName}'].control.load({index})"
}); });
@ -283,9 +281,6 @@
}; };
// 저장 callback
// 저장
/************************************************************************** /**************************************************************************
* DataTables 이벤트 * DataTables 이벤트
@ -296,26 +291,16 @@
let ${infoPrefix}List = $P.control.dataset; let ${infoPrefix}List = $P.control.dataset;
let empty = ${infoPrefix}List.empty; let empty = ${infoPrefix}List.empty;
// 업무별 DataTables(그리드) tr, td let trs = empty ?
let foundContent = document.getElementById("${infoPrefix}Row--${pageName}").content; [document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML] :
let foundTr = $(foundContent).find("tr")[0].cloneNode(false); ${infoPrefix}List.inStrings(
let foundTds = $(foundContent).find("td"); document.getElementById("${infoPrefix}Row--${pageName}").innerHTML,
(str, dataItem) => str
foundTds.each(function() { .replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("keyCnt") + "');"));
foundTr.appendChild(this.cloneNode(true)); let noMore = (${infoPrefix}List.length >= totalSize);
}); let initScroll = ($P.control.query.pageNum < 2);
//
let replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].control.setCurrent('" + dataItem.getValue("keyCnt") + "');");
// .replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnSave()");
let trs = empty ? [document.getElementById("${infoPrefix}NotFound--${pageName}").innerHTML]
: ${infoPrefix}List.inStrings(foundTr.outerHTML, replacer);
$("#tbody--${pageName}").html(trs.join());
$("#table-responsive-0--${pageName}")[0].changeContent(trs.join(), initScroll, noMore);
} }
$P.renderDetailList = (totalSize, option) => { $P.renderDetailList = (totalSize, option) => {
@ -328,15 +313,12 @@
document.getElementById("${infoPrefix}Row--${pageName}Detail").innerHTML, <%-- from template#${infoPrefix}Row --%> document.getElementById("${infoPrefix}Row--${pageName}Detail").innerHTML, <%-- from template#${infoPrefix}Row --%>
(str, dataItem) => str (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].seqInfoControl.setCurrent('" + dataItem.getValue("keyCnt") + "');") .replace(/{onclick}/gi, "pageObject['${pageName}'].seqInfoControl.setCurrent('" + dataItem.getValue("keyCnt") + "');")
.replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnSave()") .replace(/{ondblclick}/gi, "pageObject['${pageName}'].fnSave()"));
);
let noMore = (${infoPrefix}DetailList.length >= totalSize); let noMore = (${infoPrefix}DetailList.length >= totalSize);
let initScroll = ($P.seqInfoControl.query.pageNum < 2); let initScroll = ($P.seqInfoControl.query.pageNum < 2);
$("#table-responsive-1--${pageName}")[0].changeContent(trs.join(), initScroll, noMore); $("#table-responsive-1--${pageName}")[0].changeContent(trs.join(), initScroll, noMore);
} }
/************************************************************************** /**************************************************************************
* 사용자 함수(function) * 사용자 함수(function)
@ -347,8 +329,23 @@
**************************************************************************/ **************************************************************************/
//그리드(좌)조회(새로 조회) //그리드(좌)조회(새로 조회)
$P.fnSearchList = () => { $P.fnSearchList = () => {
if($P.formFields.get().schProductNm.length + $P.formFields.get().schProductCd.length === 0){
dialog.alert({
content: "상품명 또는 상품번호중 하나는 필수입니다."
});
return false;
}
if($P.formFields.get().schProductNm.length !== 0 && $P.formFields.get().schProductNm.length < 2){
dialog.alert({
content: "상품명은 2자 이상으로 조회해 주세요."
});
return false;
}
$P.control.query = { $P.control.query = {
... $P.formFields.get(), ... $P.formFields.get(),
pg: 1,
p: $P.formFields.get().schProductCd, p: $P.formFields.get().schProductCd,
pn: $P.formFields.get().schProductNm, pn: $P.formFields.get().schProductNm,
bc: '${bsshCd}', //업체코드 bc: '${bsshCd}', //업체코드
@ -359,6 +356,14 @@
$P.control.load(1); $P.control.load(1);
} }
$P.scrollList = () => {
$P.control.query.pg = $P.control.query.pageNum + 1;
$P.control.load($P.control.query.pageNum + 1);
}
//그리드(우)조회(새로 조회) //그리드(우)조회(새로 조회)
$P.fnDetailSearchList = () => { $P.fnDetailSearchList = () => {
$P.seqInfoControl.query = { $P.seqInfoControl.query = {
@ -420,6 +425,7 @@
$("#frmSearch--${pageName}Detail input").onEnterPress($P.fnDetailSearchList); $("#frmSearch--${pageName}Detail input").onEnterPress($P.fnDetailSearchList);
} }
Componentization.fnMakeScrollableTable($("#table-responsive-0--${pageName}")[0], $P.scrollList);
Componentization.fnMakeScrollableTable($("#table-responsive-1--${pageName}")[0], $P.scrollDetailDataList); Componentization.fnMakeScrollableTable($("#table-responsive-1--${pageName}")[0], $P.scrollDetailDataList);

Loading…
Cancel
Save