기관/부서 메뉴 추가

main
이범준 5 months ago
parent 2e82093d5c
commit 35e91886d9

@ -0,0 +1,10 @@
package cokr.xit.fims.base;
import org.springframework.stereotype.Controller;
import cokr.xit.base.user.Department;
import cokr.xit.base.user.Sigungu;
import cokr.xit.base.user.web.SigunguDepartmentController;
@Controller
public class SggDeptController extends SigunguDepartmentController<Sigungu, Department> {}

@ -0,0 +1,101 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<form id="dept-form">
<div class="row g-3">
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="deptID">부서코드</label>
<div class="col-sm-9">
<input name="deptID" type="text" required data-map="DEPT_CD" maxlength="7" class="form-control" placeholder="부서코드" />
<input name="sggID" type="hidden" data-map="SGG_CD" />
<input name="instCode" type="hidden" data-map="INST_CD" />
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="name">부서이름</label>
<div class="col-sm-9">
<input name="name" type="text" required data-map="DEPT_NM" maxlength="100" class="form-control" placeholder="부서이름" />
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="telno">전화번호</label>
<div class="col-sm-9">
<input name="telno" type="text" data-map="DEPT_TELNO" maxlength="20" class="form-control" placeholder="전화번호"/>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="faxno">팩스번호</label>
<div class="col-sm-9">
<input name="faxno" type="text" data-map="DEPT_FXNO" maxlength="20" class="form-control" placeholder="팩스번호"/>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="createdBy">등록자</label>
<div class="col-sm-9">
<input type="text" data-map="RGTR" readonly class="form-control" placeholder="등록자"/>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="description">등록일자</label>
<div class="col-sm-9">
<input type="text" data-map="REG_DT" readonly class="form-control" placeholder="등록일자"/>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="description">사용여부</label>
<div class="col-sm-9" style="padding:.5em .7em;">
<input name="useYN" type="hidden" data-map="USE_YN" />
<span id="deptInUse"></span>
</div>
</div>
</div>
<div class="row mt-4 justify-content-end">
<div class="col-sm-12" style="text-align:right;">
<button onclick="saveDept();" type="button" class="btn btn-primary">저장</button>
</div>
</div>
</form>
<script type="text/javascript">
var deptFields = new FormFields("#dept-form");
sggDeptControl.depts.setInfo = obj => {
let info = obj.data;
deptFields.set(sggDeptControl.depts, obj);
let create = isEmpty(info.DEPT_CD);
$("input[name='deptID']").prop("readonly", !create);
$("#dept-form input").onEnterPress(saveDept);
$("#deptInUse").html("Y" == info.USE_YN ? "사용 중" : "사용하지 않음");
document.querySelector("input[name='" + (create ? "deptID" : "name") + "']").focus();
}
sggDeptControl.depts.onModify = (changed) => {
if (["DEPT_NM"].filter(e => changed.includes(e)).length < 1)
return;
renderDeptList();
sggDeptControl.depts.dataset.setState();
}
function saveDept() {
if (!$("#dept-form input").validInputs()) return;
dialog.alert({
content:"현재 부서 정보를 저장하시겠습니까?",
onOK:() => sggDeptControl.depts.save(deptFields.get())
});
}
//# sourceURL=dept-info.jsp
</script>

