ERP-node/WebContent/WEB-INF/view/admin/dept/deptFormPopup.jsp

142 lines
3.9 KiB
Plaintext

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="com.pms.common.utils.*"%>
<%@ page import="java.util.*"%>
<%@include file="/init.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/basic.css">
<title><%=Constants.SYSTEM_NAME%></title>
<script>
var isEditMode = "${empty info?'false':'true'}";
$(function(){
$(document).ready(function(){
$("#locationName").focus();
});
//save
$("#btnSave").click(function(){
var flag = false;
if(isEditMode == "false"){
flag = fn_duplicateDeptCodeCheck();
}else{
flag = true;
}
if(flag){
if(fnc_validate("form1")){
fn_save();
}
}
});
$("#deptCode").keyup(function(e){
$("#deptCode").val($("#deptCode").val().toUpperCase());
});
});
</script>
<script>
//검사명 저장
function fn_save(){
if(confirm("저장하시겠습니까?")){
$.ajax({
url:"/admin/saveDeptInfo.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
async:false,
success:function(data){
Swal.fire(data.msg);
if(data.result == "true" || data.result == true || data.result){
opener.fn_search();
self.close(0);
}
},
error: function(jqxhr, status, error){
}
});
}
}
//검사명 중복체크
function fn_duplicateDeptCodeCheck(){
var result = false;
var deptCode = $("#deptCode").val();
$.ajax({
url:"/admin/checkDuplicateDeptCode.do",
type:"POST",
data:{"deptCode":deptCode},
dataType:"json",
async:false,
success:function(data){
if(data.result == "false" || data.result == false || !data.result){
Swal.fire(data.msg);
}else{
result = true;
}
},
error: function(jqxhr, status, error){
}
});
return result;
}
</script>
</head>
<body>
<section id="commonSection">
<div class=admin_title>
<h2>기타업체 관리</h2>
</div>
<div id="adminPopupFormWrap">
<form id="form1" name="form1" method="post">
<table id="adminPopupForm">
<colgroup>
<col width="37%" />
<col width="63%" />
</colgroup>
<tbody>
<%-- <tr>
<td><label>업체구분</label></td>
<td><input type="text" title="업체명" name="locationName" id="locationName" value="${info.LOCATION_NAME}" maxlength="20" required></td>
</tr> --%>
<tr>
<td><label>부서코드</label></td>
<td><input type="text" title="부서코드" name="deptCode" id="deptCode" value="${info.DEPT_CODE}" maxlength="10" ${!empty info?'readonly':''} required></td>
</tr>
<tr>
<td><label>회사명</label></td>
<td><input type="text" title="회사명" name="companyName" id="companyName" value="${info.COMPANY_NAME}" maxlength="20" required></td>
</tr>
<tr>
<td><label>부서명</label></td>
<td><input type="text" title="부서명" name="deptName" id="deptName" value="${info.DEPT_NAME}" maxlength="20" required></td>
</tr>
<tr>
<td><label for="">활성화 여부</label></td>
<td>
<select name="status" id="status" type="select" title="활성화 여부" required>
<option value="">선택</option>
<option value="active" ${info.STATUS eq 'active' ? 'selected' : ''}>활성화</option>
<option value="inActive" ${info.STATUS eq 'inActive' ? 'selected' : ''}>비활성화</option>
</select>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div class="btnCenterWrap">
<center class="center_btns_wrap">
<input type="button" value="저장" class="btns" id="btnSave">
<input type="button" value="닫기" name="" id="btn_close" class="btns" onclick="javascript:self.close();">
</center>
</div>
</secsion>
</body>
</html>