feat: 첨부파일 이미지 download 적용

main
minuk926 2 years ago
parent 3d7785526f
commit be5a205eb5

@ -93,23 +93,6 @@
const rowData = props.grid.getRow(props.rowKey);
fnBiz.pagePopup('detail', {interfaceSeqN: rowData.interfaceSeqN});
}
// ,onSearchChange: () => {
// if($('#searchCondition').val() === 'tmplatSeCode'){
// $('select[name="searchKeyword"]')
// .css('display', 'inline-block')
// .attr('disabled', false);
// $('input[name="searchKeyword"]')
// .css('display', 'none')
// .attr('disabled', true);
// }else{
// $('select[name="searchKeyword"]')
// .css('display', 'none')
// .attr('disabled', true);
// $('input[name="searchKeyword"]')
// .css('display', 'inline-block')
// .attr('disabled', false);
// }
// }
}
/**************************************************************************
@ -153,56 +136,85 @@
{
header: '순번',
name: 'ctznSttemntDetailSn',
width: 80,
minWidth: 50,
sortable: false,
align: 'center'
},
{
header: '기관코드',
name: 'insttCode',
width: 80,
header: '차량번호',
name: 'vhcleNo',
minWidth: 70,
sortable: false,
align: 'center'
},
{
header: '시스템코드',
name: 'sysCode',
minWidth: 200,
header: '단속일시',
name: 'regltDeTime',
minWidth: 130,
sortable: false,
align: 'center',
formatter({value}){
return setDateTimeFmt(value);
}
},
{
header: '단속장소',
name: 'regltPlace',
minWidth: 160,
sortable: false,
},
{
header: '위반내역',
name: 'violtDtlsNm',
minWidth: 150,
sortable: false,
},
{
header: 'GPS 위도',
name: 'gpsX',
minWidth: 120,
sortable: false,
align: 'center'
},
{
header: '민원구분',
name: 'cvplSe',
minWidth: 200,
header: 'GPS 경도',
name: 'gpsY',
minWidth: 120,
sortable: false,
align: 'center'
},
{
header: '민원신청번호',
name: 'cvplReqstNo',
minWidth: 200,
header: '처리상태',
name: 'ctznSttemntProcessSttus',
minWidth: 80,
sortable: false,
align: 'center'
},
{
header: '민원접수번호',
name: 'cvplRceptNo',
header: '단속ID',
name: 'regltId',
minWidth: 80,
sortable: false,
align: 'center'
},
{
header: '기관코드',
name: 'insttCode',
minWidth: 200,
sortable: false,
align: 'center'
},
{
header: '시민신고처리상태',
name: 'ctznSttemntProcessSttus',
header: '시스템코드',
name: 'sysCode',
minWidth: 200,
sortable: false,
align: 'center'
},
{
header: '민원등록일시',
name: 'cpvlRegistDt',
width: 160,
header: '등록일시',
name: 'registDt',
minWidth: 130,
sortable: false,
align: 'center',
formatter({value}){
@ -214,7 +226,10 @@
const gridOptions = {
el: 'grid',
rowHeaders: ['rowNum'],
columns: gridColumns
columns: gridColumns,
columnOptions: {
frozenCount: 6
}
};
const gridDatasource = {

@ -214,7 +214,6 @@
</div>
<!-- //popup -->
<script type="text/javascript">
/**************************************************************************
* Global Variable
@ -235,35 +234,7 @@
,url: '<c:url value="/fims/biz/ec/findNatlNewspaperAttchFiles.do"/>'
,data: {interfaceSeqN: '${interfaceSeqN}'}
,success: (res) => {
const url = '<c:url value="/framework/biz/cmm/file/download.do"/>';
res.data?.contents.forEach((dtl, idx) => {
fetch(
url
, {
method: 'post'
, body: JSON.stringify(dtl)
}
)
.then((response) => response.blob())
.then((blob) => {
const url = URL.createObjectURL(blob);
var x = document.createElement("img");
x.setAttribute("src", url);
//x.style = 'width:150px; display: block;';
x.style = 'height:150px;';
//x.setAttribute("width", "304");
//x.setAttribute("height", "228");
x.setAttribute("title", dtl.orginlFileNm);
x.setAttribute("alt", dtl.orginlFileNm);
document.querySelector('#ctznImg').appendChild(x);
// Revoke Blob URL after DOM updates..
//window.URL.revokeObjectURL(objectURL);
});
})
imgDownload(res.data?.contents, '#ctznImg');
}
})
},

@ -231,34 +231,7 @@
,url: '<c:url value="/fims/biz/ec/findNatlNewspaperAttchFiles.do"/>'
,data: {interfaceSeqN: '${interfaceSeqN}'}
,success: (res) => {
const url = '<c:url value="/framework/biz/cmm/file/download.do"/>';
res.data?.contents.forEach((dtl, idx) => {
fetch(
url
, {
method: 'post'
, body: JSON.stringify(dtl)
}
)
.then((response) => response.blob())
.then((blob) => {
const url = URL.createObjectURL(blob);
var x = document.createElement("img");
x.setAttribute("src", url);
//x.style = 'width:150px; display: block;';
x.style = 'height:150px;';
//x.setAttribute("width", "304");
//x.setAttribute("height", "228");
x.setAttribute("alt", dtl.orginlFileNm);
document.querySelector('#ctznImg').appendChild(x);
// Revoke Blob URL after DOM updates..
//window.URL.revokeObjectURL(objectURL);
});
})
imgDownload(res.data?.contents, '#ctznImg');
}
})
},

@ -498,6 +498,43 @@ function serialize (formData) {
return rtnData;
}
/**
* 첨부파일 정보 목록으로 부터 이미지 download
* @param {object} cmmFileDtls
* @param {string} appendElementId - '#ctznImg'
*/
function imgDownload(cmmFileDtls, appendElementId) {
const downloadUrl = '/framework/biz/cmm/file/download.do';
cmmFileDtls.forEach((dtl, idx) => {
fetch(
downloadUrl
,{
method: 'post'
,body: JSON.stringify(dtl)
}
)
.then((response) => response.blob())
.then((blob) => {
const url = URL.createObjectURL(blob);
const x = document.createElement("img");
x.setAttribute("src", url);
//x.style = 'width:150px; display: block;';
x.style = 'height:150px;';
//x.setAttribute("width", "304");
//x.setAttribute("height", "228");
x.setAttribute("title", dtl.orginlFileNm);
x.setAttribute("alt", dtl.orginlFileNm);
document.querySelector(appendElementId).appendChild(x);
// Revoke Blob URL after DOM updates..
//window.URL.revokeObjectURL(objectURL);
}
);
})
}
/**
* [downloadImage]
* @param {[string]} img [base64encoded image data]

Loading…
Cancel
Save