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

284 lines
9.0 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>
<script>
$(document).ready(function(){
fnc_setFileDropZone("convertAttachFileDropZone", "${convertMngInfo.OBJID}", "${DOC_TYPE}", "${DOC_TYPE_NAME}", "setUploadTemplateFile",false,null,"/common/fileUploadProc.do", "CATDRAWING|CATPART");
setUploadTemplateFile();
$("#btnConvert").click(function(){
fn_convertFile("${docType}");
});
fn_getConvertedFileList();
$("#btn_close").click(function(){
if(confirm("작업된 내용이 저장되지 않고 화면이 닫힙니다.\n화면을 닫으시겠습니까?")){
self.close(0);
}
});
});
//파일변환
function fn_convertFile(docType){
if(confirm("파일을 변환하시겠습니까?\n변환시 몇분정도의 시간이 걸릴 수 있습니다.\n변환후에도 저장을 하지않으면 이력이 저장되지 않습니다.")){
$.ajax({
url:"/common/convertDrawingFile.do",
type:"POST",
data:{"targetObjId":$("#convertMngObjId").val()},
dataType:"json",
async:true,
beforeSend:function(){
_startLoading("변환중입니다. 원본파일의 용량에따라 수분의 시간이 걸릴 수 있습니다.");
},
success:function(data){
if(data.result == "true"){
Swal.fire("변환되었습니다");
}else{
Swal.fire("변환에 실패하였습니다.");
}
fn_getConvertedFileList();
},
complete:function(){
_endLoading();
},
error: function(jqxhr, status, error){
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
Swal.fire(jqxhr.status);
Swal.fire(jqxhr.responseText);
}
});
}
}
//파일 업로드 후 처리
function setUploadTemplateFile(){
var actionType = "convertOrg";
$("#convertMngFileArea").empty();
$.ajax({
url:"/common/getFileList.do",
type:"POST",
data:{"targetObjId":$("#convertMngObjId").val(), "docType":"${DOC_TYPE}"},
dataType:"json",
async:false,
success:function(data){
console.log(data.length);
var str = "";
if(data.length != 0){
$("#convertMngFileArea").empty();
$.each(data, function(i){
str += "<tr>";
str += " <td>"+(i+1)+"</td>";
str += " <td><a href='javascript:fnc_downloadFile(\""+data[i].OBJID+"\")'>"+data[i].REAL_FILE_NAME+"</a></td>";
str += " <td><div class='delete_btn' onclick='javascript:fnc_deleteFile(\""+data[i].OBJID+"\", \"setUploadTemplateFile\")'></div></td>";
str += " <td>"+data[i].REGDATE+"</td>";
str += "</tr>";
});
}else {
str += "<tr>";
str += " <td colspan='4'>첨부된 파일이 없습니다.</td>";
str += "</tr>";
}
$("#convertMngFileArea").append(str);
},
error: function(jqxhr, status, error){
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
Swal.fire(jqxhr.status);
Swal.fire(jqxhr.responseText);
}
});
}
//변환후 파일목록 조회
function fn_getConvertedFileList(){
$.ajax({
url:"/common/getFileList.do",
type:"POST",
data:{"targetObjId":$("#convertMngObjId").val(), "docType":"${CONVERTED_DOC_TYPE}"},
dataType:"json",
async:false,
success:function(data){
console.log(data.length);
var str = "";
$("#convertCompleteFileArea").children().remove();
if(data.length != 0){
$.each(data, function(i){
str += "<tr>";
str += " <td>"+(i+1)+"</td>";
str += " <td><a href='javascript:fnc_downloadFile(\""+data[i].OBJID+"\")'>"+data[i].REAL_FILE_NAME+"</a></td>";
str += " <td><div class='delete_btn' onclick='javascript:fnc_deleteFile(\""+data[i].OBJID+"\", \"fn_getConvertedFileList\")'></div></td>";
str += " <td>"+data[i].REGDATE+"</td>";
str += "</tr>";
});
}else {
str += "<tr>";
str += " <td colspan='4'>변환된 파일이 없습니다.</td>";
str += "</tr>";
}
$("#convertCompleteFileArea").append(str);
},
error: function(jqxhr, status, error){
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
Swal.fire(jqxhr.status);
Swal.fire(jqxhr.responseText);
}
});
}
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){
Swal.fire(jqxhr.statusText + ", " + status + ", " + error);
Swal.fire(jqxhr.status);
Swal.fire(jqxhr.responseText);
}
});
}
}
function savePart(){
if(confirm("해당파트 정보를 저장하시겠습니까?")){
var param = $("#form1").serialize();
$.ajax({
type : "POST",
url : "/convertMng/insertConvertMng.do",
data: param,
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){
Swal.fire(result.message);
opener.fn_search();
self.close();
}
}
});
}
}
</script>
</head>
<body>
<form name="form1" id="form1" action="" method="post">
<input type="hidden" name="convertMngObjId" id="convertMngObjId" value="${convertMngInfo.OBJID}">
<section>
<div class="plm_menu_name">
<h2>
<span>도면변환관리</span>
</h2>
</div>
<div id="businessPopupFormWrap">
<div class="form_popup_title" style="position:relative;">&nbsp;&nbsp;&nbsp;도면변환관리 등록</div>
<div id="excelUploadPopupForm">
<div class="fileDnDWrap">
<div id="convertAttachFileDropZone" class="dropzone" style="height:50px;">Drag & Drop CATPart, CATDrawing Files</div>
<div id="convertAttachFileList">
<p style="background:url(/images/menu_bullet.png) left center no-repeat; padding-left:20px;">원본파일목록</p>
<div class="plm_table_wrap">
<div style="overflow-y:scroll;">
<table class="plm_table" style="margin:0;">
<colgroup>
<col width="5%"/>
<col width="*"/>
<col width="15%"/>
<col width="15%"/>
</colgroup>
<thead>
<tr class="plm_thead">
<td>No</td>
<td>파일명</td>
<td>삭제</td>
<td>등록일</td>
</tr>
</thead>
</table>
</div>
<div class="plm_scroll_table" style="height:100px;">
<table class="plm_table" style="margin:0;">
<colgroup>
<col width="5%"/>
<col width="*"/>
<col width="15%"/>
<col width="15%"/>
</colgroup>
<tbody id="convertMngFileArea">
</tbody>
</table>
</div>
</div>
<div id="convertCompleteAttachFileList">
<p style="background:url(/images/menu_bullet.png) left center no-repeat; padding-left:20px;">변환파일목록</p>
<div class="plm_table_wrap">
<div style="overflow-y:scroll;">
<table class="plm_table" style="width:100%; margin:0;">
<colgroup>
<col width="5%"/>
<col width="*"/>
<col width="15%"/>
<col width="15%"/>
</colgroup>
<thead>
<tr class="plm_thead">
<td>No</td>
<td>파일명</td>
<td>삭제</td>
<td>등록일</td>
</tr>
</thead>
</table>
</div>
<div class="plm_scroll_table" style="height:100px;">
<table class="plm_table" style="margin:0;">
<colgroup>
<col width="5%"/>
<col width="*"/>
<col width="15%"/>
<col width="15%"/>
</colgroup>
<tbody id="convertCompleteFileArea">
<tr>
<td colspan="4">변환된 파일이 없습니다.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="btn_wrap" style="clear:both;">
<div class="plm_btn_wrap_center">
<c:if test="${!empty param.actionType}">
<input type="button" value="저장" class="plm_btns" onclick="savePart();">
</c:if>
<input type="button" value="변환" id="btnConvert" class="plm_btns">
<input type="button" value="닫기" id="btn_close" class="plm_btns">
</div>
</div>
</div>
</div>
</div>
</section>
</form>
</body>
</html>