feat : 개별 입력 등록 작업중
parent
6d7b1a3d01
commit
8e5aedd20d
@ -1,26 +1,78 @@
|
||||
package go.kr.project.biz.minwon.indivreg.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import egovframework.constant.TilesConstants;
|
||||
import egovframework.util.ApiResponseUtil;
|
||||
import go.kr.project.biz.minwon.indivreg.dto.IndivRegDto;
|
||||
import go.kr.project.biz.minwon.indivreg.service.IndivRegService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping("/minwon/indivreg/{sggCd}")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "민원자료 개별 등록", description = "민원 신고 기관 개별 요청")
|
||||
public class IndivRegController {
|
||||
/**
|
||||
* 개별 등록 목록 데이터 조회 (AJAX)
|
||||
* @param sggCd 시군구코드
|
||||
* @return 응답 데이터
|
||||
*/
|
||||
|
||||
// 생성자 인젝션
|
||||
private final IndivRegService indivRegService;
|
||||
|
||||
@GetMapping("/minwon/indivreg/indivreg.do")
|
||||
public String pageReturnIndivReg() {
|
||||
return "biz/minwon/indivreg/indivreg" + TilesConstants.BASE;
|
||||
}
|
||||
|
||||
@PostMapping("/minwon/indivreg/indivreg-search-myBatis.ajax")
|
||||
public ResponseEntity<?> openIndivRegList(@ModelAttribute IndivRegDto.Request.Search dto) {
|
||||
|
||||
int totalCount = 0;
|
||||
dto.setTotalCount(totalCount);
|
||||
|
||||
// 페이징 처리를 위한 설정
|
||||
dto.setPagingYn("Y");
|
||||
|
||||
List<IndivRegDto.Response.cpSeallOne> result = indivRegService.searchIndivRegMybatis(dto);
|
||||
|
||||
return ApiResponseUtil.successWithGrid(result, dto);
|
||||
}
|
||||
|
||||
@GetMapping("/minwon/indivreg/indivregform.do")
|
||||
public String openIndivRegForm(Model model) {
|
||||
// 등록 폼에 필요한 초기 데이터가 있다면 여기서 설정
|
||||
model.addAttribute("indivreg", new IndivRegDto());
|
||||
|
||||
return "biz/minwon/indivreg/indivregform" + TilesConstants.BASE;
|
||||
}
|
||||
|
||||
@PostMapping("/minwon/indivreg/indivreginsert.ajax")
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> insertIndivReg(@RequestBody IndivRegDto.Request.InsertData dto) {
|
||||
try {
|
||||
log.info("등록 요청: {}", dto);
|
||||
|
||||
indivRegService.insertIndivReg(dto);
|
||||
|
||||
return ResponseEntity.ok(
|
||||
Collections.singletonMap("result", "succeses")
|
||||
);
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity
|
||||
.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.body(Collections.singletonMap("result", "fail"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
package go.kr.project.biz.minwon.indivreg.dto;
|
||||
|
||||
import go.kr.project.system.common.model.PagingVO;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class IndivRegDto {
|
||||
|
||||
// 요즘 트렌드에 맞춰 이너클래스를 사용한다.
|
||||
// Request(파라미터를 받을 형식 객체) 와 Response(응답해줄 형식 객체)로 나눠서 관리한다.
|
||||
|
||||
// 프론트에서 파라미터 받아오는 객체
|
||||
public static class Request {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class Search extends PagingVO {
|
||||
|
||||
private String searchCondition;
|
||||
private String searchKeyword;
|
||||
private String searchUseYn;
|
||||
private String fromDt;
|
||||
private String toDt;
|
||||
private String worker;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class InsertData {
|
||||
|
||||
private String soSggcode; // 시군구 코드
|
||||
private String soInGb; // 등록구분
|
||||
private String soInDt; // 입력일자
|
||||
private String soJsdate; // 접수일자
|
||||
private String soBbsNo; // 목록번호
|
||||
private String soState; // 상태
|
||||
private Integer soUser; // 사용자 코드
|
||||
}
|
||||
}
|
||||
|
||||
// 디비 조회해서 프론트로 반납해주는 객체
|
||||
public static class Response {
|
||||
@Getter
|
||||
@Setter
|
||||
public static class cpSeallOne {
|
||||
private String soSggcode ;
|
||||
private String soInDt;
|
||||
private String soInGb;
|
||||
private String soJsdate;
|
||||
private String soBbsNo;
|
||||
private String soMmcode;
|
||||
private String soState;
|
||||
private Integer soUser;
|
||||
private String soPutDt;
|
||||
private String umName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package go.kr.project.biz.minwon.indivreg.mapper;
|
||||
|
||||
import go.kr.project.biz.minwon.indivreg.dto.IndivRegDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface IndivRegMapper {
|
||||
|
||||
// SQL문이 있는 xml과 연결 해줌
|
||||
// 해당 메서드가 호출되면 sql문이 나감
|
||||
List<IndivRegDto.Response.cpSeallOne> selectAllIndivReg(IndivRegDto.Request.Search searchDto);
|
||||
|
||||
void insertIndivReg(IndivRegDto.Request.InsertData dto);
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
package go.kr.project.biz.minwon.indivreg.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class MinwonIndivRegConfigVO {
|
||||
|
||||
private String sggCd;
|
||||
|
||||
private String aplyDt;
|
||||
|
||||
private String regSe;
|
||||
|
||||
private String rcptYmd;
|
||||
|
||||
private String listNo;
|
||||
|
||||
private String crdnId;
|
||||
|
||||
private Integer regUser;
|
||||
|
||||
private String regDt;
|
||||
|
||||
// 사용자 이름 (JOIN 시 사용)
|
||||
private String flnm;
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
package go.kr.project.biz.minwon.indivreg.model;
|
||||
|
||||
import go.kr.project.system.common.model.PagingVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class MinwonIndivRegSearchVO extends PagingVO {
|
||||
|
||||
// 민원 개별 등록 요청 조회
|
||||
private String sggCd;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package go.kr.project.biz.minwon.indivreg.service;
|
||||
|
||||
import go.kr.project.biz.minwon.indivreg.dto.IndivRegDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
// 실제 로직을 이어주는 인터페이스
|
||||
// 해당 인터페이스를 정의하면 반드시 implements를 통해 구현을 해야한다.
|
||||
// eGov 에서 필수라 사용할 뿐
|
||||
public interface IndivRegService {
|
||||
|
||||
// 해당 인터페이스에 정의한 메소드는 반드시 impl로 구현해야함.
|
||||
List<IndivRegDto.Response.cpSeallOne> searchIndivRegMybatis(IndivRegDto.Request.Search dto);
|
||||
|
||||
void insertIndivReg(IndivRegDto.Request.InsertData dto);
|
||||
}
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
package go.kr.project.biz.minwon.indivreg.service.impl;
|
||||
|
||||
import go.kr.project.biz.minwon.indivreg.dto.IndivRegDto;
|
||||
import go.kr.project.biz.minwon.indivreg.mapper.IndivRegMapper;
|
||||
import go.kr.project.biz.minwon.indivreg.service.IndivRegService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class IndivRegServiceImpl extends EgovAbstractServiceImpl implements IndivRegService {
|
||||
|
||||
//dao : DataBase Access Object로 디비와 연겷하는 역할은 한다.
|
||||
// 현재 프로젝트에서는 dao역할은 mybatis 매퍼인터페이스로 한다.
|
||||
private final IndivRegMapper indivRegMapper;
|
||||
|
||||
@Override
|
||||
public List<IndivRegDto.Response.cpSeallOne> searchIndivRegMybatis(IndivRegDto.Request.Search testDto) {
|
||||
// 매퍼 xml의 resultType을 리턴값으로 받아야한다.
|
||||
List<IndivRegDto.Response.cpSeallOne> result = indivRegMapper.selectAllIndivReg(testDto);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertIndivReg(IndivRegDto.Request.InsertData dto) {
|
||||
indivRegMapper.insertIndivReg(dto);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<!-- 여기는 매퍼인터페이스를 경로를 정확히 입력해야 바인딩이 된다. -->
|
||||
<mapper namespace="go.kr.project.biz.minwon.indivreg.mapper.IndivRegMapper">
|
||||
|
||||
<!--
|
||||
매퍼인터페이스의 매소드명과 id가 일치해야 한다.
|
||||
parameterType은 사용할 파라미터,
|
||||
resultType은 쿼리 결과를 반납하는 객체를 넣어준다.
|
||||
아래 보면 이너클래스는 $형태로 들어간다.
|
||||
-->
|
||||
<select id="selectAllIndivReg"
|
||||
parameterType="go.kr.project.biz.minwon.indivreg.dto.IndivRegDto$Request$Search"
|
||||
resultType="go.kr.project.biz.minwon.indivreg.dto.IndivRegDto$Response$cpSeallOne">
|
||||
select *
|
||||
from CP_SEALL_ONE
|
||||
inner join CP_USER on (SO_USER=UM_CODE)
|
||||
WHERE 1=1
|
||||
<if test="searchKeyword != null and searchKeyword != ''">
|
||||
<choose>
|
||||
<when test="searchCondition == 'soJsdate'">
|
||||
AND SO_JSDATE LIKE CONCAT('%', #{searchKeyword}, '%')
|
||||
</when>
|
||||
<when test="searchCondition == 'soBbsNo'">
|
||||
AND SO_BBS_NO LIKE CONCAT('%', #{searchKeyword}, '%')
|
||||
</when>
|
||||
<when test="searchCondition == 'umName'">
|
||||
AND UM_NAME LIKE CONCAT('%', #{searchKeyword}, '%')
|
||||
</when>
|
||||
<otherwise>
|
||||
AND (
|
||||
SO_JSDATE LIKE CONCAT('%', #{searchKeyword}, '%')
|
||||
OR SO_BBS_NO LIKE CONCAT('%', #{searchKeyword}, '%')
|
||||
OR UM_NAME LIKE CONCAT('%', #{searchKeyword}, '%')
|
||||
)
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
ORDER BY SO_SGGCODE, SO_JSDATE, SO_BBS_NO
|
||||
</select>
|
||||
|
||||
<insert id="insertIndivReg" parameterType="go.kr.project.biz.minwon.indivreg.dto.IndivRegDto$Request$InsertData">
|
||||
INSERT INTO CP_SEALL_ONE (
|
||||
SO_SGGCODE, SO_IN_GB, SO_IN_DT, SO_JSDATE, SO_BBS_NO, SO_STATE, SO_USER
|
||||
) VALUES (
|
||||
#{soSggcode}, #{soInGb}, #{soInDt}, #{soJsdate}, #{soBbsNo}, #{soState}, #{soUser}, #{soMMcode}, #{soPutDt}
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,364 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
|
||||
<!-- Main body -->
|
||||
<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='/minwon/indivreg/indivregform.do'/>'" class="newbtn bg1">요청등록</button>
|
||||
<button type="button" onclick="location.href='<c:url value='/template/noticeSample/register.do'/>'" class="newbtn bg1">한건삭제</button>
|
||||
<button type="button" onclick="location.href='<c:url value='/template/noticeSample/register.do'/>'" class="newbtn bg1">전체삭제</button>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
<input type="text" id="bbs_no">
|
||||
<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="soJsdate" <c:if test="${paramVO.searchCondition eq 'soJsdate'}">selected</c:if>>접수일자</option>
|
||||
<option value="soBbsNo" <c:if test="${paramVO.searchCondition eq 'soBbsNo'}">selected</c:if>>목록번호</option>
|
||||
<option value="umName" <c:if test="${paramVO.searchCondition eq 'umName'}">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="worker" name="worker" class="input" value=""/></li>
|
||||
<li class="th">사용여부</li>
|
||||
<li>
|
||||
<select id="searchUseYn" name="searchUseYn" class="input">
|
||||
<option value="">전체</option>
|
||||
<option value="Y" <c:if test="${param.searchUseYn eq 'Y'}">selected</c:if>>사용</option>
|
||||
<option value="N" <c:if test="${param.searchUseYn eq 'N'}">selected</c:if>>미사용</option>
|
||||
</select>
|
||||
</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="20" <c:if test="${param.perPage eq '20'}">selected</c:if>>페이지당 20</option>
|
||||
<option value="30" <c:if test="${param.perPage eq '30'}">selected</c:if>>페이지당 30</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>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main body -->
|
||||
|
||||
<script type="text/javascript">
|
||||
/**
|
||||
* 게시판 목록 관리 모듈
|
||||
* 게시판 목록을 조회하고 관리하는 기능을 제공합니다.
|
||||
*/
|
||||
|
||||
|
||||
(function(window, $) {
|
||||
'use strict';
|
||||
|
||||
var SEARCH_COND = {};
|
||||
|
||||
// 검색정보 셋팅
|
||||
var setSearchCond = function() {
|
||||
var searchCondition = $.trim(nvl($("#searchCondition").val(), ""));
|
||||
var searchKeyword = $.trim(nvl($("#searchKeyword").val(), ""));
|
||||
var searchUseYn = $.trim(nvl($("#searchUseYn").val(), ""));
|
||||
var searchStartDt = $.trim(nvl($("#searchStartDt").val(), ""));
|
||||
var 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;
|
||||
};
|
||||
|
||||
/**
|
||||
* 게시판 목록 관리 네임스페이스
|
||||
*/
|
||||
var NoticeList = {
|
||||
/**
|
||||
* 그리드 관련 객체
|
||||
*/
|
||||
grid: {
|
||||
/**
|
||||
* 그리드 인스턴스
|
||||
*/
|
||||
instance: null,
|
||||
|
||||
/**
|
||||
* 그리드 설정 초기화
|
||||
* @returns {Object} 그리드 설정 객체
|
||||
*/
|
||||
initConfig: function() {
|
||||
// 데이터 소스 설정
|
||||
var dataSource = this.createDataSource();
|
||||
|
||||
// 현재 선택된 perPage 값 가져오기
|
||||
var perPage = parseInt($('#perPageSelect').val() || 10, 10);
|
||||
|
||||
// 그리드 설정 객체 생성
|
||||
var gridConfig = new XitTuiGridConfig();
|
||||
|
||||
// 기본 설정
|
||||
gridConfig.setOptDataSource(dataSource); // 데이터소스 연결
|
||||
gridConfig.setOptGridId('grid'); // 그리드를 출력할 Element ID
|
||||
gridConfig.setOptGridHeight(390); // 그리드 높이(단위: px)
|
||||
gridConfig.setOptRowHeight(30); // 그리드 행 높이(단위: px)
|
||||
gridConfig.setOptRowHeaderType('checkbox'); // 행 첫번째 셀 타입(rowNum: 순번, checkbox: 체크박스, '': 출력 안함)
|
||||
|
||||
// 페이징 옵션 설정
|
||||
gridConfig.setOptPageOptions({
|
||||
useClient: false, // 클라이언트 페이징 여부(false: 서버 페이징)
|
||||
perPage: perPage // 페이지당 표시 건수
|
||||
});
|
||||
gridConfig.setOptUseClientSort(false); // 서버사이드 정렬 false
|
||||
|
||||
// 컬럼 정보 설정
|
||||
gridConfig.setOptColumns([
|
||||
{
|
||||
header: '시군구코드',
|
||||
name: 'soSggcode',
|
||||
width: 70,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
header: '신청일시',
|
||||
name: 'soInDt',
|
||||
width: 70,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
header: '등록구분',
|
||||
name: 'soInGb',
|
||||
width: 50,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
header: '접수일자',
|
||||
name: 'soJsdate',
|
||||
width: 70,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
header: '목록번호',
|
||||
name: 'soBbsNo',
|
||||
width: 70,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
header: '단속ID',
|
||||
name: 'soMmcode',
|
||||
width: 120,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
header: '자료상태',
|
||||
name: 'soState',
|
||||
width: 70,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
header: '등록사용자',
|
||||
name: 'soUser',
|
||||
width: 70,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
header: '등록일시',
|
||||
name: 'soPutDt',
|
||||
width: 70,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
header: '사용자성명',
|
||||
name: 'umName',
|
||||
width: 70,
|
||||
align: 'center'
|
||||
}
|
||||
]);
|
||||
|
||||
return gridConfig;
|
||||
},
|
||||
|
||||
/**
|
||||
* 데이터 소스 생성
|
||||
* @returns {Object} 데이터 소스 객체
|
||||
*/
|
||||
createDataSource: function() {
|
||||
return {
|
||||
api: {
|
||||
readData: {
|
||||
url: '<c:url value="/minwon/indivreg/indivreg-search-myBatis.ajax"/>',
|
||||
method: 'POST',
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
processData: true
|
||||
}
|
||||
},
|
||||
initialRequest: false,
|
||||
serializer: function (params) {
|
||||
setSearchCond();
|
||||
SEARCH_COND.perPage = params.perPage;
|
||||
SEARCH_COND.page = params.page;
|
||||
return $.param(SEARCH_COND);
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* 그리드 인스턴스 생성
|
||||
*/
|
||||
create: function() {
|
||||
var gridConfig = this.initConfig();
|
||||
var Grid = tui.Grid;
|
||||
this.instance = gridConfig.instance(Grid);
|
||||
|
||||
// 그리드 테마 설정
|
||||
Grid.applyTheme('striped');
|
||||
|
||||
// 그리드 이벤트 설정
|
||||
this.gridBindEvents();
|
||||
},
|
||||
|
||||
/**
|
||||
* 그리드 이벤트 바인딩
|
||||
*/
|
||||
gridBindEvents: function() {
|
||||
var self = this;
|
||||
|
||||
// 요청 성공 시 총 건수 표시
|
||||
this.instance.on('successResponse', function(ev) {
|
||||
var responseObj = JSON.parse(ev.xhr.response);
|
||||
//$('.totCnt').text(responseObj.data.pagination.totalCount);
|
||||
$("#currentPage").text(responseObj.data.pagination.page);
|
||||
$("#totalPages").text(responseObj.data.pagination.totalPages);
|
||||
});
|
||||
|
||||
// 행 더블클릭 이벤트 - 게시물 상세 페이지로 이동
|
||||
this.instance.on('dblclick', function(ev) {
|
||||
var popUrl = '${pageContext.request.contextPath}/total/info.do';
|
||||
var popTitle = "비밀번호 변경";
|
||||
var popOption = "width=1400px, height=900px, resizable=yes, scrollbars=yes, location=no, top=100px, left=100px";
|
||||
window.open(popUrl, popTitle, popOption);
|
||||
<%--if (ev.rowKey !== undefined && ev.columnName !== '_number') {--%>
|
||||
<%-- var rowData = self.instance.getRow(ev.rowKey);--%>
|
||||
<%-- if (rowData && rowData.noticeId) {--%>
|
||||
<%-- // 새로운 함수를 사용하여 URL 생성 및 페이지 이동--%>
|
||||
<%-- window.location.href = "<c:url value="/minwon/init/init.do"/>";--%>
|
||||
<%-- console.log("asd11`11")--%>
|
||||
<%-- }--%>
|
||||
<%--}--%>
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 이벤트 핸들러 설정
|
||||
*/
|
||||
eventBindEvents: function() {
|
||||
var self = this;
|
||||
|
||||
// 검색 버튼 클릭 이벤트
|
||||
$('#search_btn').on('click', function() {
|
||||
// 등록일 from~to 유효성 검사
|
||||
var startDate = $("#searchStartDt").val();
|
||||
var endDate = $("#searchEndDt").val();
|
||||
|
||||
// 시작일과 종료일 중 하나만 입력된 경우 체크
|
||||
if ((startDate && !endDate) || (!startDate && endDate)) {
|
||||
alert("등록일 검색 시 시작일과 종료일을 모두 입력해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 시작일과 종료일이 모두 입력된 경우 유효성 검사
|
||||
if (startDate && endDate) {
|
||||
if (!isDate(startDate) || !isDate(endDate)) {
|
||||
alert("유효한 날짜 형식이 아닙니다. (YYYY-MM-DD)");
|
||||
return;
|
||||
}
|
||||
|
||||
// 시작일이 종료일보다 늦은 경우 체크
|
||||
var startDateObj = new Date(startDate);
|
||||
var endDateObj = new Date(endDate);
|
||||
|
||||
if (startDateObj > endDateObj) {
|
||||
alert("시작일은 종료일보다 이후일 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 페이지를 1로 리셋
|
||||
$("#page").val(1);
|
||||
// 그리드 데이터 리로드
|
||||
self.grid.instance.readData(1);
|
||||
});
|
||||
|
||||
// 검색어 입력 필드에서 엔터키 이벤트 처리
|
||||
$('#searchKeyword').on('keypress', function(e) {
|
||||
if (e.which === 13) { // 엔터키 코드는 13
|
||||
e.preventDefault(); // 기본 이벤트 방지
|
||||
$('#search_btn').trigger('click'); // 검색 버튼 클릭 이벤트 트리거
|
||||
}
|
||||
});
|
||||
|
||||
// perPage 변경 이벤트 추가
|
||||
$('#perPageSelect').on('change', function() {
|
||||
var perPage = parseInt($(this).val(), 10);
|
||||
// Grid의 perPage 설정 변경 및 데이터 리로드
|
||||
self.grid.instance.setPerPage(perPage);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 모듈 초기화
|
||||
*/
|
||||
init: function() {
|
||||
|
||||
// 그리드 생성
|
||||
this.grid.create();
|
||||
|
||||
// 이벤트 핸들러 설정
|
||||
this.eventBindEvents();
|
||||
|
||||
this.grid.instance.readData(${param.page eq null or param.page eq 0 ? 1 : param.page});
|
||||
}
|
||||
};
|
||||
|
||||
// 페이지 로드 시 초기화
|
||||
$(function() {
|
||||
NoticeList.init();
|
||||
});
|
||||
|
||||
// 전역 네임스페이스에 모듈 노출
|
||||
window.NoticeList = NoticeList;
|
||||
|
||||
})(window, jQuery);
|
||||
</script>
|
||||
@ -0,0 +1,124 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||
|
||||
<!-- TOAST UI Editor CDN -->
|
||||
<link rel="stylesheet" href="<c:url value="/plugins/tuiEditor/3.2.2/toastui-editor.min.css"/>" />
|
||||
<script src="<c:url value="/plugins/tuiEditor/3.2.2/toastui-editor-all.min.js"/>"></script>
|
||||
<!-- TOAST UI Editor 한국어 지원 -->
|
||||
<script src="<c:url value="/plugins/tuiEditor/3.2.2/i18n/ko-kr.min.js"/>"></script>
|
||||
|
||||
<!-- Main body -->
|
||||
<div class="main_body">
|
||||
<input type="text" id="soJsdate" name="soJsdate" class="input calender datepicker" value="${param.soJsdate}" />
|
||||
<section id="section8" class="main_bars">
|
||||
<div class="bgs-main">
|
||||
<section id="section5">
|
||||
<div class="sub_title"></div>
|
||||
<button type="button" id="btnSave" class="newbtn bg4">확인</button>
|
||||
<button type="button" onclick="location.href='<c:url value='/minwon/indivreg/indivreg.do'/>'" class="newbtn bg1">목록</button>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
<div class="contants_body" >
|
||||
<form id="registerForm" name="registerForm" enctype="multipart/form-data">
|
||||
<div class="box_column">
|
||||
<div class="">
|
||||
<div class="forms_table_non">
|
||||
<table>
|
||||
<tr>
|
||||
<th class="th"><span class="required">*</span>접수일자</th>
|
||||
<td colspan="3">
|
||||
<input type="text" id="soJsdate" name="soJsdate" class="input calender datepicker" value="${param.soJsdate}" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="th"><span class="required">*</span>목록번호</th>
|
||||
<td colspan="3">
|
||||
<input type="text" id="soBbsNo" name="soBbsNo" class="input" validation-check="required" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /Main body -->
|
||||
|
||||
<%--<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>--%>
|
||||
<script>
|
||||
|
||||
const fnBiz = {
|
||||
|
||||
search: (formData) => {
|
||||
$.ajax({
|
||||
url: '/minwon/indivreg/indivreginsert.ajax',
|
||||
type: 'POST',
|
||||
contentType: 'application/json; charset=UTF-8',
|
||||
data: JSON.stringify(formData),
|
||||
success: function(res) {
|
||||
alert('등록이 완료되었습니다.');
|
||||
window.close();
|
||||
if (opener &&opener.NoticeList && opener.NoticeList.grid) {
|
||||
opener.NoticeList.grid.instance.readData(1);
|
||||
} else if (opener) {
|
||||
opener.location.reload();
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.log('등록 실패 응답', xhr.responseText);
|
||||
alert('등록 실패, 다시 시도해주세요.');
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
eventListener: () => {
|
||||
$('#btnSave').on('click', function() {
|
||||
// 1) 현재 일시 생성 (YYYYMMDDHHmmss)
|
||||
var now = new Date();
|
||||
var yyyy = now.getFullYear();
|
||||
var MM = ('0' + (now.getMonth() + 1)).slice(-2);
|
||||
var dd = ('0' + now.getDate()).slice(-2);
|
||||
var HH = ('0' + now.getHours()).slice(-2);
|
||||
var mm = ('0' + now.getMinutes()).slice(-2);
|
||||
var ss = ('0' + now.getSeconds()).slice(-2);
|
||||
var yyyymmddhhmmss = yyyy + MM + dd + HH + mm + ss;
|
||||
|
||||
// 2) 접수일자 yyyy-mm-dd → yyyymmdd 변환
|
||||
var jsd = $('#soJsdate').val(); // 예: "2025-11-19"
|
||||
var jsdFormat = jsd ? jsd.split('-').join('') : ""; // "20251119"
|
||||
|
||||
// 3) 서버로 보낼 데이터
|
||||
var formData = {
|
||||
soSggcode: "41590",
|
||||
soInGb: "1",
|
||||
soInDt: yyyymmddhhmmss,
|
||||
soJsdate: jsdFormat, // ← 여기!
|
||||
soBbsNo: $('#soBbsNo').val(),
|
||||
soState: "B",
|
||||
soUser: 20
|
||||
};
|
||||
|
||||
console.log('보내는 데이터:', formData); // 디버깅용
|
||||
|
||||
fnBiz.search(formData);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
$(function () {
|
||||
|
||||
fnBiz.eventListener();
|
||||
|
||||
$('.datepicker').datepicker({
|
||||
orientation: "top",
|
||||
autoclose: true,
|
||||
language: "ko",
|
||||
format: "yyyy.mm.dd"
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue