ERP-node/WebContent/WEB-INF/view/problem/problemGroupFormPopup.jsp

437 lines
12 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">
<title><%=Constants.SYSTEM_NAME%></title>
</head>
<script>
var connector = "${connector}";
$(document).ready(function(){
//고객사 setting
fn_setOEMList();
//제품군 setting
fn_setProductGroupList();
//검사명 setting
fn_setTestTypeList();
//고객사별 차종 목록 조회
$("#oemObjId").change(function(){
var oemObjId = $(this).val();
fn_setCarTypeList(oemObjId);
});
//제품군별 제품 목록 조회
$("#prodGroupObjId").change(function(){
var productGroupObjId = $(this).val();
fn_setProductList(productGroupObjId);
});
//닫기
$("#btnClose").click(function(){
self.close(0);
});
//저장
$("#btnSave").click(function(){
fn_save();
});
//취소
$("#btnCancel").click(function(){
var objId = $(this).attr("data-OBJID");
var params = "?objId="+objId;
document.form1.action ="/problem/problemGroupDetailPopup.do"+params;
document.form1.submit();
});
//단계 change
$("#step1").change(function(){
fnc_setStep2($(this).val(), "${info.STEP2}");
});
//단계1 change trigger
$("#step1").trigger("change");
//사원조회
$(".searchEmployee").click(function(){
var params = "";
params += "?title=조치담당자 지정";
params += "&callback=fn_searchEmployeeCallback";
window.open("/common/searchEmployeePopup.do"+params, "", "width=480, height=400");
});
});
</script>
<script>
//사원조회 callback function
function fn_searchEmployeeCallback(userId, userName, deptName){
//Swal.fire("parent "+"userId : "+userId+", userName : "+userName+", deptName : "+deptName);
$("#resPICUserName").val("["+deptName+"] "+userName);
$("#resPIC").val(userId);
}
//save
function fn_save(){
if(fn_validate()){
if(confirm("저장하시겠습니까?")){
$.ajax({
url:"/problem/saveProblemGroupInfo.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
success:function(data){
if(fnc_checkTrue(data.result)){
opener.fn_search();
self.close(0);
}
},
error: function(jqxhr, status, error){
}
});
}
}
}
//oem 목록 조회
function fn_setOEMList(){
$.ajax({
url:"/common/getOEMList.do",
type:"POST",
data:{"isJson":true},
dataType:"json",
success:function(data){
var appendCode = "";
$.each(data, function(i){
appendCode += "<option value='"+data[i].OBJID+"'>"+data[i].OEM_NAME+"("+data[i].OEM_CODE+")</option>";
});
$("#oemObjId").append(appendCode);
var dbVal = fnc_checkNull("${info.OEM_OBJID}");
if(dbVal != ""){
$("#oemObjId > option[value="+dbVal+"]").attr("selected", "true");
$("#oemObjId").trigger("change");
}
},
error: function(jqxhr, status, error){
}
});
}
//car 목록 조회
function fn_setCarTypeList(oemObjId){
if(fnc_checkNull(oemObjId) != ""){
$.ajax({
url:"/common/getCarTypeList.do",
type:"POST",
data:{"isJson":true, "search_oemObjId":oemObjId},
dataType:"json",
success:function(data){
var appendCode = "<option value=''>선택</option>";
$.each(data, function(i){
appendCode += "<option value='"+data[i].OBJID+"'>"+data[i].CAR_CODE+"("+data[i].CAR_NAME+")</option>";
});
$("#carObjId").children().remove();
$("#carObjId").append(appendCode);
$("#carObjId > option[value=${info.CAR_OBJID}]").attr("selected", "true");
},
error: function(jqxhr, status, error){
}
});
}else{
$("#carObjId").children().remove();
$("#carObjId").append("<option value=''>선택</option>");
}
}
//product group 목록 조회
function fn_setProductGroupList(){
$.ajax({
url:"/common/getProductGroupList.do",
type:"POST",
data:{"isJson":true},
dataType:"json",
success:function(data){
var appendCode = "";
$.each(data, function(i){
appendCode += "<option value='"+data[i].OBJID+"'>"+data[i].PRODUCT_GROUP_NAME+"</option>";
});
$("#prodGroupObjId").append(appendCode);
var dbVal = fnc_checkNull("${info.PROD_GROUP_OBJID}");
if(dbVal != ""){
$("#prodGroupObjId > option[value="+dbVal+"]").attr("selected", "true");
$("#prodGroupObjId").trigger("change");
}
},
error: function(jqxhr, status, error){
}
});
}
//product 목록 조회
function fn_setProductList(productGroupObjId){
if(fnc_checkNull(productGroupObjId) != ""){
$.ajax({
url:"/common/getProductList.do",
type:"POST",
data:{"isJson":true, "search_productGroupObjId":productGroupObjId},
dataType:"json",
success:function(data){
var appendCode = "<option value=''>선택</option>";
$.each(data, function(i){
appendCode += "<option value='"+data[i].OBJID+"'>"+data[i].PRODUCT_NAME+"</option>";
});
$("#prodObjId").children().remove();
$("#prodObjId").append(appendCode);
$("#prodObjId > option[value=${info.PROD_OBJID}]").attr("selected", "true");
},
error: function(jqxhr, status, error){
}
});
}else{
$("#prodObjId").children().remove();
$("#prodObjId").append("<option value=''>선택</option>");
}
}
//검사명 목록 조회
function fn_setTestTypeList(){
$.ajax({
url:"/common/getTestTypeList.do",
type:"POST",
data:{"isJson":true},
dataType:"json",
success:function(data){
var appendCode = "";
$.each(data, function(i){
appendCode += "<option value='"+data[i].OBJID+"'>"+data[i].TEST_TYPE_NAME+"</option>";
});
$("#testTypeObjId").append(appendCode);
var dbVal = fnc_checkNull("${info.TEST_TYPE_OBJID}");
if(dbVal != ""){
$("#testTypeObjId > option[value="+dbVal+"]").attr("selected", "true");
}
},
error: function(jqxhr, status, error){
}
});
}
//정합성체크
function fn_validate(){
if($("#region").val() == null || $("#region").val() == ""){
Swal.fire("지역을 선택해 주시기 바랍니다.");
$("#region").focus();
return false;
}
if($("#oemObjId").val() == null || $("#oemObjId").val() == ""){
Swal.fire("고객사를 선택해 주시기 바랍니다.");
$("#oemObjId").focus();
return false;
}
if($("#carObjId").val() == null || $("#carObjId").val() == ""){
Swal.fire("차종을 선택해 주시기 바랍니다.");
$("#carObjId").focus();
return false;
}
if($("#prodGroupObjId").val() == null || $("#prodGroupObjId").val() == ""){
Swal.fire("제품군을 선택해 주시기 바랍니다.");
$("#prodGroupObjId").focus();
return false;
}
if($("#prodObjId").val() == null || $("#prodObjId").val() == ""){
Swal.fire("제품을 선택해 주시기 바랍니다.");
$("#prodObjId").focus();
return false;
}
if($("#step1").val() == null || $("#step1").val() == ""){
Swal.fire("상위단계를 선택해 주시기 바랍니다.");
$("#step1").focus();
return false;
}
if($("#step2").val() == null || $("#step2").val() == ""){
Swal.fire("하위단계를 선택해 주시기 바랍니다.");
$("#step2").focus();
return false;
}
if($("#testTypeObjId").val() == null || $("#testTypeObjId").val() == ""){
Swal.fire("검사명을 선택해 주시기 바랍니다.");
$("#testTypeObjId").focus();
return false;
}
if($("#resPICUserName").val() == null || $("#resPICUserName").val() == ""){
Swal.fire("담당자를 입력해 주시기 바랍니다.");
return false;
}
if($("#resPIC").val() == connector){
if(connector != "plm_admin"){
Swal.fire("제기자와 조치자는 같을 수 없습니다.");
return false;
}
}
if($("#title").val() == null || $("#title").val() == ""){
Swal.fire("제목을 입력해 주시기 바랍니다.");
$("#title"). focus();
return false;
}
return true;
}
</script>
<body>
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="objId" id="objId" value="${info.OBJID}" />
<input type="hidden" name="resPIC" id="resPIC" value="${info.RES_PIC}">
<section style="min-width:580px;">
<div class="plm_menu_name">
<h2>
<span>제품문제점관리</span>
</h2>
</div>
<div id="businessPopupFormWrap">
<div class="form_popup_title">&nbsp;&nbsp;&nbsp;갑지등록 정보입력</div>
<table class="pmsPopupForm">
<colgroup>
<col width="13%"/>
<col width="18%"/>
<col width="18%"/>
<col width="15%"/>
<col width="20%"/>
<col width="*"/>
</colgroup>
<tr>
<td class="input_title">
<label for="">지역</label>
</td>
<td colspan="2">
<select name="region" id="region" style="">
<option value="">선택</option>
<option value="D" ${info.REGION eq 'D'?'selected':''}>국내</option>
<option value="F" ${info.REGION eq 'F'?'selected':''}>해외</option>
</select>
</td>
</tr>
<tr>
<td class="input_title">
<label for="">고객사</label>
</td>
<td colspan="2">
<select name="oemObjId" id="oemObjId" >
<option value="">선택</option>
</select>
</td>
<td class="input_title">
<label for="">차종</label>
</td>
<td colspan="2">
<select name="carObjId" id="carObjId">
<option value="">선택</option>
</select>
</td>
</tr>
<tr>
<td class="input_title">
<label for="">제품군</label>
</td>
<td colspan="2">
<select name="prodGroupObjId" id="prodGroupObjId" style="">
<option value="">선택</option>
</select>
</td>
<td class="input_title">
<label for="">제품</label>
</td>
<td colspan="2">
<select name="prodObjId" id="prodObjId">
<option value="">선택</option>
</select>
</td>
</tr>
<tr>
<td class="input_title"><label for="">단계</label></td>
<td colspan="2">
<select name="step1" id="step1" style="width:90px;">
<option value="">선택</option>
<option value="design" ${info.STEP1 eq 'design'?'selected':''}>설계</option>
<option value="develop" ${info.STEP1 eq 'develop'?'selected':''}>개발</option>
<option value="production" ${info.STEP1 eq 'production'?'selected':''}>양산</option>
</select>
<select name="step2" id="step2" style="width:91px;">
<option value="">선택</option>
</select>
</td>
<td class="input_title">
<label for="">검사명</label>
</td>
<td colspan="2">
<select name="testTypeObjId" id="testTypeObjId">
<option value="">선택</option>
</select>
</td>
</tr>
<tr>
<td class="input_title">
<label for="">조치담당자</label>
</td>
<td colspan="2">
<input type="text" name="resPICUserName" id="resPICUserName" value="${info.RES_PIC_USER_NAME}" style="width:90%;" readonly><span class="search_btn searchEmployee"></span>
</td>
</tr>
<tr>
<td class="input_title">
<label for="">제목</label>
</td>
<td colspan="5">
<input type="text" name="title" id="title" value="${info.TITLE}" style="width:96%;" maxlength="128">
</td>
</tr>
</table>
<div class="btn_wrap">
<div class="plm_btn_wrap_center">
<input type="button" value="저장" id="btnSave" class="plm_btns">
<c:choose>
<c:when test="${param.actionType eq 'regist'}">
</c:when>
<c:otherwise>
<input type="button" id="btnCancel" value="취소" class="plm_btns" data-OBJID="${info.OBJID}">
</c:otherwise>
</c:choose>
<input type="button" value="닫기" id="btnClose" class="plm_btns">
</div>
</div>
</div>
</section>
</form>
</body>
</html>