wyh20 12-05
기존 조직도 백업
@6dfc5da4ba231de70b1c3650141fe97b8de52752
 
src/main/webapp/WEB-INF/jsp/uss/itsm/orgChart/OrgChartManage_backup.jsp (added)
+++ src/main/webapp/WEB-INF/jsp/uss/itsm/orgChart/OrgChartManage_backup.jsp
@@ -0,0 +1,1074 @@
+<%--
+  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">
+<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/jquery-1.12.4.min.js' />"></script>
+<%-- <script src="<c:url value='/js/jstree.min.js' />"></script> --%>
+<script src="<c:url value='/js/jstree.min.assetlocshow.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();
+	    });
+		
+		
+	});
+	
+	
+	/*********************************************************
+	 * 아이디 체크 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:'jsonp',
+			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();
+	    }
+	}
+	
+	function wrapWindowByMask(){
+	    // 화면의 높이와 너비를 변수로 만듭니다.
+	    var maskHeight = $(document).height();
+	    var maskWidth = $(window).width();
+
+	    // 마스크의 높이와 너비를 화면의 높이와 너비 변수로 설정합니다.
+	    $('.mask').css({'width':maskWidth,'height':maskHeight});
+
+	    // fade 애니메이션 : 1초 동안 검게 됐다가 80%의 불투명으로 변합니다.
+	    $('.mask').fadeIn(1000);
+	    $('.mask').fadeTo("slow",0.8);
+
+	    // 레이어 팝업을 가운데로 띄우기 위해 화면의 높이와 너비의 가운데 값과 스크롤 값을 더하여 변수로 만듭니다.
+	    var left = ( $(window).scrollLeft() + ( $(window).width() - $('.window').width()) / 2 );
+	    var top = ( $(window).scrollTop() + ( $(window).height() - $('.window').height()) / 2 );
+
+	    // css 스타일을 변경합니다.
+	    $('.window').css({'left':left,'top':top, 'position':'absolute'});
+
+	    // 레이어 팝업을 띄웁니다.
+	    $('.window').show();
+	}
+	
+	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/itsm/orgChart/orgChartInitAjax.do'/>",
+					"dataType" : "json",
+					"cache": false  , 
+					"data" : function (node) {
+						return {'id' : node.id }
+					}
+				}
+			},
+			"types" : {
+				"#" : {
+					/* "max_children" : 4, */
+					"max_depth" : 4,
+					"valid_children" : ["root"]
+				},
+				"root" : {
+					"icon" : "glyphicon glyphicon-flash",
+					"valid_children" : ["default"]
+				},
+			    "default" : {
+					"valid_children" : ["default","file"]
+			    },
+			    "file" : {
+					//"icon" : "glyphicon glyphicon-file",
+					"icon" : "jstree-file",
+					"valid_children" : []
+				}
+			},
+			"plugins" : [
+				"contextmenu",  "search",
+				"types"
+			]
+		})
+		.bind('loaded.jstree', function(e, data) {
+			$(this).jstree(true).open_all();
+			getSearchCondition_01("All" , 'Search'); 
+			cleanForm();
+		})
+		.on('select_node.jstree', function (e, data) {
+			cleanForm();
+			
+			/*  부서 선택 */
+			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(data.node.parents.length == 1){
+				getSearchCondition_01("All" , 'Search'); 
+			}else{
+				var parents = data.node.parents ;
+				var parentsArray = [];
+				for(var i =0 ; i < data.node.parents.length ; i++){
+					parentsArray.push(data.node.parents[i]) ;
+				}
+				
+				parentsArray.splice(parentsArray.indexOf("#"), 1);
+				parentsArray.unshift(menuNo) ;
+				getSearchCondition_01(parentsArray, 'Search');				
+			}
+			
+		})
+		.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/itsm/asset/assetSubNmUpdateAjax.do' />",
+							data:{ "menuNo" : nodeId, 
+								"upperMenuId" :  upperMenuId, 
+								"menuNm" :  newText , 
+								"nodeDepth" : data.node.parents.length,
+								"tabType": $('#tabType').val() },
+							dataType:'jsonp',
+							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/itsm/asset/AssetSubCdDeleteAjax.do' />",
+							data:{ "menuNo" : data.node.id ,  
+								"upperMenuId" :  upperMenuId, 
+								"nodeDepth" : data.node.parents.length,
+								"tabType": $('#tabType').val() },
+							dataType:'jsonp',
+							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/itsm/asset/assetSubInsertAjax.do' />",
+						data:{ "menuNm" : menuNm, 
+								"upperMenuId" :  upperMenuId, 
+								"nodeDepth" :data.node.parents.length, 
+								"nodeIds" : childrenNodes.toString(),
+								"tabType": $('#tabType').val()},
+						dataType:'jsonp',
+						success : function(returnData, status) {
+							if(returnData.status == "success") {
+								alert("데이터가 추가 되었습니다.");
+								//fn_select_menuNo(returnData.menuManageVO, returnData.menuManageVO.menuUserType);
+								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:'jsonp',
+					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 getSearchCondition_01(nextValue, search){
+		var nodeDepth = $('#nodeDepth').val();
+		var parent = $('#parent').val();
+
+		$('#searchCondition_01').val("");   
+		$('#searchCondition_02').val("");  
+		$('#searchCondition_03').val(""); 
+		$('#searchCondition_01').niceSelect('destroy').css('display','none') ;
+		$('#searchCondition_02').niceSelect('destroy').css('display','none') ;
+		$('#searchCondition_03').niceSelect('destroy').css('display','none') ;
+
+		$.ajax({
+			type:"POST",
+			url:"<c:url value='/uss/itsm/orgChart/getOrgChartInitAjax_01.do' />",
+			data:{"nodeDepth": nodeDepth, "parent" : parent},
+			dataType:'jsonp',
+			success : function(returnData, status) {
+				if (status == "success"){
+					if(returnData.resultList !=  undefined){
+						$("select#searchCondition_01 option").remove(); //초기화
+						if(returnData.resultList.length == 0){
+							return;
+						}
+						var select_text_01 = "<option disabled value=''>선택</option>";
+						
+						for(var i=0 ; i<returnData.resultList.length; i++){
+							select_text_01 +="<option disabled value='"+returnData.resultList[i].id+"'>"+returnData.resultList[i].text+"</option>" ;
+						}	
+						
+						if(nextValue == "All"){ //전체조회
+							$('#searchCondition_01').append(select_text_01);
+							$('#searchCondition_01').show();
+							$('#searchCondition_01').val('');
+							$('#searchCondition_01').niceSelect();
+						}else{
+							$('#searchCondition_01').append(select_text_01);
+							$('#searchCondition_01').show();
+							$('#searchCondition_01').val(nextValue);
+							$('#searchCondition_01').niceSelect();
+							if(nextValue !=undefined && nextValue.length > 2){  //(nextValue 트리에서 넘김)하위 검색이 있으면 다음 select박스로 넘김(트리구조에서 자동검색위해)
+								getSearchCondition_02(nextValue, search); 
+							}else{
+								if(search == 'Search'){
+									getList(nextValue[0]); //리스트 조회
+								}
+							}	
+						} 
+					}
+				} else { alert("ERROR"); return;}
+			},
+			error : function(request , status, error) {
+			},
+			complete : function () {
+				//return true;
+				deleteLodingBar();
+			}
+		});
+	};
+
+	/* 전체 셀렉트 박스 내용 두번째 가져오기 */
+	function getSearchCondition_02(nextValue, search){
+		var searchConditionVal_01 = $('#searchCondition_01').val();
+		$('#searchCondition_02').val(""); 
+		$('#searchCondition_03').val("");
+		$('#searchCondition_02').niceSelect('destroy').css('display','none') ;
+		$('#searchCondition_03').niceSelect('destroy').css('display','none') ;
+		
+		if(searchConditionVal_01 ==""){
+			return;
+		}
+		$.ajax({
+			type:"POST",
+			url:"<c:url value='/uss/itsm/orgChart/getOrgChartInitAjax_02.do' />",
+			data:{"searchCondition_01" :searchConditionVal_01 },
+			dataType:'jsonp',
+			success : function(returnData, status) {
+				if (status == "success"){
+					$("select#searchCondition_02 option").remove(); //초기화
+					if(returnData.resultList !=  undefined){
+						if(returnData.resultList.length == 0){
+							return;
+						}
+						var select_text_01 = "<option disabled value=''>전체</option>";
+						for(var i=0 ; i<returnData.resultList.length; i++){
+							select_text_01 +="<option disabled value='"+returnData.resultList[i].id+"'>"+returnData.resultList[i].text+"</option>" ;
+						}
+						$('#searchCondition_02').append(select_text_01);
+						$('#searchCondition_02').show();
+						$('#searchCondition_02').val(nextValue);
+						$('#searchCondition_02').niceSelect() ;
+						if(!(nextValue == "" || nextValue==undefined)){
+							if(nextValue.length > 3){
+								getSearchCondition_03(nextValue, search); //하위 검색이 있으면 다음 select박스로 넘김
+							}else{
+								if(search == 'Search'){
+									getList(nextValue[0]); //리스트 조회
+								}
+							}	
+						}
+					}
+				} else { alert("ERROR"); return;}
+			},
+			error : function(request , status, error) {
+			},
+			complete : function () {
+				deleteLodingBar();
+			}
+		});
+	};
+
+	/* 전체 셀렉트 박스 내용 두번째 가져오기 */
+	function getSearchCondition_03(nextValue, search){
+		var searchConditionVal_02 = $('#searchCondition_02').val();
+		$('#searchCondition_03').val("");
+		$('#searchCondition_03').niceSelect('destroy').css('display','none') ;
+		if(searchConditionVal_02 ==""){
+			return;
+		}
+		$.ajax({
+			type:"POST",
+			url:"<c:url value='/uss/itsm/orgChart/getOrgChartInitAjax_03.do' />",
+			data:{"searchCondition_02" :searchConditionVal_02 },
+			dataType:'jsonp',
+			success : function(returnData, status) {
+				if (status == "success"){
+					$("select#searchCondition_03 option").remove(); //초기화
+					if(returnData.resultList !=  undefined){
+						if(returnData.resultList.length == 0){
+							return;
+						}
+						var select_text_01 = "<option disabled value=''>전체</option>";
+						for(var i=0 ; i<returnData.resultList.length; i++){
+							select_text_01 +="<option disabled value='"+returnData.resultList[i].id+"'>"+returnData.resultList[i].text+"</option>" ;
+						}
+						$('#searchCondition_03').append(select_text_01);
+						$('#searchCondition_03').show();
+						$('#searchCondition_03').val(nextValue);
+						$('#searchCondition_03').niceSelect();
+						if(search == 'Search'){
+							getList(nextValue[0]); //리스트 조회
+						}
+					}
+				} else { alert("ERROR"); return;}
+			},
+			error : function(request , status, error) {
+			},
+			complete : function () {
+				deleteLodingBar();
+			}
+		});
+	};
+	
+	
+	function selectAllNum(object){
+		if($(object).is(':checked')){
+			$('#userList').find('input[type=checkbox]').prop("checked", true);
+		}else{
+			$('#userList').find('input[type=checkbox]').prop("checked", false);
+		}
+	}
+	
+	function getList(id) {
+		$.ajax({
+			type:"POST",
+			url:"<c:url value='/cop/itsm/selectUserListAjax.do' />",
+			data:{"partIdx" :id },
+			dataType:'jsonp',
+			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><input type='checkbox' name='del' id='user_"+i+"'  value='"+tempUserList[i].emplyrId+"'><label for='user_"+i+"'></label></td>"
+						tmpHtml+="<td>"+num+"</td>";
+						tmpHtml+="<td>"+tempUserList[i].ofcpsNm+"</td>";
+						tmpHtml+="<td>"+tempUserList[i].userNm+"</td>";
+						tmpHtml+="<td class='orgWork'>"+tempUserList[i].authorCode+"</td>";
+						tmpHtml+="<td>"+ (tempUserList[i].userWork == null ? '' : tempUserList[i].userWork) + "</td>";
+						tmpHtml+="<td><input type='button' class='editBtn' onclick='selectUserInfo(\""+tempUserList[i].emplyrId+"\")'></td>";
+						tmpHtml+="</tr>";
+	 					$("#userList").append(tmpHtml);
+					}
+				} else { 
+					alert("ERROR"); 
+					return;
+				}
+			},
+			error : function(request , status, error) {
+			},
+			complete : function () {
+			}
+		});
+	};
+	
+	// 직원 정보 조회
+	function selectUserInfo(id){
+		$.ajax({
+		    type: "POST",
+		    url: "/cop/itsm/selectUserInfoAjax.do",
+		    data:{"emplyrId" :id },
+		    dataType:'jsonp',
+		    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;
+		        		
+		        		$('#selectAuthorCode').val("");
+		        		$('#selectAuthorCode option[value=\''+userInfo.authorCode+'\']').prop('selected', 'selected').change();
+		        		$('#selectAuthorCode').niceSelect('update');
+		        		$('#uniqId').val(userInfo.uniqId);
+						$('#updateEmplyrId').val(userInfo.emplyrId);
+						$('#emplyrId').val(userInfo.emplyrId);
+						$('#emplyrNm').val(userInfo.userNm);
+						$('#ofcpsNm').val(userInfo.ofcpsNm);
+						$('#emplNo').val(userInfo.emplNo);
+						$('#userWork').val(userInfo.userWork);
+						$('#emailAdres').val(userInfo.emailAdres);
+						$('#offmTelno').val(userInfo.offmTelno);
+						$('#esntlId').val(userInfo.esntlId);
+		        	}
+		        }else{
+		        	alert("조회에 실패하였습니다.");
+		        }
+		    },
+		    error: function (e) {
+		    	alert("조회에 실패하였습니다.");
+		    }
+		});
+	}
+	
+	//직원  선택 삭제
+	function getDelete(id){
+
+		var checkbox_check = false;
+		$('#userList').find('input[type=checkbox]').each(function() {
+			if($(this).is(":checked")){
+				checkbox_check = true;
+			}
+		});
+		
+		if(!checkbox_check){
+			alert("선택된 항목이 없습니다.");
+			return false;
+		}
+		
+		event.preventDefault();
+		var frm = document.writeForm;
+		var data = new FormData(frm);
+		
+		$.ajax({
+		    type: "POST",
+		    url: "/cop/itsm/deleteUserInfoAjax.do",
+		    data: data,
+		    dataType:'jsonp',
+		    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("선택한 사원이 삭제 되었습니다.");
+		        		
+		        		getList($('#partIdx').val());
+		        	}
+		        }else{
+		        	alert("삭제에 실패하였습니다.");
+		        }
+		    },
+		    error: function (e) {
+		        alert("등록에 실패하였습니다.");
+		    }
+		});
+	}
+	
+	//직원 삭제
+	function userInfoDelete(id){
+		$.ajax({
+		    type: "POST",
+		    url: "/cop/itsm/deleteUserInfoAjax.do",
+		    data:{"del" :id },
+		    dataType:'jsonp',
+		    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("선택한 사원이 삭제 되었습니다.");
+		        		
+		        		getList($('#partIdx').val());
+		        	}
+		        }else{
+		        	alert("삭제에 실패하였습니다.");
+		        }
+		    },
+		    error: function (e) {
+		        alert("등록에 실패하였습니다.");
+		    }
+		});
+	}
+	
+	//숫자만 입력
+	function validatePassword(character) {
+	    return /^(?=.*[A-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{8,}$/.test(character);
+	}
+	
+	// 직원 등록
+	function userInsert(){
+		
+		var selectedDepths = $("select[id^=searchCondition_] option:selected[value!='']");
+		if (selectedDepths.length == 0) { alert("부서를 선택해주세요."); return; }
+		var id = 'searchCondition_0'+selectedDepths.length ;
+		$('#partIdx').val($('#'+id+' option:selected').val());
+	
+		if($('#emplyrId').val() == ''){
+			$('#emplyrId').focus();
+			alert("ID를 입력해 주세요.");
+			return false;
+		}
+		
+		
+		if($('#password').val() == ''){
+			$('#password').focus();
+			alert("패스워드를 입력해 주세요.");
+			return false;
+		}else if(!validatePassword($('#password').val())){
+			$('#password').val('');
+			$('#password').focus();
+        	alert("비밀번호 최소 하나의 문자 + 하나의 숫자 + 하나의 특수 문자 포함, 최소 8자리, 최대 20자리입니다.");
+        	return;
+        }
+		
+		if($('#password2').val() == ''){
+			$('#password2').focus();
+			alert("패스워드 확인를 입력해 주세요.");
+			return false;
+		}else if($('#password').val() != $('#password2').val()){
+			$('#password2').focus();
+        	alert("입력된 패스워드와 일치하지 않습니다. 페스워드를 확인하여 주세요");
+        	return;
+        }
+		
+		if($('#emplyrNm').val() == ''){
+			$('#emplyrNm').focus();
+			alert("이름을 입력해 주세요.");
+			return false;
+		}
+		
+		if($('#ofcpsNm').val() == ''){
+			$('#ofcpsNm').focus();
+        	alert("직위는 필수 값입니다.");
+        	return;
+        }
+
+		if($('#emplNo').val() == ''){
+			$('#emplNo').focus();
+        	alert("사원번호는 필수 값입니다.");
+        	return;
+        }
+		
+		if($('#userWork').val() == ''){
+			$('#userWork').focus();
+        	alert("담당업무는 필수 값입니다.");
+        	return;
+        }
+		
+		
+		$('#authorCode').val($('#selectAuthorCode option:selected').val());
+		
+		event.preventDefault();
+		var frm = document.writeForm;
+		var data = new FormData(frm);
+		
+		$.ajax({
+		    type: "POST",
+		    url: "/cop/itsm/insertUserInfoAjax.do",
+		    data: data,
+		    dataType:'jsonp',
+		    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("등록에 성공하였습니다.");
+		        		getList($('#partIdx').val());
+		        	}
+		        }else{
+		        	alert("등록에 실패하였습니다.");
+		        }
+		    },
+		    error: function (e) {
+		        alert("등록에 실패하였습니다.");
+		    }
+		});
+	}
+	
+	function userPassword(){
+		
+		
+	}
+	
+	// 직원 수정
+	function userupdate(){
+		var selectedDepths = $("select[id^=searchCondition_] option:selected[value!='']");
+		if (selectedDepths.length == 0) { alert("부서를 선택해주세요."); return; }
+		var id = 'searchCondition_0'+selectedDepths.length ;
+		$('#partIdx').val($('#'+id+' option:selected').val());
+		
+		/* if($('#emplyrNm').val() == ''){
+			$('#emplyrNm').focus();
+			alert("이름을 입력해 주세요.");
+			return false;
+		}
+		
+		if($('#ofcpsNm').val() == ''){
+			$('#ofcpsNm').focus();
+        	alert("직위는 필수 값입니다.");
+        	return;
+        }
+		
+		if($('#emplNo').val() == ''){
+			$('#emplNo').focus();
+        	alert("사원번호는 필수 값입니다.");
+        	return;
+        }
+		
+		if($('#userWork').val() == ''){
+			$('#userWork').focus();
+        	alert("담당업무는 필수 값입니다.");
+        	return;
+        } */
+		
+		$('#authorCode').val($('#selectAuthorCode option:selected').val());
+		
+		event.preventDefault();
+		var frm = document.writeForm;
+		var data = new FormData(frm);
+		
+		$.ajax({
+		    type: "POST",
+		    url: "/cop/itsm/updateUserInfoAjax.do",
+		    data: data,
+		    dataType:'jsonp',
+		    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("수정에 성공하였습니다.");
+		        		getList($('#partIdx').val());
+		        	}
+		        }else{
+		        	alert("수정에 실패하였습니다.");
+		        }
+		    },
+		    error: function (e) {
+		        alert("수정에 실패하였습니다.");
+		    }
+		});
+	}
+	
+	// 상세보기 초기화
+	function cleanForm(){
+		$(".insert").show();
+		$(".update").hide();
+		
+// 		getSearchCondition_01("All" , 'Search'); 
+		
+		$('#emplyrId').val('');
+		$('#updateEmplyrId').val('');
+		$('#password').val('');
+		$('#password2').val('');
+		$('#emplyrNm').val('');
+		$('#ofcpsNm').val('');
+		$('#emailAdres').val('');
+		$('#offmTelno').val('');
+		$('#emplNo').val('');
+		$('#userWork').val('');
+		
+	}
+</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="cont_area myPage_area orgn_area">
+			<div class="cont_main_title">
+				<img src="/direct/img/home_icon.png" alt="">
+	        	<span id="cnt_cate_list"></span>
+			</div>
+			<div class="orgn_wrap">
+				<div class="orgnSerch_area" style="width: 347px;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="orgnDetail_wrap">
+				<div class="orgnDetailteam_title">
+					<li id="partNm">우체국물류지원단</li>
+					<li>
+					<!-- <div class="orgnListBtn">
+						<input type="button" class="delListBtn" value="삭제" onclick="getDelete()">
+						<input type="button" class="addListBtn" value="직원추가" onclick="cleanForm()"> 
+					</div> -->
+					</li>
+				</div>
+				<div class="orgnList_wrap">
+					<table class="orgnListTable" id="tbEmpList">
+						<thead>
+							<tr>
+								<th>
+									<input type="checkbox" id="selectAll" onclick="selectAllNum(this);" >
+									<label for="selectAll"></label>
+								</th>
+								<th>번호</th>
+								<th>직급</th>
+								<th>이름</th>
+								<th>권한</th>
+								<!-- <th>사번</th> -->
+								<th>업무</th>
+								<th>수정</th>
+								<!-- <th>삭제</th> -->
+							</tr>
+						</thead>
+						<tbody id="userList">
+						</tbody>
+					</table>
+				</div>
+				
+				<input type="hidden" id="selectPartIdx" />
+				<input type="hidden" id="selectPartParents" />
+				<div class="orgnDetail_title">직원상세보기</div>
+				<div class="list_wrap setting_list_wrap mypage_wrap">
+					<table>
+						<tr>
+							<th>
+								<span class="required_area"><div class="listTitle">부&emsp;&emsp;서</div></span>
+							</th>
+							<td id="select_part">
+								<!-- <select name="searchCondition_01" id="searchCondition_01" class="asset_sec_sort" style="display:none;" onchange="getSearchCondition_02();"></select>
+		                        <select name="searchCondition_02" id="searchCondition_02" class="asset_thr_sort" style="display:none;" onchange="getSearchCondition_03();"></select>
+		                        <select name="searchCondition_03" id="searchCondition_03" class="asset_four_sort" style="display:none;"></select> -->
+		                        
+		                        <select name="searchCondition_01" id="searchCondition_01" class="asset_sec_sort" style="display:none;" ></select>
+		                        <select name="searchCondition_02" id="searchCondition_02" class="asset_thr_sort" style="display:none;" ></select>
+		                        <select name="searchCondition_03" id="searchCondition_03" class="asset_four_sort" style="display:none;"></select>
+		                        
+		                        
+							</td>
+						</tr>
+						<tr>
+							<th><span class="star_t"></span><div class="listTitle">관리자아이디</div></th>
+							<td class="insert">
+								<input type="text" class="showMask read" name="emplyrId" id="emplyrId" title="사용자아이디" size="20" maxlength="20" readonly="true" />
+								<!-- <a href="#" class="showMask">
+									<button class="id_check_btn">
+										<img src="/img/post/id_check_btn.png">중복아이디 검색
+									</button>
+								</a> -->
+							</td>
+							
+							<td class="update" style="display: none">
+								<input type="text" class="read"  name="updateEmplyrId" id="updateEmplyrId" title="사용자아이디" size="20" maxlength="20" readonly="true" />
+							</td>
+						</tr>
+						<!-- <tr class="insert">
+							<th><span class="star_t"></span><div class="listTitle">비밀번호</div></th>
+							<td>
+								<input style="width: 88%;" name="password" id="password" type="password" title="비밀번호" size="20" maxlength="20" />
+								<br/>
+								<span style="color:red;font-size:12px;">비밀번호  문자 + 숫자 + 특수 문자 포함, 최소 8~20자리</span>
+							</td>
+						</tr>
+						<tr class="insert">
+							<th><span class="star_t"></span><div class="listTitle">비밀번호확인</div></th>
+							<td>
+								<input style="width: 88%;" name="password2" id="password2" title="비밀번호확인" type="password" size="20" maxlength="20" />
+							</td>
+						</tr> -->
+						<tr>
+							<th><span class="star_t"></span><div class="listTitle">이름</div></th>
+							<td>
+								<input class="read" name="emplyrNm" id="emplyrNm" title="이름" type="text" size="20" value="" maxlength="60" readonly="true" />
+							</td>
+						</tr>
+						<tr>
+							<th><span class="star_t"></span><div class="listTitle">직위</div></th>
+							<td>
+								<input class="read" name="ofcpsNm" id="ofcpsNm" title="직위" type="text" size="20" value="" maxlength="60" readonly="true" />
+							</td>
+						</tr>
+						<!-- <tr>
+							<th><span class="star_t"></span><div class="listTitle">사원번호</div></th>
+							<td>
+								<input class="read" name="emplNo" id="emplNo" title="사원번호" type="text" size="20" value="" maxlength="60" readonly="true" />
+							</td>
+						</tr> -->
+						<tr>
+							<th><span class="star_t"></span><div class="listTitle">담당업무</div></th>
+							<td>
+								<input class="read" name="userWork" id="userWork" title="담당업무" type="text" size="20" value="" maxlength="60" readonly="true" />
+							</td>
+						</tr>
+						<tr>
+							<th><div class="listTitle">이메일주소</div></th>
+							<td>
+								<input type="text" class="read" style="border:1px solid #ccc;border-radius:3px;height:30px;" readonly="true" name="emailAdres" id="emailAdres" title="이메일주소" cssClass="txaIpt" size="20" maxlength="50" />
+							</td>
+						</tr>
+						<tr>
+							<th><span class="star_t"></span><div class="listTitle">권한</div></th>
+							<td>
+								<input type="hidden" id="authorCode" name="authorCode">
+								<select id="selectAuthorCode" name="selectAuthorCode" title="권한">
+					            <c:forEach var="authorResult" items="${authorList}" varStatus="status">
+					                	<option value="<c:out value="${authorResult.authorCode}"/>" > <c:out value="${authorResult.authorNm}"/></option>
+					       		 </c:forEach>
+						   		 </select>
+							</td>
+						</tr>
+						<tr>
+							<th><div class="listTitle">사무실전화번호</div></th>
+							<td>
+								<input type="text" class="read" name="offmTelno" id="offmTelno" readonly="true" title="사무실전화번호" cssClass="txaIpt" size="20" maxlength="15" style="border:1px solid #ccc;border-radius:3px;height:30px;" />
+							</td>
+						</tr>
+					</table>
+				</div>
+				<div class="saveBtn_area insert">
+					<input type="button" class="saveBtn" value="저장"  onclick="userInsert()">
+				</div>
+				<div class="setting_btn  update" style="display: none;">
+					<input type="button" class="edit_btn" value="수정"  onclick="userupdate()">
+					<input type="button" class="password_change_btn" value="페스워드 변경"  onclick="userPassword()">
+				</div>
+			</div>
+		</div>
+	</form>
+		<div class="setDiv">
+			<div class="mask"></div>
+			<div class="window">
+				<div class="id_check1">
+					<input type="button" href="#" class="close">
+					<span>아이디 중복 확인</span>
+				</div>
+				<div class="id_check2">
+				<span>사용할 아이디</span><input type="text" id="checkIdModal"  onkeypress="press();" >
+				</div>
+				<div class="id_check3">
+					<span>중복확인을 실행하십시오</span><button onclick="fn_id_check(); return false;">중복확인조회</button>
+				</div>
+			</div>
+		</div>
+</body>
+</html>(No newline at end of file)
Add a comment
List