You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
265 lines
11 KiB
Plaintext
265 lines
11 KiB
Plaintext
<%--
|
|
Created by IntelliJ IDEA.
|
|
User: moong
|
|
Date: 2025-11-20
|
|
Time: 오전 10:07
|
|
To change this template use File | Settings | File Templates.
|
|
--%>
|
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
|
|
|
<div class="main_body">
|
|
<section id="section8" class="main_bars">
|
|
<div class="bgs-main">
|
|
<section id="section5">
|
|
<div class="sub_title"></div>
|
|
<button type="button" onclick="location.href='<c:url value='/template/noticeSample/register.do'/>'" class="newbtn bg1">등록</button>
|
|
</section>
|
|
</div>
|
|
</section>
|
|
<div class="contants_body">
|
|
<div class="gs_b_top">
|
|
<ul class="lef">
|
|
<li class="th">검색구분</li>
|
|
<li>
|
|
<select id="searchCondition" name="searchCondition" class="input">
|
|
<option value="">검색구분</option>
|
|
<option value="title" <c:if test="${paramVO.searchCondition eq 'title'}">selected</c:if>>차량번호</option>
|
|
<option value="contents" <c:if test="${paramVO.searchCondition eq 'contents'}">selected</c:if>>소유자</option>
|
|
<option value="writer" <c:if test="${paramVO.searchCondition eq 'writer'}">selected</c:if>>주민번호</option>
|
|
<option value="code" <c:if test="${paramVO.searchCondition eq 'code'}">selected</c:if>>코드</option>
|
|
</select>
|
|
</li>
|
|
<li class="th">검색어</li>
|
|
<li><input type="text" id="searchKeyword" name="searchKeyword" class="input" value="${param.searchKeyword}"/></li>
|
|
<li class="th">접수일자 지정</li>
|
|
<li>
|
|
<input type="text" id="searchStartDt" name="searchStartDt" class="input calender datepicker" value="${param.searchStartDt}" /> ~
|
|
<input type="text" id="searchEndDt" name="searchEndDt" class="input calender datepicker" value="${param.searchEndDt}" />
|
|
</li>
|
|
<li>
|
|
<button type="button" id="search_btn" class="newbtnss bg1">검색</button>
|
|
</li>
|
|
</ul>
|
|
<ul class="rig2">
|
|
<li>
|
|
<select id="perPageSelect" class="input">
|
|
<option value="10" <c:if test="${param.perPage eq '10'}">selected</c:if>>페이지당 10</option>
|
|
<option value="30" <c:if test="${empty param.perPage or param.perPage eq '30'}">selected</c:if>>페이지당 30</option>
|
|
<option value="100" <c:if test="${param.perPage eq '100'}">selected</c:if>>페이지당 100</option>
|
|
</select>
|
|
<span class="page_number"><span id="currentPage"></span><span class="bar">/</span><sapn id="totalPages"></sapn> Pages</span>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="gs_booking">
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<div class="box_column">
|
|
<div class="containers">
|
|
<div id="grid"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
|
|
let INIT_POPUP = null;
|
|
let SEARCH_COND = {};
|
|
let GRID = null;
|
|
|
|
// 검색조건 세팅
|
|
let setSearchCond = function () {
|
|
let searchCondition = $.trim(nvl($("#searchCondition").val(), ""));
|
|
let searchKeyword = $.trim(nvl($("#searchKeyword").val(), ""));
|
|
let searchUseYn = $.trim(nvl($("#searchUseYn").val(), ""));
|
|
let searchStartDt = $.trim(nvl($("#searchStartDt").val(), ""));
|
|
let searchEndDt = $.trim(nvl($("#searchEndDt").val(), ""));
|
|
|
|
SEARCH_COND.searchCondition = searchCondition;
|
|
SEARCH_COND.searchKeyword = searchKeyword;
|
|
SEARCH_COND.searchUseYn = searchUseYn;
|
|
SEARCH_COND.searchStartDt = searchStartDt;
|
|
SEARCH_COND.searchEndDt = searchEndDt;
|
|
|
|
};
|
|
|
|
const fnBiz = {
|
|
|
|
init: () => {
|
|
initGrid();
|
|
},
|
|
|
|
eventListener: () => {
|
|
|
|
// 엑셀 다운로드
|
|
$('#btnExcel').on('click', function () {
|
|
const params = $.param({
|
|
searchCondition: $('#searchCondition').val(),
|
|
searchKeyword: $('#searchKeyword').val(),
|
|
searchStartDt: $('#searchStartDt').val(),
|
|
searchEndDt: $('#searchEndDt').val()
|
|
});
|
|
|
|
const url = '${pageContext.request.contextPath}/minwon/dayanswer/dayanswer-excel.do?' + params;
|
|
window.location.href = url;
|
|
});
|
|
|
|
// 검색 버튼
|
|
$('#search_btn').on('click', function () {
|
|
let startDate = $("#searchStartDt").val();
|
|
let endDate = $("#searchEndDt").val();
|
|
|
|
if ((startDate && !endDate) || (!startDate && endDate)) {
|
|
alert("등록일 검색 시 시작일과 종료일을 모두 입력해주세요.");
|
|
return;
|
|
}
|
|
if (startDate && endDate) {
|
|
if (!isDate(startDate) || !isDate(endDate)) {
|
|
alert("유효한 날짜 형식이 아닙니다. (YYYY-MM-DD)");
|
|
return;
|
|
}
|
|
let startDateObj = new Date(startDate);
|
|
let endDateObj = new Date(endDate);
|
|
if (startDateObj > endDateObj) {
|
|
alert("시작일은 종료일보다 이후일 수 없습니다.");
|
|
return;
|
|
}
|
|
}
|
|
|
|
$("#page").val(1);
|
|
GRID.readData(1);
|
|
});
|
|
|
|
// 검색어 엔터
|
|
$('#searchKeyword').on('keypress', function (e) {
|
|
if (e.which === 13) {
|
|
e.preventDefault();
|
|
$('#search_btn').trigger('click');
|
|
}
|
|
});
|
|
|
|
// perPage 변경 이벤트 추가
|
|
$('#perPageSelect').on('change', () => {
|
|
const pagination = TuiGrid.instance.getPagination();
|
|
if (!pagination) return;
|
|
|
|
pagination.setItemsPerPage($('#perPageSelect').val());
|
|
pagination.reset(TuiGrid.instance.getRowCount());
|
|
pagination.movePageTo(1);
|
|
});
|
|
|
|
// 상태 탭 클릭
|
|
$('.state-tabs li').on('click', function () {
|
|
$('.state-tabs li').removeClass('on');
|
|
$(this).addClass('on');
|
|
|
|
const state = $(this).data('state') || '';
|
|
$('#tabState').val(state);
|
|
|
|
SEARCH_COND = {};
|
|
GRID.readData(1);
|
|
});
|
|
}
|
|
};
|
|
|
|
/** tui-grid Set */
|
|
const initGrid = () => {
|
|
|
|
const gridColumns = [
|
|
{ header: '자료출처', name: 'mmIngb', width: 150, align: 'center' },
|
|
{ header: '접수(위반)일시', name: 'mmDate', width: 150, align: 'center' },
|
|
{ header: '차량번호', name: 'mmCarno', width: 150, align: 'center' },
|
|
{ header: '주민번호', name: 'omJno', width: 150, align: 'center' },
|
|
{ header: '소유자', name: 'omName', width: 150, align: 'center' },
|
|
{ header: '잔액', name: 'mmKeum2', width: 150, align: 'center' },
|
|
{ header: '영상매체', name: 'mmImageGb', width: 150, align: 'center' },
|
|
{ header: '사진', name: 'mmImageCnt', width: 150, align: 'center' },
|
|
{ header: '차량확인', name: 'mmCarcheck', width: 150, align: 'center' },
|
|
{ header: '처리상태', name: 'mmState', width: 150, align: 'center' },
|
|
{ header: 'mmCode', name: 'mmCode', sortable: true, width: 150, align: 'center', hidden: true}
|
|
];
|
|
|
|
const gridDatasource = {
|
|
api: {
|
|
readData: {
|
|
url: '<c:url value="/search/search-select.ajax"/>',
|
|
method: 'POST',
|
|
contentType: 'application/x-www-form-urlencoded',
|
|
processData: true
|
|
}
|
|
},
|
|
initialRequest: false, // 직접 readData(1) 호출할 거라 false
|
|
serializer: function (params) {
|
|
setSearchCond();
|
|
SEARCH_COND.perPage = params.perPage;
|
|
SEARCH_COND.page = params.page;
|
|
|
|
return $.param(SEARCH_COND);
|
|
}
|
|
};
|
|
|
|
const perPage = parseInt($('#perPageSelect').val() || 10, 10);
|
|
|
|
const gridOptions = {
|
|
el: 'grid',
|
|
rowHeaders: ['checkbox'],
|
|
columns: gridColumns,
|
|
noData: "처리 할 초기자료가 없습니다.",
|
|
pageOptions: {
|
|
useClient: false,
|
|
perPage: perPage
|
|
}
|
|
};
|
|
|
|
// 실제 GRID 생성
|
|
GRID = TuiGrid.of(gridOptions, gridDatasource, (res) => {
|
|
// 서버 응답 후 페이지 정보 세팅
|
|
const data = res.data || {};
|
|
if (data.pagination) {
|
|
$("#currentPage").text(data.pagination.page || '');
|
|
$("#totalPages").text(data.pagination.totalPages || '');
|
|
}
|
|
|
|
// 더블 클릭 이벤트
|
|
GRID.on("dblclick", (e) => {
|
|
var popUrl = '/minwon/init/init_popup.do';
|
|
var popTitle = "initPopup";
|
|
var popOption = "width=1400px, height=900px, resizable=yes, scrollbars=yes, location=no, top=100px, left=100px";
|
|
|
|
// 1) localStorage에 저장
|
|
console.log(e)
|
|
|
|
let cursor = e.instance.getValue(e.rowKey, 'mmCode');
|
|
let mmCodes = e.instance.getData().map(row => row.mmCode);
|
|
|
|
console.log(cursor);
|
|
|
|
const state = { cursor, mmCodes, savedAt: Date.now() };
|
|
localStorage.setItem('TOTAL_INFO_STATE', JSON.stringify(state));
|
|
|
|
// 2) 팝업이 없거나 닫혀 있으면 새로 열기
|
|
if (!INIT_POPUP || INIT_POPUP.closed) {
|
|
INIT_POPUP = window.open(popUrl, popTitle, popOption);
|
|
} else {
|
|
// 이미 떠 있으면 새로 안 만들고, 그 창에 포커스만 줌
|
|
INIT_POPUP.focus();
|
|
INIT_POPUP.INIT_POP_API.search();
|
|
}
|
|
});
|
|
});
|
|
|
|
// 최초 1페이지 조회
|
|
GRID.readData(1);
|
|
};
|
|
|
|
// 레디펑션
|
|
$(function () {
|
|
fnBiz.init();
|
|
fnBiz.eventListener();
|
|
});
|
|
|
|
</script>
|
|
|