From 8bb1e9270468c9119f76c6ee2e9ed1bdc60b7df6 Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 21 Sep 2023 11:15:37 +0800 Subject: [PATCH] fix bug --- .../ApplyForm/PublicNoticeApplyForm.js | 14 +++++++++----- src/pages/PublicNotice/ListPanel/BaseGrid.js | 2 +- .../PublicNotice/ListPanel/PendingPaymentTab.js | 2 +- .../ListPanel/SearchPublicNoticeTable.js | 2 +- src/utils/HttpUtils.js | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js index 19a9e6c..9297ae5 100644 --- a/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js +++ b/src/pages/PublicNotice/ApplyForm/PublicNoticeApplyForm.js @@ -54,11 +54,15 @@ const PublicNoticeApplyForm = ({loadedData, selections}) => { return; } if(!attachment){ - setWarningText("請選擇上傳文件"); + setWarningText("請選擇上傳檔案"); + setIsWarningPopUp(true); + return; + }else if(!attachment.size || attachment.size <=0){ + setWarningText("請上傳有效檔案"); setIsWarningPopUp(true); return; }else if(attachment.size >= (10*1024*1034)){ - setWarningText("上傳文件大小應<10MB"); + setWarningText("上傳檔案大小應<10MB"); setIsWarningPopUp(true); return; } @@ -77,7 +81,7 @@ const PublicNoticeApplyForm = ({loadedData, selections}) => { faxNumber: values.faxNumber }, issueId:values.issueId, - remarks:values.remarks, + remarks:values.remarks?values.remarks:"", }, files: [attachment], onSuccess: function(){ @@ -163,7 +167,7 @@ const PublicNoticeApplyForm = ({loadedData, selections}) => { - 上傳文件 ({"檔案大小應<10MB"}): + 犒件檔案 ({"檔案大小應<10MB"}): {attachment.name} @@ -184,7 +188,7 @@ const PublicNoticeApplyForm = ({loadedData, selections}) => { component="span" variant="outlined" size="large" - >{attachment?"上傳文件":"重新上傳"} + >{attachment?"上傳檔案":"重新上傳"} diff --git a/src/pages/PublicNotice/ListPanel/BaseGrid.js b/src/pages/PublicNotice/ListPanel/BaseGrid.js index ce74361..2c7c7e9 100644 --- a/src/pages/PublicNotice/ListPanel/BaseGrid.js +++ b/src/pages/PublicNotice/ListPanel/BaseGrid.js @@ -49,7 +49,7 @@ export default function BaseGrid({rows}) { contact = "電話: " + phone?.countryCode + " " + phone?.phoneNumber } - if (faxNo) { + if (faxNo && faxNo?.faxNumber) { if (contact != "") contact = contact + ", " contact = contact + "傳真:" + faxNo?.countryCode + " " + faxNo?.faxNumber diff --git a/src/pages/PublicNotice/ListPanel/PendingPaymentTab.js b/src/pages/PublicNotice/ListPanel/PendingPaymentTab.js index be446a7..00a891f 100644 --- a/src/pages/PublicNotice/ListPanel/PendingPaymentTab.js +++ b/src/pages/PublicNotice/ListPanel/PendingPaymentTab.js @@ -53,7 +53,7 @@ export default function SubmittedTab({ rows }) { contact = "電話: " + phone?.countryCode + " " + phone?.phoneNumber } - if (faxNo) { + if (faxNo && faxNo?.faxNumber) { if (contact != "") contact = contact + ", " contact = contact + "傳真:" + faxNo?.countryCode + " " + faxNo?.faxNumber diff --git a/src/pages/PublicNotice/ListPanel/SearchPublicNoticeTable.js b/src/pages/PublicNotice/ListPanel/SearchPublicNoticeTable.js index 789f050..72e8e5d 100644 --- a/src/pages/PublicNotice/ListPanel/SearchPublicNoticeTable.js +++ b/src/pages/PublicNotice/ListPanel/SearchPublicNoticeTable.js @@ -55,7 +55,7 @@ export default function SearchPublicNoticeTable({ recordList }) { contact = "電話: " + phone?.countryCode + " " + phone?.phoneNumber } - if (faxNo) { + if (faxNo && faxNo?.faxNumber) { if (contact != "") contact = contact + ", " contact = contact + "傳真:" + faxNo?.countryCode + " " + faxNo?.faxNumber diff --git a/src/utils/HttpUtils.js b/src/utils/HttpUtils.js index 64ade39..027bba5 100644 --- a/src/utils/HttpUtils.js +++ b/src/utils/HttpUtils.js @@ -45,7 +45,7 @@ export const postWithFiles = ({url, params, files, onSuccess, onFail, onError}) if(typeof(params[key]) ==='object'){ formData.append(key, JSON.stringify(params[key])); }else{ - formData.append(key, params[key]?params[key]:null); + formData.append(key, params[key]); } }