Merge branch 'dev' into daily
This commit is contained in:
@@ -349,8 +349,14 @@ table tbody th {
|
||||
padding: 0.8rem;
|
||||
background-color: #f1f3f5;
|
||||
}
|
||||
.tree-wrap .open > .tit::before {
|
||||
background-image: url("../../images/common/ico_tree_open.svg");
|
||||
.tree-wrap li:not(.folding) > ul {
|
||||
display: none;
|
||||
}
|
||||
.tree-wrap .folding > ul {
|
||||
display: block !important;
|
||||
}
|
||||
.tree-wrap .folding > .tit::before {
|
||||
background-image: url("../../images/common/ico_tree_close.svg");
|
||||
}
|
||||
.tree-wrap .tit {
|
||||
margin-left: 2.4rem;
|
||||
@@ -362,7 +368,7 @@ table tbody th {
|
||||
content: "";
|
||||
width: 2.4rem;
|
||||
height: 2.4rem;
|
||||
background-image: url("../../images/common/ico_tree_close.svg");
|
||||
background-image: url("../../images/common/ico_tree_open.svg");
|
||||
background-size: 1.8rem;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
@@ -386,22 +392,22 @@ table tbody th {
|
||||
font-weight: 600;
|
||||
color: #262626;
|
||||
}
|
||||
.tree-wrap .list-twodepth {
|
||||
.tree-wrap .list-depth {
|
||||
margin-top: 0.4rem;
|
||||
padding-left: 2.4rem;
|
||||
}
|
||||
.tree-wrap .list-twodepth li + li {
|
||||
.tree-wrap .list-depth li + li {
|
||||
margin-top: 0.4rem;
|
||||
}
|
||||
.tree-wrap .list-threedepth {
|
||||
.tree-wrap .list-detail {
|
||||
margin-top: 0.4rem;
|
||||
padding-left: 2.4rem;
|
||||
}
|
||||
.tree-wrap .list-threedepth li {
|
||||
.tree-wrap .list-detail li {
|
||||
position: relative;
|
||||
padding-left: 2rem;
|
||||
}
|
||||
.tree-wrap .list-threedepth li::before {
|
||||
.tree-wrap .list-detail li::before {
|
||||
position: absolute;
|
||||
display: block;
|
||||
content: "";
|
||||
@@ -411,16 +417,16 @@ table tbody th {
|
||||
top: 1rem;
|
||||
left: 0.6rem;
|
||||
}
|
||||
.tree-wrap .list-threedepth li button {
|
||||
.tree-wrap .list-detail li button {
|
||||
font-weight: 400;
|
||||
}
|
||||
.tree-wrap .list-threedepth li button:hover {
|
||||
.tree-wrap .list-detail li button:hover {
|
||||
background-color: #f1f5fe;
|
||||
}
|
||||
.tree-wrap .list-threedepth li button.selected {
|
||||
.tree-wrap .list-detail li button.selected {
|
||||
background-color: #f1f5fe;
|
||||
}
|
||||
.tree-wrap .list-threedepth li + li {
|
||||
.tree-wrap .list-detail li + li {
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -34,9 +34,9 @@
|
||||
<link rel="stylesheet" th:href="@{/static/library/jquery-ui/jquery-ui.min.css}"/>
|
||||
<script th:src="@{/static/library/jquery-ui/jquery-ui.min.js}"></script>
|
||||
|
||||
<link rel="stylesheet" th:href="@{/static/library/bootstrap-treeview/bootstrap-treeview.min.css}">
|
||||
<script th:src="@{/static/library/bootstrap-treeview/bootstrap-treeview.min.js}"
|
||||
type="text/javascript"></script>
|
||||
<!-- <link rel="stylesheet" th:href="@{/static/library/bootstrap-treeview/bootstrap-treeview.min.css}">-->
|
||||
<!-- <script th:src="@{/static/library/bootstrap-treeview/bootstrap-treeview.min.js}"
|
||||
type="text/javascript"></script>-->
|
||||
|
||||
<link rel="shortcut icon" type="image/x-icon" th:href="@{/favicon.ico}" />
|
||||
<link rel="stylesheet" th:href="@{/static/assets/styles/style.css}" />
|
||||
|
||||
@@ -3,109 +3,127 @@
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<section layout:fragment="content">
|
||||
<div class="row mb-1">
|
||||
<div class="col ps-0 pe-0">
|
||||
<a href="javascript:expand();" class="link-secondary">Expand</a>
|
||||
<a href="javascript:collapse();" class="link-secondary">Collapse</a>
|
||||
|
||||
<button type="button" class="btn btn-sm btn-secondary float-end ms-1" onclick="searchNode();">
|
||||
<i
|
||||
class="bi bi-search"></i></button>
|
||||
<input class="form-control form-control-sm w-25 inline-block float-end" id="searchNode"
|
||||
type="text"
|
||||
placeholder="노드 검색">
|
||||
<div class="searching-group">
|
||||
<div class="component-input">
|
||||
<div class="d-flex">
|
||||
<div class="input-field">
|
||||
<input type="text" id="searchNode" placeholder="노드 검색">
|
||||
</div>
|
||||
<button type="button" class="btn" onclick="searchNode();">
|
||||
<span class="btn-txt">검색</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn arr-up" onclick="move('up');">
|
||||
<span class="hide-txt">위로</span>
|
||||
</button>
|
||||
<button type="button" class="btn arr-down" onclick="move('down');">
|
||||
<span class="hide-txt">아래로</span>
|
||||
</button>
|
||||
<button type="button" class="btn add" onclick="addChildNode();">
|
||||
<span class="btn-txt">하위 노드 추가 <i class="ico-plus" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="col"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col fw-bold border rounded-3 overflow-auto lh-1" id="tree"
|
||||
style="height:450px;"></div>
|
||||
<div class="col fw-bold ms-4" style="height:450px;">
|
||||
<div class="row mb-1">
|
||||
<a href="javascript:expand();" class="link-secondary">Expand</a>
|
||||
<a href="javascript:collapse();" class="link-secondary">Collapse</a>
|
||||
</div>
|
||||
|
||||
<div class="section-flex-wrap">
|
||||
<section>
|
||||
<div class="tree-wrap" id="tree">
|
||||
<!-- JavaScript에서 동적으로 트리 렌더링 -->
|
||||
</div>
|
||||
</section>
|
||||
<section>
|
||||
<form name="formDto" th:action="@{/settings/uri/update}" method="post">
|
||||
<input type="hidden" name="parentId" value="">
|
||||
<input type="hidden" name="orderNo" value="">
|
||||
<input type="hidden" name="mode" value="create"/>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="id">코드ID *</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="id" name="id" class="form-control" placeholder="코드 ID 를 입력하세요"/>
|
||||
<div class="invalid-feedback fw-bold field-id"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="codeText">Text *</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="codeText" name="codeText" class="form-control"
|
||||
placeholder="코드명을 입력하세요"/>
|
||||
<div class="invalid-feedback fw-bold field-codeText"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="codeValue">Value</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="codeValue" name="codeValue" class="form-control"
|
||||
placeholder="코드값을 입력하세요"/>
|
||||
<div class="invalid-feedback fw-bold field-codeValue"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="codeType">코드 타입</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="codeType" name="codeType" class="form-control"
|
||||
placeholder="코드타입을 입력하세요"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="msgCode">메세지 코드</label>
|
||||
<div class="col-sm-9">
|
||||
<input type="text" id="msgCode" name="msgCode" class="form-control"
|
||||
placeholder="메세지 코드를 입력하세요"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row mb-3">
|
||||
<label class="col-sm-3 col-form-label" for="inUse">사용여부</label>
|
||||
<div class="col-sm-9">
|
||||
<select class="form-select" id="inUse" name="inUse">
|
||||
<option value="true">사용</option>
|
||||
<option value="false">미사용</option>
|
||||
</select>
|
||||
<table class="type-form">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><label for="id">코드ID *</label></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="id" name="id" placeholder="코드 ID 를 입력하세요">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> <label for="codeText">Text *</label></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="codeText" name="codeText" placeholder="코드명을 입력하세요">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> <label for="codeValue">Value *</label></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="codeValue" name="codeValue" placeholder="코드값을 입력하세요">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> <label for="codeType">코드 타입</label></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="codeType" name="codeType" placeholder="코드타입을 입력하세요">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> <label for="msgCode">추가 조건</label></th>
|
||||
<td>
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="msgCode" name="msgCode" placeholder="추가 조건을 입력하세요">
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> <label for="inUse">사용여부</label></th>
|
||||
<td>
|
||||
<div class="component-select">
|
||||
<select class="form-select" id="inUse" name="inUse">
|
||||
<option value="true">사용</option>
|
||||
<option value="false">미사용</option>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn btn-secondary" onclick="goRemove();">
|
||||
<span class="btn-txt">삭제</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" onclick="goSave();">
|
||||
<span class="btn-txt">저장</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div class="mb-2 row">
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('up');">
|
||||
<i class="bi bi-arrow-up-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary mt-1" onclick="move('down');">
|
||||
<i class="bi bi-arrow-down-circle-fill"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-secondary mt-1" onclick="addChildNode();">하위 노드
|
||||
추가
|
||||
</button>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button type="button" class="btn btn-primary" onclick="goSave();">저장</button>
|
||||
<button type="button" class="btn btn-danger" onclick="goRemove();">삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script th:inline="javascript">
|
||||
|
||||
// 노드가 보여질 level 전연벽수 기본값 6
|
||||
// 노드가 보여질 level 전역 변수 기본값 6
|
||||
let globalLevels = 6;
|
||||
|
||||
$(document).ready(function () {
|
||||
@@ -119,6 +137,9 @@
|
||||
cache: false,
|
||||
success: function (data) {
|
||||
renderTree(data, currentId);
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error('트리 로드 실패:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -126,75 +147,176 @@
|
||||
function convertToTreeValue(data) {
|
||||
data.text = data.codeText;
|
||||
data.value = data.codeValue;
|
||||
$(data.nodes).each(function (idx, el) {
|
||||
convertToTreeValue(el);
|
||||
});
|
||||
if (data.nodes) {
|
||||
data.nodes.forEach(node => convertToTreeValue(node));
|
||||
}
|
||||
}
|
||||
|
||||
function renderTree(nodes, currentId) {
|
||||
const tree = $('#tree');
|
||||
const treeWrap = document.querySelector('#tree');
|
||||
let json = nodes;
|
||||
convertToTreeValue(json);
|
||||
|
||||
tree.treeview({
|
||||
data: [json],
|
||||
color: "#428bca",
|
||||
expandIcon: 'bi bi-plus-square-fill',
|
||||
collapseIcon: 'bi bi-dash-square-fill',
|
||||
emptyIcon: 'bi bi-dot',
|
||||
// nodeIcon: 'bi bi-dot',
|
||||
showBorder: false,
|
||||
enableLinks: true,
|
||||
levels: globalLevels,
|
||||
});
|
||||
// 기존 트리 제거
|
||||
treeWrap.innerHTML = '';
|
||||
|
||||
tree.on('rendered', function () {
|
||||
if (currentId) {
|
||||
setTimeout(function () {
|
||||
const currentNode = tree.treeview('findNodes', ['^' + currentId + '$', 'id']);
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
currentNode[0].$el[0].scrollIntoView();
|
||||
}, 0);
|
||||
// 트리 렌더링
|
||||
const ul = document.createElement('ul');
|
||||
ul.className = 'list-onedepth';
|
||||
treeWrap.appendChild(ul);
|
||||
|
||||
function renderNode(node, parentUl, depth) {
|
||||
const li = document.createElement('li');
|
||||
// 1depth와 2depth는 기본적으로 확장, 3depth는 축소
|
||||
li.className = depth <= 2 ? 'open' : '';
|
||||
|
||||
const button = document.createElement('button');
|
||||
button.type = 'button';
|
||||
button.className = depth === 1 ? 'tit onedepth' : depth === 2 ? 'tit twodepth' : '';
|
||||
button.setAttribute('data-id', node.id || '');
|
||||
button.setAttribute('data-parent-id', node.parentId || '');
|
||||
button.setAttribute('data-order-no', node.orderNo || '0');
|
||||
|
||||
const textSpan = document.createElement('span');
|
||||
textSpan.textContent = node.text || node.codeText;
|
||||
button.appendChild(textSpan);
|
||||
|
||||
button.onclick = function (e) {
|
||||
// 하위 노드가 있고, depth가 2 이하인 경우 토글 동작
|
||||
if (node.nodes && node.nodes.length > 0 && depth <= 2) {
|
||||
toggleNode(this);
|
||||
}
|
||||
// 항상 노드 선택 동작 수행
|
||||
selectNode(this);
|
||||
};
|
||||
li.appendChild(button);
|
||||
|
||||
if (node.nodes && node.nodes.length > 0) {
|
||||
const childUl = document.createElement('ul');
|
||||
childUl.className = depth === 1 ? 'list-twodepth' : 'list-threedepth';
|
||||
li.appendChild(childUl);
|
||||
node.nodes.forEach(child => renderNode(child, childUl, depth + 1));
|
||||
}
|
||||
});
|
||||
|
||||
tree.off('nodeSelected').on('nodeSelected', function (event, data) {
|
||||
const f = document.formDto;
|
||||
const currentNode = tree.treeview('getSelected')[0];
|
||||
const parentNode = tree.treeview('getParents', currentNode)[0];
|
||||
parentUl.appendChild(li);
|
||||
}
|
||||
|
||||
if (data.id === 'code.new.temp') {
|
||||
// 신규 노드일 경우 id는 'code.new.temp'
|
||||
cleanFormFields();
|
||||
f.mode.value = 'create';
|
||||
json.nodes.forEach(node => renderNode(node, ul, 1));
|
||||
|
||||
f.codeText.value = currentNode.text;
|
||||
f.parentId.value = parentNode.id;
|
||||
f.id.value = f.parentId.value + '.';
|
||||
f.id.focus();
|
||||
// 현재 노드 선택 및 스크롤 이동
|
||||
if (currentId) {
|
||||
setTimeout(() => {
|
||||
const currentNode = treeWrap.querySelector(`button[data-id="${currentId}"]`);
|
||||
if (currentNode) {
|
||||
// 기존 선택 해제
|
||||
const previouslySelected = treeWrap.querySelector('button.selected');
|
||||
if (previouslySelected) {
|
||||
previouslySelected.classList.remove('selected');
|
||||
}
|
||||
// 새 노드 선택
|
||||
currentNode.classList.add('selected');
|
||||
currentNode.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
// 상위 노드 확장
|
||||
let parent = currentNode.parentElement;
|
||||
while (parent && parent.tagName === 'LI') {
|
||||
parent.classList.add('open');
|
||||
parent = parent.parentElement.parentElement;
|
||||
}
|
||||
selectNode(currentNode);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
} else {
|
||||
f.mode.value = 'update';
|
||||
}
|
||||
getInfo(data);
|
||||
});
|
||||
function toggleNode(button) {
|
||||
const li = button.parentElement;
|
||||
li.classList.toggle('open');
|
||||
}
|
||||
|
||||
function selectNode(button) {
|
||||
const treeWrap = document.querySelector('#tree');
|
||||
const f = document.formDto;
|
||||
|
||||
// 기존 선택 해제
|
||||
const previouslySelected = treeWrap.querySelector('button.selected');
|
||||
if (previouslySelected) {
|
||||
previouslySelected.classList.remove('selected');
|
||||
}
|
||||
|
||||
// 새 노드 선택
|
||||
button.classList.add('selected');
|
||||
|
||||
// 노드 데이터 추출
|
||||
const data = {
|
||||
id: button.getAttribute('data-id'),
|
||||
text: button.querySelector('span:not(.toggle-icon)').textContent,
|
||||
parentId: button.getAttribute('data-parent-id'),
|
||||
orderNo: parseInt(button.getAttribute('data-order-no')) || 0
|
||||
};
|
||||
|
||||
// 신규 노드 처리
|
||||
if (data.id === 'code.new.temp') {
|
||||
cleanFormFields();
|
||||
f.mode.value = 'create';
|
||||
f.codeText.value = data.text;
|
||||
f.parentId.value = data.parentId;
|
||||
f.id.value = data.parentId ? data.parentId + '.' : '';
|
||||
f.id.focus();
|
||||
return;
|
||||
} else {
|
||||
f.mode.value = 'update';
|
||||
}
|
||||
|
||||
getInfo(data);
|
||||
}
|
||||
|
||||
function addChildNode() {
|
||||
const tree = $('#tree');
|
||||
const parentNode = tree.treeview('getSelected');
|
||||
tree.treeview('addNode', [{text: 'NEW NODE - 저장 필요', id: 'code.new.temp'}, parentNode]);
|
||||
const currentNode = tree.treeview('findNodes', ['^code.new.temp$', 'id']);
|
||||
const treeWrap = document.querySelector('#tree');
|
||||
const selectedButton = treeWrap.querySelector('button.selected');
|
||||
if (!selectedButton) {
|
||||
alert('하위 노드를 추가할 부모 노드를 선택하세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
tree.treeview('selectNode', [currentNode, {silent: false}]);
|
||||
}, 0);
|
||||
const parentId = selectedButton.getAttribute('data-id');
|
||||
const parentLi = selectedButton.parentElement;
|
||||
let ul = parentLi.querySelector('.list-twodepth') || parentLi.querySelector('.list-threedepth');
|
||||
const depth = parentLi.parentElement.classList.contains('list-onedepth') ? 2 : 3;
|
||||
|
||||
if (!ul) {
|
||||
ul = document.createElement('ul');
|
||||
ul.className = depth === 2 ? 'list-twodepth' : 'list-threedepth';
|
||||
parentLi.appendChild(ul);
|
||||
}
|
||||
|
||||
const li = document.createElement('li');
|
||||
const button = document.createElement('button');
|
||||
button.type = 'button';
|
||||
button.className = depth === 2 ? 'tit twodepth' : '';
|
||||
button.classList.add('no-toggle');
|
||||
button.setAttribute('data-id', 'code.new.temp');
|
||||
button.setAttribute('data-parent-id', parentId);
|
||||
button.setAttribute('data-order-no', '0');
|
||||
|
||||
const textSpan = document.createElement('span');
|
||||
textSpan.textContent = 'NEW NODE - 저장 필요';
|
||||
button.appendChild(textSpan);
|
||||
|
||||
button.onclick = function () {
|
||||
selectNode(this);
|
||||
if (depth <= 2 && this.classList.contains('toggle-icon')) {
|
||||
toggleNode(this);
|
||||
}
|
||||
};
|
||||
li.appendChild(button);
|
||||
ul.appendChild(li);
|
||||
|
||||
parentLi.classList.add('open');
|
||||
selectedButton.classList.replace('no-toggle', 'toggle-icon');
|
||||
selectNode(button);
|
||||
}
|
||||
|
||||
function refreshTree(currentId) {
|
||||
$('#tree').treeview('remove');
|
||||
cleanFormFields();
|
||||
loadTree(currentId);
|
||||
}
|
||||
|
||||
@@ -204,36 +326,33 @@
|
||||
}
|
||||
|
||||
const f = document.formDto;
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: '/api/uicode/' + data.id,
|
||||
cache: false,
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (response) {
|
||||
alert(response.responseJSON.message);
|
||||
},
|
||||
// success
|
||||
200: function (data) {
|
||||
f.id.value = data.id;
|
||||
f.codeText.value = data.codeText;
|
||||
f.codeValue.value = data.codeValue;
|
||||
f.codeType.value = data.codeType;
|
||||
f.msgCode.value = data.msgCode;
|
||||
f.orderNo.value = data.orderNo;
|
||||
f.parentId.value = data.parentId;
|
||||
f.inUse.value = data.inUse;
|
||||
f.codeValue.value = data.codeValue || '';
|
||||
f.codeType.value = data.codeType || '';
|
||||
f.msgCode.value = data.msgCode || '';
|
||||
f.orderNo.value = data.orderNo || '';
|
||||
f.parentId.value = data.parentId || '';
|
||||
f.inUse.value = data.inUse !== undefined ? data.inUse : 'true';
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function goSave() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
const treeWrap = document.querySelector('#tree');
|
||||
const selectedNode = treeWrap.querySelector('button.selected');
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
if (!selectedNode) {
|
||||
alert(/*[[#{operation.adminRole.save.choose.first}]]*/);
|
||||
return;
|
||||
}
|
||||
@@ -249,20 +368,18 @@
|
||||
data: JSON.stringify(obj),
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (data) {
|
||||
alert('저장되었습니다.');
|
||||
refreshTree(data.id);
|
||||
},
|
||||
statusCode: {
|
||||
// error
|
||||
400: function (response) {
|
||||
const resJson = response.responseJSON;
|
||||
alert(resJson.message);
|
||||
},
|
||||
// validation fail
|
||||
422: function (response) {
|
||||
const fieldErrors = response.responseJSON.fieldErrors;
|
||||
let form = document.formDto;
|
||||
@@ -272,43 +389,49 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function goRemove() {
|
||||
const tree = $('#tree');
|
||||
const selectedNode = tree.treeview('getSelected');
|
||||
const treeWrap = document.querySelector('#tree');
|
||||
const selectedNode = treeWrap.querySelector('button.selected');
|
||||
|
||||
if (selectedNode.length === 0) {
|
||||
if (!selectedNode) {
|
||||
alert('삭제할 노드를 선택하세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
const info = selectedNode[0];
|
||||
const info = {
|
||||
id: selectedNode.getAttribute('data-id'),
|
||||
text: selectedNode.querySelector('span:not(.toggle-icon)').textContent
|
||||
};
|
||||
|
||||
if (confirm("'" + info.text + "' 메뉴를 정말 삭제하시겠습니까?")) {
|
||||
if (!info.id) {
|
||||
// 신규생성 임시 노드인 경우
|
||||
tree.treeview('removeNode', [selectedNode]);
|
||||
if (info.id === 'code.new.temp') {
|
||||
const parentLi = selectedNode.parentElement.parentElement.parentElement;
|
||||
selectedNode.parentElement.remove();
|
||||
if (!parentLi.querySelector('ul')) {
|
||||
parentLi.querySelector('.toggle-icon')?.classList.replace('toggle-icon', 'no-toggle');
|
||||
}
|
||||
alert('삭제되었습니다.');
|
||||
refreshTree();
|
||||
cleanFormFields();
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/uicode/remove',
|
||||
data: {id: info.id},
|
||||
data: { id: info.id },
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function () {
|
||||
alert('삭제되었습니다.');
|
||||
refreshTree();
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,97 +448,120 @@
|
||||
}
|
||||
|
||||
function move(dir) {
|
||||
const curNode = $('#tree').treeview('getSelected');
|
||||
if (curNode.length === 0) {
|
||||
const treeWrap = document.querySelector('#tree');
|
||||
const selectedNode = treeWrap.querySelector('button.selected');
|
||||
if (!selectedNode) {
|
||||
alert('이동할 아이템을 선택해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
const info = curNode[0];
|
||||
if (!info.id) {
|
||||
const info = {
|
||||
id: selectedNode.getAttribute('data-id'),
|
||||
orderNo: parseInt(selectedNode.getAttribute('data-order-no')) || 0
|
||||
};
|
||||
|
||||
if (!info.id || info.id === 'code.new.temp') {
|
||||
alert('먼저 아이템을 저장한 후 이동해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
const curOrderNo = info.orderNo;
|
||||
const siblingsWithoutMe = $('#tree').treeview('getSiblings', curNode);
|
||||
let updateList = [];
|
||||
const parentLi = selectedNode.parentElement.parentElement;
|
||||
const siblings = Array.from(parentLi.children).filter(li => li.querySelector('button'));
|
||||
const currentLi = selectedNode.parentElement;
|
||||
let targetItem;
|
||||
|
||||
switch (dir) {
|
||||
case 'up':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo < curOrderNo) {
|
||||
targetItem = item;
|
||||
}
|
||||
targetItem = siblings.find((li, idx) => {
|
||||
const btn = li.querySelector('button');
|
||||
return btn !== selectedNode && parseInt(btn.getAttribute('data-order-no')) < info.orderNo && siblings[idx + 1] === currentLi;
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.before}]]);
|
||||
alert(/*[[#{operation.uri.move.cannot.before}]]*/);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
case 'down':
|
||||
$(siblingsWithoutMe).each(function (idx, item) {
|
||||
if (item.orderNo > curOrderNo) {
|
||||
console.log('nextNode is ', item);
|
||||
targetItem = item;
|
||||
return false;
|
||||
}
|
||||
targetItem = siblings.find((li, idx) => {
|
||||
const btn = li.querySelector('button');
|
||||
return btn !== selectedNode && parseInt(btn.getAttribute('data-order-no')) > info.orderNo && siblings[idx - 1] === currentLi;
|
||||
});
|
||||
if (!targetItem) {
|
||||
alert([[#{operation.uri.move.cannot.after}]]);
|
||||
alert(/*[[#{operation.uri.move.cannot.after}]]*/);
|
||||
return;
|
||||
}
|
||||
updateList.push({id: info.id, orderNo: targetItem.orderNo});
|
||||
updateList.push({id: targetItem.id, orderNo: info.orderNo});
|
||||
break;
|
||||
}
|
||||
|
||||
// 다음 tree 랜더링시 보여줄 level 설정
|
||||
globalLevels = info.nodeId.split('.').length - 1;
|
||||
const targetInfo = {
|
||||
id: targetItem.querySelector('button').getAttribute('data-id'),
|
||||
orderNo: parseInt(targetItem.querySelector('button').getAttribute('data-order-no'))
|
||||
};
|
||||
|
||||
const updateList = [
|
||||
{ id: info.id, orderNo: targetInfo.orderNo },
|
||||
{ id: targetInfo.id, orderNo: info.orderNo }
|
||||
];
|
||||
|
||||
globalLevels = info.id.split('.').length - 1;
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/api/uicode/sort',
|
||||
headers: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
headers: { 'content-type': 'application/json' },
|
||||
data: JSON.stringify(updateList),
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success: function (data) {
|
||||
success: function () {
|
||||
refreshTree(info.id);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function collapse() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('collapseAll', {silent: true});
|
||||
tree.treeview('expandAll', {silent: true, levels: 1});
|
||||
const treeWrap = document.querySelector('#tree');
|
||||
const lis = treeWrap.querySelectorAll('li');
|
||||
lis.forEach(li => li.classList.remove('open'));
|
||||
treeWrap.querySelectorAll('.list-onedepth > li').forEach(li => li.classList.add('open'));
|
||||
}
|
||||
|
||||
function expand() {
|
||||
const tree = $('#tree');
|
||||
tree.treeview('collapseAll', {silent: true});
|
||||
tree.treeview('expandAll', {silent: true, levels: 6});
|
||||
const treeWrap = document.querySelector('#tree');
|
||||
const lis = treeWrap.querySelectorAll('li');
|
||||
lis.forEach(li => li.classList.add('open'));
|
||||
}
|
||||
|
||||
function searchNode() {
|
||||
let searchVal = $('#searchNode').val().trim();
|
||||
const searchVal = $('#searchNode').val().trim();
|
||||
if (!searchVal) {
|
||||
return;
|
||||
}
|
||||
const tree = $('#tree');
|
||||
const searchNode = tree.treeview('findNodes', [searchVal, 'text']);
|
||||
tree.treeview('selectNode', [searchNode, {silent: false}]);
|
||||
tree.treeview('revealNode', [searchNode, {silent: true}]);
|
||||
|
||||
const treeWrap = document.querySelector('#tree');
|
||||
const buttons = treeWrap.querySelectorAll('button');
|
||||
const matchingNode = Array.from(buttons).find(btn => btn.querySelector('span:not(.toggle-icon)').textContent.toLowerCase().includes(searchVal.toLowerCase()));
|
||||
|
||||
if (matchingNode) {
|
||||
const previouslySelected = treeWrap.querySelector('button.selected');
|
||||
if (previouslySelected) {
|
||||
previouslySelected.classList.remove('selected');
|
||||
}
|
||||
matchingNode.classList.add('selected');
|
||||
matchingNode.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
let parent = matchingNode.parentElement;
|
||||
while (parent && parent.tagName === 'LI') {
|
||||
parent.classList.add('open');
|
||||
parent = parent.parentElement.parentElement;
|
||||
}
|
||||
selectNode(matchingNode);
|
||||
} else {
|
||||
alert('일치하는 노드가 없습니다.');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
@@ -73,7 +73,16 @@ kri.logger.warn = function(message){
|
||||
console.warn("[WARN] caller : " + callee + " / message : " + message);
|
||||
};
|
||||
|
||||
|
||||
kri.form.errorInit = function (formElement) {
|
||||
if (formElement.length > 0) {
|
||||
$(formElement).find('.component-input').removeClass('input-invalid');
|
||||
$(formElement).find('.input-flex-group').removeClass('invalid');
|
||||
$(formElement).find('.select-group').removeClass('select-invalid');
|
||||
$(formElement).find('.input-info').each(function () {
|
||||
$(this).remove();
|
||||
});
|
||||
}
|
||||
};
|
||||
kri.form.error = function(errorList){
|
||||
let isResetDone = false;
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<head th:replace="~{common/components :: head}"></head>
|
||||
|
||||
<body>
|
||||
|
||||
<section class="container" layout:fragment="content">
|
||||
<p>Page content goes here</p>
|
||||
</section>
|
||||
|
||||
<div id="wrap">
|
||||
<div id="container" class = "login-wrap" layout:fragment="content">
|
||||
<p>Page content goes here</p>
|
||||
</div>
|
||||
<section th:replace="~{common/components :: footer}"></section>
|
||||
</div>
|
||||
<section layout:fragment="script"></section>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,45 +1,108 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
<html layout:decorate="~{layout/layout-login}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section layout:fragment="content">
|
||||
<form method="post" th:action="@{/login}">
|
||||
<div layout:fragment="content">
|
||||
<form method="post" th:action="@{/login}" name="loginForm">
|
||||
|
||||
<div class="" th:if="${session['SPRING_SECURITY_LAST_EXCEPTION']} != null">
|
||||
<div class="alert alert-danger fw-bold"
|
||||
th:utext="${session['SPRING_SECURITY_LAST_EXCEPTION'].message}">
|
||||
<main id="content" role="main">
|
||||
<div class="inner">
|
||||
<hgroup class="login-tit-group">
|
||||
<span>2025</span>
|
||||
<h3>
|
||||
임가경제조사 일계부
|
||||
</h3>
|
||||
</hgroup>
|
||||
<div class="login-form-group">
|
||||
<div class="component-input">
|
||||
<div class="input-label">
|
||||
<label for="floatingInput" class="label-txt">
|
||||
임가번호
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input autofocus class="" id="floatingInput" name="username" placeholder="임가번호를 입력해 주세요" value="11111"
|
||||
type="number" maxlength="5">
|
||||
</div>
|
||||
<ul class="input-info" id="username-error" style="display: none;">
|
||||
<li>임가번호를 입력해주세요</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="component-input" data-props-toggle-Password="true">
|
||||
<div class="input-label">
|
||||
<label for="floatingPassword" class="label-txt">
|
||||
비밀번호
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="password" name="password" id="floatingPassword" placeholder="비밀번호 4자리를 입력해 주세요" value="1111" maxlength="4">
|
||||
</div>
|
||||
<ul class="input-info" id="password-error" style="display: none;">
|
||||
<li>비밀번호를 입력해주세요</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="component-input" roleDto="group" aria-label="Basic checkbox toggle button group">
|
||||
<label for="btn_ck1" class="checkbox-inner">
|
||||
<input autocomplete="off" type="checkbox" id="btn_ck1" name="remember-me">
|
||||
<span class="checkbox-item">
|
||||
<span class="checkbox-txt">로그인 상태 유지</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-m btn-primary btn-full">
|
||||
<span class="btn-txt">로그인</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<h3>
|
||||
<a href="/oauth2/authorization/kakao">카카오 로그인</a>
|
||||
<a href="/oauth2/authorization/naver">네이버 로그인</a>
|
||||
</h3>
|
||||
|
||||
<div class="">
|
||||
<label for="floatingInput">ID</label>
|
||||
<input autofocus class="" id="floatingInput" name="username" placeholder="ID를 입력해주세요" value="11111"
|
||||
type="text">
|
||||
</div>
|
||||
<div class="">
|
||||
<label for="floatingPassword">Password</label>
|
||||
<input class="f" id="floatingPassword" name="password" placeholder="Password" type="password" value="1111">
|
||||
</div>
|
||||
|
||||
<div class="">
|
||||
<div aria-label="Basic checkbox toggle button group" class="" roleDto="group">
|
||||
<input autocomplete="off" class="" id="btn_ck1" name="remember-me" type="checkbox">
|
||||
<label class="" for="btn_ck1">로그인 상태 유지하기</label>
|
||||
</div>
|
||||
</div>
|
||||
<button class="" type="submit">Sign in</button>
|
||||
</form>
|
||||
|
||||
<div>
|
||||
<a href="/user/register">회원가입</a>
|
||||
</div>
|
||||
</div>
|
||||
<th:block layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
|
||||
</section>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const errorMessage = /*[[${session['SPRING_SECURITY_LAST_EXCEPTION']?.message}]]*/ null;
|
||||
if (errorMessage) {
|
||||
etUI.dialog.alert({
|
||||
message: "입력하신 정보가 맞지 않습니다.\n 다시 확인해주세요.",
|
||||
type: "alert",
|
||||
callback: function () {
|
||||
document.loginForm.reset();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('floatingPassword').addEventListener('focusout', function() {
|
||||
const passwordInput = this;
|
||||
const passwordValue = passwordInput.value;
|
||||
const errorContainer = document.getElementById('password-error');
|
||||
const parentComponent = passwordInput.closest('.component-input');
|
||||
if (passwordValue.length < 4) {
|
||||
parentComponent.classList.add('input-invalid');
|
||||
errorContainer.style.display = 'block';
|
||||
} else {
|
||||
parentComponent.classList.remove('input-invalid');
|
||||
errorContainer.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
document.getElementById('floatingInput').addEventListener('focusout', function() {
|
||||
const floatingInput = this;
|
||||
const userNameValue = floatingInput.value;
|
||||
const errorContainer = document.getElementById('username-error');
|
||||
const parentComponent = floatingInput.closest('.component-input');
|
||||
if (userNameValue.length < 5) {
|
||||
parentComponent.classList.add('input-invalid');
|
||||
errorContainer.style.display = 'block';
|
||||
} else {
|
||||
parentComponent.classList.remove('input-invalid');
|
||||
errorContainer.style.display = 'none';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</th:block>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user