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

588 lines
23 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>
<!-- //jQuery script -->
<script>
$(function(){
$(document).ready(function(){
//첨부 파일 기능
fnc_setFileDropZone("problemDropZone", "${info.OBJID}", "${problemCode}", "${problemName}", "problemAreaDraw",true,null,null);
fnc_setFileDropZone("responseDropZone", "${info.OBJID}", "${responseCode}", "${responseName}", "responseAreaDraw",true,null,null);
fnc_setFileDropZone("reasonDropZone", "${info.OBJID}", "${reasonCode}", "${reasonName}", "reasonAreaDraw",true,null,null);
problemAreaDraw();
responseAreaDraw();
reasonAreaDraw();
//닫기
$("#btnClose").click(function(){
self.close(0);
});
//저장
$("#btnSave").click(function(){
fn_save();
});
//유형 change
$("#type1").change(function(){
fnc_setType2($(this).val(), "${info.TYPE2}");
});
$("#unManageTypeLebel").click(function(){
var isChecked = $("#unManageType").prop("checked");
if(isChecked){
$("#unManageType").prop("checked", false);
}else{
$("#unManageType").prop("checked", true);
}
});
$("#type1").trigger("change");
fnc_datepick();
$(".searchPart").click(function(){
fn_openSearchPart();
});
//사원조회
$(".searchEmployee").click(function(){
var params = "";
params += "?title=조치담당자 지정";
params += "&callback=fn_searchEmployeeCallback";
window.open("/common/searchEmployeePopup.do"+params, "", "width=480, height=400");
});
//취소
$("#btnCancel").click(function(){
var objId = $(this).attr("data-OBJID");
var params = "?objId="+objId;
document.form1.action ="/problem/problemDetailPopup.do"+params;
document.form1.submit();
});
});
});
</script>
<!-- //DOM script -->
<script>
//첨부파일 미리보기
function openImagePopUp(url){
var img=new Image();
img.src=url;
var img_width=img.width;
var img_height=img.height;
var win_width=img.width+25;
var height=img.height+30;
window.open(url,"problemShapeImgPopUp","width="+img_width+",height="+height+", menubars=no, scrollbars=yes'");
}
//사원조회 callback function
function fn_searchEmployeeCallback(userId, userName, deptName){
$("#resPICUserName").val("["+deptName+"] "+userName);
$("#resPIC").val(userId);
}
//첨부파일 목록을 가져온다.
function problemAreaDraw(){
fn_fileCallback("problem","${problemCode}");
}
function responseAreaDraw(){
fn_fileCallback("response","${responseCode}");
}
function reasonAreaDraw(){
fn_fileCallback("reason","${reasonCode}");
}
function fn_fileCallback(areaId,fileType){
$.ajax({
url:"/common/getFileList.do",
type:"POST",
data:{"targetObjId":"${info.OBJID}", "docType":fileType},
dataType:"json",
async:false,
success:function(data){
if("problem" == areaId){
callBackFn = "problemAreaDraw";
targetArea = "problemFileArea";
height = "130";
width = "auto";
maxWidth = "600";
}else if("response" == areaId){
callBackFn = "responseAreaDraw";
targetArea = "responseFileArea";
height = "230";
width = "auto";
maxWidth = "600";
}else{
callBackFn = "reasonAreaDraw";
targetArea = "reasonFileArea";
height = "130";
width = "auto";
maxWidth = "600";
}
if(0 < data.length){
//파일드롭다운 영역 hide
$("#"+areaId+"DropZone").hide();
//첨부파일 목록 영역 show
$("#"+areaId+"FileArea").empty();
$.each(data, function(i){
var appendText = "";
var path = data[i].FILE_PATH;
var fileName = data[i].SAVED_FILE_NAME;
var fileExt = data[i].UPPER_FILE_EXT;
if("${isResponsor}" && areaId == "problem"){
if(fileExt == "JPEG" || fileExt == "JPG"){
var srcLocation = encodeURI("/common/viewImage.do?realFileName="+data[i].REAL_FILE_NAME+"&savedFileName="+data[i].SAVED_FILE_NAME+"&attDir="+data[i].FILE_PATH);
appendText+= "<div id='"+targetArea+"' id=\"imgTd\">";
appendText+= " <img src='"+srcLocation+"' height='"+height+"'width='"+width+"' style='cursor:pointer;'/>";
appendText+= "</div>";
$("#"+areaId+"AttachFileList").append(appendText);
}else{
Swal.fire("형상에 업로드 가능한 확장자(jpeg,jpg)가 아닙니다.");
$("#"+areaId+"DropZone").show();
fileDelete(data[i].OBJID,"refeshAttachFileArea",false);
}
}
else{
if(fileExt == "JPEG" || fileExt == "JPG"){
var srcLocation = encodeURI("/common/viewImage.do?realFileName="+data[i].REAL_FILE_NAME+"&savedFileName="+data[i].SAVED_FILE_NAME+"&attDir="+data[i].FILE_PATH);
appendText+= "<div id='"+targetArea+"' id=\"imgTd\">";
appendText+= " <img src='"+srcLocation+"' height='"+height+"'width='"+width+"'onclick='openImagePopUp(this.src)' style='cursor:pointer;' /><div class='close_btn' onclick=\"fnc_deleteFile('"+data[i].OBJID+"','"+callBackFn+"')\"></div>";
appendText+= "</div>";
$("#"+areaId+"AttachFileList").append(appendText);
}else{
Swal.fire("형상에 업로드 가능한 확장자(jpeg,jpg)가 아닙니다.");
$("#"+areaId+"DropZone").show();
fileDelete(data[i].OBJID,"refeshAttachFileArea",false);
}
}
});
}else{
if("${isResponsor}" && areaId == "problem"){
//파일드롭다운 영역 hide
$("#"+areaId+"DropZone").hide();
//첨부파일 목록 영역 show
$("#"+areaId+"FileArea").remove();
} else {
//파일드롭다운 영역 hide
$("#"+areaId+"DropZone").show();
//첨부파일 목록 영역 show
$("#"+areaId+"FileArea").remove();
}
}
},
error: function(jqxhr, status, error){
}
});
}//파일 첨부 END
//search part
function fn_openSearchPart(){
var targetObjId = $("#objId").val();
var url = "/common/openSearchPartPopup.do?callback=setPartInfo&targetObjId="+targetObjId;
window.open(url, "searchPart", "width=600, height=400");
}
function setPartInfo(partObjId, partNo, partName){
$("#partNo").val(partNo);
$("#partName").val(partName);
}
//save
function fn_save(){
if(fnc_dateFormChk($("#reqDate").val(),$("#resPlanDate").val())){
if(fn_validate()){
if(confirm("저장하시겠습니까?")){
$.ajax({
url:"/problem/saveProblemInfo.do",
type:"POST",
data:$("#form1").serialize(),
dataType:"json",
success:function(data){
if(data.result == "true" || data.result == true || data.result){
opener.fn_refresh();
//self.close();
document.form1.action = "/problem/problemDetailPopup.do";
document.form1.submit();
}
},
error: function(jqxhr, status, error){
}
});
}
}
}
}
//정합성체크
function fn_validate(){
if($("#subject").val() == null || $("#subject").val() == ""){
Swal.fire("제목을 입력해 주시기 바랍니다.");
$("#subject").focus();
return false;
}
if($("#type1").val() == null || $("#type1").val() == ""){
Swal.fire("상위 유형을 선택해 주시기 바랍니다.");
$("#type1").focus();
return false;
}
if($("#type2").val() == null || $("#type2").val() == ""){
Swal.fire("하위 유형을 선택해 주시기 바랍니다.");
$("#type2").focus();
return false;
}
if($("#imputation").val() == null || $("#imputation").val() == ""){
Swal.fire("발행처를 선택해 주시기 바랍니다.");
$("#imputation").focus();
return false;
}
if($("#partNo").val() == null || $("#partNo").val() == ""){
Swal.fire("품번을 입력해 주시기 바랍니다.");
$("#partNo").focus();
return false;
}
if($("#partName").val() == null || $("#partName").val() == ""){
Swal.fire("품명을 입력해 주시기 바랍니다.");
$("#partName").focus();
return false;
}
if($("#reqDate").val() == null || $("#reqDate").val() == ""){
Swal.fire("제기일을 입력해 주시기 바랍니다.");
$("#reqDate").focus();
return false;
}
return true;
}
//첨부 파일 삭제
function fileDelete(fileObjId, callbackFnc, confirmFlag){
if(confirmFlag){
fnc_deleteFile(fileObjId,callbackFnc);
}else{
$.ajax({
url:"/common/deleteFileInfo.do",
type:"POST",
data:{"objId":fileObjId},
dataType:"json",
async :true,
success:function(data){
eval(callbackFnc+"();");
},
error: function(jqxhr,status, error){
}
});
}
}
</script>
</head>
<body>
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="targetObjId" id="targetObjId" value="${empty param.targetObjId?info.targetObjId:param.targetObjId}" />
<input type="hidden" name="objId" id="objId" value="${info.OBJID}" />
<div class="plm_menu_name">
<h2>
<span>문제점 등록</span>
</h2>
</div>
<section class="contents_page_basic_margin">
<div id="plmSearchZon" class="td_padding_short" style="width:97%; clear:both; border:1px solid #d4d4d4; margin-top:15px;">
<table style="width:100%; margin:0 auto;">
<colgroup>
<col width="50px;">
<col width="190px">
<col width="70px;">
<col width="160px;">
<col width="110px;">
<col width="160px;">
<col width="70px;">
<col width="160px;">
<col width="100px;">
<col width="150px;">
</colgroup>
<tr>
<td><label for="">유형</label></td>
<td>
<c:choose>
<c:when test="${isResponsor}">
<input type="hidden" name="type1" id="type1" value="${info.TYPE1}" />
<input type="hidden" name="type2" id="type2" value="${info.TYPE2}" />
<span class="tr_data_border_bottom">
<c:choose>
<c:when test="${info.TYPE1 eq 'design'}">
설계
</c:when>
<c:when test="${info.TYPE1 eq 'mold'}">
금형/단품
</c:when>
<c:when test="${info.TYPE1 eq 'facilities'}">
조립/설비
</c:when>
<c:when test="${info.TYPE1 eq 'etc'}">
부자재/기타
</c:when>
<c:otherwise>
${info.TYPE1}
</c:otherwise>
</c:choose>
/ ${info.TYPE2}
</span>
</c:when>
<c:otherwise>
<select name="type1" id="type1" style="width:97px;">
<option value="">선택</option>
<option value="design" ${info.TYPE1 eq 'design'?'selected':''}>설계</option>
<option value="mold" ${info.TYPE1 eq 'mold'?'selected':''}>금형/단품</option>
<option value="facilities" ${info.TYPE1 eq 'facilities'?'selected':''}>조립/설비</option>
<option value="etc" ${info.TYPE1 eq 'etc'?'selected':''}>부자재/기타</option>
</select>
<select name="type2" id="type2" style="width:73px;">
<option value="">선택</option>
</select>
</c:otherwise>
</c:choose>
</td>
<td><label for="">발생처</label></td>
<td>
<c:choose>
<c:when test="${isResponsor}">
<input type="hidden" name="imputation" id="imputation" value="${info.IMPUTATION}" />
<span class="tr_data_border_bottom">
<c:choose>
<c:when test="${info.IMPUTATION eq 'self'}">
사내
</c:when>
<c:when test="${info.IMPUTATION eq 'oem'}">
고객사
</c:when>
<c:when test="${info.IMPUTATION eq 'subcontractor'}">
협력업체
</c:when>
<c:otherwise>
${info.IMPUTATION}
</c:otherwise>
</c:choose>
</span>
</c:when>
<c:otherwise>
<select name="imputation" id="imputation" >
<option value="">선택</option>
<option value="self" ${info.IMPUTATION eq 'self'?'selected':''}>사내</option>
<option value="oem" ${info.IMPUTATION eq 'oem'?'selected':''}>고객사</option>
<option value="subcontractor" ${info.IMPUTATION eq 'subcontractor'?'selected':''}>협력업체</option>
</select>
</c:otherwise>
</c:choose>
</td>
<td><label for="">과거차 대상여부</label></td>
<td>
<c:choose>
<c:when test="${isResponsor}">
<input type="hidden" name="continualMngType" id="continualMngType" value="${info.CONTINUAL_MNG_TYPE}" />
<span class="tr_data_border_bottom">
<c:choose>
<c:when test="${info.CONTINUAL_MNG_TYPE eq 'Y'}">
대상
</c:when>
<c:when test="${info.CONTINUAL_MNG_TYPE eq 'N'}">
비대상
</c:when>
<c:otherwise>
${info.CONTINUAL_MNG_TYPE}
</c:otherwise>
</c:choose>
</span>
</c:when>
<c:otherwise>
<select name="continualMngType" id="continualMngType">
<option value="">선택</option>
<option value="Y" ${info.CONTINUAL_MNG_TYPE eq 'Y'?'selected':''}>대상</option>
<option value="N" ${info.CONTINUAL_MNG_TYPE eq 'N'?'selected':''}>비대상</option>
</select>
</c:otherwise>
</c:choose>
</td>
<td><label for="">제기일</label></td>
<td>
<c:choose>
<c:when test="${isResponsor}">
<input type="hidden" name="reqDate" id="reqDate" value="${info.REQ_DATE}" />
<span class="tr_data_border_bottom">
${info.REQ_DATE}
</span>
</c:when>
<c:otherwise>
<input type="text" name="reqDate" id="reqDate" style="width:152px;" value="${info.REQ_DATE}">
</c:otherwise>
</c:choose>
</td>
<td><label for="">조치요청일</label></td>
<td>
<c:choose>
<c:when test="${isResponsor}">
<input type="hidden" name="resPlanDate" id="resPlanDate" value="${info.RES_PLAN_DATE}" />
<span class="tr_data_border_bottom">
${info.RES_PLAN_DATE}
</span>
</c:when>
<c:otherwise>
<input type="text" name="resPlanDate" id="resPlanDate" style="width:152px;" value="${info.RES_PLAN_DATE}">
</c:otherwise>
</c:choose>
</td>
</tr>
<td><label for="">품번</label></td>
<td>
<c:choose>
<c:when test="${isResponsor}">
<input type="hidden" name="partNo" id="partNo" value="${info.PART_NO}" />
<span class="tr_data_border_bottom">
${info.PART_NO}
</span>
</c:when>
<c:otherwise>
<input type="text" name="partNo" id="partNo" style="width:152px;" value="${info.PART_NO}" class="searchPart" readonly><span class="search_btn searchPart"></span>
</c:otherwise>
</c:choose>
</td>
<td><label for="">품명</label></td>
<td colspan="3">
<c:choose>
<c:when test="${isResponsor}">
<input type="hidden" name="partName" id="partName" value="${info.PART_NAME}" />
<span class="tr_data_border_bottom">
${info.PART_NAME}
</span>
</c:when>
<c:otherwise>
<input type="text" name="partName" id="partName" style="width:95%;" value="${info.PART_NAME}" class="searchPart" readonly><span class="search_btn searchPart"></span>
</c:otherwise>
</c:choose>
</td>
<td><label for="">제목</label></td>
<td colspan="3">
<c:choose>
<c:when test="${isResponsor}">
<input type="hidden" name="subject" id="subject" value="${info.SUBJECT}" maxlength="120"/>
<span class="tr_data_border_bottom" title="${info.SUBJECT}">
${info.SUBJECT}
</span>
</c:when>
<c:otherwise>
<input type="text" name="subject" id="subject" style="width:100%;" value="${info.SUBJECT}" maxlength="128">
</c:otherwise>
</c:choose>
</td>
</tr>
</table>
</div>
<table id="problemManageMentPopupPpt">
<tr>
<td class="ppt_thead" style="width: 50%;">문제점</td>
<td colspan="8" class="ppt_thead">개선대책</td>
</tr>
<tr class="ppt_tbody_contents1">
<td class="textarea_detail" rowspan="2">
<textarea name="problemContents" id="problemContents" placeholder="내용을 입력하세요." ${isResponsor?'style="cursor:help;" title="조치자는 문제점을 수정하실 수 없습니다." readonly':''}>${info.PROBLEM_CONTENTS}</textarea>
</td>
<td colspan="8"><textarea name="responseContents" id="responseContents" placeholder="내용을 입력하세요." >${info.RESPONSE_CONTENTS}</textarea></td>
</tr>
<tr>
<td colspan="8" class="ppt_thead">조치내용</td>
</tr>
<tr class="ppt_tbody_contents1" style="height:150px;">
<td class="img_insert" id="problemAttachFileList"><div id="problemDropZone" class="dropzone" style="width:99%; margin:0 auto; height:100%; line-height:140px; text-align:center;">Drag & Drop Files Here</div></td>
<td colspan="8" rowspan="5" class="img_insert" id="responseAttachFileList" ></div><div id="responseDropZone" class="dropzone" style="width:99%; margin:0 auto; line-height:343px; height:100%;">Drag & Drop Files Here</div></td>
</tr>
<tr>
<td class="ppt_thead">원인</td>
</tr>
<tr>
<td style="" class="">
<div class="ridio_zone" style="cursor:help;" title="이 체크박스가 체크될 경우 문제점으로 등록은 되나 현황관리는 하지않습니다." id="unManageTypeLebel">
<font color="red"><b>※ 미조치 대상여부</b></font>
<input type="checkbox" name="unManageType" id="unManageType" value="Y" style="cursor:help;" ${!empty info.UNMANAGE_TYPE?'checked':''}>
</div>
</td>
</tr>
<tr>
<td>
<textarea name="problemReasonContents" id="problemReasonContents" placeholder="내용을 입력하세요." style="height:80px;" >${info.PROBLEM_REASON_CONTENTS}</textarea>
</td>
</tr>
<tr style="height:70px;">
<td rowspan="5" class="img_insert" id="reasonAttachFileList"><div id="reasonDropZone" class="dropzone" style="width:99%; margin:0 auto; height:100%; line-height:140px;">Drag & Drop Files Here</div></td>
</tr>
<tr class="td_height_20">
<td rowspan="4" class="ppt_thead">제기</td>
<td colspan="2" class="">${problemGroupInfo.WRITER_USER_TYPE_NAME}</td>
<td rowspan="4" class="ppt_thead">조치</td>
<td class="">${problemGroupInfo.RES_PIC_USER_TYPE_NAME}</td>
<td class="">수정일</td>
<td class="ppt_thead" rowspan="4">적용</td>
<td class="">반영예정</td>
</tr>
<tr>
<td colspan="2">${problemGroupInfo.WRITER_DEPT_NAME} ${problemGroupInfo.WRITER_USER_NAME}</td>
<td>${problemGroupInfo.CAR_CODE} TFT</td>
<td rowspan="3">
<c:if test="${isResponsor}">
<input type="text" name="resModifyDate" id="resModifyDate" style="width:100%; height:19px;" value="${info.RES_MODIFY_DATE}">
</c:if>
</td>
<td>
<c:if test="${isResponsor}">
<input type="text" name="reflectPlanDate" id="reflectPlanDate" style="width:100%;" value="${info.REFLECT_PLAN_DATE}">
</c:if>
</td>
</tr>
<tr>
<td>${problemGroupInfo.STEP2}</td>
<td>${info.REQ_DATE}</td>
<td>${problemGroupInfo.RES_PIC_DEPT_NAME}</td>
<td class="">반영여부</td>
</tr>
<tr>
<td colspan="2"></td>
<td>${problemGroupInfo.RES_PIC_USER_NAME}</td>
<td>
<c:if test="${isResponsor}">
<select name="reflectResult" id="reflectResult" style="width:100%;">
<option value="">선택</option>
<option value="Y" ${info.REFLECT_RESULT eq 'Y'?'selected':''}>Y</option>
<option value="N" ${info.REFLECT_RESULT eq 'N'?'selected':''}>N</option>
</select>
</c:if>
</td>
</tr>
</table>
<div class="btn_wrap" style="margin-top:5px;">
<div class="plm_btn_wrap_center">
<input type="button" value="저장" class="plm_btns" id="btnSave">
<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="닫기" class="plm_btns" id="btnClose">
</div>
</div>
</section>
</form>
</body>
</html>