[BO] 엑셀다운로드 로딩바 추가 - 로딩바가 필요한 엑셀 다운로드일 경우 excelDownload(url, data); 함수 사용하면 됩니다.
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<mask id="path-1-inside-1_24355_18053" fill="white">
|
||||
<path d="M48 24C48 37.2548 37.2548 48 24 48C10.7452 48 0 37.2548 0 24C0 10.7452 10.7452 0 24 0C37.2548 0 48 10.7452 48 24Z"/>
|
||||
</mask>
|
||||
<g clip-path="url(#paint0_angular_24355_18053_clip_path)" data-figma-skip-parse="true" mask="url(#path-1-inside-1_24355_18053)"><g transform="matrix(0 -0.024 0.024 0 24 24)"><foreignObject x="-1291.67" y="-1291.67" width="2583.33" height="2583.33"><div xmlns="http://www.w3.org/1999/xhtml" style="background:conic-gradient(from 90deg,rgba(75, 188, 67, 0) 0deg,rgba(75, 188, 67, 0.8462) 304.615deg,rgba(75, 188, 67, 1) 360deg);height:100%;width:100%;opacity:1"></div></foreignObject></g></g><path d="M48 24H41C41 33.3888 33.3888 41 24 41V48V55C41.1208 55 55 41.1208 55 24H48ZM24 48V41C14.6112 41 7 33.3888 7 24H0H-7C-7 41.1208 6.87917 55 24 55V48ZM0 24H7C7 14.6112 14.6112 7 24 7V0V-7C6.87917 -7 -7 6.87917 -7 24H0ZM24 0V7C33.3888 7 41 14.6112 41 24H48H55C55 6.87917 41.1208 -7 24 -7V0Z" data-figma-gradient-fill="{"type":"GRADIENT_ANGULAR","stops":[{"color":{"r":0.29411765933036804,"g":0.73725491762161255,"b":0.26274511218070984,"a":0.0},"position":0.0},{"color":{"r":0.29411765933036804,"g":0.73725491762161255,"b":0.26274511218070984,"a":0.84615385532379150},"position":0.84615385532379150},{"color":{"r":0.29411765933036804,"g":0.73725491762161255,"b":0.26274511218070984,"a":1.0},"position":1.0}],"stopsVar":[{"color":{"r":0.29411765933036804,"g":0.73725491762161255,"b":0.26274511218070984,"a":0.0},"position":0.0},{"color":{"r":0.29411765933036804,"g":0.73725491762161255,"b":0.26274511218070984,"a":0.84615385532379150},"position":0.84615385532379150},{"color":{"r":0.29411765933036804,"g":0.73725491762161255,"b":0.26274511218070984,"a":1.0},"position":1.0}],"transform":{"m00":-5.6229855298871312e-14,"m01":48.0,"m02":5.6229855298871312e-14,"m10":-48.0,"m11":-6.1558925817072063e-14,"m12":48.0},"opacity":1.0,"blendMode":"NORMAL","visible":true}" mask="url(#path-1-inside-1_24355_18053)"/>
|
||||
<defs>
|
||||
<clipPath id="paint0_angular_24355_18053_clip_path"><path d="M48 24H41C41 33.3888 33.3888 41 24 41V48V55C41.1208 55 55 41.1208 55 24H48ZM24 48V41C14.6112 41 7 33.3888 7 24H0H-7C-7 41.1208 6.87917 55 24 55V48ZM0 24H7C7 14.6112 14.6112 7 24 7V0V-7C6.87917 -7 -7 6.87917 -7 24H0ZM24 0V7C33.3888 7 41 14.6112 41 24H48H55C55 6.87917 41.1208 -7 24 -7V0Z" mask="url(#path-1-inside-1_24355_18053)"/></clipPath></defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
@@ -192,6 +192,48 @@ var ajaxUtil = {
|
||||
},
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 엑셀 다운로드 (로딩바 포함)
|
||||
*/
|
||||
_excelDownload: function(url, data, errorCallback) {
|
||||
ajaxUtil._showWaiting();
|
||||
|
||||
$.ajax({
|
||||
url: url,
|
||||
method: 'GET',
|
||||
data: data,
|
||||
xhrFields: {
|
||||
responseType: 'blob'
|
||||
},
|
||||
beforeSend: function(xhr) {
|
||||
if (ajaxUtil._csrfHeader != undefined) {
|
||||
xhr.setRequestHeader(ajaxUtil._csrfHeader, ajaxUtil._csrfToken);
|
||||
}
|
||||
},
|
||||
success: function(blob, status, xhr) {
|
||||
const disposition = xhr.getResponseHeader('Content-Disposition');
|
||||
const filenameMatch = disposition?.match(/filename\*?=UTF-8''(.+)/);
|
||||
const filename = filenameMatch ? decodeURIComponent(filenameMatch[1]) : 'download.xlsx';
|
||||
|
||||
const blobUrl = window.URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = blobUrl;
|
||||
a.download = filename;
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(blobUrl);
|
||||
},
|
||||
error: function(rstData) {
|
||||
if (typeof errorCallback !== 'undefined') {
|
||||
errorCallback(rstData.status, rstData);
|
||||
} else {
|
||||
alert('엑셀 다운로드 실패');
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
ajaxUtil._hideWaiting();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
_jsonParse : function parse(jsonStr) {
|
||||
@@ -220,11 +262,17 @@ var ajaxUtil = {
|
||||
_hideWaiting:function(){
|
||||
if (ajaxUtil.loadingStatus) {
|
||||
ajaxUtil.loadingStatus = false;
|
||||
// TODO : 로딩바 숨김
|
||||
$('#loading').hide();
|
||||
}
|
||||
},
|
||||
_showWaiting:function(){
|
||||
ajaxUtil.loadingStatus = true;
|
||||
// TODO : 로딩바 활성화
|
||||
$('#loading').show();
|
||||
},
|
||||
};
|
||||
|
||||
const excelDownload = (url, data) => {
|
||||
ajaxUtil._excelDownload(url, data, (status, error) => {
|
||||
console.error('엑셀 다운로드 실패:', status, error);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user