File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
<%--
Class Name : EgovOrgChartManage.jsp
Description : 조직도 관리 화면
Modification Information
수정일 수정자 수정내용
------- -------- ---------------------------
2018.06.11 ITN 최초 생성
author : ITN
since : 2018.06.11
--%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Language" content="ko">
<link href="<c:url value='/'/>css/jstree/themes/default/style.min.css" rel="stylesheet" type="text/css">
<script src="/direct/js/jquery.nice-select.min.js"></script>
<title>자산관리</title>
<!-- <link rel="stylesheet" href="/direct/css/font.css"> -->
<link rel="stylesheet" href="/direct/css/reset.css">
<link rel="stylesheet" href="/direct/css/index.css">
<link rel="stylesheet" href="/direct/css/nice-select.css">
<%-- <script src="<c:url value='/js/jstree.min.assetlocshow.js' />"></script> --%><!-- 이동,삭제,수정 없음 -->
<script src="<c:url value='/js/jstree.min.js' />"></script>
<script src="<c:url value='/js/EgovCalPopup.js' />"></script>
<!-- <script type="text/javascript" src="/js/audit/jquery.form.min.js"></script> -->
<script>
$( document ).ready(function(){
jstreeInit();//전체 리스트 부분
// 닫기(close)를 눌렀을 때 작동합니다.
$('.window .close').click(function (e) {
e.preventDefault();
$('.mask, .window').hide();
$("input[name=emplyrId]").val("");
});
// 뒤 검은 마스크를 클릭시에도 모두 제거하도록 처리합니다.
$('.mask').click(function () {
$(this).hide();
$('.window').hide();
});
$('select').not(".displayN").niceSelect();
$("#orgDepth_01").on("change", function(){
setOrgDepth_01();
});
setOrgDepth_01(); //초기 세팅
});
function setOrgDepth_01(){
$('#orgDepth_02').html($('#span_one_'+$("#orgDepth_01").val()).html().trim()) ;
$('#orgDepth_02').niceSelect('update');
$('#partIdx').val($("#orgDepth_01").val());
}
function onChagneOrgDepth_02(){ //변경시 partIdx 세팅
if(""==$("#orgDepth_02").val()){
$('#partIdx').val($("#orgDepth_01").val());
}else{
$('#partIdx').val($("#orgDepth_02").val());
}
}
/*********************************************************
* 아이디 체크 AJAX
******************************************************** */
function fn_id_check(){
if($("#checkIdModal").val()==''){
alert("사용할 아이디를 넣어주세요.");
return;
}
$.ajax({
type:"POST",
url:"<c:url value='/uss/umt/user/EgovIdDplctCnfirmAjax.do' />",
data:{
"checkId": $("#checkIdModal").val()
},
dataType:'json',
timeout:(1000*30),
success:function(returnData, status){
if(status == "success") {
if(returnData.usedCnt > 0 ){
alert("사용할수 없는 아이디입니다");
}else{
$("input[name=emplyrId]").val(returnData.checkId);
$('.mask, .window').hide();
}
}else{ alert("ERROR!");return;}
},
error:function(request , status, error){
alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
}
});
}
function press() {
if (event.keyCode==13) {
fn_id_check();
event.preventDefault();
}
}
var newNodeId = "";
var modiNodeId = "";
var leafIds = new Array();
function jstreeInit() {
$('#kopost_organization').jstree({
"core" : {
"animation" : 0,
"multiple" : false,
"check_callback" : true,
"themes" : { "stripes" : true },
"data" : {
"url" : "<c:url value='/uss/orgChart/orgChartInitAjax.do'/>",
"dataType" : "json",
"cache": false ,
"data" : function (node) {
return {'id' : node.id }
}
}
},
"types" : {
"#" : {
"max_depth" : 4,
"valid_children" : ["root"]
},
"root" : {
"icon" : "glyphicon glyphicon-flash",
"valid_children" : ["default"]
},
"default" : {
"valid_children" : ["default","file"]
},
"file" : {
"icon" : "jstree-file",
"valid_children" : []
}
},
"plugins" : [
"contextmenu", "search", "dnd",
"types"
]
})
.bind('loaded.jstree', function(e, data) {
$(this).jstree(true).open_all();
cleanForm();
})
.on('select_node.jstree', function (e, data){
/* 부서 선택 */
var menuNo = data.node.id;
var upperMenuId = data.node.parent;
$("#partNm").text(data.node.text);
$('#nodeDepth').val(data.node.parents.length);
$('#upperMenuId').val(upperMenuId);
if(2==data.node.parents.length){ //1뎁스 자신것
$("#orgDepth_01").val(menuNo);
setOrgDepth_01();
}else if(3==data.node.parents.length){ //2뎁스
$("#orgDepth_01").val(upperMenuId);
setOrgDepth_01();
$("#orgDepth_02").val(menuNo);
}
$("#orgDepth_01").niceSelect('update');
$("#orgDepth_02").niceSelect('update');
getList(menuNo);
})
.on('rename_node.jstree', function (e, data) { //매뉴명 변경
var nodeId = data.node.id;
var oldText = data.old;
var newText = data.text;
var upperMenuId = data.node.parent;
if (data.node.parents.length == 1) {
alert("최상위 데이터는 변경할수 없습니다.");
data.instance.refresh();
}else if (data.node.parents.length > 0) {
/* 부서명 변경 */
if (oldText != newText) {
if (confirm("데이터를 변경하시겠습니까?" )) {
$.ajax({
type:"POST",
url:"<c:url value='/uss/orgChart/orgChartNmUpdateAjax.do' />",
data:{ "menuNo" : nodeId,
"upperMenuId" : upperMenuId,
"menuNm" : newText ,
"nodeDepth" : data.node.parents.length,
"tabType": $('#tabType').val() },
dataType:'json',
success : function(returnData, status) {
if (status == "success") {
alert("데이터가 변경되었습니다.");
} else { alert("ERROR"); return;}
},
error : function(request , status, error) {
alert("데이터 변경이 실패되었습니다.");
},
complete : function () {
data.instance.refresh();
}
});
} else {
data.instance.refresh();
}
}
}else{/* 매뉴 추가 */
}
})
.on('delete_node.jstree', function (e, data) {
/* 매뉴 삭제 */
var upperMenuId = data.node.parent;
if(data.node.parents.length == 1){
alert("최상위 데이터는 삭제할수 없습니다.");
data.instance.refresh();
}else{
if(data.node.children.length != 0){
alert("하위 데이터를 먼저 삭제 후 매뉴를 삭제해 주세요.");
data.instance.refresh();
}else{
if (confirm("[" + data.node.text + "]" + " 데이터를 삭제하시겠습니까?")){
$.ajax({
type:"POST",
url:"<c:url value='/uss/orgChart/orgChartDeleteAjax.do' />",
data:{ "menuNo" : data.node.id ,
"upperMenuId" : upperMenuId,
"nodeDepth" : data.node.parents.length,
"tabType": $('#tabType').val() },
dataType:'json',
success : function(returnData, status) {
if (status == "success") {
alert("데이터가 삭제되었습니다.");
} else { alert("ERROR"); return;}
},
error : function(request , status, error) {
alert("데이터 삭제가 실패되었습니다.");
},
complete : function () {
data.instance.refresh();
}
});
} else {
data.instance.refresh();
}
}
}
})
.on('create_node.jstree', function(e, data){
if($('#tabType').val()=='01' && data.node.parents.length > 2) {
alert("품목별 매뉴는 더 이상 하위 데이터를 생성할수 없습니다.");
data.instance.refresh();
}else if($('#tabType').val()=='02' && data.node.parents.length > 3) {
alert("위치별 매뉴는 더 이상 하위 데이터를 생성할수 없습니다.");
data.instance.refresh();
}else if($('#tabType').val()=='03' && data.node.parents.length > 4){
alert("부서별 매뉴는 더 이상 하위 데이터를 생성할수 없습니다.");
data.instance.refresh();
}else{
if (confirm("데이터를 추가하시겠습니까?")){
var instance = data.instance;
var menuNm = data.text;
var upperMenuId = data.node.parent;
var menuOrdr = 1;
var childrenNodes = instance.get_node(upperMenuId).children;
childrenNodes.pop() ;
// 하위 매뉴 있을 시 마지막 부서 sort_ord + 1
if (childrenNodes.length > 1) {
menuOrdr = childrenNodes.length ;
}
$.ajax({
type:"POST",
url:"<c:url value='/uss/orgChart/orgChartInsertAjax.do' />",
data:{ "menuNm" : menuNm,
"upperMenuId" : upperMenuId,
"nodeDepth" :data.node.parents.length,
"nodeIds" : childrenNodes.toString(),
"tabType": $('#tabType').val()},
dataType:'json',
success : function(returnData, status) {
if(returnData.status == "success") {
alert("데이터가 추가 되었습니다.");
newNodeId = returnData.newMenuNo ; //매뉴추가후 노드선택
}else if(returnData.status == "dupl"){
alert("중복된 아이디가 있습니다.\n 중복된 아이디변경/삭제후 다시 추가해 주세요\n"+ "("+returnData.menuManageVO.codeNm+")");
return;
}else{
alert("데이터 추가가 실패하였습니다.");
return;
}
},
error : function(request , status, error) {
alert("데이터 추가가 실패되었습니다.")
},
complete : function () {
data.instance.refresh();
}
});
}else{
data.instance.refresh();
}
}
})
.on('move_node.jstree', function (e, data){
/* 매뉴 위치 변경 */
var instance = data.instance;
var menuNo = data.node.id;
var childrenNodes = instance.get_node(menuNo).children;
if (confirm("데이터 위치를 변경하시겠습니까?" )){
var upperMenuId = data.parent;
var sort = data.position + 1;
var sortOver = "A" ;
if(data.old_position > data.position){ //위치 후열로
sortOver = "D";
}
$.ajax({
type:"POST",
url:"<c:url value='/uss/itsm/asset/AssetMoveAjax.do' />",
data:{ "menuNo":menuNo
, "upperMenuId":upperMenuId
, "sort":sort
, "sortOver":sortOver
, "tabType": $('#tabType').val()
},
dataType:'json',
success : function(returnData, status) {
if (status == "success") {
alert("데이터 위치가 변경되었습니다.");
} else { alert("ERROR"); return;}
},
error : function(request , status, error) {
alert("데이터 위치 변경이 실패되었습니다.");
},
complete : function () {
data.instance.refresh();
}
});
} else {
data.instance.refresh();
}
})
.on("refresh.jstree", function (e,data) {
if(modiNodeId !=""){
$('#'+data.instance.get_node(modiNodeId).a_attr.id).trigger("click");
}
});
}
function getList(id){
$.ajax({
type:"POST",
url:"<c:url value='/cop/selectUserListAjax.do' />",
data:{"partIdx" :id },
dataType:'json',
success : function(returnData, status) {
if (status == "success"){
cleanForm();
$('#userList tr').remove();
var tempUserList = returnData.userList;
var authorList = returnData.authorList;
var num = 0;
$('#partIdx').val(id);
for(var i=0; i < tempUserList.length; i++){
num = num +1;
var tmpHtml="<tr>";
tmpHtml+="<td>"+num+"</td>";
tmpHtml+="<td>"+tempUserList[i].partIdxTxt+"</td>";
tmpHtml+="<td>"+tempUserList[i].userNm+"</td>";
tmpHtml+="<td>"+tempUserList[i].ofcpsNm+"</td>";
tmpHtml+="<td>"+ (tempUserList[i].offmTelno == null ? '' : tempUserList[i].offmTelno) + "</td>";
tmpHtml+="<td>"+tempUserList[i].userWork+"</td>";
tmpHtml+="<td><input type='button' class='editBtn' onclick='selectUserInfo(\""+tempUserList[i].locInfoId+"\")'><input type='button' class='editBtn' onclick='deleteUserInfoLoc(\""+tempUserList[i].locInfoId+"\")'></td>";
tmpHtml+="</tr>";
$("#userList").append(tmpHtml);
}
if(null != returnData.locVO){
$("#locCn").val(returnData.locVO.locCn);
}
} else {
alert("ERROR");
return;
}
},
error : function(request , status, error) {
},
complete : function () {
deleteLodingBar();
$('#sort').val($('#userList').find('tr').length + 1);
}
});
};
// 직원 정보 조회
function selectUserInfo(id){
$.ajax({
type: "POST",
url: "/cop/selectUserInfoAjax.do",
data:{"emplyrId" :id },
dataType:'json',
success: function (returnData, status) {
if(status == 'success'){
if(returnData.result == 'fail'){
alert("조회에 실패하였습니다.");
}else if(returnData.result == 'auth_fail'){
alert("세션이 종료되었습니다.");
}else if(returnData.result =='success'){
$(".insert").hide();
$(".update").show();
var userInfo = returnData.userInfo;
$('#emplyrNm').val(userInfo.userNm);
$('#locInfoId').val(userInfo.locInfoId);
$('#ofcpsNm').val(userInfo.ofcpsNm);
$('#userWork').val(userInfo.userWork);
$('#offmTelno').val(userInfo.offmTelno);
$('#sort').val(userInfo.sort);
}
}else{
alert("조회에 실패하였습니다.");
}
},
error: function (e) {
alert("조회에 실패하였습니다.");
}
});
}
//직원 등록
function userSave(){
if(""==$('#emplyrId').val()){
alert("직원을 선택해 주세요");
return;
}
if(""==$('#emplyrNm').val()){
alert("이름은 필수값입니다.");
return;
}
event.preventDefault();
var frm = document.writeForm;
var data = new FormData(frm);
$.ajax({
type: "POST",
url: "/uss/orgChart/updateUserInfoAjax.do",
data: data,
dataType:'json',
async: false,
processData: false,
contentType: false,
cache: false,
timeout: 600000,
success: function (returnData, status) {
if(status == 'success'){
if(returnData.result == 'fail'){
alert("등록에 실패하였습니다.");
}else if(returnData.result == 'auth_fail'){
alert("세션이 종료되었습니다.");
}else if(returnData.result =='success'){
alert("등록에 성공하였습니다.");
$("#kopost_organization").jstree("refresh"); //새로고침
$('#locInfoId').val('')
}
}else{
alert("등록에 실패하였습니다.");
}
},
error: function (e) {
alert("등록에 실패하였습니다.");
}
});
}
// 직원 정보 삭제
function deleteUserInfoLoc(id){
if (!confirm("조직도 직원을 삭제하시겠습니까?" )) {
return;
}
$.ajax({
type: "POST",
url: "/cop/deleteUserInfoLocAjax.do",
data:{"emplyrId" :id },
dataType:'json',
success: function (returnData, status) {
if(status == 'success'){
if(returnData.result == 'fail'){
alert("조회에 실패하였습니다.");
}else if(returnData.result == 'auth_fail'){
alert("세션이 종료되었습니다.");
}else if(returnData.result =='success'){
alert("정상적으로 삭제처리 되었습니다.");
$("#kopost_organization").jstree("refresh"); //새로고침
}
}else{
alert("조회에 실패하였습니다.");
}
},
error: function (e) {
alert("조회에 실패하였습니다.");
}
});
}
// 상세보기 초기화
function cleanForm(){
$(".insert").show();
$(".update").hide();
$('#emplyrId').val('');
$('#updateEmplyrId').val('');
$('#password').val('');
$('#password2').val('');
$('#emplyrNm').val('');
$('#ofcpsNm').val('');
$('#emailAdres').val('');
$('#offmTelno').val('');
$('#emplNo').val('');
$('#userWork').val('');
}
//부서업무등록
function locCnSave(){
if (!confirm("부서업무를 등록하시겠습니까?" )) {
return;
}
event.preventDefault();
var frm = document.writeForm;
var data = new FormData(frm);
$.ajax({
type: "POST",
url: "/uss/orgChart/updateLocCnSaveAjax.do",
data: data,
dataType:'json',
async: false,
processData: false,
contentType: false,
cache: false,
timeout: 600000,
success: function (returnData, status) {
if(status == 'success'){
if(returnData.result == 'fail'){
alert("등록에 실패하였습니다.");
}else if(returnData.result == 'auth_fail'){
alert("세션이 종료되었습니다.");
}else if(returnData.result =='success'){
alert("등록에 성공하였습니다.");
}
}else{
alert("등록에 실패하였습니다.");
}
},
error: function (e) {
alert("등록에 실패하였습니다.");
}
});
}
</script>
<style>
.read{background-color: #ccc;}
</style>
</head>
<body>
<form name="writeForm" id="writeForm" enctype="multipart/form-data" method="post">
<input type="hidden" id="partIdx" name="partIdx"/>
<input type="hidden" id="uniqId" name="uniqId"/>
<input type="hidden" id="staffId" name="staffId"/>
<input type="hidden" id="esntlId" name="esntlId"/>
<input type="hidden" name="tabType" id="tabType" value="03"><!-- 기본값 품목별 -->
<div class="contWrap">
<div class="pageTitle">
<div class="pageIcon"><img src="/pb/img/pageTitIcon4.png" alt=""></div>
<h2 class="titType1 c_222222 fwBold">조직도</h2>
<p class="tType6 c_999999">본사 및 지사 임직원을 조직별로 관리할 수 있습니다.</p>
</div>
<div class="pageNav">
<img src="/pb/img/common/homeIcon.png" alt="홈이미지"> > <p class="topDepth">홈페이지관리</p> > <p class="subDepth">매뉴관리</p>
</div>
<div class="pageCont">
<div class="orgWrap">
<div class="btnWrap">
<input type="button" value="모두열기" class="btnType1">
<input type="button" value="모두닫기" class="btnType2">
</div>
<div class="orgCont" style="overflow-x:auto;height:650px;border:1px solid #dde6e9;overflow-y:scroll;">
<div class="orgnIn_wrap" id="kopost_organization" class="jstree_orgChart"></div>
</div>
</div>
<div class="tbWrap">
<span class="tbTit" id="partNm">임원실</span>
<table class="tbType1">
<colgroup>
<col style="width: 5%">
<col style="width: 10%">
<col style="width: 5%">
<col style="width: 10%">
<col style="width: 10%">
<col style="width: 10%">
<col style="width: 10%">
</colgroup>
<thead>
<tr>
<th>번호</th>
<th>소속</th>
<th>이름</th>
<th>직위</th>
<th>전화번호</th>
<th>담당업무</th>
<th>선택/삭제</th>
</tr>
</thead>
<tbody id="userList">
</tbody>
</table>
<span class="tbTit" id="partNm">부서업무</span>
<table class="tbType2">
<colgroup>
<col style="width: 100%">
</colgroup>
<tbody>
<tr>
<td>
<textarea name="locCn" id="locCn" cols="150" rows="10" id="textarea"></textarea>
<input type="button" class="btnType1 bg_456ded" value="저 장" onclick="locCnSave()">
</td>
</tr>
</tbody>
</table>
<input type="hidden" id="selectPartIdx" />
<input type="hidden" id="selectPartParents" />
<span class="tbTit">직원상세보기</span>
<p class="right fwMd"><span class="tType4 c_e40000 fwBold">*</span>는 필수입력 항목입니다.</p>
<table class="tbType2">
<colgroup>
<col style="width: 30%">
<col style="width: 70%">
</colgroup>
<tbody>
<tr>
<th><span class="reqArea">부서</span></th>
<td id="select_part_hidden">
<select name="orgDepth_01" id="orgDepth_01" class="asset_sec_sort">
<c:forEach var="hiddenResult_one" items="${orgHiddenList}" varStatus="status">
<c:if test="${hiddenResult_one.depth eq '1'}">
<option value="<c:out value='${hiddenResult_one.id}'/>"><c:out value='${hiddenResult_one.text}'/></option>
</c:if>
</c:forEach>
</select>
<select name="orgDepth_02" id="orgDepth_02" class="asset_sec_sort" onchange="onChagneOrgDepth_02(); return false;" />
</td>
</tr>
<!-- <tr>
<th><span class="reqArea">아이디</span></th>
<td class="insert">
<input type="text" class="showMask read" name="emplyrId" id="emplyrId" title="사용자아이디" size="20" maxlength="20" readonly />
</td>
<td class="update" style="display: none">
<input type="text" class="read" name="updateEmplyrId" id="updateEmplyrId" title="사용자아이디" size="20" maxlength="20" readonly />
</td>
</tr> -->
<tr>
<th><span class="reqArea">이름</span></th>
<td>
<input name="emplyrNm" id="emplyrNm" title="이름" type="text" size="20" value="" maxlength="60" />
<input name="locInfoId" id="locInfoId" title="이름" type="hidden" size="20" value="" maxlength="60" />
</td>
</tr>
<tr>
<th>직급</th>
<td>
<input name="ofcpsNm" id="ofcpsNm" title="직급" type="text" size="20" value="" maxlength="60" />
</td>
</tr>
<tr>
<th>전화번호</th>
<td>
<input name="offmTelno" id="offmTelno" title="전화번호" type="text" size="20" value="" maxlength="60" />
</td>
</tr>
<!-- <tr>
<th>팩스번호</th>
<td>
<input name="fxnum" id="fxnum" title="팩스번호" type="text" size="20" value="" maxlength="60" />
</td>
</tr> -->
<tr>
<th>담당업무</th>
<td>
<input name="userWork" id="userWork" title="담당업무" type="text" size="20" value="" maxlength="60" />
</td>
</tr>
<tr>
<th>순번</th>
<td>
<input name="sort" id="sort" title="순번" type="text" size="20" value="" maxlength="60" />
</td>
</tr>
<!-- <tr>
<th><span>이메일주소</span></th>
<td>
<input type="text" style="border:1px solid #ccc;border-radius:3px;height:30px;" name="emailAdres" id="emailAdres" title="이메일주소" cssClass="txaIpt" size="20" maxlength="50" />
</td>
</tr> -->
</tbody>
</table>
</div>
<div class="btnWrap">
<input type="button" class="btnType1 bg_456ded" value="저 장" onclick="userSave()">
</div>
</div>
</div>
</form>
<!-- selectbox 미리만들기 -->
<!-- 2뎁스 만들기 -->
<c:forEach var="hiddenResult_one" items="${orgHiddenList}" varStatus="status">
<c:if test="${hiddenResult_one.depth eq '1'}">
<span id="span_one_${hiddenResult_one.id}" style="display:none;">
<option value="">선택</option>
<c:forEach var="hiddenResult_two" items="${orgHiddenList}" varStatus="status"><c:if test="${hiddenResult_one.id eq hiddenResult_two.parent}"><option value="<c:out value='${hiddenResult_two.id}'/>"><c:out value='${hiddenResult_two.text}'/></option></c:if></c:forEach>
</span>
</c:if>
</c:forEach>
</body>
</html>