diff --git a/src/pages/DemandNote/Create/SearchForm.js b/src/pages/DemandNote/Create/SearchForm.js
index 6b46abd..339e8c9 100644
--- a/src/pages/DemandNote/Create/SearchForm.js
+++ b/src/pages/DemandNote/Create/SearchForm.js
@@ -27,6 +27,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p
const [isSuccessPopUp, setIsSuccessPopUp] = React.useState(false);
const [resultCount, setResultCount] = React.useState(0);
+ const [dnIdList, setDnIdList] = React.useState([]);
const [issueSelected, setIssueSelected] = React.useState({});
const [paymentCount, setPaymentCount] = React.useState(0);
@@ -86,6 +87,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p
url: UrlUtils.DEMAND_NOTE_CREATE + "/" + issueSelected.id,
onSuccess: function (responseData) {
setResultCount(responseData.count);
+ setDnIdList(responseData.idList);
setIsSuccessPopUp(true);
}
});
@@ -95,9 +97,10 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p
const fileDownload = () => {
HttpUtils.fileDownload({
+ method:'post',
url: UrlUtils.DEMAND_NOTE_EXPORT,
params: {
- "issueId": issueSelected.id
+ "dnIdList": dnIdList
},
onSuccess: function () {
notifyDownloadSuccess();
@@ -219,7 +222,7 @@ const SearchPublicNoticeForm = ({ applySearch, issueComboData, _paymentCount, _p
-
-
-
+
);
}
diff --git a/src/utils/HttpUtils.js b/src/utils/HttpUtils.js
index 1ab55ba..4c87c38 100644
--- a/src/utils/HttpUtils.js
+++ b/src/utils/HttpUtils.js
@@ -58,35 +58,56 @@ export const postWithFiles = ({url, params, files, onSuccess, onFail, onError})
});
};
-export const fileDownload = ({url, fileId, skey, filename, onResponse, onError}) =>{
+export const fileDownload = ({url, fileId, skey, filename, params, method, onResponse, onError}) =>{
if(!url){
url = FILE_DOWN_GET+"/"+fileId+"/"+skey+"/"+filename
}
- axios.get( url,
- {
- responseType: 'blob',
- }
- ).then(
- (response)=>{
- const fn = response.headers.get("content-disposition")?.split("filename=")[1]?.split('"')[1]?.trim()??filename;
- const url = URL.createObjectURL(response.data);
- const a = document.createElement('a');
- a.href = url;
- a.setAttribute("download", fn);
- document.body.appendChild(a);
- a.click();
- document.body.removeChild(a);
- URL.revokeObjectURL(url);
- if(onResponse){
- onResponse();
+ if(method == 'post'){
+ axios.post( url, params,
+ {
+ responseType: 'blob',
+ headers:{
+ "Content-Type":"application/json"
+ }
}
- }
- ).catch(error => {
- return handleError(error,onError);
- });
-};
+ ).then(
+ (response)=>{
+ fileDownloadResponse(response, onResponse)
+ }
+ ).catch(error => {
+ return handleError(error,onError);
+ });
+ }else{
+ axios.get( url,
+ {
+ responseType: 'blob',
+ params:params
+ }
+ ).then(
+ (response)=>{
+ fileDownloadResponse(response, onResponse)
+ }
+ ).catch(error => {
+ return handleError(error,onError);
+ });
+ }
+};
+const fileDownloadResponse=(response, onResponse)=>{
+ const fn = response.headers.get("content-disposition")?.split("filename=")[1]?.split('"')[1]?.trim()??filename;
+ const url = URL.createObjectURL(response.data);
+ const a = document.createElement('a');
+ a.href = url;
+ a.setAttribute("download", fn);
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
+ URL.revokeObjectURL(url);
+ if(onResponse){
+ onResponse();
+ }
+}
export const fileUpload = ({refType, refId, files, refCode, onSuccess, onFail, onError}) =>{
postWithFiles({