@ -0,0 +1,57 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<!-- Page Body -->
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer">
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0">
<thead>
<tr><th class="sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" aria-sort="ascending" style="">시군구</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" style="">기관</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" style="">부서</th>
</tr>
</thead>
<tbody id="sggDeptList">
</tbody>
<template id="sggDeptRow">
<tr data-key="{dataKey}">
<td onclick="sggDepts.setCurrent('{dataKey}')">{SGG_CD}</td>
<td onclick="sggDepts.setCurrent('{dataKey}')">{SGG_NM}</td>
<td onclick="sggDepts.setCurrent('{dataKey}')">{INST_CD}</td>
<td onclick="sggDepts.setCurrent('{dataKey}')">{INST_NM}</td>
<td onclick="sggDepts.setCurrent('{dataKey}')">{DEPT_CD}</td>
<td onclick="sggDepts.setCurrent('{dataKey}')">{DEPT_NM}</td>
</tr>
</template>
<template id="sggDeptNotFound">
<tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">부서정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
</div>
<!--/ Page Body -->
<script >
var sggDepts = new Dataset({
keymapper: info => info.dataKey,
onDatasetChange: obj => {
let empty = sggDepts.empty;
let trs = empty ?
[document.getElementById("sggDeptNotFound").innerHTML] : <%-- from template#${infoPrefix}NotFound --%>
sggDepts.inStrings(document.getElementById("sggDeptRow").innerHTML); <%-- from template#${infoPrefix}Row --%>
$("#sggDeptList").html(trs.join());
},
onCurrentChange: item => {
if (!item) return;
let key = item.data.dataKey;
$("#sggDeptList").setCurrentRow(key);
}
});
function getSelectedDept() {
return sggDepts.getCurrent();
}
sggDepts.setData(${sggDepts});
//# sourceURL=select-sggDepts.jsp
</script>

