mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 04:03:45 +09:00
mybatis join 관련한 기능 추가
This commit is contained in:
169
src/main/webapp/WEB-INF/views/authority/create_group.jsp
Normal file
169
src/main/webapp/WEB-INF/views/authority/create_group.jsp
Normal file
@@ -0,0 +1,169 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<script>
|
||||
/*
|
||||
yes no 모달의 확인 버튼을 누를때 재정의할 function
|
||||
|
||||
yesNoModal.yesFunction = myYesFunction;
|
||||
function myYesFunction(){
|
||||
alert("재정의 됨");
|
||||
}
|
||||
*/
|
||||
const authorityCategoryList = [
|
||||
{'eng' : 'account', 'kor' : '계정'},
|
||||
{'eng':'authority','kor' : '권한'},
|
||||
{'eng' : 'productCategory', 'kor' : '제품 카테고리'},
|
||||
{'eng': 'product' ,'kor' : '제품' },
|
||||
{'eng':'prices' ,'kor' : '가격' },
|
||||
{'eng': 'vendor' ,'kor' : '거래처' } ,
|
||||
{'eng':'warehouse' ,'kor' : '창고' },
|
||||
{'eng': 'stock' ,'kor' : '재고' } ,
|
||||
{'eng':'planIn' ,'kor' : '입고 예정'},
|
||||
{'eng':'productIn' ,'kor' : '입고'},
|
||||
{'eng':'productOut' ,'kor' : '출고'},
|
||||
{'eng':'board' ,'kor' : '게시판'}
|
||||
]
|
||||
|
||||
$(function(){
|
||||
const $div_check_box_body = $("#table_check_box_body");
|
||||
authorityCategoryList.reverse().forEach(function(element){
|
||||
$div_check_box_body.after('<tr>' +
|
||||
' <td>'+element.kor+'</td>\n' +
|
||||
' <td><div id="'+element.eng+'_check_read" class="form-check form-check-inline">\n' +
|
||||
' <input class="form-check-input" data-category="'+element.eng+'" type="checkbox" value="8" id="'+element.eng+'_read">\n' +
|
||||
' <label class="form-check-label" for='+element.eng+'_read">\n' +
|
||||
' 읽기\n' +
|
||||
' </label>\n' +
|
||||
' </div>\n' +
|
||||
' <div id="'+element.eng+'_check_write" class="form-check form-check-inline">\n' +
|
||||
' <input class="form-check-input" data-category="'+element.eng+'" type="checkbox" value="4" id="'+element.eng+'_create">\n' +
|
||||
' <label class="form-check-label" for="'+element.eng+'_create">\n' +
|
||||
' 쓰기\n' +
|
||||
' </label>\n' +
|
||||
' </div>\n' +
|
||||
' <div id="'+element.eng+'_check_create" class="form-check form-check-inline">\n' +
|
||||
' <input class="form-check-input" data-category="'+element.eng+'" type="checkbox" value="2" id="'+element.eng+'_update">\n' +
|
||||
' <label class="form-check-label" for="'+element.eng+'_update">\n' +
|
||||
' 수정\n' +
|
||||
' </label>\n' +
|
||||
' </div>\n' +
|
||||
' <div id="'+element.eng+'_check_delete" class="form-check form-check-inline">\n' +
|
||||
' <input class="form-check-input" data-category="'+element.eng+'" type="checkbox" value="1" id="'+element.eng+'_delete">\n' +
|
||||
' <label class="form-check-label" for="'+element.eng+'_delete">\n' +
|
||||
' 삭제\n' +
|
||||
' </label>\n' +
|
||||
' </div></td>\n' +
|
||||
' </tr>');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function checkName(){
|
||||
if($("#btn_check_name").text() === "다시 설정"){
|
||||
$("#authority_name").removeAttr("disabled");
|
||||
$("#btn_check_name").text("중복 확인");
|
||||
return;
|
||||
}
|
||||
|
||||
const name = $("#authority_name").val();
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/authority/checkNameDuplicate', // 요청할 서버url
|
||||
dataType : 'json', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : {'name' : name},
|
||||
success : function(data) { // 결과 성공 콜백함수
|
||||
if(Number(data) === 0){
|
||||
$("#authority_name").attr('disabled','true');
|
||||
$("#btn_check_name").text("다시 설정");
|
||||
}else{
|
||||
alert("이미 존재하는 권한 명 입니다");
|
||||
}
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function onAuthorityProcess(){
|
||||
if($("#authority_name:disabled").length === 0 ){
|
||||
alert("'중복 확인'을 해주세요");
|
||||
return;
|
||||
}
|
||||
|
||||
let data = {};
|
||||
data.name = $("#authority_name").val();
|
||||
const $checkBoxList = $("input[type='checkbox']:checked");
|
||||
$checkBoxList.each(function(index, element){
|
||||
const category = $(element).data('category');
|
||||
if(data[category] == null){
|
||||
data[category] = 0;
|
||||
}
|
||||
data[category] += Number($(element).val());
|
||||
});
|
||||
data['isGroupAuthority'] = true;
|
||||
data['activation'] = true;
|
||||
console.log(data);
|
||||
$.ajax({
|
||||
type : 'post', // 타입 (get, post, put 등등)
|
||||
url : '/authority/create_process', // 요청할 서버url
|
||||
dataType : 'json', // 데이터 타입 (html, xml, json, text 등등)
|
||||
data : data,
|
||||
success : function(result) { // 결과 성공 콜백함수
|
||||
alert(result);
|
||||
if(result === 's'){
|
||||
$("#authority_name").attr('disabled','true');
|
||||
}else if(result === 'f'){
|
||||
alert("이미 존재하는 권한 명 입니다");
|
||||
}
|
||||
},
|
||||
error : function(request, status, error) {
|
||||
alert(error)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
<h1>권한 추가</h1>
|
||||
</div>
|
||||
<div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
권한명
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<input class="form-control w-30 d-inline" id="authority_name" name='name' type="text" placeholder="권한 명을 입력하세요">
|
||||
<button id="btn_check_name" class="btn btn-primary" onclick="checkName()">중복 확인</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table">
|
||||
<tbody id="table_check_box_body">
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<button class="btn btn-primary" onclick="onAuthorityProcess()">생성</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
125
src/main/webapp/WEB-INF/views/authority/list.jsp
Normal file
125
src/main/webapp/WEB-INF/views/authority/list.jsp
Normal file
@@ -0,0 +1,125 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<!-- 이 안에 내용 복사해서 jsp에 붙여넣기 -->
|
||||
<link rel="stylesheet" href="authority.css">
|
||||
<script>
|
||||
/*
|
||||
yes no 모달의 확인 버튼을 누를때 재정의할 function
|
||||
|
||||
yesNoModal.yesFunction = myYesFunction;
|
||||
function myYesFunction(){
|
||||
alert("재정의 됨");
|
||||
}
|
||||
*/
|
||||
$(function() {
|
||||
$("#div_personal_search").hide();
|
||||
$(".nav-item button").on("click", function(obj){
|
||||
const selectedButtonId = $(obj.currentTarget).attr('id');
|
||||
if(selectedButtonId === 'home-tab'){
|
||||
$("#div_group_search").show();
|
||||
$("#div_personal_search").hide();
|
||||
}else{
|
||||
$("#div_group_search").hide();
|
||||
$("#div_personal_search").show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function onSearch(isPersonalSearch){
|
||||
let jsonData = {};
|
||||
if(isPersonalSearch){
|
||||
jsonData.searchOption = $("select[name='search_select'] option:selected").val();
|
||||
jsonData.searchValue = $("#search_personal_input").val();
|
||||
|
||||
}else{
|
||||
jsonData.searchValue = $("#search_group_input").val();
|
||||
}
|
||||
|
||||
console.log(JSON.stringify(jsonData));
|
||||
}
|
||||
</script>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="mt-5 mb-5 text-center">
|
||||
<h1>그룹 권한 관리</h1>
|
||||
</div>
|
||||
<div>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
<!-- 탭 부분 -->
|
||||
<ul class="nav nav-tabs" id="myTab" role="tablist">
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link active" id="profile-tab" data-bs-toggle="tab" data-bs-target="#personal_authority_tab" type="button" role="tab" aria-controls="profile" aria-selected="false">개인 권한</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" id="home-tab" data-bs-toggle="tab" data-bs-target="#group_authority_tab" type="button" role="tab" aria-controls="home" aria-selected="true">그룹 권한</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<div id="div_group_search" class="text-end">
|
||||
<input id="search_group_input" type="text" class="w-60 d-inline form-control" placeholder="검색">
|
||||
<button id="search_group_btn" type="button" class="btn btn-primary" onclick="onSearch(false)">검색</button>
|
||||
</div>
|
||||
<div id="div_personal_search" class="text-end">
|
||||
<select name="search_select" class="form-select d-inline">
|
||||
<option selected value="10">10</option>
|
||||
<option value="20">20</option>
|
||||
<option value="30">30</option>
|
||||
</select>
|
||||
<input id="search_personal_input" type="text" class="w-60 d-inline form-control" placeholder="검색">
|
||||
<button id="search_personal_btn" type="button" class="btn btn-primary" onclick="onSearch(true)">검색</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="tab-content" id="myTabContent">
|
||||
<div class="tab-pane fade show active" id="personal_authority_tab" role="tabpanel" aria-labelledby="personal-authority-tab">
|
||||
<table class="table" >
|
||||
<thead class="table-dark">
|
||||
<tr><th>사번</th><th>사용자 명</th><th>권한 명</th><th>활성 여부</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach items="${list }" var="dto" varStatus="status">
|
||||
<c:if test="${dto.isGroupAuthority == false}">
|
||||
<tr>
|
||||
<td>${dto.accountDto.employeeNumber}</td>
|
||||
<td>${dto.accountDto.name}</td>
|
||||
<td>${dto.name}</td>
|
||||
<td>${dto.activation}</td>
|
||||
</tr>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="group_authority_tab" role="tabpanel" aria-labelledby="group-authority-tab">
|
||||
<table class="table" >
|
||||
<thead class="table-dark">
|
||||
<tr><th>번호</th><th>권한 명</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>1</td><td>사장 권한</td></tr>
|
||||
<tr><td>2</td><td>관리자 권한</td></tr>
|
||||
<tr><td>3</td><td>사원 권한</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 탭 부분 끝 -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user