528 lines
17 KiB
Plaintext
528 lines
17 KiB
Plaintext
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||
<%@ page import="com.pms.common.utils.*"%>
|
||
<%@ page import="java.util.*" %>
|
||
<%@include file= "/init_new.jsp" %>
|
||
<%
|
||
String menuObjId = request.getParameter("menuObjId");
|
||
String actionType = CommonUtils.checkNull(request.getParameter("actionType"));
|
||
// 뷰 모드인지 판단
|
||
boolean isViewMode = "view".equals(actionType);
|
||
String menuName = isViewMode ? "조치결과 조회" : CommonUtils.getMenuName(menuObjId, "조치결과 등록");
|
||
|
||
Map info = (Map)request.getAttribute("info");
|
||
if(info == null) info = new HashMap();
|
||
|
||
String objId = CommonUtils.checkNull(info.get("objid"));
|
||
|
||
// 오늘 날짜
|
||
String today = new java.text.SimpleDateFormat("yyyy-MM-dd").format(new java.util.Date());
|
||
String actionDate = CommonUtils.checkNull(info.get("action_date"));
|
||
if(actionDate.isEmpty()) actionDate = today;
|
||
|
||
// 조치자
|
||
String actionUserName = CommonUtils.checkNull(info.get("action_user_name"));
|
||
if(actionUserName.isEmpty()) actionUserName = connectUserName;
|
||
%>
|
||
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
<title><%=Constants.SYSTEM_NAME%></title>
|
||
<style>
|
||
body { min-height: auto !important; }
|
||
.two_column_container {
|
||
display: flex;
|
||
gap: 15px;
|
||
padding: 10px;
|
||
}
|
||
.two_column_container > div {
|
||
flex: 1;
|
||
}
|
||
.two_column_container .pmsPopuptable tr {
|
||
height: 38px;
|
||
}
|
||
</style>
|
||
</head>
|
||
|
||
<script type="text/javascript">
|
||
var isViewMode = <%=isViewMode%>;
|
||
|
||
$(document).ready(function(){
|
||
fnc_datepick();
|
||
$('.select2').select2();
|
||
|
||
// 기존 값 선택
|
||
var savedBlameDecision = "${info.blame_decision}";
|
||
var savedStatus = "${info.status}";
|
||
if(savedBlameDecision) $("#BLAME_DECISION").val(savedBlameDecision).trigger('change');
|
||
if(savedStatus) $("#STATUS").val(savedStatus).trigger('change');
|
||
|
||
// 뷰 모드일 경우 입력 필드 비활성화
|
||
if(isViewMode){
|
||
$("#form1 input, #form1 textarea, #form1 select").prop("disabled", true);
|
||
$("#btnSave, #btnUpload, #btnImgUpload, #file1, #imgFile1").hide();
|
||
// 파일 삭제 버튼 숨기기
|
||
$(".delete_btn").parent().hide();
|
||
} else {
|
||
// 첨부파일 드래그앤드랍 설정 (뷰 모드가 아닐 때만)
|
||
fnc_setFileDropZone("srDropZone", "<%=objId%>", "CUSTOMER_CS_ACTION", "조치첨부", "srAreaDraw", false, null, null, null, "");
|
||
}
|
||
srAreaDraw();
|
||
imgAreaDraw();
|
||
|
||
// 파일 업로드 버튼
|
||
$("#btnUpload").click(function(){
|
||
var files = $("#file1")[0].files;
|
||
if(files.length > 0){
|
||
fnc_fileMultiUpload(files, null, "<%=objId%>", "CUSTOMER_CS_ACTION", "조치첨부", null, "srAreaDraw", null, "");
|
||
$("#file1").val("");
|
||
}else{
|
||
Swal.fire("선택된 파일이 없습니다.");
|
||
}
|
||
});
|
||
|
||
// 이미지 업로드 버튼
|
||
$("#btnImgUpload").click(function(){
|
||
var files = $("#imgFile1")[0].files;
|
||
if(files.length > 0){
|
||
// 이미지 파일 확장자 검사
|
||
var allowedExts = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'];
|
||
for(var i = 0; i < files.length; i++){
|
||
var ext = files[i].name.split('.').pop().toLowerCase();
|
||
if(allowedExts.indexOf(ext) < 0){
|
||
Swal.fire("이미지 파일만 업로드 가능합니다. (jpg, jpeg, png, gif, bmp, webp)");
|
||
return;
|
||
}
|
||
}
|
||
fnc_fileMultiUpload(files, null, "<%=objId%>", "CUSTOMER_CS_IMAGE", "조치이미지", null, "imgAreaDraw", null, "");
|
||
$("#imgFile1").val("");
|
||
}else{
|
||
Swal.fire("선택된 파일이 없습니다.");
|
||
}
|
||
});
|
||
|
||
// 저장
|
||
$("#btnSave").click(function(){
|
||
fn_save();
|
||
});
|
||
|
||
// 닫기
|
||
$("#btnClose").click(function(){
|
||
window.close();
|
||
});
|
||
});
|
||
|
||
// 첨부파일 목록 새로고침
|
||
function srAreaDraw(){
|
||
fn_fileCallback("sr", "CUSTOMER_CS_ACTION");
|
||
}
|
||
|
||
// 이미지 목록 새로고침
|
||
function imgAreaDraw(){
|
||
fn_imageCallback("img", "CUSTOMER_CS_IMAGE");
|
||
}
|
||
|
||
// 이미지 목록 조회
|
||
function fn_imageCallback(areaId, fileType){
|
||
$.ajax({
|
||
url: "/common/getFileList.do",
|
||
type: "POST",
|
||
data: {"targetObjId": "<%=objId%>", "docType": fileType},
|
||
dataType: "json",
|
||
async: false,
|
||
success: function(data){
|
||
$("#" + areaId + "FileArea").empty();
|
||
if(data.length > 0){
|
||
$.each(data, function(i){
|
||
var appendHtml = '<div style="display:inline-block; margin:5px; text-align:center; cursor:pointer; position:relative;" onclick="fn_viewImage(\'/common/downloadFile.do?objId=' + data[i].OBJID + '\')">';
|
||
appendHtml += '<img src="/common/downloadFile.do?objId=' + data[i].OBJID + '" style="width:80px; height:80px; object-fit:cover; border:1px solid #ddd; border-radius:4px;">';
|
||
if(!isViewMode){
|
||
appendHtml += '<a href="javascript:fn_imageDelete(\'' + data[i].OBJID + '\', event)" style="position:absolute; top:-5px; right:-5px; background:#ff4444; color:#fff; border-radius:50%; width:18px; height:18px; line-height:18px; text-align:center; font-size:12px; text-decoration:none;">×</a>';
|
||
}
|
||
appendHtml += '<div style="font-size:10px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:80px;" title="' + data[i].REAL_FILE_NAME + '">' + data[i].REAL_FILE_NAME + '</div>';
|
||
appendHtml += '</div>';
|
||
$("#" + areaId + "FileArea").append(appendHtml);
|
||
});
|
||
}else{
|
||
$("#" + areaId + "FileArea").append('<div style="color:#999; padding:10px;">등록된 이미지가 없습니다.</div>');
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
// 이미지 원본 보기
|
||
function fn_viewImage(imgSrc){
|
||
var img = new Image();
|
||
img.onload = function(){
|
||
var width = Math.min(this.width, 1200);
|
||
var height = Math.min(this.height, 800);
|
||
window.open(imgSrc, "_blank", "width=" + width + ",height=" + height + ",scrollbars=yes,resizable=yes");
|
||
};
|
||
img.src = imgSrc;
|
||
}
|
||
|
||
// 이미지 삭제
|
||
function fn_imageDelete(fileObjId, event){
|
||
if(event){
|
||
event.preventDefault();
|
||
event.stopPropagation();
|
||
}
|
||
if(isViewMode) return;
|
||
|
||
if(confirm("이미지를 삭제하시겠습니까?")){
|
||
$.ajax({
|
||
url: "/common/deleteFileInfo.do",
|
||
type: "POST",
|
||
data: {"objId": fileObjId},
|
||
dataType: "json",
|
||
async: false,
|
||
success: function(data){
|
||
imgAreaDraw();
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
// 첨부파일 목록 조회
|
||
function fn_fileCallback(areaId, fileType){
|
||
$.ajax({
|
||
url: "/common/getFileList.do",
|
||
type: "POST",
|
||
data: {"targetObjId": "<%=objId%>", "docType": fileType},
|
||
dataType: "json",
|
||
async: false,
|
||
success: function(data){
|
||
$("#" + areaId + "FileArea").empty();
|
||
if(data.length > 0){
|
||
$.each(data, function(i){
|
||
var appendText = "";
|
||
var fileExt = data[i].UPPER_FILE_EXT;
|
||
appendText += "<tr>";
|
||
appendText += "<td>" + (i + 1) + "</td>";
|
||
if(fileExt == 'PDF'){
|
||
appendText += "<td class='align_l'><a href='javascript:fnc_viewPdfFile(\"" + data[i].OBJID + "\")'> " + data[i].REAL_FILE_NAME + "</a>";
|
||
}else{
|
||
appendText += "<td class='align_l'><a href='javascript:fnc_downloadFile(\"" + data[i].OBJID + "\")'> " + data[i].REAL_FILE_NAME + "</a>";
|
||
}
|
||
// 뷰 모드가 아닐 때만 삭제 버튼 표시
|
||
if(!isViewMode){
|
||
appendText += "<a href='javascript:fn_fileDelete(\"" + data[i].OBJID + "\")'><div class='delete_btn'></div></a>";
|
||
}
|
||
appendText += "</td>";
|
||
appendText += "<td>" + data[i].REGDATE + "</td>";
|
||
appendText += "<td>" + data[i].FILE_SIZE + "</td>";
|
||
appendText += "</tr>";
|
||
$("#" + areaId + "FileArea").append(appendText);
|
||
});
|
||
}else{
|
||
var appendText = "<tr><td colspan='4'>첨부 파일이 없습니다.</td></tr>";
|
||
$("#" + areaId + "FileArea").append(appendText);
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
// PDF 미리보기
|
||
function fnc_viewPdfFile(fileObjId){
|
||
window.open("/common/downloadFile.do?objId=" + fileObjId, "_blank");
|
||
}
|
||
|
||
// 첨부파일 삭제
|
||
function fn_fileDelete(fileObjId){
|
||
// 뷰 모드에서는 삭제 불가
|
||
if(isViewMode) return;
|
||
|
||
if(confirm("파일을 삭제하시겠습니까?")){
|
||
$.ajax({
|
||
url: "/common/deleteFileInfo.do",
|
||
type: "POST",
|
||
data: {"objId": fileObjId},
|
||
dataType: "json",
|
||
async: false,
|
||
success: function(data){
|
||
srAreaDraw();
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
function fn_save(){
|
||
// 유효성 검사
|
||
if(!fnc_valitate("form1")){
|
||
return;
|
||
}
|
||
|
||
Swal.fire({
|
||
title: '저장하시겠습니까?',
|
||
icon: 'question',
|
||
showCancelButton: true,
|
||
confirmButtonText: '저장',
|
||
cancelButtonText: '취소'
|
||
}).then((result) => {
|
||
if(result.isConfirmed){
|
||
$.ajax({
|
||
url: "/quality/saveCustomerCsAction.do",
|
||
type: "POST",
|
||
data: $("#form1").serialize(),
|
||
dataType: "json",
|
||
success: function(result){
|
||
if(result.RESULT == "SUCCESS"){
|
||
Swal.fire({
|
||
title: '저장되었습니다.',
|
||
icon: 'success'
|
||
}).then(() => {
|
||
if(window.opener && window.opener.fn_search){
|
||
window.opener.fn_search();
|
||
}
|
||
window.close();
|
||
});
|
||
} else {
|
||
Swal.fire({
|
||
title: '저장 실패',
|
||
text: result.MESSAGE || '저장 중 오류가 발생했습니다.',
|
||
icon: 'error'
|
||
});
|
||
}
|
||
},
|
||
error: function(xhr, status, error){
|
||
Swal.fire({
|
||
title: '저장 실패',
|
||
text: '서버 통신 오류가 발생했습니다.',
|
||
icon: 'error'
|
||
});
|
||
}
|
||
});
|
||
}
|
||
});
|
||
}
|
||
</script>
|
||
|
||
<body>
|
||
<form name="form1" id="form1" method="post">
|
||
<input type="hidden" name="OBJID" id="OBJID" value="${info.objid}">
|
||
|
||
<section class="business_staff_popup_min_width">
|
||
<div class="plm_menu_name">
|
||
<h2>
|
||
<span><%=menuName%></span>
|
||
</h2>
|
||
</div>
|
||
|
||
<div id="EntirePopupFormWrap">
|
||
<div class="two_column_container">
|
||
<!-- 왼쪽: 접수 정보 -->
|
||
<div>
|
||
<div class="form_popup_title">
|
||
<span>접수 정보</span>
|
||
</div>
|
||
<table class="">
|
||
<colgroup>
|
||
<col width="90%" />
|
||
</colgroup>
|
||
<tr>
|
||
<td>
|
||
<table class="pmsPopuptable">
|
||
<colgroup>
|
||
<col width="20%" />
|
||
<col width="30%" />
|
||
<col width="20%" />
|
||
<col width="30%" />
|
||
</colgroup>
|
||
<tr>
|
||
<!-- <td class="input_title"><label>접수번호</label></td>
|
||
<td>${info.receipt_no}</td> -->
|
||
<td class="input_title"><label>접수일</label></td>
|
||
<td>${info.receipt_date}</td>
|
||
<td class="input_title"><label>접수자</label></td>
|
||
<td>${info.writer_name}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="input_title"><label>고객사</label></td>
|
||
<td colspan="3">${info.customer_name}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="input_title"><label>수량</label></td>
|
||
<td>${info.qty}</td>
|
||
<td class="input_title"><label>제품구분</label></td>
|
||
<td>${info.product_type_name}</td>
|
||
</tr>
|
||
<tr>
|
||
<!-- <td class="input_title"><label>모델명</label></td>
|
||
<td>${info.model_name}</td> -->
|
||
<td class="input_title"><label>품명</label></td>
|
||
<td>${info.product_name}</td>
|
||
<td class="input_title"><label>품번</label></td>
|
||
<td>${info.product_no}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="input_title"><label>부품품명</label></td>
|
||
<td>${info.part_name}</td>
|
||
<td class="input_title"><label>부품품번</label></td>
|
||
<td>${info.part_no}</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td class="input_title"><label>생산일</label></td>
|
||
<td>${info.production_date}</td>
|
||
<td class="input_title"><label>판매일</label></td>
|
||
<td>${info.sales_date}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="input_title"><label>S/N</label></td>
|
||
<td>${info.serial_no}</td>
|
||
<td class="input_title"><label>제조사</label></td>
|
||
<td colspan="3">${info.manufacturer}</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="input_title"><label>이슈내용</label></td>
|
||
<td colspan="3">
|
||
<textarea rows="4" style="width:100%;" readonly>${info.complaint_content}</textarea>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<!-- 오른쪽: 조치결과 등록 -->
|
||
<div>
|
||
<div class="form_popup_title">
|
||
<span>조치결과 등록</span>
|
||
</div>
|
||
<table class="">
|
||
<colgroup>
|
||
<col width="110%" />
|
||
</colgroup>
|
||
<tr>
|
||
<td>
|
||
<table class="pmsPopuptable">
|
||
<colgroup>
|
||
<col width="20%" />
|
||
<col width="30%" />
|
||
<col width="20%" />
|
||
<col width="30%" />
|
||
</colgroup>
|
||
<tr>
|
||
<td class="input_title"><label>귀책판정 <span style="color:red;">*</span></label></td>
|
||
<td>
|
||
<select name="BLAME_DECISION" id="BLAME_DECISION" class="select2" required reqTitle="귀책판정" type="select">
|
||
<option value="">선택</option>
|
||
<option value="R" ${info.BLAME_DECISION eq 'R' ? 'selected' : ''}>RPS</option>
|
||
<option value="C" ${info.BLAME_DECISION eq 'C' ? 'selected' : ''}>고객사</option>
|
||
<option value="O" ${info.BLAME_DECISION eq 'O' ? 'selected' : ''}>외주업체</option>
|
||
<option value="O" ${info.BLAME_DECISION eq 'E' ? 'selected' : ''}>단순문의</option>
|
||
</select>
|
||
</td>
|
||
<td class="input_title"><label>상태 <span style="color:red;">*</span></label></td>
|
||
<td>
|
||
<select name="STATUS" id="STATUS" class="select2" required reqTitle="상태" type="select">
|
||
<option value="">선택</option>
|
||
<option value="Open">Open</option>
|
||
<option value="Closed">Closed</option>
|
||
</select>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="input_title"><label>조치일 <span style="color:red;">*</span></label></td>
|
||
<td>
|
||
<input type="text" name="ACTION_DATE" id="ACTION_DATE" class="date_icon" value="<%=actionDate%>" required reqTitle="조치일">
|
||
</td>
|
||
<td class="input_title"><label>조치자 <span style="color:red;">*</span></label></td>
|
||
<td>
|
||
<input type="text" name="ACTION_USER_NAME" id="ACTION_USER_NAME" value="<%=actionUserName%>" readonly>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="input_title"><label>조치구분 <span style="color:red;">*</span></label></td>
|
||
<td>
|
||
<select name="ACTION_TYPE" id="ACTION_TYPE" class="select2" required reqTitle="조치구분" type="select">
|
||
<option value="">선택</option>
|
||
${code_map.action_type}
|
||
</select>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="input_title"><label>조치내용 <span style="color:red;">*</span></label></td>
|
||
<td colspan="3">
|
||
<textarea name="ACTION_CONTENT" id="ACTION_CONTENT" rows="3" style="width:100%;" required reqTitle="조치내용" type="text">${info.action_content}</textarea>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="input_title"><label>비고</label></td>
|
||
<td colspan="3">
|
||
<textarea name="REMARK" id="REMARK" rows="2" style="width:100%;">${info.remark}</textarea>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="input_title"><label>이미지</label></td>
|
||
<td colspan="3">
|
||
<div style="margin-bottom: 5px;">
|
||
<input type="file" name="imgFile1" id="imgFile1" multiple accept="image/*" style="width:80%;">
|
||
<input type="button" id="btnImgUpload" value="업로드" class="plm_btns">
|
||
</div>
|
||
<div id="imgFileArea" style="min-height:50px; border:1px dashed #ccc; border-radius:4px; padding:5px; background:#fafafa;">
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td class="input_title"><label>첨부파일</label></td>
|
||
<td colspan="3">
|
||
<div style="margin-bottom: 5px;">
|
||
<input type="file" name="file1" id="file1" multiple style="width:80%;">
|
||
<input type="button" id="btnUpload" value="업로드" class="plm_btns">
|
||
</div>
|
||
<div id="srFileAreaTable" class="spec_data_in_table">
|
||
<div style="overflow-y:auto;">
|
||
<table class="fileListscrollThead" style="width:100% !important;">
|
||
<colgroup>
|
||
<col width="30px">
|
||
<col width="*">
|
||
<col width="80px">
|
||
<col width="60px">
|
||
</colgroup>
|
||
<tr>
|
||
<td>No</td>
|
||
<td>파일명</td>
|
||
<td>등록일</td>
|
||
<td>Size</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
<div style="max-height: 80px; overflow-y: auto; border-bottom: 1px solid #cacaca;">
|
||
<table class="fileListscrollTbody">
|
||
<colgroup>
|
||
<col width="30px">
|
||
<col width="*">
|
||
<col width="80px">
|
||
<col width="60px">
|
||
</colgroup>
|
||
<tbody id="srFileArea">
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="btn_wrap">
|
||
<div class="plm_btn_wrap_center">
|
||
<input type="button" value="저장" id="btnSave" class="plm_btns">
|
||
<input type="button" value="닫기" id="btnClose" class="plm_btns">
|
||
</div>
|
||
</div>
|
||
|
||
</section>
|
||
</form>
|
||
</body>
|
||
</html>
|