@ -0,0 +1,245 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<c:set var="prefixName" scope="request">기관 정보</c:set>
<!-- Page Body -->
<div class="d-flex flex-column flex-grow-1">
<div id="DataTables_Table_0_wrapper" class="dataTables_wrapper dt-bootstrap5 no-footer">
<div class="d-flex flex-row justify-content-evenly">
<div style="width:49%;">
<h5 class="mt-3">${prefixName}</h5>
<div class="d-flex flex-row justify-content-between p-3">
<%--div>
<div class="input-group" id="DataTables_Table_0_length">
<select id="by" onchange="document.getElementById('term').focus();" aria-controls="DataTables_Table_0" class="form-select">
<option value="sggName">이름</option>
<option value="sggID">아이디</option>
</select>
<input id="term" autofocus type="text" placeholder="조회 조건을 입력하십시오." class="form-control">
</div>
</div--%>
<div>
<%--button onclick="searchSggs();" class="btn btn-primary">찾기</button--%>
<button onclick="sggDeptControl.newSgg();" class="btn btn-primary">+ 추가</button>
<button id="btnRemoveSggs" onclick="removeSggs();" class="btn btn-primary">- 제거</button>
</div>
</div>
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input onchange="sggDeptControl.sggs.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="text-center sorting sorting_asc" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2" aria-sort="ascending">시군구</th>
<th class="text-center sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="2">기관</th>
</tr>
</thead>
<tbody id="sggList">
</tbody>
<template id="sggRow">
<tr data-key="{SGG_CD}"{notUsed}>
<td style="text-align:center;"><input value="{SGG_CD}" onchange="sggDeptControl.sggs.select('{SGG_CD}', this.checked);" type="checkbox" class="form-check-input"></td>
<td onclick="sggDeptControl.sggs.setCurrent('{SGG_CD}')" ondblclick="sggDeptControl.sggs.getInfo({})">{SGG_CD}</td>
<td onclick="sggDeptControl.sggs.setCurrent('{SGG_CD}')" ondblclick="sggDeptControl.sggs.getInfo({})">{SGG_NM}</td>
<td onclick="sggDeptControl.sggs.setCurrent('{SGG_CD}')" ondblclick="sggDeptControl.sggs.getInfo({})">{INST_CD}</td>
<td onclick="sggDeptControl.sggs.setCurrent('{SGG_CD}')" ondblclick="sggDeptControl.sggs.getInfo({})">{INST_NM}</td>
</tr>
</template>
<template id="sggNotFound">
<tr class="odd">
<td valign="top" colspan="5" class="dataTables_empty text-center">${prefixName}를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<label id="sggPagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="sggPaging" class="pagination pagination-primary">
</ul>
</div>
</div>
<div style="width:49%;">
<h5 class="mt-3">부서 정보</h5>
<div class="d-flex flex-row justify-content-end p-3">
<div>
<button id="btnAddDept" onclick="sggDeptControl.newDept();" class="btn btn-primary">+ 추가</button>
<button id="btnRemoveDepts" onclick="removeDepts();" class="btn btn-primary">- 제거</button>
</div>
</div>
<table class="datatables-ajax table table-bordered dataTable no-footer" id="DataTables_Table_0" aria-describedby="DataTables_Table_0_info">
<thead>
<tr><th tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1" style="text-align:center;"><input id="deptToggler" onchange="sggDeptControl.depts.select(this.checked);" type="checkbox" class="form-check-input"></th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1">부서코드</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1">부서이름</th>
<th class="sorting" tabindex="0" aria-controls="DataTables_Table_0" rowspan="1" colspan="1">전화번호</th>
</tr>
</thead>
<tbody id="deptList">
</tbody>
<template id="deptRow">
<tr data-key="{DEPT_CD}"{notUsed}>
<td style="text-align:center;"><input value="{DEPT_CD}" onchange="sggDeptControl.depts.select('{DEPT_CD}', this.checked);" type="checkbox" class="form-check-input"></td>
<td onclick="sggDeptControl.depts.setCurrent('{DEPT_CD}')" ondblclick="sggDeptControl.depts.getInfo({})">{DEPT_CD}</td>
<td onclick="sggDeptControl.depts.setCurrent('{DEPT_CD}')" ondblclick="sggDeptControl.depts.getInfo({})">{DEPT_NM}</td>
<td onclick="sggDeptControl.depts.setCurrent('{DEPT_CD}')" ondblclick="sggDeptControl.depts.getInfo({})">{DEPT_TELNO}</td>
</tr>
</template>
<template id="deptNotFound">
<tr class="odd">
<td valign="top" colspan="4" class="dataTables_empty text-center">부서 정보를 찾지 못했습니다.</td>
</tr>
</template>
</table>
<div class="d-flex flex-row p-3 justify-content-between">
<label id="deptPagingInfo" class="dataTables_info" role="status" aria-live="polite"></label>
<ul id="deptPaging" class="pagination pagination-primary">
</ul>
</div>
</div>
</div>
</div>
</div>
<!--/ Page Body -->
<script >
var sggDeptControl = new SggDeptControl();
sggDeptControl.sggs.query = {includeAll: true};
<%--
function searchSggs() {
sggDeptControl.sggs.query = {
by:$("#by").val(),
term:$("#term").val(),
includeAll: true
};
sggDeptControl.sggs.load(1);
}--%>
function removeSggs() {
dialog.alert({
content:"선택한 ${prefixName} 정보를 제거하시겠습니까?",
onOK:() => {
sggDeptControl.sggs.remove();
}
});
}
function removeDepts() {
dialog.alert({
content:"선택한 코드를 삭제하시겠습니까?",
onOK:() => {
sggDeptControl.depts.remove();
}
});
}
function renderSggList() {
let sggList = sggDeptControl.sggs.dataset;
let empty = sggList.empty;
let trs = empty ?
[document.getElementById("sggNotFound").innerHTML] : <%-- from template#sggNotFound --%>
sggList.inStrings(
document.getElementById("sggRow").innerHTML,
(tmpl, item) => tmpl.replace(/{notUsed}/gi, item.getValue("USE_YN") == "N" ? "class=\"not-used\"" : "")
); <%-- from template#sggRow --%>
$("#sggList").html(trs.join());
$("th input[type='checkbox']").prop("checked", false);
}
sggDeptControl.sggs.onDatasetChange = obj => {
renderSggList();
$("#sggPaging").setPaging({
list:sggDeptControl.sggs.dataset,
prefix:sggDeptControl.sggs.prefix,
start:obj.sggStart,
totalSize:obj.sggTotal,
fetchSize:obj.sggFetch,
func:"sggDeptControl.sggs.load({index})"
});
};
sggDeptControl.sggs.onCurrentChange = item => {
$("#btnAddDept").prop("disabled", !item);
if (!item) return;
let key = item.data.SGG_CD;
$("#sggList").setCurrentRow(key);
sggDeptControl.getDepts({includeAll: true});
};
sggDeptControl.sggs.onSelectionChange = selected => {
let sggList = sggDeptControl.sggs.dataset;
let keys = selected.map(e => sggList.getKey(e));
$("#sggList input[type='checkbox']").each(function() {
let checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val()));
});
$("#btnRemoveSggs").prop("disabled", keys.length < 1);
};
function renderDeptList() {
let deptList = sggDeptControl.depts.dataset;
let empty = deptList.empty;
let trs = empty ?
[document.getElementById("deptNotFound").innerHTML] : <%-- from template#sggNotFound --%>
deptList.inStrings(
document.getElementById("deptRow").innerHTML,
(tmpl, item) => tmpl.replace(/{notUsed}/gi, item.getValue("USE_YN") == "N" ? "class=\"not-used\"" : "")
); <%-- from template#sggRow --%>
$("#deptList").html(trs.join());
$("#deptToggler").prop("checked", false);
}
sggDeptControl.depts.onDatasetChange = obj => {
renderDeptList();
$("#deptPaging").setPaging({
list:sggDeptControl.depts.dataset,
prefix:sggDeptControl.depts.prefix,
start:obj ? obj.deptStart : -1,
totalSize:obj ? obj.deptTotal : 0,
fetchSize:obj ? obj.deptFetch : 10,
func:"sggDeptControl.depts.load({index})"
});
};
sggDeptControl.depts.onCurrentChange = item => {
if (!item) return;
let data = item.data;
let key = data.DEPT_CD;
$("#deptList").setCurrentRow(key);
};
sggDeptControl.depts.onSelectionChange = selected => {
let deptList = sggDeptControl.depts.dataset;
let keys = selected.map(e => deptList.getKey(e));
$("#deptList input[type='checkbox']").each(function() {
let checkbox = $(this);
checkbox.prop("checked", keys.includes(checkbox.val()));
});
let sgg = sggDeptControl.sggs.getCurrent();
sgg = sgg ? sgg.USE_YN : "N";
$("#btnAddDept").prop("disabled", "N" == sgg);
$("#btnRemoveDepts").prop("disabled", selected.length < 1);
};
$(function(){
${onload}
sggDeptControl.sggs.setData({
sggList:${sggList},
sggStart:${sggStart},
sggFetch:${sggFetch},
sggTotal:${sggTotal}
});
sggDeptControl.depts.setData({
deptList:${deptList},
deptStart:${deptStart},
deptFetch:${deptFetch},
deptTotal:${deptTotal}
});
<%-- $("#term").onEnterPress(searchSggs); --%>
});
//# sourceURL=sgg-dept.jsp
</script>

