From 88236e32ee6a9525dd51534941d13e1e2bc813b0 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 28 Dec 2023 10:48:41 +0800 Subject: [PATCH] fix bug --- .../Details/ApplicationDetailCard.js | 32 ++++++++++++------- .../DemandNote/Details/ClientDetailCard.js | 12 +++---- src/pages/DemandNote/Details/DnDetailCard.js | 15 +++++++-- .../DemandNote/Details/GazetteDetailCard.js | 16 +++++++--- src/pages/DemandNote/Details/index.js | 4 +-- src/utils/HttpUtils.js | 5 ++- 6 files changed, 57 insertions(+), 27 deletions(-) diff --git a/src/pages/DemandNote/Details/ApplicationDetailCard.js b/src/pages/DemandNote/Details/ApplicationDetailCard.js index 931965c..27ada79 100644 --- a/src/pages/DemandNote/Details/ApplicationDetailCard.js +++ b/src/pages/DemandNote/Details/ApplicationDetailCard.js @@ -12,6 +12,7 @@ import Loadable from 'components/Loadable'; const MainCard = Loadable(React.lazy(() => import('components/MainCard'))); import * as StatusUtils from "utils/statusUtils/PublicNoteStatusUtils"; +import * as HttpUtils from "utils/HttpUtils"; import DownloadIcon from '@mui/icons-material/Download'; import { notifyDownloadSuccess } from 'utils/CommonFunction'; @@ -33,8 +34,7 @@ const ApplicationDetailCard = ({ data }) => { skey: appDetail.appSkey, filename: appDetail.appFilename, }); - notifyDownloadSuccess() - setUploadStatus(true) + notifyDownloadSuccess(); }; return ( @@ -56,7 +56,9 @@ const ApplicationDetailCard = ({ data }) => { - {appDetail.appNo} + + {appDetail.appNo} + @@ -69,7 +71,7 @@ const ApplicationDetailCard = ({ data }) => { - {StatusUtils.getStatusByTextEng(appDetail.status)} + {StatusUtils.getStatusByTextEng(appDetail.appStatus)} @@ -85,9 +87,11 @@ const ApplicationDetailCard = ({ data }) => { - {appDetail.orgId === null ? - appDetail.contactPerson : appDetail.enCompanyName - } + + {appDetail.orgId === null ? + appDetail.contactPerson : appDetail.enCompanyName + } + @@ -100,7 +104,9 @@ const ApplicationDetailCard = ({ data }) => { - {appDetail.contactTelNo ? appDetail.contactTelNo.countryCode + " " + appDetail.contactTelNo.phoneNumber : ""} + + {appDetail.contactTelNo ? appDetail.contactTelNo.countryCode + " " + appDetail.contactTelNo.phoneNumber : ""} + @@ -114,7 +120,9 @@ const ApplicationDetailCard = ({ data }) => { - {appDetail.contactPerson} + + {appDetail.contactPerson} + @@ -126,7 +134,9 @@ const ApplicationDetailCard = ({ data }) => { - {appDetail.contactFaxNo ? appDetail.contactFaxNo.countryCode + " " + appDetail.contactFaxNo.faxNumber : ""} + + {appDetail.contactFaxNo ? appDetail.contactFaxNo.countryCode + " " + appDetail.contactFaxNo.faxNumber : ""} + @@ -150,7 +160,7 @@ const ApplicationDetailCard = ({ data }) => { id='fileName' variant="h5" > - {appDetail.filename} + {appDetail.appFilename} diff --git a/src/pages/DemandNote/Details/ClientDetailCard.js b/src/pages/DemandNote/Details/ClientDetailCard.js index ce3a290..d9cdd1c 100644 --- a/src/pages/DemandNote/Details/ClientDetailCard.js +++ b/src/pages/DemandNote/Details/ClientDetailCard.js @@ -21,14 +21,14 @@ const ClientDetailCard = ({ data }) => { }, [data]); const getDisplayField = (label, value) => { - return - + return + {label}: - - {value} + + + {value} + ; } diff --git a/src/pages/DemandNote/Details/DnDetailCard.js b/src/pages/DemandNote/Details/DnDetailCard.js index f542fcf..beac57a 100644 --- a/src/pages/DemandNote/Details/DnDetailCard.js +++ b/src/pages/DemandNote/Details/DnDetailCard.js @@ -7,11 +7,13 @@ import { } from '@mui/material'; import * as React from "react"; +import * as HttpUtils from "utils/HttpUtils"; import * as StatusUtils from "utils/statusUtils/DnStatus"; import Loadable from 'components/Loadable'; const MainCard = Loadable(React.lazy(() => import('components/MainCard'))); import DownloadIcon from '@mui/icons-material/Download'; +import { notifyDownloadSuccess } from 'utils/CommonFunction'; // ==============================|| DASHBOARD - DEFAULT ||============================== // @@ -25,9 +27,16 @@ const DnDetailCard = ({ data }) => { } }, [data]); - const onDownloadClick = () => { - - } + const onDownloadClick = () => () => { + HttpUtils.fileDownload({ + fileId: dnData.fileId, + skey: dnData.skey, + filename: dnData.filename, + onResponse: function(){ + notifyDownloadSuccess(); + } + }); + }; const getDisplayField = (label, value) => { return diff --git a/src/pages/DemandNote/Details/GazetteDetailCard.js b/src/pages/DemandNote/Details/GazetteDetailCard.js index 0fdddcf..956a23e 100644 --- a/src/pages/DemandNote/Details/GazetteDetailCard.js +++ b/src/pages/DemandNote/Details/GazetteDetailCard.js @@ -40,7 +40,9 @@ const GazetteDetailCard = ({ data }) => { - {appData.issueNum} + + {appData.issueNum} + @@ -52,7 +54,9 @@ const GazetteDetailCard = ({ data }) => { - {appData.groupNo} + + {appData.groupNo} + @@ -68,7 +72,9 @@ const GazetteDetailCard = ({ data }) => { - {appData.gazetteIssueDate} + + {appData.gazetteIssueDate} + @@ -80,7 +86,9 @@ const GazetteDetailCard = ({ data }) => { - {appData.groupTitle} + + {appData.groupTitle} + diff --git a/src/pages/DemandNote/Details/index.js b/src/pages/DemandNote/Details/index.js index aaea97f..83ffeae 100644 --- a/src/pages/DemandNote/Details/index.js +++ b/src/pages/DemandNote/Details/index.js @@ -75,7 +75,7 @@ const DemandNote_index = () => { - + @@ -101,7 +101,7 @@ const DemandNote_index = () => { - + diff --git a/src/utils/HttpUtils.js b/src/utils/HttpUtils.js index 453db92..eaeafd8 100644 --- a/src/utils/HttpUtils.js +++ b/src/utils/HttpUtils.js @@ -58,7 +58,7 @@ export const postWithFiles = ({url, params, files, onSuccess, onFail, onError}) }); }; -export const fileDownload = ({fileId, skey, filename, onError}) =>{ +export const fileDownload = ({fileId, skey, filename, onResponse, onError}) =>{ axios.get( FILE_DOWN_GET+"/"+fileId+"/"+skey+"/"+filename, { responseType: 'blob', @@ -73,6 +73,9 @@ export const fileDownload = ({fileId, skey, filename, onError}) =>{ a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); + if(onResponse){ + onResponse(); + } } ).catch(error => { return handleError(error,onError);