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