@ -0,0 +1,122 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
<form id="sgg-form">
<div class="row g-3">
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end">시군구</label>
<div class="col-sm-9">
<div class="row justify-content-between" style="padding: 0 .75rem;">
<input name="sggID" type="text" required data-map="SGG_CD" maxlength="5" class="form-control" style="width: 28%;" placeholder="시군구 코드" />
<input name="sggName" type="text" required data-map="SGG_NM" maxlength="60" class="form-control" style="width: 70%;" placeholder="시군구 이름" />
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end">기관</label>
<div class="col-sm-9">
<div class="row justify-content-between" style="padding: 0 .75rem;">
<select name="instType" data-map="INST_SE_CD" class="form-control" style="width: 24%;">
<option value="">구분</option>
<option value="01">시청</option>
<option value="02">구청</option>
<option value="03">군청</option>
<option value="04">도청</option>
<option value="05">출장소</option>
<option value="06">사무소</option>
</select>
<input name="instCode" type="text" data-map="INST_CD" maxlength="7" class="form-control" style="width: 25%;" placeholder="기관 코드"/>
<input name="instName" type="text" data-map="INST_NM" maxlength="100" class="form-control" style="width: 48%;" placeholder="기관 이름"/>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end">주소</label>
<div class="col-sm-9">
<div class="row justify-content-between" style="padding: 0 .75rem;">
<input name="instAddress" type="text" data-map="INST_ADDR" maxlength="200" class="form-control" placeholder="주소"/>
<input name="instDetailAddress" type="text" data-map="INST_DADDR" maxlength="200" class="form-control" style="margin: .5rem 0;" placeholder="상세주소"/>
<input name="instZipCode" type="text" data-map="INST_ZIP" maxlength="6" class="form-control" style="width: 32%;" placeholder="기관 우편번호"/>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end">직인 파일</label>
<div class="col-sm-9">
<div class="row justify-content-between" style="padding: 0 .75rem;">
<input name="officialSealFilepath" type="text" data-map="OFFCS_FILE_PATH" maxlength="200" class="form-control" placeholder="직인 파일경로"/>
<input name="officialSealFilename" type="text" data-map="OFFCS_FILE_NM" maxlength="100" class="form-control" style="margin: .5rem 0;" placeholder="직인 파일이름"/>
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end" for="createdBy">등록자</label>
<div class="col-sm-9">
<input type="text" data-map="RGTR" readonly class="form-control" placeholder="등록자"/>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end">등록일자</label>
<div class="col-sm-9">
<input type="text" data-map="REG_DT" readonly class="form-control" placeholder="등록일자"/>
</div>
</div>
</div>
<div class="col-md-12">
<div class="row">
<label class="col-sm-3 col-form-label text-sm-end">사용여부</label>
<div class="col-sm-9" style="padding:.5em .7em;">
<input name="useYN" type="hidden" data-map="USE_YN" />
<span id="sggInUse"></span>
</div>
</div>
</div>
<div class="row mt-4 justify-content-end">
<div class="col-sm-12" style="text-align:right;">
<button onclick="saveSgg();" type="button" class="btn btn-primary">저장</button>
</div>
</div>
</form>
<script type="text/javascript">
var sggFields = new FormFields("#sgg-form");
sggDeptControl.sggs.setInfo = obj => {
let info = obj.data;
sggFields.set(sggDeptControl.sggs, obj);
let create = isEmpty(info.SGG_CD);
$("input[name='sggID']").prop("readonly", !create);
$("#sgg-form input").onEnterPress(saveSgg);
$("#sggInUse").html(info.USE_YN == "Y" ? "사용 중" : "사용하지 않음");
document.querySelector("input[name='" + (create ? "sggID" : "sggName") + "']").focus();
}
sggDeptControl.sggs.onModify = (changed) => {
if (["SGG_NM"].filter(e => changed.includes(e)).length < 1)
return;
renderSggList();
sggDeptControl.sggs.dataset.setState();
}
function saveSgg() {
if (!$("#sgg-form input").validInputs()) return;
dialog.alert({
content:"현재 시군구 정보를 저장하시겠습니까?",
onOK:() => sggDeptControl.sggs.save(sggFields.get())
});
}
//# sourceURL=sgg-info.jsp
</script>

@ -29,6 +29,7 @@
<script src="<c:url value="/webjars/js/base/menu-support.js"/>"></script> <script src="<c:url value="/webjars/js/base/menu-support.js"/>"></script>
<script src="<c:url value="/webjars/js/base/actionGroup.js"/>"></script> <script src="<c:url value="/webjars/js/base/actionGroup.js"/>"></script>
<script src="<c:url value="/webjars/js/base/user.js"/>"></script> <script src="<c:url value="/webjars/js/base/user.js"/>"></script>
<script src="<c:url value="/webjars/js/base/sgg-dept.js"/>"></script>
<script src="<c:url value="/webjars/js/base/authority.js"/>"></script> <script src="<c:url value="/webjars/js/base/authority.js"/>"></script>

Loading…
Cancel
Save