From f5e671ca7f4595090d99ca91e750b7ab03e26ca0 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Mon, 23 Jun 2025 00:26:21 +0800 Subject: [PATCH] fix public notes save search criteria --- src/auth/utils.js | 2 +- src/components/FiDataGrid.js | 10 ++++++++-- .../ListPanel/SearchPublicNoticeForm.js | 3 ++- .../ListPanel/SearchPublicNoticeTab.js | 10 +++++++++- .../ListPanel/SearchPublicNoticeTable.js | 15 +++++++++------ 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/auth/utils.js b/src/auth/utils.js index d0283ce..72b2b31 100644 --- a/src/auth/utils.js +++ b/src/auth/utils.js @@ -150,7 +150,7 @@ export const checkSearchCriteriaPath = (path) =>{ if(!path.startsWith("/application") || path === "/application/search"){ if(!path.startsWith("/user/")){ - if(!path.startsWith("/publicNotice/")){ + if(!path.startsWith("/publicNotice/")|| path === "/publicNotice"){ return true } } diff --git a/src/components/FiDataGrid.js b/src/components/FiDataGrid.js index a0e3517..c7e6a16 100644 --- a/src/components/FiDataGrid.js +++ b/src/components/FiDataGrid.js @@ -12,7 +12,7 @@ import { getSearchCriteria, checkSearchCriteriaPath } from "auth/utils"; export function FiDataGrid({ rows, columns, sx, autoHeight, hideFooterSelectedRowCount, rowModesModel, editMode, - pageSizeOptions, filterItems, customPageSize, doLoad, applyGridOnReady, applySearch, ...props }) { + pageSizeOptions, filterItems, customPageSize, doLoad, applyGridOnReady, applySearch, tab, ...props }) { const intl = useIntl(); const [_rows, set_rows] = useState([]); const [_doLoad, set_doLoad] = useState({}); @@ -148,7 +148,13 @@ export function FiDataGrid({ rows, columns, sx, autoHeight, _doLoad.params.start = page * pageSize; _doLoad.params.limit = pageSize; if(checkSearchCriteriaPath(window.location.pathname)){ - localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:_doLoad.params})) + if(window.location.pathname === "/publicNotice"){ + if (tab != undefined && tab ==="application"){ + localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:_doLoad.params})) + } + }else if (window.location.pathname != "/publicNotice"){ + localStorage.setItem('searchCriteria', JSON.stringify({path:window.location.pathname,data:_doLoad.params})) + } } HttpUtils.get({ diff --git a/src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js b/src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js index a386922..ecdab0d 100644 --- a/src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js +++ b/src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js @@ -24,7 +24,7 @@ import {LocalizationProvider} from "@mui/x-date-pickers/LocalizationProvider"; import {AdapterDayjs} from "@mui/x-date-pickers/AdapterDayjs"; // ==============================|| DASHBOARD - DEFAULT ||============================== // -const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { +const SearchPublicNoticeForm = ({ applySearch, searchCriteria, onGridReady }) => { const intl = useIntl(); const [type, setType] = React.useState([]); const [status, setStatus] = React.useState(localStorage.getItem('userData').creditor?ComboData.publicNoticeStatic_Creditor[0]:ComboData.publicNoticeStatic[0]); @@ -328,6 +328,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => {