다이얼로그 관련 소스정리
parent
8f37ef29db
commit
981362504b
@ -1,64 +1,73 @@
|
|||||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||||
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
|
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
|
||||||
<form id="frmEdit--${pageName}">
|
<span data-doctx="${pageName}">
|
||||||
<div class="d-flex flex-row justify-content-evenly">
|
<form name="frmEdit">
|
||||||
<div class="card" style="width:1000px;min-height:200px;">
|
<div class="d-flex flex-row justify-content-evenly">
|
||||||
<div class="row">
|
<div class="card" style="width:1000px;min-height:200px;">
|
||||||
<div class="col-4">
|
<div class="row">
|
||||||
<label class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">업무</label>
|
<div class="col-4">
|
||||||
<select id="taskSeCd--${pageName}" name="taskSeCd" class="form-select">
|
<label is="name-label" for="taskSeCd"
|
||||||
<c:forEach items="${taskSeCdList}" var="item">
|
class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">업무</label>
|
||||||
<option value="${item.CODE}">${item.CODE_VAL}</option>
|
<select is="id-select" name="taskSeCd" class="form-select">
|
||||||
</c:forEach>
|
<c:forEach items="${taskSeCdList}" var="item">
|
||||||
</select>
|
<option value="${item.CODE}">${item.CODE_VAL}</option>
|
||||||
|
</c:forEach>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<label is="name-label" for="srcSgg"
|
||||||
|
class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">소스 시군구</label>
|
||||||
|
<select is="id-select" name="srcSgg" class="form-select">
|
||||||
|
<c:forEach items="${sggList}" var="item">
|
||||||
|
<option value="${item.SGG_CD}">${item.SGG_NM}</option>
|
||||||
|
</c:forEach>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<label is="name-label" for="trgtSgg"
|
||||||
|
class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">타겟 시군구</label>
|
||||||
|
<select is="id-select" name="trgtSgg" class="form-select">
|
||||||
|
<c:forEach items="${sggList}" var="item">
|
||||||
|
<option value="${item.SGG_CD}">${item.SGG_NM}</option>
|
||||||
|
</c:forEach>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-12">
|
||||||
|
<span class="float-end p-4">
|
||||||
|
<button type="button" name="btnCopyStng" class="btn btn-primary">업무,위반 설정 복사</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-4">
|
|
||||||
<label class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">소스 시군구</label>
|
|
||||||
<select id="srcSgg--${pageName}" name="srcSgg" class="form-select">
|
|
||||||
<c:forEach items="${sggList}" var="item">
|
|
||||||
<option value="${item.SGG_CD}">${item.SGG_NM}</option>
|
|
||||||
</c:forEach>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-4">
|
|
||||||
<label class="w-px-130 bg-lighter pe-2 col-form-label text-sm-end">타겟 시군구</label>
|
|
||||||
<select id="trgtSgg--${pageName}" name="trgtSgg" class="form-select">
|
|
||||||
<c:forEach items="${sggList}" var="item">
|
|
||||||
<option value="${item.SGG_CD}">${item.SGG_NM}</option>
|
|
||||||
</c:forEach>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="col-12">
|
|
||||||
<span class="float-end p-4">
|
|
||||||
<button type="button" id="btnCopyStng--${pageName}" class="btn btn-primary">업무,위반 설정 복사</button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</form>
|
</span>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$("#btnCopyStng--${pageName}").on("click", function(){
|
pageObject['${pageName}'] = newDoctxFinder("${pageName}");
|
||||||
|
$(document).ready(function() {
|
||||||
|
let $P = pageObject['${pageName}'];
|
||||||
|
$P.$find("btnCopyStng").on("click", function(){
|
||||||
|
|
||||||
if($("#srcSgg--${pageName}").val() == $("#trgtSgg--${pageName}").val()){
|
if($P.$find("srcSgg").val() == $P.$find("trgtSgg").val()){
|
||||||
alert("동일한 시군구 선택 불가");
|
alert("동일한 시군구 선택 불가");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ajax.get({
|
ajax.get({
|
||||||
url : wctx.url("admin/copySggStng.do"),
|
url : wctx.url("admin/copySggStng.do"),
|
||||||
data : {
|
data : {
|
||||||
taskSeCd : $("#taskSeCd--${pageName}").val(),
|
taskSeCd : $P.$find("taskSeCd").val(),
|
||||||
srcSgg : $("#srcSgg--${pageName}").val(),
|
srcSgg : $P.$find("srcSgg").val(),
|
||||||
trgtSgg : $("#trgtSgg--${pageName}").val()
|
trgtSgg : $P.$find("trgtSgg").val()
|
||||||
},
|
},
|
||||||
success : (resp) => {
|
success : (resp) => {
|
||||||
if(resp.saved){
|
if(resp.saved){
|
||||||
alert('완료');
|
alert('완료');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
@ -1,192 +1,188 @@
|
|||||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
|
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" session="false"%>
|
||||||
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
|
<%@ include file="/WEB-INF/jsp/include/taglib.jsp"%>
|
||||||
<form id="frmEdit--${pageName}">
|
<span data-doctx="${pageName}">
|
||||||
<div class="d-flex flex-row justify-content-evenly">
|
<form name="frmEdit">
|
||||||
<div class="card" style="width:500px;">
|
<div class="d-flex flex-row justify-content-evenly">
|
||||||
<h3>시군구 백업</h3>
|
<div class="card" style="width:500px;">
|
||||||
|
<h3>시군구 백업</h3>
|
||||||
<div class="card-datatable text-nowrap">
|
|
||||||
<div id="backupSgg-DataTables_Table_0_wrapper--${pageName}" class="dataTables_wrapper dt-bootstrap5 no-footer">
|
<div class="card-datatable text-nowrap">
|
||||||
<div id="backupSgg-table-responsive--${pageName}" class="table-responsive"
|
<div class="dataTables_wrapper dt-bootstrap5 no-footer">
|
||||||
style="overflow-x: scroll;height:500px;overflow-y: scroll;">
|
<div class="table-responsive"
|
||||||
<table id="backupSgg-DataTables_Table_0--${pageName}"
|
style="overflow-x: scroll;height:500px;overflow-y: scroll;">
|
||||||
class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer">
|
<table class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer">
|
||||||
<thead class="sticky-thead">
|
<thead class="sticky-thead">
|
||||||
<tr data-key="{SGG_CD}">
|
<tr data-key="{SGG_CD}">
|
||||||
<th style="width: 50px;"></th>
|
<th style="width: 50px;"></th>
|
||||||
<th style="width: 140px;" >시군구코드</th>
|
<th style="width: 140px;" >시군구코드</th>
|
||||||
<th style="width: 300px;" >시군구명</th>
|
<th style="width: 300px;" >시군구명</th>
|
||||||
<th class="cmn dummy-th"></th>
|
<th class="cmn dummy-th"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="backupSggTbody--${pageName}">
|
<tbody name="backupSggTbody">
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card" style="width:100px;">
|
<div class="card" style="width:100px;">
|
||||||
<div style="display: flex;flex-direction: column;justify-content: space-evenly;height: 100%;">
|
<div style="display: flex;flex-direction: column;justify-content: space-evenly;height: 100%;">
|
||||||
<button type="button" id="btnAdd--${pageName}">추가 >></button>
|
<button type="button" name="btnAdd">추가 >></button>
|
||||||
<button type="button" id="btnDel--${pageName}"><< 삭제</button>
|
<button type="button" name="btnDel"><< 삭제</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card" style="width:500px;">
|
<div class="card" style="width:500px;">
|
||||||
<h3>시군구</h3>
|
<h3>시군구</h3>
|
||||||
|
|
||||||
<div class="card-datatable text-nowrap">
|
<div class="card-datatable text-nowrap">
|
||||||
<div id="originalSgg-DataTables_Table_0_wrapper--${pageName}" class="dataTables_wrapper dt-bootstrap5 no-footer">
|
<div class="dataTables_wrapper dt-bootstrap5 no-footer">
|
||||||
<div id="originalSgg-table-responsive--${pageName}" class="table-responsive"
|
<div class="table-responsive"
|
||||||
style="overflow-x: scroll;height:500px;overflow-y: scroll;">
|
style="overflow-x: scroll;height:500px;overflow-y: scroll;">
|
||||||
<table id="originalSgg-DataTables_Table_0--${pageName}"
|
<table class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer">
|
||||||
class="table-layout-fixed datatables-ajax table table-bordered dataTable no-footer">
|
<thead class="sticky-thead">
|
||||||
<thead class="sticky-thead">
|
<tr data-key="{SGG_CD}">
|
||||||
<tr data-key="{SGG_CD}">
|
<th style="width: 50px;"></th>
|
||||||
<th style="width: 50px;"></th>
|
<th style="width: 140px;" >시군구코드</th>
|
||||||
<th style="width: 140px;" >시군구코드</th>
|
<th style="width: 300px;" >시군구명</th>
|
||||||
<th style="width: 300px;" >시군구명</th>
|
<th class="cmn dummy-th"></th>
|
||||||
<th class="cmn dummy-th"></th>
|
</tr>
|
||||||
</tr>
|
</thead>
|
||||||
</thead>
|
<tbody name="originalSggTbody">
|
||||||
<tbody id="originalSggTbody--${pageName}">
|
</tbody>
|
||||||
</tbody>
|
|
||||||
|
</table>
|
||||||
</table>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
</div>
|
|
||||||
|
<template name="sggRow">
|
||||||
|
<tr data-key="{SGG_CD}">
|
||||||
</form>
|
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center cmn">
|
||||||
|
<input type="checkbox" value="{SGG_CD}" />
|
||||||
|
</td>
|
||||||
<template id="sggRow--${pageName}">
|
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center cmn">{SGG_CD}</td>
|
||||||
<tr data-key="{SGG_CD}">
|
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center cmn">{SGG_NM}</td>
|
||||||
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center cmn">
|
<td class="dummy-td cmn"></td>
|
||||||
<input type="checkbox" value="{SGG_CD}" />
|
</tr>
|
||||||
</td>
|
</template>
|
||||||
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center cmn">{SGG_CD}</td>
|
<template name="sggNotFound">
|
||||||
<td onclick="{onclick}" ondblclick="{ondblclick}" class="text-center cmn">{SGG_NM}</td>
|
<tr>
|
||||||
<td class="dummy-td cmn"></td>
|
<td valign="top" colspan="14" class="dataTables_empty text-center">
|
||||||
</tr>
|
정보를 찾지 못했습니다.
|
||||||
</template>
|
</td>
|
||||||
<template id="sggNotFound--${pageName}">
|
</tr>
|
||||||
<tr>
|
</template>
|
||||||
<td valign="top" colspan="14" class="dataTables_empty text-center">
|
</span>
|
||||||
정보를 찾지 못했습니다.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
pageObject['${pageName}'] = {};
|
pageObject['${pageName}'] = newDoctxFinder("${pageName}");
|
||||||
|
|
||||||
pageObject['${pageName}'].originalDataset = new Dataset({
|
$(document).ready(function(){
|
||||||
keymapper : info => info ? info.SGG_CD : ""
|
let $P = pageObject['${pageName}'];
|
||||||
});
|
|
||||||
pageObject['${pageName}'].backupDataset = new Dataset({
|
|
||||||
keymapper : info => info ? info.SGG_CD : ""
|
|
||||||
});
|
|
||||||
|
|
||||||
|
$P.originalDataset = new Dataset({
|
||||||
|
keymapper : info => info ? info.SGG_CD : ""
|
||||||
|
});
|
||||||
|
$P.backupDataset = new Dataset({
|
||||||
|
keymapper : info => info ? info.SGG_CD : ""
|
||||||
|
});
|
||||||
|
|
||||||
function fnRenderBackupAndOriginal(list,tbodyId,dataset){
|
$P.fnRenderBackupAndOriginal = (list,tbodyName, dataset) => {
|
||||||
$("#"+tbodyId).html("");
|
$P.$find(tbodyName).html("");
|
||||||
|
|
||||||
if(list != null && list.length > 0){
|
|
||||||
dataset.setData(list);
|
|
||||||
} else {
|
|
||||||
dataset.setData([]);
|
|
||||||
}
|
|
||||||
|
|
||||||
var empty = dataset.empty;
|
|
||||||
var notFound = [document.getElementById("sggNotFound--${pageName}").innerHTML];
|
|
||||||
var found = document.getElementById("sggRow--${pageName}").innerHTML;
|
|
||||||
var replacer = (str, dataItem) => str.replace(/{onclick}/gi, "");
|
|
||||||
var trs = empty ? notFound : dataset.inStrings(found, replacer);
|
|
||||||
$("#"+tbodyId).html(trs.join());
|
|
||||||
}
|
|
||||||
|
|
||||||
function getBackupAndOriginalDataList(){
|
|
||||||
ajax.get({
|
|
||||||
url : wctx.url("/admin/sggBackup/list.do"),
|
|
||||||
data : {
|
|
||||||
originalTable : "TB_SGG",
|
|
||||||
backupTable : "TB_SGG_ORG",
|
|
||||||
pkName : "SGG_CD"
|
|
||||||
},
|
|
||||||
success : (resp) => {
|
|
||||||
|
|
||||||
fnRenderBackupAndOriginal(resp.originalDataList,"originalSggTbody--${pageName}", pageObject['${pageName}'].originalDataset);
|
|
||||||
fnRenderBackupAndOriginal(resp.backupDataList,"backupSggTbody--${pageName}", pageObject['${pageName}'].backupDataset);
|
|
||||||
|
|
||||||
|
if(list != null && list.length > 0){
|
||||||
|
dataset.setData(list);
|
||||||
|
} else {
|
||||||
|
dataset.setData([]);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#btnAdd--${pageName}").on("click", function(){
|
var empty = dataset.empty;
|
||||||
var checked = $("#backupSggTbody--${pageName}").find("input[type='checkbox']:checked");
|
var notFound = [$P.find("sggNotFound").innerHTML];
|
||||||
if(checked.length < 1){
|
var found = $P.find("sggRow").innerHTML;
|
||||||
return;
|
var replacer = (str, dataItem) => str.replace(/{onclick}/gi, "");
|
||||||
}
|
var trs = empty ? notFound : dataset.inStrings(found, replacer);
|
||||||
|
$P.$find(tbodyName).html(trs.join());
|
||||||
|
};
|
||||||
|
|
||||||
|
$P.getBackupAndOriginalDataList = () => {
|
||||||
|
ajax.get({
|
||||||
|
url : wctx.url("/admin/sggBackup/list.do"),
|
||||||
|
data : {
|
||||||
|
originalTable : "TB_SGG",
|
||||||
|
backupTable : "TB_SGG_ORG",
|
||||||
|
pkName : "SGG_CD"
|
||||||
|
},
|
||||||
|
success : (resp) => {
|
||||||
|
|
||||||
|
$P.fnRenderBackupAndOriginal(resp.originalDataList,"originalSggTbody", $P.originalDataset);
|
||||||
|
$P.fnRenderBackupAndOriginal(resp.backupDataList,"backupSggTbody", $P.backupDataset);
|
||||||
|
|
||||||
var arr = [];
|
|
||||||
checked.each(function(){
|
|
||||||
arr.push(this.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
ajax.post({
|
|
||||||
url : wctx.url("/admin/sggBackup/activate.do"),
|
|
||||||
data : {
|
|
||||||
originalTable : "TB_SGG",
|
|
||||||
backupTable : "TB_SGG_ORG",
|
|
||||||
pkName : "SGG_CD",
|
|
||||||
pks : arr.join(",")
|
|
||||||
},
|
|
||||||
success : (resp) => {
|
|
||||||
if(resp.saved){
|
|
||||||
getBackupAndOriginalDataList();
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
};
|
||||||
|
|
||||||
});
|
$P.$find("btnAdd").on("click", function(){
|
||||||
$("#btnDel--${pageName}").on("click", function(){
|
var checked = $P.$find("backupSggTbody").find("input[type='checkbox']:checked");
|
||||||
var checked = $("#originalSggTbody--${pageName}").find("input[type='checkbox']:checked");
|
if(checked.length < 1){
|
||||||
if(checked.length < 1){
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
var arr = [];
|
|
||||||
checked.each(function(){
|
|
||||||
arr.push(this.value);
|
|
||||||
});
|
|
||||||
|
|
||||||
ajax.post({
|
var arr = [];
|
||||||
url : wctx.url("/admin/sggBackup/deactivate.do"),
|
checked.each(function(){
|
||||||
data : {
|
arr.push(this.value);
|
||||||
originalTable : "TB_SGG",
|
});
|
||||||
backupTable : "TB_SGG_ORG",
|
|
||||||
pkName : "SGG_CD",
|
ajax.post({
|
||||||
pks : arr.join(",")
|
url : wctx.url("/admin/sggBackup/activate.do"),
|
||||||
},
|
data : {
|
||||||
success : (resp) => {
|
originalTable : "TB_SGG",
|
||||||
if(resp.saved){
|
backupTable : "TB_SGG_ORG",
|
||||||
getBackupAndOriginalDataList();
|
pkName : "SGG_CD",
|
||||||
|
pks : arr.join(",")
|
||||||
|
},
|
||||||
|
success : (resp) => {
|
||||||
|
if(resp.saved){
|
||||||
|
$P.getBackupAndOriginalDataList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
$P.$find("btnDel").on("click", function(){
|
||||||
|
var checked = $P.$find("originalSggTbody").find("input[type='checkbox']:checked");
|
||||||
|
if(checked.length < 1){
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
var arr = [];
|
||||||
|
checked.each(function(){
|
||||||
|
arr.push(this.value);
|
||||||
|
});
|
||||||
|
|
||||||
|
ajax.post({
|
||||||
|
url : wctx.url("/admin/sggBackup/deactivate.do"),
|
||||||
|
data : {
|
||||||
|
originalTable : "TB_SGG",
|
||||||
|
backupTable : "TB_SGG_ORG",
|
||||||
|
pkName : "SGG_CD",
|
||||||
|
pks : arr.join(",")
|
||||||
|
},
|
||||||
|
success : (resp) => {
|
||||||
|
if(resp.saved){
|
||||||
|
$P.getBackupAndOriginalDataList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
$P.getBackupAndOriginalDataList();
|
||||||
getBackupAndOriginalDataList();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue