refactor: 파일업로드 수정
This commit is contained in:
parent
3860ce04c1
commit
696263128c
@ -15,7 +15,7 @@ public enum AdrInnorixFileEnumVO {
|
||||
// history 값
|
||||
private final String p_code_desc;
|
||||
|
||||
// history 값
|
||||
// history stat 값
|
||||
private final String p_stat_cd;
|
||||
private final String p_adrHstryMgrSeq;
|
||||
private final String p_updateQuery;
|
||||
|
||||
@ -43,6 +43,7 @@ public class AdrInnorixFileVO extends ComDefaultVO implements Serializable {
|
||||
public String openYn = "";
|
||||
public String atchFileId = "";
|
||||
public String mode = "";
|
||||
public String successMsg = "";
|
||||
public boolean isAdrRpplDoc;
|
||||
|
||||
/*
|
||||
@ -225,6 +226,14 @@ public class AdrInnorixFileVO extends ComDefaultVO implements Serializable {
|
||||
public void setAdrRpplDoc(boolean isAdrRpplDoc) {
|
||||
this.isAdrRpplDoc = isAdrRpplDoc;
|
||||
}
|
||||
|
||||
public String getSuccessMsg() {
|
||||
return successMsg;
|
||||
}
|
||||
|
||||
public void setSuccessMsg(String successMsg) {
|
||||
this.successMsg = successMsg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -109,7 +109,8 @@ public class InnorixFileServiceImpl extends EgovAbstractServiceImpl implements I
|
||||
return new RestResponse(HttpStatus.BAD_REQUEST, "등록에 실패하였습니다.", LocalDateTime.now());
|
||||
}
|
||||
|
||||
return new RestResponse(HttpStatus.OK, "등록 되었습니다.", LocalDateTime.now());
|
||||
System.out.println("adrInnorixFileListVO :: "+ adrInnorixFileListVO.getSuccessMsg());
|
||||
return new RestResponse(HttpStatus.OK, adrInnorixFileListVO.getSuccessMsg(), adrInnorixFileListVO.getAtchFileId(),LocalDateTime.now());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -128,8 +129,6 @@ public class InnorixFileServiceImpl extends EgovAbstractServiceImpl implements I
|
||||
|
||||
List<FileVO> result = this.fileChange(innorixVO, atchFileId, 0);
|
||||
|
||||
|
||||
log.info(" // file data 반복문 끝 ");
|
||||
// 파일 업로드
|
||||
fileManageDAO.insertFileInfs(result);
|
||||
|
||||
|
||||
@ -44,7 +44,16 @@ public class InnorixFileController {
|
||||
@Resource(name = "InnorixFileService")
|
||||
protected InnorixFileService innorixService;
|
||||
|
||||
@RequestMapping(value = {"/kccadr/common/insertInnorixFileAjax.do"}, method = RequestMethod.POST)
|
||||
/**
|
||||
* @methodName : insertInnorixFileAjax
|
||||
* @author : 이호영
|
||||
* @date : 2022.12.26
|
||||
* @description : 파일등록 외에 rpplDoc 과 history 관련 Controller
|
||||
* @param adrInnorixFileVO
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = {"/kccadr/common/insertInnorixFileAndRpplAjax.do"}, method = RequestMethod.POST)
|
||||
public ResponseEntity<RestResponse> insertInnorixFileAjax(@RequestBody AdrInnorixFileVO adrInnorixFileVO) throws Exception {
|
||||
|
||||
//로그인 권한정보 불러오기
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="<c:url value='/innorix/innorix.js' />"></script>
|
||||
<script src="<c:url value='/js/kccadr/adm/common/innorixCommon.js' />"></script>
|
||||
<link rel="stylesheet" href="<c:url value='/innorix/innorix.css'/>" type="text/css">
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
@ -225,60 +226,21 @@
|
||||
|
||||
//등록 버튼
|
||||
function fncReg() {
|
||||
var f = document.getElementById("listForm");
|
||||
var data = new FormData(f);
|
||||
_fileForm2.forEach(function(obj, idx) {
|
||||
if (obj)
|
||||
data.append("file" + idx, obj.fileObj);
|
||||
});
|
||||
|
||||
if (validation()) {
|
||||
if(confirm("사건문서를 등록 하시겠습니까?")){
|
||||
|
||||
if(control.getUploadFiles().length > 0){
|
||||
|
||||
var postObj = new Object();
|
||||
postObj.innoDirPath = $('#innoDirPath').val();
|
||||
control.setPostData(postObj); // 업로드시 함께 전달될 POST Param 추가
|
||||
|
||||
control.upload(); // 업로드 시작
|
||||
|
||||
}else{
|
||||
|
||||
alert("등록된 첨부파일이 없습니다.");
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
// $.ajax({
|
||||
// type : "POST",
|
||||
// enctype : 'multipart/form-data',
|
||||
// url : "/kccadr/adjPgrMgr/apm/docRegPopAjax.do",
|
||||
// data : data,
|
||||
// dataType : 'json',
|
||||
// async : false,
|
||||
// processData : false,
|
||||
// contentType : false,
|
||||
// cache : false,
|
||||
// success : function(returnData, status) {
|
||||
// if (returnData.result == 'success') {
|
||||
// alert("사건문서 제출이 완료되었습니다.");
|
||||
// opener.location.reload(true);
|
||||
// self.close();
|
||||
// } else {
|
||||
// alert(returnData.message);
|
||||
// }
|
||||
|
||||
// },
|
||||
// error : function(e) {
|
||||
// alert("사건문서 제출에 실패하였습니다.");
|
||||
// console.log("ERROR : ", e);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 파일 업로드 솔루션 init 셋팅
|
||||
@ -289,15 +251,14 @@
|
||||
el: '#fileControl' // 컨트롤 출력 HTML 객체 ID
|
||||
, transferMode: 'both' // 업로드, 다운로드 혼합사용
|
||||
, installUrl: '/innorix/install/install.html' // Agent 설치 페이지
|
||||
, uploadUrl: '/innorix/exam/upload_test_220916.jsp' // 업로드 URL
|
||||
, uploadUrl: '/innorix/exam/upload.jsp' // 업로드 URL
|
||||
, height:80
|
||||
, width: 635
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
fn_insertFile(p.files); // 파일 정보 DB isnert function
|
||||
control.removeAllFiles(); // control 초기화
|
||||
fn_callBackInnorix(p.files); // 파일 정보 DB isnert function
|
||||
});
|
||||
};
|
||||
|
||||
@ -305,12 +266,14 @@
|
||||
/*
|
||||
* 파일 정보 DB insert Ajax
|
||||
* */
|
||||
function fn_insertFile(data){
|
||||
function fn_callBackInnorix(data){
|
||||
|
||||
var url = "<c:url value='/kccadr/common/insertInnorixFileAndRpplAjax.do' />";
|
||||
|
||||
var filePath = location.pathname;
|
||||
var jspFileName = filePath.substring(filePath.lastIndexOf("/")+1, filePath.lastIndexOf("."));
|
||||
|
||||
var resultData = {
|
||||
|
||||
var sendData = {
|
||||
"adrSeq": $('#adrSeq').val()
|
||||
, "adrSn": $('#adrSn').val()
|
||||
, "adrDocTy": $('#adrDocTy').val()
|
||||
@ -319,37 +282,19 @@
|
||||
, "openYn": $('#openYn').val()
|
||||
, "jspFileName": jspFileName
|
||||
, "innorixFileListVO": data
|
||||
, "successMsg" : "사건문서 제출이 완료되었습니다."
|
||||
}
|
||||
|
||||
console.log('resultData :: ', resultData);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<c:url value='/kccadr/common/insertInnorixFileAjax.do' />",
|
||||
data: JSON.stringify(resultData),
|
||||
dataType:'json',
|
||||
async: false,
|
||||
processData: false,
|
||||
contentType: "application/json",
|
||||
cache: false,
|
||||
success: function (returnData) {
|
||||
if(returnData.status == "OK"){
|
||||
alert("사건문서 제출이 완료되었습니다.");
|
||||
opener.location.reload(true);
|
||||
self.close();
|
||||
}else{
|
||||
alert(returnData.data);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error: function (e) { alert("저장에 실패하였습니다."); console.log("ERROR : ", e); }
|
||||
});
|
||||
|
||||
/*
|
||||
* 공통 : innorixCommon.js
|
||||
* fn_insertInnorixFileAndRpplAjax() 호출 후 status가 성공(OK)이면 실행
|
||||
*/
|
||||
if(fn_insertInnorixFileAndRpplAjax(sendData, url) == "OK")
|
||||
{
|
||||
opener.location.reload(true);
|
||||
self.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.file_wrap .tbType02{border-bottom: 0}
|
||||
@ -420,52 +365,9 @@
|
||||
<p style="font-size: 16px; float: right; margin-top: 16px; color: #666;">* 첨부파일을 등록해 주세요. (최대3개)</p>
|
||||
<!-- <div class="file_wrap file_upload_box no_img_box"> -->
|
||||
<!-- -->
|
||||
<div id="fileControl"></div><br/>
|
||||
<div id="fileControl"></div><br/>
|
||||
|
||||
<!-- </div> -->
|
||||
<div class="file_wrap fileAfter file_list_div">
|
||||
<table class="tbType02">
|
||||
<caption>첨부파일 추가 리스트 : 파일명, 종류, 크기, 삭제</caption>
|
||||
<colgroup>
|
||||
<col style="width: 60%">
|
||||
<col style="width: 10%">
|
||||
<col style="width: 20%">
|
||||
<col style="width: 10%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<th scope="col">파일 명</th>
|
||||
<th scope="col">종류</th>
|
||||
<th scope="col">크기</th>
|
||||
<th scope="col">삭제</th>
|
||||
</thead>
|
||||
<tbody id="tbody_fiielist" class="tb_file_after">
|
||||
<c:forEach var="fileList" items="${fileList}" varStatus="status">
|
||||
<tr class="item_<c:out value='${fileList.atchFileId}' />_<c:out value='${fileList.fileSn}' /> uploaded_obj">
|
||||
<input type="hidden" name="fileSize" class="item_file_size" value="<c:out value='${fileList.fileSize}' />">
|
||||
<input type="hidden" name="limitcount" value="3" />
|
||||
<td class="td_filename">
|
||||
<span class="file_name_text"><c:out value='${fileList.orignlFileNm}' /></span>
|
||||
</td>
|
||||
<td class="td_filesort">
|
||||
<span class="file_filesort_text" value="<c:out value="${fileList.fileExtsn}"/>">
|
||||
<c:out value="${fileList.fileExtsn}" />
|
||||
</span>
|
||||
</td>
|
||||
<td class="td_filesize">
|
||||
<span class="file_size_text" value="<c:out value="${fileList.fileMg}"/>">
|
||||
<c:out value="${fileList.fileMg}" />
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn_del" onclick="delAtchFile('<c:out value='${fileList.atchFileId}' />', '<c:out value='${fileList.fileSn}' />'); return false;" title="파일${status.count} 삭제">
|
||||
<i></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@ -31,28 +31,33 @@
|
||||
<!-- <script src="//t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"></script> -->
|
||||
<script src="/kccadrPb/adm/script/postcode.js"></script>
|
||||
<script src="<c:url value='/js/kccadr/kccadrCom.js' />"></script>
|
||||
<script src="<c:url value='/innorix/innorix.js' />"></script>
|
||||
<link rel="stylesheet" href="<c:url value='/innorix/innorix.css'/>" type="text/css">
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
// $('.irx_btn_del.irx_remove').click(function(e) {
|
||||
$('.irx_remove').click(function(e) {
|
||||
|
||||
console.log('??');
|
||||
e.preventDefault();
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script src="<c:url value='/innorix/innorix.js' />"></script>
|
||||
<script src="<c:url value='/js/kccadr/adm/common/innorixCommon.js' />"></script>
|
||||
<link rel="stylesheet" href="<c:url value='/innorix/innorix.css'/>" type="text/css">
|
||||
|
||||
<%-- 원자력 --%>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(function() {
|
||||
|
||||
$('#filebutton').click(function(e) {
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
$('#file_temp').click();
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
function setAdrNoTxt() {
|
||||
$('#adrNoTxt').text($('#adrNo').val());
|
||||
}
|
||||
|
||||
function fncReg() {
|
||||
|
||||
@ -62,16 +67,16 @@
|
||||
var data = new FormData(f);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
enctype: 'multipart/form-data',
|
||||
url : "/kccadr/adjPgrMgr/apm/updtRpplPopPastAjax.do",
|
||||
data: data,
|
||||
dataType:'json',
|
||||
async: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
cache: false,
|
||||
success : function(returnData, status) {
|
||||
type: "POST"
|
||||
, enctype: 'multipart/form-data'
|
||||
, url : "/kccadr/adjPgrMgr/apm/updtRpplPopPastAjax.do"
|
||||
, data: data
|
||||
, dataType:'json'
|
||||
, async: false
|
||||
, processData: false
|
||||
, contentType: false
|
||||
, cache: false
|
||||
, success : function(returnData, status) {
|
||||
if (returnData.result == 'success') {
|
||||
alert("대리인 수정 되었습니다.");
|
||||
window.opener.location.reload();
|
||||
@ -79,9 +84,8 @@
|
||||
} else {
|
||||
alert(returnData.message);
|
||||
}
|
||||
|
||||
},
|
||||
error : function(e) {
|
||||
}
|
||||
, error : function(e) {
|
||||
alert("대리인수정을 실패하였습니다.");
|
||||
console.log("ERROR : ", e);
|
||||
}
|
||||
@ -100,80 +104,35 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
function fncRelationCheck() {
|
||||
|
||||
}
|
||||
|
||||
function phoneSelect (){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
// 파일 업로드 솔루션 init 셋팅
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // * 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // * 업로드, 다운로드 혼합사용
|
||||
installUrl: '/innorix/install/install.html', // * Agent 설치 페이지
|
||||
uploadUrl: '/innorix/exam/upload.jsp' // * 업로드 URL
|
||||
});
|
||||
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
var control = new Object(); // 파일전송 컨트롤 객체선언
|
||||
var downFileArr = new Array(); // 다운로드 목록 정보
|
||||
var resetFileArr = new Array(); // 다운로드 목록 초기화 정보
|
||||
var delFileArr = new Array(); // 삭제된 파일 정보
|
||||
var removeFlag = true; // 삭제 이벤트 조건 플래그
|
||||
|
||||
|
||||
// 키값에 해당하는 인덱스 삭제
|
||||
function deleteArr(array, key, value) {
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
if (array[i][key] == value) {
|
||||
array.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl', // 컨트롤 출력 HTML 객체 ID
|
||||
transferMode: 'both', // 업로드, 다운로드 혼합사용
|
||||
installUrl: '/innorix/install/install.html', // Agent 설치 페이지
|
||||
uploadUrl: '/innorix/exam/upload.jsp' // 업로드 URL
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
fn_insertFile(p.files); // 파일 정보 DB isnert function
|
||||
});
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
fn_callBackInnorix(p.files); // * 파일 정보 DB isnert function
|
||||
});
|
||||
|
||||
// 파일전송 컨트롤 로딩 완료
|
||||
control.on('loadComplete', function (p) {
|
||||
// 다운로드 목록
|
||||
//
|
||||
// .do 호출 시 불러온 fileList에서 솔루션에 맞게 변환
|
||||
<c:forEach items="${fileList}" var="file">
|
||||
var fileObj = new Object();
|
||||
fileObj.printFileName = "${file.orignlFileNm}";
|
||||
fileObj.fileSize = "${file.fileSize}";
|
||||
// fileObj.downloadUrl = "/innorix/exam/download.jsp?fileName=" + "${file.streFileNm}&innoDirPath="+$('#innoDirPath').val();
|
||||
fileObj.downloadUrl = "/innorix/exam/download.jsp?fileName=" + "${file.streFileNm}";
|
||||
fileObj.fileSn = "${file.fileSn}";
|
||||
downFileArr.push(fileObj);
|
||||
</c:forEach>
|
||||
|
||||
// downFileArr =
|
||||
// [{
|
||||
// printFileName: "INNORIX WP 브로셔.pdf",
|
||||
// fileSize: 1433885,
|
||||
// downloadUrl: urlBase + "download.jsp?fileID=1"
|
||||
// },
|
||||
// {
|
||||
// printFileName: "INNORIX WP Brochure.pdf",
|
||||
// fileSize: 1433885,
|
||||
// downloadUrl: urlBase + "download.jsp?fileID=2"
|
||||
// },
|
||||
// {
|
||||
// printFileName: "INNORIX WP パンフレット.pdf",
|
||||
// fileSize: 1433885,
|
||||
// downloadUrl: urlBase + "download.jsp?fileID=3"
|
||||
// }];
|
||||
|
||||
resetFileArr = downFileArr; // 다운로드 정보 초기화 정보 생성
|
||||
resetFileArr = resetFileArr.slice(0); // 배열 깊은 복사
|
||||
control.presetDownloadFiles(resetFileArr); // 다운로드 파일 추가
|
||||
@ -181,40 +140,49 @@
|
||||
|
||||
// 파일 삭제 이벤트
|
||||
control.on('removeFiles', function (p) {
|
||||
if (removeFlag == true) {
|
||||
// 삭제된 파일정보 배열에 담기
|
||||
for (var i = 0; i < p.length; i++ ) {
|
||||
var fileObj = new Object();
|
||||
if (p[i].transferType == "download")
|
||||
{
|
||||
fileObj.downloadUrl = p[i].downloadUrl;
|
||||
fileObj.printFileName = p[i].printFileName;
|
||||
fileObj.fileSize = p[i].fileSize;
|
||||
fileObj.fileSn = p[i].fileSn;
|
||||
|
||||
delFileArr.push(fileObj);
|
||||
|
||||
|
||||
delAtchFile( $('#atchFileId').val(), p[i].fileSn);
|
||||
|
||||
deleteArr(downFileArr, "printFileName", p[i].printFileName);
|
||||
console.log('delFileArr :: ', delFileArr);
|
||||
console.log('deleteArr :: ', deleteArr);
|
||||
}
|
||||
}
|
||||
}
|
||||
removeFlag = true;
|
||||
});
|
||||
};
|
||||
if (removeFlag == true)
|
||||
{
|
||||
if(confirm("삭제하시겠습니까?"))
|
||||
{
|
||||
// 삭제된 파일정보 배열에 담기
|
||||
for (var i = 0; i < p.length; i++ )
|
||||
{
|
||||
var fileObj = new Object();
|
||||
if (p[i].transferType == "download")
|
||||
{
|
||||
/*
|
||||
* innorixDelAtchFile => innorixCommon.js 호출
|
||||
* DB에서 file 정보 삭제
|
||||
* deleteFromResetFileArr => innorixCommon.js 호출
|
||||
* DB에서 file 정보 삭제
|
||||
*/
|
||||
innorixDelAtchFile( $('#atchFileId').val(), p[i].fileSn);
|
||||
deleteFromResetFileArr(p[i].printFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fileListReset();
|
||||
}
|
||||
}
|
||||
removeFlag = true;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
function save() {
|
||||
/*
|
||||
* 등록버튼 클릭 event
|
||||
* */
|
||||
function save() {
|
||||
if(confirm("대리인 정보를 수정 하시겠습니까?")){
|
||||
|
||||
if (control.getUploadFiles().length > 0) {
|
||||
|
||||
var postObj = new Object();
|
||||
postObj.innoDirPath = $('#innoDirPath').val();
|
||||
control.setPostData(postObj); // 업로드시 함께 전달될 POST Param 추가
|
||||
control.upload();
|
||||
|
||||
} else if (delFileArr.length > 0) {
|
||||
@ -226,57 +194,34 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 업로드, 삭제된 파일정보 submit
|
||||
function submit(uploadFileArr, delFileArr, url) {
|
||||
innoJquery.post(url, { uploadFiles: uploadFileArr, deleteFiles: delFileArr})
|
||||
.done(function(data) {
|
||||
delFileArr = new Array(); // 삭제정보 초기화
|
||||
alert(data);
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 파일 정보 DB insert Ajax
|
||||
* */
|
||||
function fn_insertFile(data){
|
||||
function fn_callBackInnorix(data){
|
||||
|
||||
var url = "<c:url value='/kccadr/common/insertInnorixFileAndRpplAjax.do' />";
|
||||
|
||||
var filePath = location.pathname;
|
||||
var jspFileName = filePath.substring(filePath.lastIndexOf("/")+1, filePath.lastIndexOf("."));
|
||||
|
||||
var resultData = {
|
||||
var sendData = {
|
||||
"adrSeq": $('#adrSeq').val()
|
||||
, "atchFileId": $('#atchFileId').val()
|
||||
, "jspFileName": jspFileName
|
||||
, "innorixFileListVO": data
|
||||
}
|
||||
|
||||
console.log('resultData :: ', resultData);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<c:url value='/kccadr/common/insertInnorixFileAjax.do' />",
|
||||
data: JSON.stringify(resultData),
|
||||
dataType:'json',
|
||||
async: false,
|
||||
processData: false,
|
||||
contentType: "application/json",
|
||||
cache: false,
|
||||
success: function (returnData) {
|
||||
if(returnData.status == "OK"){
|
||||
fncReg();
|
||||
}else{
|
||||
alert(returnData.data);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error: function (e) { alert("저장에 실패하였습니다."); console.log("ERROR : ", e); }
|
||||
});
|
||||
|
||||
/*
|
||||
* 공통 : innorixCommon.js
|
||||
* fn_insertInnorixFileAndRpplAjax() 호출 후 status가 성공(OK)이면 실행
|
||||
*/
|
||||
if(fn_insertInnorixFileAndRpplAjax(sendData, url) == "OK")
|
||||
{
|
||||
fncReg();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@ -421,59 +366,9 @@
|
||||
<td class="upload_area">
|
||||
<input type="file" id="file_temp" name="file_temp" class="uploadFile" style="display: none" />
|
||||
<button type="button" onclick="control.openFileDialog();" class="btnType01 btn_add_file">파일찾기</button>
|
||||
<!-- <button type="button" id="filebutton" class="btnType01 btn_add_file">파일찾기</button> -->
|
||||
<p style="font-size: 16px; float: right; margin-top: 16px; color: #666;">* 첨부파일을 등록해 주세요. (최대3개)</p>
|
||||
<!-- <div class="file_wrap file_upload_box no_img_box"> -->
|
||||
<!-- -->
|
||||
<div id="fileControl"></div><br/>
|
||||
</div>
|
||||
<%--
|
||||
<div class="file_wrap fileAfter file_list_div">
|
||||
<table class="tbType02">
|
||||
<colgroup>
|
||||
<col style="width: 60%">
|
||||
<col style="width: 10%">
|
||||
<col style="width: 20%">
|
||||
<col style="width: 10%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<!-- <th>
|
||||
<input type="checkbox" id="all_check"><label for="all_check"></label>
|
||||
</th> -->
|
||||
<th>파일 명</th>
|
||||
<th>종류</th>
|
||||
<th>크기</th>
|
||||
<th>삭제</th>
|
||||
</thead>
|
||||
<tbody id="tbody_fiielist" class="tb_file_after">
|
||||
<c:forEach var="fileList" items="${fileList}" varStatus="status">
|
||||
<tr class="item_<c:out value='${fileList.atchFileId}' />_<c:out value='${fileList.fileSn}' /> uploaded_obj">
|
||||
<input type="hidden" name="fileSize" class="item_file_size" value="${fileList.fileSize}">
|
||||
<td class="td_filename">
|
||||
<!-- <img src="/direct/img/upload_hwp_img.png" alt="" /> -->
|
||||
<span class="file_name_text"><c:out value='${fileList.orignlFileNm}' /></span>
|
||||
</td>
|
||||
<td class="td_filesort">
|
||||
<span class="file_filesort_text" value="<c:out value="${fileList.fileExtsn}"/>">
|
||||
<c:out value="${fileList.fileExtsn}" />
|
||||
</span>
|
||||
</td>
|
||||
<td class="td_filesize">
|
||||
<span class="file_size_text" value="<c:out value="${fileList.fileMg}"/>">
|
||||
<c:out value="${fileList.fileMg}" />
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn_del" onclick="delAtchFile('<c:out value='${fileList.atchFileId}' />', '<c:out value='${fileList.fileSn}' />'); return false;">
|
||||
<i></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
--%>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@ -29,12 +29,31 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<script src="<c:url value='/innorix/innorix.js' />"></script>
|
||||
<script src="<c:url value='/js/kccadr/adm/common/innorixCommon.js' />"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function(){
|
||||
fn_selectFileList();
|
||||
});
|
||||
|
||||
//파일 업로드 솔루션 init 셋팅
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl' // * 컨트롤 출력 HTML 객체 ID
|
||||
, transferMode: 'both' // * 업로드, 다운로드 혼합사용
|
||||
, installUrl: '/innorix/install/install.html' // * Agent 설치 페이지
|
||||
, uploadUrl: '/innorix/exam/upload.jsp' // * 업로드 URL
|
||||
, height:80
|
||||
, width: 635
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
fn_callBackInnorix(p.files); // * 파일 정보 DB isnert function
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
@ -93,61 +112,39 @@ function fn_makeList(data){
|
||||
/*
|
||||
* 파일 정보 DB insert Ajax
|
||||
* */
|
||||
function fn_insertFile(data){
|
||||
function fn_callBackInnorix(data){
|
||||
|
||||
var url = "<c:url value='/kccadr/common/insertInnorixFileAndRpplAjax.do' />";
|
||||
|
||||
var filePath = location.pathname;
|
||||
var jspFileName = filePath.substring(filePath.lastIndexOf("/")+1, filePath.lastIndexOf("."));
|
||||
var resultData = {
|
||||
|
||||
var sendData = {
|
||||
"adrSeq": $('#adrSeq').val()
|
||||
, "adrDocTy": $('#adrDocTy').val()
|
||||
, "frstRegistPnttm": $('#frstRegistPnttm').val()
|
||||
, "jspFileName": jspFileName
|
||||
, "innorixFileListVO": data
|
||||
}
|
||||
, "jspFileName": jspFileName // * /insertInnorixFileAndRpplAjax.do 호출 시 필수 값
|
||||
, "innorixFileListVO": data // * 솔루션에서 등록한 파일 정보
|
||||
, "successMsg" : "사건문서 제출이 완료되었습니다." // * 성공 메세지
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<c:url value='/kccadr/common/insertInnorixFileAjax.do' />",
|
||||
data: JSON.stringify(resultData),
|
||||
dataType:'json',
|
||||
async: false,
|
||||
processData: false,
|
||||
contentType: "application/json",
|
||||
cache: false,
|
||||
success: function (returnData) {
|
||||
if(data.status == "OK"){
|
||||
alert(returnData.data);
|
||||
}else{
|
||||
alert(returnData.data);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error: function (e) { alert("저장에 실패하였습니다."); console.log("ERROR : ", e); }
|
||||
});
|
||||
/*
|
||||
* 공통 : innorixCommon.js
|
||||
* fn_insertInnorixFileAndRpplAjax() 호출 후 status가 성공(OK)이면 실행
|
||||
*/
|
||||
if(fn_insertInnorixFileAndRpplAjax(sendData, url) == "OK")
|
||||
{
|
||||
fn_selectFileList(); // 파일 정보 list select function
|
||||
fn_initFileRegForm();
|
||||
control.removeAllFiles(); // control 초기화
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 파일 업로드 솔루션 init 셋팅
|
||||
var control = new Object();
|
||||
window.onload = function() {
|
||||
// 파일전송 컨트롤 생성
|
||||
control = innorix.create({
|
||||
el: '#fileControl' // 컨트롤 출력 HTML 객체 ID
|
||||
, transferMode: 'both' // 업로드, 다운로드 혼합사용
|
||||
, installUrl: '/innorix/install/install.html' // Agent 설치 페이지
|
||||
, uploadUrl: '/innorix/exam/upload_test_220916.jsp' // 업로드 URL
|
||||
, height:80
|
||||
, width: 635
|
||||
});
|
||||
|
||||
// 업로드 완료 이벤트
|
||||
control.on('uploadComplete', function (p) {
|
||||
fn_insertFile(p.files); // 파일 정보 DB isnert function
|
||||
fn_selectFileList(); // 파일 정보 list select function
|
||||
control.removeAllFiles(); // control 초기화
|
||||
});
|
||||
};
|
||||
function fn_initFileRegForm(){
|
||||
$('#frstRegistPnttm').val('');
|
||||
$('#adrDocTy').val('10').prop("selected",true);
|
||||
}
|
||||
|
||||
|
||||
// 등록 버튼 클릭파일 업로드 솔루션 init 셋팅
|
||||
@ -179,13 +176,7 @@ function fn_upload() {
|
||||
<style type="text/css">
|
||||
.calendarPop {left:-165px;}
|
||||
.cont .list {overflow:inherit;min-height:auto;border-bottom:0 none;}
|
||||
.tbType01 tbody td .sel_date button {width:20px;height:18px;}
|
||||
/* .cont .list.tbType01 tbody tr td {padding:10px 15px;} */
|
||||
/* .cont .list.tbType01 tbody tr td .sel_date {position:relative;} */
|
||||
/* .cont .list.tbType01 tbody tr td .sel_date .startDate {width:100%;box-sizing:border-box;} */
|
||||
/* .cont .list.tbType01 tbody tr td .sel_date .calendar_in {position:absolute;right:0;top:8px;} */
|
||||
/* .cont .list.tbType01 tbody tr td.upload_area {text-align:left;} */
|
||||
/* .cont .list.tbType01 tbody tr td.upload_area .btnType01 {height:36px;padding:0 11px;font-size:15px;} */
|
||||
.tbType01 tbody td .sel_date button {width:20px;height:18px;}
|
||||
</style>
|
||||
<link rel="stylesheet" href="<c:url value='/innorix/innorix.css'/>" type="text/css">
|
||||
<title>사건관련문서 등록</title>
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||
|
||||
<%-- <%@ page import="egovframework.rte.fdl.property.EgovPropertyService" %> --%>
|
||||
<%
|
||||
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||
if (request.getMethod().equals("POST"))
|
||||
{
|
||||
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||
System.out.println("========== directory :: " + directory + " ==========");
|
||||
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||
// directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||
// directory = PropertyService.getString("Globals.fileStorePath");
|
||||
directory = "/usr/local/tomcat/file/sht/";
|
||||
int maxPostSize = 2147482624; // bytes
|
||||
|
||||
|
||||
|
||||
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||
|
||||
/*
|
||||
@ -32,6 +35,26 @@ if (request.getMethod().equals("POST"))
|
||||
String _type = uploader.getParameter("type"); // 커스텀 정의 POST Param 1
|
||||
String _part = uploader.getParameter("part"); // 커스텀 정의 POST Param 2
|
||||
String _transferId = uploader.getParameter("_transferId"); // TransferId
|
||||
String _innoFilePath = uploader.getParameter("innoDirPath"); // 커스텀 정의 POST Param 2
|
||||
|
||||
/*
|
||||
|
||||
현재 페이지를 호출하는 jsp에서
|
||||
<input type="hidden" id="innoDirPath" value="<spring:eval expression="@globalSettings['Globals.Innorix.FilePath']"/>" />
|
||||
위 코드를 작성하고
|
||||
|
||||
control.upload() 전에
|
||||
|
||||
|
||||
var postObj = new Object();
|
||||
postObj.innoDirPath = $('#innoDirPath').val();
|
||||
control.setPostData(postObj); // 업로드시 함께 전달될 POST Param 추가
|
||||
|
||||
위 코드를 넣어 줘야 함
|
||||
|
||||
*/
|
||||
uploader.setDirectory(_innoFilePath);
|
||||
|
||||
String _run_retval = uploader.run();
|
||||
|
||||
// 개별파일 업로드 완료
|
||||
|
||||
@ -1,18 +1,15 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.innorix.transfer.InnorixUpload" %>
|
||||
<%-- <%@ page import="egovframework.rte.fdl.property.EgovPropertyService" %> --%>
|
||||
|
||||
<%
|
||||
// CORS체크를 위한 OPTIONS 메소드가 들어오므로 POST 일 경우에만 동작하도록 조건 추가
|
||||
if (request.getMethod().equals("POST"))
|
||||
{
|
||||
String directory = InnorixUpload.getServletAbsolutePath(request);
|
||||
// directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||
// directory = PropertyService.getString("Globals.fileStorePath");
|
||||
directory = "/usr/local/tomcat/file/sht/";
|
||||
System.out.println("========== directory :: " + directory + " ==========");
|
||||
directory = directory.substring(0, directory.lastIndexOf("/") + 1) + "data";
|
||||
int maxPostSize = 2147482624; // bytes
|
||||
|
||||
|
||||
|
||||
InnorixUpload uploader = new InnorixUpload(request, response, maxPostSize, directory);
|
||||
|
||||
/*
|
||||
@ -35,26 +32,6 @@ if (request.getMethod().equals("POST"))
|
||||
String _type = uploader.getParameter("type"); // 커스텀 정의 POST Param 1
|
||||
String _part = uploader.getParameter("part"); // 커스텀 정의 POST Param 2
|
||||
String _transferId = uploader.getParameter("_transferId"); // TransferId
|
||||
String _innoFilePath = uploader.getParameter("innoDirPath"); // 커스텀 정의 POST Param 2
|
||||
|
||||
/*
|
||||
|
||||
현재 페이지를 호출하는 jsp에서
|
||||
<input type="hidden" id="innoDirPath" value="<spring:eval expression="@globalSettings['Globals.Innorix.FilePath']"/>" />
|
||||
위 코드를 작성하고
|
||||
|
||||
control.upload() 전에
|
||||
|
||||
|
||||
var postObj = new Object();
|
||||
postObj.innoDirPath = $('#innoDirPath').val();
|
||||
control.setPostData(postObj); // 업로드시 함께 전달될 POST Param 추가
|
||||
|
||||
위 코드를 넣어 줘야 함
|
||||
|
||||
*/
|
||||
uploader.setDirectory(_innoFilePath);
|
||||
|
||||
String _run_retval = uploader.run();
|
||||
|
||||
// 개별파일 업로드 완료
|
||||
@ -29,4 +29,6 @@ function openExampleAdminPop(exmpCd) {
|
||||
|
||||
// commonPopWindowopenForm("/web/kccadr/adjst/popup/"+uri, '500', '400', "openExampleAdminPop", $('#pop'));
|
||||
commonPopWindowopenForm("/kccadr/adjPgrMgr/apm/popup/"+uri, '600', '400', "openExampleAdminPop", $('#pop'));
|
||||
|
||||
fn_data_reg(atchfileId);
|
||||
}
|
||||
|
||||
111
src/main/webapp/js/kccadr/adm/common/innorixCommon.js
Normal file
111
src/main/webapp/js/kccadr/adm/common/innorixCommon.js
Normal file
@ -0,0 +1,111 @@
|
||||
/**
|
||||
*
|
||||
* @author : 이호영
|
||||
* @fileName : InnorixCommon.js
|
||||
* @date : 2022.12.26
|
||||
* @description : innorix 대용량 파일 업로드 솔루션 공통 js
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* ----------------------------------------------------------- *
|
||||
* 2022.11.01 이호영 최초 생성
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
var innoJquery = innorix._load("innoJquery");
|
||||
|
||||
var urlBase = location.href.substring(0, location.href.lastIndexOf("/") + 1);
|
||||
var control = new Object(); // 파일전송 컨트롤 객체선언
|
||||
var downFileArr = new Array(); // 다운로드 목록 정보
|
||||
var resetFileArr = new Array(); // 다운로드 목록 초기화 정보
|
||||
var delFileArr = new Array(); // 삭제된 파일 정보
|
||||
var removeFlag = true; // 삭제 이벤트 조건 플래그
|
||||
|
||||
function fn_insertInnorixFileAndRpplAjax(sendData, url){
|
||||
|
||||
var successData;
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: JSON.stringify(sendData),
|
||||
dataType:'json',
|
||||
async: false,
|
||||
processData: false,
|
||||
contentType: "application/json",
|
||||
cache: false,
|
||||
success: function (returnData) {
|
||||
console.log('returnData : ', returnData);
|
||||
if(returnData.status == "OK"){
|
||||
if(returnData.data != "")
|
||||
alert(returnData.data);
|
||||
successData = returnData.status;
|
||||
}else{
|
||||
alert(returnData.data);
|
||||
return false;
|
||||
}
|
||||
},
|
||||
error: function (e) { alert("저장에 실패하였습니다."); console.log("ERROR : ", e); }
|
||||
});
|
||||
return successData;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* 등록되어 있는 파일 삭제버튼 클릭시 */
|
||||
function innorixDelAtchFile(itemId , fileSn){
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/uss/ion/fms/fmsfileDeleteAjax.do",
|
||||
data:{ "atchFileId" : itemId , "fileSn" : fileSn},
|
||||
dataType:'json',
|
||||
cache: false,
|
||||
async: false,
|
||||
timeout: 600000,
|
||||
success: function (returnData, status) {
|
||||
if(status == 'success'){
|
||||
if(returnData.result == 'fail'){
|
||||
alert("삭제처리가 실패하였습니다.");
|
||||
}else if(returnData.result == 'auth_fail'){
|
||||
alert("세션이 종료되었습니다.");
|
||||
}else if(returnData.result =='success'){
|
||||
alert("삭제되었습니다.");
|
||||
}
|
||||
}else{
|
||||
alert("삭제처리에 실패하였습니다.");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log("ERROR : ", e);
|
||||
alert("삭제처리에 실패하였습니다.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* loadComplete에서 불러온 최초 파일 array에서
|
||||
* 삭제된 파일 정보 삭제
|
||||
*/
|
||||
function deleteFromResetFileArr(value) {
|
||||
|
||||
$(resetFileArr).each(function(index, element){
|
||||
if(element.printFileName === value)
|
||||
resetFileArr.splice(index, 1);
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 파일 삭제 confire 아니요 클릭 시
|
||||
* 솔루션에서 진행하는 자동 파일 삭제 후
|
||||
* reset을 통해 파일 배열 다시 불러옴
|
||||
*/
|
||||
function fileListReset() {
|
||||
removeFlag = false;
|
||||
delFileArr = new Array(); // 삭제정보 초기화
|
||||
control.removeAllFiles(); // 리스트 컨트롤에서 파일을 삭제
|
||||
control.presetDownloadFiles(resetFileArr); // 다운로드 목록 초기화
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user