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

328 lines
10 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 type="text/javascript">
$(function(){
$(document).ready(function(){
fnc_setFileDropZone("dropzone", "${info.OBJID}", "${DOC_TYPE}", "${DOC_TYPE_NAME}", "fn_fileCallback",true,null,null);
});
//파일 삭제
$(document).on("click", ".btnDeleteFile", function(){
var objId = $(this).attr("data-OBJID");
var areaId = $(this).attr("data-TYPE");
fileDelete(objId, "distributionAreaDraw", true);
});
//파일 찾아서 Upload
$(".upload_btns").click(function(){
var type = $(this).attr("data-TYPE");
var files = $("#file1")[0].files;
if(files.length > 0){
fnc_fileMultiUpload(files, null, "${info.OBJID}", "${DOC_TYPE}", "${DOC_TYPE_NAME}", null, "distributionAreaDraw");
}else{
Swal.fire("선택된 File이 없습니다.");
}
});
$('#btn_close').click(function(){
self.close();
});
$("#btnSend").click(function(){
fn_send();
});
$("#btnSearchEmployee").click(function(){
fn_searchEmployee();
});
$(document).on("click", ".btnDeleteReceiver", function(){
var objId = $(this).attr("data-OBJID");
fn_deleteReceiver(objId);
});
fn_refreshReceiverList();
});
</script>
<script>
//첨부파일 목록을 가져온다.
function distributionAreaDraw(){
fn_pptFileCallback("${DOC_TYPE}");
}
//첨부파일 목록을 가져온다.
function fn_pptFileCallback(fileType){
$.ajax({
url:"/common/getFileList.do",
type:"POST",
data:{"targetObjId":"${info.OBJID}", "docType":fileType},
dataType:"json",
success:function(data){
if(0 <data.length){
$("#distributionFileArea").empty();
$.each(data, function(i){
var appendText ="";
appendText+= "<tr>";
appendText+= " <td title='"+data[i].REAL_FILE_NAME+"' class='align_l'><a href='javascript:fnc_downloadFile(\""+data[i].OBJID+"\")'>&nbsp;&nbsp;"+data[i].REAL_FILE_NAME+"</a></td>";
appendText+= " <td title='"+data[i].DEPT_NAME+"' '"+data[i].USER_NAME+"'>"+data[i].DEPT_NAME+" "+ data[i].USER_NAME+"</td>"
appendText+= " <td title='"+data[i].REGDATE+"'>"+data[i].REGDATE+"</td>";
appendText+= " <td><input type='button' class='date_delete btnDeleteFile' value='x' data-TYPE='"+areaId+"' data-OBJID='"+data[i].OBJID+"'></td>"
appendText+= "</tr>";
$("#distributionFileArea").append(appendText);
});
}else{
$("#distributionFileArea").empty();
var appendText = "";
appendText +="<tr>";
appendText += "<td colspan='4'>첨부 파일이 없습니다.</td>";
appendText +="</tr>";
$("#distributionFileArea").append(appendText);
}
},
error: function(jqxhr,status,error){
}
});
}
//수신인삭제
function fn_deleteReceiver(objId){
$.ajax({
url:"/distribution/deleteSendFileReceiverInfo.do",
type:"POST",
data:{"objId":objId},
dataType:"json",
async:false,
success:function(data){
fn_refreshReceiverList();
},
error: function(jqxhr, status, error){
}
});
}
//사원조회
function fn_searchEmployee(){
var objId = $("#objId").val();
var params = "";
params += "?callBackFn=opener.fn_refreshReceiverList";
params += "&actionURL=/distribution/addSendFileReceivers.do";
params += "&targetObjId="+objId;
window.open("/common/openSearchMember.do"+params, "searchEmployee", "width=550 height=325 menubar=no status=no");
}
//수신인목록 새로고침
function fn_refreshReceiverList(){
var targetObjId = $("#objId").val();
$.ajax({
url:"/distribution/getSendFileReceiverList.do",
type:"POST",
data:{"targetObjId":targetObjId},
dataType:"json",
async:false,
success:function(data){
var appendText = "";
if(data.length > 0){
$.each(data, function(i){
appendText += "<tr>";
appendText += "<td>"+(i+1)+"</td>";
appendText += "<td>"+fnc_checkNull(data[i].RECEIVER_USER_TYPE_NAME)+"</td>";
appendText += "<td>"+fnc_checkNull(data[i].RECEIVER_DEPT_NAME)+"</td>";
appendText += "<td>"+fnc_checkNull(data[i].RECEIVER_USER_NAME)+"</td>";
appendText += "<td><a href='#' class='btnDeleteReceiver delete_btn' data-OBJID='"+data[i].OBJID+"'></a></td>";
appendText += "</tr>";
});
}else{
appendText += "<td colspan='5' align='center'>등록된 수신인이 없습니다.</td>";
}
$("#receiverList").empty();
$("#receiverList").append(appendText);
},
error: function(jqxhr, status, error){
}
});
}
//파일송부
function fn_send(){
if(fnc_valitate('form1')){
if(confirm("파일을 송부하시겠습니까?")){
$.ajax({
url:"/distribution/saveSendFileInfo.do",
type:"POST",
data:$('#form1').serialize(),
dataType:"json",
async:false,
success:function(data){
Swal.fire(data.msg);
top.opener.window.location.reload();
self.close();
},
error: function(jqxhr, status, error){
}
});
}
}
}
</script>
</head>
<body class="backcolor_light_blue">
<form id="form1" name="form1" method="post">
<input type="hidden" name="objId" id="objId" value="${info.OBJID}">
<section>
<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="10%">
<col width="20%">
<col width="8%">
<col width="20%">
<col width="18%">
<col width="8%">
<col width="13%">
<col width="*">
</colgroup>
<tr>
<td class="input_title">
<label>제목</label>
</td>
<td colspan="8">
<input type="text" name="title" id="title" title="제목" class="text_area" required value="${info.TITLE}" maxlength="200" placeholder="제목을 입력해 주시기 바랍니다." style="width:100%;">
</td>
</tr>
<tr>
<td class="input_title">
<label for="">내용</label>
</td>
<td colspan="8">
<textarea name="description" id="description" maxlength="500" placeholder="500자까지 입력 가능합니다." style="width:100%; height:50px; border:1px solid #ccc;">${info.DESCRIPTION}</textarea>
</td>
</tr>
<tr>
<td class="input_title">
<label for="">첨부파일</label>
</td>
<td colspan="8">
<div id="dropzone">Drag & Drop Files Here</div>
<input type="file" name="file1" id="file1" multiple style="width:93%;">
<input type="button" id="btnUpload" value="Upload" data-TYPE="suggest" class="upload_btns">
<div class="plm_table_wrap">
<div style="overflow-y:scroll;">
<table class="plm_table">
<colgroup>
<col width="5%">
<col width="*">
<col width="*">
<col width="*">
</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="*">
<col width="*">
</colgroup>
<tbody>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</td>
<!-- <div id="distributeFileList">
<table id="distributeFileAreaTable" class="spec_data_in_table">
<tbody id="distributeFileArea">
</tbody>
</table>
</div> -->
</tr>
<tr>
<td class="input_title">
<label for="">수신인<a href="#" id="btnSearchEmployee" style="display:inline-block; width:23px; height:18px; background:url(/images/crew.png) center right no-repeat; background-size: 18px 18px; position:absolute;"></a></label>
</td>
<td colspan="8">
<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="*"/>
<col width="*"/>
<col width="10%"/>
</colgroup>
<thead>
<tr class="plm_thead">
<td>No</td>
<td>소속</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="*"/>
<col width="*"/>
<col width="10%"/>
</colgroup>
<tbody id="receiverList">
<tr>
<td colspan="4">등록된 수신인이 없습니다.</td>
</tr>
</tbody>
</table>
</div>
</div>
</td>
</tr>
</table>
<div class="btn_wrap" style="clear:both;">
<div class="plm_btn_wrap_center">
<input type="button" value="파일송부" class="plm_btns" id="btnSend">
<input type="button" value="닫기" id="btn_close" class="plm_btns">
</div>
</div>
</div>
</section>
</form>
</body>
</html>