Files
vexplor/WebContent/WEB-INF/view/eo/eoFormPopup.jsp
2025-08-21 09:41:46 +09:00

556 lines
17 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>
<c:set var="actionType" value="${param.actionType}" />
<c:set var="objId" value="${eoInfo.OBJID}" />
<c:set var="eoNo" value="${empty eoInfo.EO_NO ? '' : eoInfo.EO_NO}" />
<c:set var="eoIssueDate" value="${empty eoInfo.EO_ISSUE_DATE ? '' : eoInfo.EO_ISSUE_DATE}" />
<c:set var="hkmcDistributeDate" value="${empty eoInfo.HKMC_DISTRIBUTE_DATE ? '' : eoInfo.HKMC_DISTRIBUTE_DATE}" />
<c:set var="designTeam" value="${empty eoInfo.DESIGN_TEAM ? '' : eoInfo.DESIGN_TEAM}" />
<c:set var="oemObjId" value="${empty eoInfo.OEM_OBJID ? '' : eoInfo.OEM_OBJID}" />
<c:set var="carObjId" value="${empty eoInfo.CAR_OBJID ? '' : eoInfo.CAR_OBJID}" />
<c:set var="status" value="${empty eoInfo.STATUS ? '' : eoInfo.STATUS}" />
<c:set var="eoType" value="${empty eoInfo.EO_TYPE ? '' : eoInfo.EO_TYPE}" />
<c:set var="urgentDegree" value="${empty eoInfo.URGENT_DEGREE ? '' : eoInfo.URGENT_DEGREE}" />
<script type="text/javascript">
$(document).ready(
function() {
fnc_datepick();
fnc_setFileDropZone("dropzone", "${objId}", "EO_PDF", "EO 갑지 첨부파일", "pdfParser", true);
getConnectPartList();
$("#eoAttachFileList").hide();
$("#uploadedFileArea").hide();
if ("" != "${oemObjId}"){
getCarList("${oemObjId}", "${carObjId}");
}else{
getCarList($("#oem").val(), "");
}
fn_fileCallback();
getCardistributeList();
});
//고객사에 따른 차종의 목록을 가져온다.
function getCarList(oemObjid, carObjid) {
var carSelectObj = $("#car");
$(carSelectObj).find("option").remove();
$(carSelectObj).append("<option value=''>선택</option>");
if ("" == oemObjid || null == oemObjid) {
return false;
} else {
$.ajax({
type : "POST",
url : "/admin/getOEMsCarList.do",
data : {
"status" : "active",
"oemObjId" : oemObjid
},
dataType : "json",
async : false,
error : function(jqxhr, status, error) {
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
Swal.fire(jqxhr.status);
Swal.fire(jqxhr.responseText);
},
success : function(result) {
if (null != result) {
for (var i = 0; i < result.length; i++) {
var objid = result[i].OBJID;
var carName = result[i].CAR_NAME;
var carCode = result[i].CAR_CODE;
var carModelCode = result[i].MODEL_CODE;
$(carSelectObj).append(
"<option value='"+objid+"'>"+carCode+"</option>");
}
if ("" != carObjid) {
$(carSelectObj).val(carObjid);
//차종 선택 시 차종의 배포처를 가져온다.
getCardistributeList();
}
}
}
});
}
}
//차종에 해당하는 배포처를 가져온다.
function getCardistributeList(){
var carObjId = fnc_checkNull($("#car").val());
$("#distribution_men").empty();
$("#distribution_men").append("차종에 지정된 배포처가 없습니다.");
if(carObjId != ""){
$.ajax({
url : "/admin/getDistributeListAjax.do",
type : "POST",
data : {"search_carObjid":carObjId,"isJson":true},
dataType : "json",
async : false,
success : function(data) {
if (null != data) {
if(data.length > 0){
for(var i=0;i<data.length;i++){
var appendText = "";
appendText = data[i].DEPT_NAME+" "+data[i].USER_NAME;
if(i+1 != data.length){
appendText+=",";
}
$("#distribution_men").append(appendText);
}
}
}
},
error : function(jqxhr, status, error) {
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
Swal.fire(jqxhr.status);
Swal.fire(jqxhr.responseText);
}
});
}
}
//첨부된 PDF파일을 파싱하여 해당 문서의 데이터를 추출
function pdfParser() {
$.ajax({
url : "/eo/getPDFParsingData.do",
type : "POST",
data : {
"targetObjId" : "${objId}",
"docType" : "EO_PDF"
},
dataType : "json",
async : true,
success : function(data) {
if (null != data) {
$("#designTeam").val(fnc_checkNull(data.designTeam));
$("#eoNo").val(fnc_checkNull(data.eoNo));
$("#eoIssueDate").val(fnc_checkNull(data.eoDate));
$("#oem").val(fnc_checkNull(data.oemObjId));
if ("" != fnc_checkNull(data.oemObjId)) {
getCarList(fnc_checkNull(data.oemObjId),fnc_checkNull(data.carObjId));
}
$("#eoType").val(fnc_checkNull(data.eoType));
$("#urgentDegree").val(fnc_checkNull(data.emergencyLvl));
fn_fileCallback();
}
},
error : function(jqxhr, status, error) {
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
Swal.fire(jqxhr.status);
Swal.fire(jqxhr.responseText);
}
});
}
function fn_fileCallback() {
var objid = $("#objId").val();
if ("" != objid) {
$.ajax({
url : "/common/getFileList.do",
type : "POST",
data : {
"targetObjId" : objid,
"docType" : "EO_PDF"
},
dataType : "json",
async : true,
success : function(data) {
if (0 < data.length) {
//파일드롭다운 영역 hide
$("#dropzone").hide();
//첨부파일 목록 영역 show
$("#eoAttachFileList").show();
$("#uploadedFileArea").remove();
$
.each(
data,
function(i) {
var appendText = "";
appendText += "<tr>";
appendText += " <td><a href='javascript:fnc_downloadFile(\""
+ data[i].OBJID
+ "\")'>"
+ data[i].REAL_FILE_NAME
+ "</a></td>";
appendText += " <td><div class='delete_btn' onclick='javascript:fnc_deleteFile(\""
+ data[i].OBJID
+ "\", \"fn_fileCallback\")'></div></td>";
appendText += "</tr>";
$("#uploadedFileAreaTable")
.append(appendText);
});
} else {
$("#dropzone").show();
$("#eoAttachFileList").hide();
$("#uploadedFileArea").remove();
}
},
error : function(jqxhr, status, error) {
Swal.fire(jqxhr.statusText + ", " + status + ", "
+ error);
Swal.fire(jqxhr.status);
Swal.fire(jqxhr.responseText);
}
});
} else {
$("#dropzone").show();
$("#eoAttachFileList").hide();
$("#uploadedFileArea").remove();
}
}
function saveEO() {
if(fnc_valitate("form1")){
if(confirm("저장하시겠습니까?")){
var param = $("#form1").serialize();
$.ajax({
url : "/eo/saveEO.do",
type : "POST",
data : param,
dataType : "json",
async : true,
success : function(data) {
if ("" != data.message) {
Swal.fire(data.message);
opener.search();
self.close();
}
},
error : function(jqxhr, status, error) {
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
Swal.fire(jqxhr.status);
Swal.fire(jqxhr.responseText);
}
});
}
}
}
//연결된 part의 목록을 가져온다.
function getConnectPartList() {
var eoObjId = $("#objId").val();
$.ajax({
url : "/eo/getConnectPartList.do",
type : "POST",
data : {
"objId" : eoObjId
},
dataType : "json",
async : true,
success : function(result) {
if (null != result) {
$("#connectedPartList").empty();
if (0 < result.length) {
$("#partListDefault").hide();
for (var i = 0; i < result.length; i++) {
var attachText = "";
attachText += "<tr style='text-align:center;'>";
attachText += " <td>" + result[i].RNUM+ "</td>";
attachText += " <td><input type='checkBox' name='connectedPart' value='"+result[i].OBJID+"'></td>";
attachText += " <td>" + result[i].PART_NO+ "</td>";
attachText += " <td>" + result[i].PART_NAME+ "</td>";
attachText+= " <td>"+fnc_checkNull(result[i].CHANGE_ITEM_TITLE)+"</td>";
attachText += " <td>" + fnc_checkNull(result[i].REV)+ "</td>";
attachText += " <td>";
if (null != result[i].ECD_OBJID) {
attachText += "<a href='javascript:fnc_downloadFile('"+ result[i].ECD_OBJID+ "')'>Y</a>";
} else {
attachText += "N";
}
attachText += " </td>";
attachText += " <td>";
if (null != result[i].MNG_ITEM_FILE_OBJID) {
attachText += "<a href='javascript:fnc_downloadFile('"+ result[i].MNG_ITEM_FILE_OBJID+ "')'>Y</a>";
} else {
attachText += "N";
}
attachText += " </td>";
attachText += " <td>"+ fnc_checkNull(result[i].APPLY_POINT_NAME);
attachText += " </td>";
attachText += "</tr>";
$("#connectedPartList").append(attachText);
}
} else {
$("#partListDefault").show();
}
}
},
error : function(jqxhr, status, error) {
Swal.fire(jqxhr.statusText + ", " + status + ", "
+ error);
Swal.fire(jqxhr.status);
Swal.fire(jqxhr.responseText);
}
});
}
function openPartSearchPopUp() {
var form = document.form1;
window.open("", "openPartSearchPopUp","width=1500 height=560 menubar=no status=no");
form.action = "/eo/partSearchPopup.do";
form.target = "openPartSearchPopUp";
form.submit();
}
function deleteConnectedPart() {
var checkedPartLength = $("input[name='connectedPart']:checked").length;
if(0 < checkedPartLength){
var param = $("#form1").serialize();
$.ajax({
url : "/eo/disConnectPart.do",
type : "POST",
data : param,
dataType : "json",
async : true,
success : function(data) {
if ("" != data.message) {
Swal.fire(data.message);
getConnectPartList();
}
},
error : function(jqxhr, status, error) {
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
Swal.fire(jqxhr.status);
Swal.fire(jqxhr.responseText);
}
});
}else{
Swal.fire("선택된 파트가 없습니다.");
}
}
//전체 체크
function fn_allChk(obj) {
var checked = $(obj).is(":checked");
$("input[name=connectedPart]").each(function() {
if (checked)
this.checked = true;
else
this.checked = false;
});
}
</script>
</head>
<body class="backcolor">
<form name="form1" id="form1" method="post">
<input type="hidden" name="objId" id="objId" value="${objId}">
<input type="hidden" name="status" id="status" value="${status}">
<input type="hidden" name="actionType" id="actionType"
value="${actionType}">
<div class="">
<div class="plm_menu_name">
<h2>
<span>ECO 등록</span>
</h2>
</div>
<div id="eoPopup">
<div class="color_eoback">
<div id="eoPopupTtWrap">
<p id="eoPopupTt">engineering change order(ECO)갑지</p>
<table id="approvalTable" style="width:300px;">
<tr>
<td>SEQ</td>
<td>부서</td>
<td>이름</td>
<td>결재일</td>
</tr>
<c:choose>
<c:when test="${empty eoApprovalList}">
<tr>
<td colspan="4">결재내역이 없습니다.</td>
</tr>
</c:when>
<c:otherwise>
<c:forEach var="item" items="${eoApprovalList}" varStatus="varStatus">
<tr>
<td>${item.SEQ}</td>
<td>${item.DEPT_NAME}</td>
<td>${item.USER_NAME}</td>
<td>${item.PROC_DATE_TITLE}</td>
</tr>
</c:forEach>
</c:otherwise>
</c:choose>
</table>
</div>
<table id="eoPopuoSearchZon">
<tr>
<td><label for="" class="black_label">고객사</label></td>
<td>
<select name="oem" id="oem" onchange="getCarList(this.value,'${carObjId}')" type="select" reqTitle="고객사" required>
<c:choose>
<c:when test="${empty oemList}">
<option value="">선택</option>
</c:when>
<c:otherwise>
<option value="">선택</option>
<c:forEach var="item" items="${oemList}" varStatus="varStatus">
<c:if test="${item.OBJID eq oemObjId}">
<option value="${item.OBJID}" selected>${item.OEM_NAME}(${item.OEM_CODE})</option>
</c:if>
<c:if test="${'' eq oemObjId and (item.OEM_NAME eq 'HMC')}">
<option value="${item.OBJID}" selected>${item.OEM_NAME}(${item.OEM_CODE})</option>
</c:if>
<c:if test="${'' eq oemObjId and (item.OEM_NAME ne 'HMC')}">
<option value="${item.OBJID}">${item.OEM_NAME}(${item.OEM_CODE})</option>
</c:if>
</c:forEach>
</c:otherwise>
</c:choose>
</select>
</td>
<td><label for="" class="black_label">차종</label></td>
<td>
<select style="width: 170px;" name="car" id="car" required reqTitle="차종" type="select" onchange="getCardistributeList();">
</select>
</td>
<td><label for="" class="black_label">ECO종류</label></td>
<td>
<select style="width: 170px;" name="eoType" id="eoType" required reqTitle="EO 종류" type="select">
<option value="">선택</option>
<option value="regular" ${'regular' eq eoType ? 'selected' : ''}>정규</option>
<option value="tempApp" ${'tempApp' eq eoType ? 'selected' : ''}>임시적용</option>
</select>
</td>
<td><label for="" class="black_label">고객사 설계팀</label></td>
<td><input type="text" name="designTeam" id="designTeam" value="${designTeam}" required reqTitle="고객사 설계팀" type="select"></td>
</tr>
<tr>
<td><label for="" class="black_label">ECO No</label></td>
<td><input type="text" name="eoNo" id="eoNo" value="${eoNo}" required reqTitle="EO No"></td>
<td><label for="" class="black_label">EO Date</label></td>
<td><input type="text" name="eoIssueDate" id="eoIssueDate" class="input_date" value="${eoIssueDate}" required reqTitle="EO Date"></td>
<td><label for="" class="black_label">긴급도</label></td>
<td>
<select style="width: 170px;" name="urgentDegree" id="urgentDegree" required reqTitle="긴급도" type="select">
<option value="">선택</option>
<option value="normal" ${'normal' eq urgentDegree ? 'selected' : ''}>보통</option>
<option value="emergency" ${'emergency' eq urgentDegree ? 'selected' : ''}>긴급</option>
</select>
</td>
<td><label for="" class="black_label">구매배포일</label></td>
<td><input type="text" name="hkmcDistributeDate" id="hkmcDistributeDate" class="input_date" value="${hkmcDistributeDate}"></td>
</tr>
</table>
</div>
<div style="float: right; width: 40%;">
<div id="eoPopupFile" style="width: 65%;">
<label for="" class="orange_label">첨부</label>
<div id="fileDnDWrap">
<div id="dropzone">Drag & Drop Files Here</div>
<div id="eoAttachFileList">
<table id="uploadedFileAreaTable" class="spec_data_in_table">
<tbody id="uploadedFileArea">
</tbody>
</table>
</div>
</div>
</div>
<div id="pdmSearchBtnWrap" style="float: left; margin-top:10px;">
<input type="button" value="Part추가" class="plm_btns" onclick="openPartSearchPopUp();">
<input type="button" value="Part삭제" class="plm_btns" onclick="deleteConnectedPart();">
</div>
</div>
<div class="eo_table_side_margin">
<div>
<p class="eoPt">도면출도리스트</p>
<div class="plm_table_wrap">
<div style="overflow-y:scroll;">
<table class="plm_table">
<colgroup>
<col width="3%" />
<col width="2%" />
<col width="*" />
<col width="*" />
<col width="*%" />
<col width="3%" />
<col width="3%" />
<col width="4%" />
<col width="8%" />
</colgroup>
<thead>
<tr class="plm_thead">
<td>No</td>
<td><input type="checkbox" name="allCheck" id="allCheck" onclick="fn_allChk(this);"></td>
<td>품번</td>
<td>품명</td>
<td>변경내용</td>
<td>Rev</td>
<td>ECD</td>
<td>관리항목</td>
<td>설계적용시점</td>
</tr>
</thead>
</table>
</div>
</div>
<div class="plm_scroll_table" style="width:100%; height:300px;">
<table class="plm_table">
<colgroup>
<col width="3%" />
<col width="2%" />
<col width="*" />
<col width="*" />
<col width="*%" />
<col width="3%" />
<col width="3%" />
<col width="4%" />
<col width="8%" />
</colgroup>
<tr style="text-align: center;" id="partListDefault">
<td align="center" colspan="9">연결된 데이터가 없습니다.</td>
</tr>
<tbody id="connectedPartList">
</tbody>
</table>
</div>
</div>
<div class="eo_pop_btn_w">
<div class="eo_pop_btn_po">
<p id="dismen">배포처</p>
<p id="distribution_men"></p>
</div>
</div>
<div class="btn_wrap" style="clear:both; margin-top:60px;">
<div class="plm_btn_wrap_center">
<input type="button" value="저장" name="" id="" class="plm_btns" onclick="saveEO();">
<input type="button" value="닫기" name="" id="btn_close" class="plm_btns" onclick="javascript:self.close();">
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</body>
</html>