diff --git a/src/pages/DemandNote/Search/SearchForm.js b/src/pages/DemandNote/Search/SearchForm.js index 8a93408..e197179 100644 --- a/src/pages/DemandNote/Search/SearchForm.js +++ b/src/pages/DemandNote/Search/SearchForm.js @@ -21,13 +21,11 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue }) => { const [type, setType] = React.useState([]); - // const [status, setStatus] = React.useState({ key: 0, label: 'All', type: 'all' }); const [orgSelected, setOrgSelected] = React.useState({}); const [orgCombo, setOrgCombo] = React.useState(); const [issueSelected, setIssueSelected] = React.useState({}); const [issueCombo, setIssueCombo] = React.useState([]); - const [selectedStatus, setSelectedStatus] = React.useState([]); - const [selectedLabelsString, setSelectedLabelsString] = React.useState(''); + const [selectedStatus, setSelectedStatus] = React.useState(ComboData.denmandNoteStatus[0]); const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); @@ -41,7 +39,7 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue const { reset, register, handleSubmit } = useForm() const onSubmit = (data) => { - data.status = selectedLabelsString + data.status = selectedStatus?.type; let typeArray = []; for (let i = 0; i < type.length; i++) { @@ -57,7 +55,7 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue dateTo: data.dateTo, dueDateFrom: data.dueDateFrom, dueDateTo: data.dueDateTo, - status: (data.status === '' || data.status.includes("all")) ? "" : data.status, + status: (data?.status === '' || data?.status?.includes("all")) ? "" : data.status, }; applySearch(temp); }; @@ -77,9 +75,9 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue function resetForm() { setType([]); - // setStatus({ key: 0, label: 'All', type: 'all' }); setOrgSelected({}); setIssueSelected({}); + setSelectedStatus(ComboData.denmandNoteStatus[0]); reset(); } @@ -136,9 +134,7 @@ const SearchDemandNoteForm = ({ applySearch, orgComboData, searchCriteria, issue inputValue={(issueSelected?.id) ? getIssueLabel(issueSelected) : ""} getOptionLabel={(option) => getIssueLabel(option)} onChange={(event, newValue) => { - if (newValue !== null) { - setIssueSelected(newValue); - } + setIssueSelected(newValue); }} renderInput={(params) => ( { - if (newValue !== null) { setOrgSelected(newValue); - } }} renderInput={(params) => ( { - const findAllIndex = newValue.findIndex((ele) => { - return ele.type === "all" - }) - - if (findAllIndex > -1) { - setSelectedStatus([newValue[findAllIndex]]); - setSelectedLabelsString('all') - } else { - const selectedLabels = newValue.map(option => option.type); - const selectedLabelsString = `${selectedLabels.join(',')}`; + if(newValue==null){ + setSelectedStatus(ComboData.denmandNoteStatus[0]); + }else{ setSelectedStatus(newValue); - setSelectedLabelsString(selectedLabelsString); } }} getOptionLabel={(option) => option.label} diff --git a/src/pages/Organization/SearchPage/OrganizationSearchForm.js b/src/pages/Organization/SearchPage/OrganizationSearchForm.js index 44aad85..ae841c6 100644 --- a/src/pages/Organization/SearchPage/OrganizationSearchForm.js +++ b/src/pages/Organization/SearchPage/OrganizationSearchForm.js @@ -22,7 +22,7 @@ import {ThemeProvider} from "@emotion/react"; const OrganizationSearchForm = ({ applySearch }) => { const [type, setType] = useState([]); - const [creditorSelected, setCreditorSelected] = React.useState({ key: 0, labelCht: '全部', label: 'All', type: 'all' }); + const [creditorSelected, setCreditorSelected] = React.useState(ComboData.CreditorStatus[0]); const { reset, register, handleSubmit } = useForm() const onSubmit = (data) => { @@ -47,6 +47,7 @@ const OrganizationSearchForm = ({ applySearch }) => { function resetForm() { setType([]); + setCreditorSelected(ComboData.CreditorStatus[0]); reset(); } @@ -117,7 +118,12 @@ const OrganizationSearchForm = ({ applySearch }) => { options={ComboData.CreditorStatus} value={creditorSelected} onChange={(event, newValue) => { - setCreditorSelected(newValue); + if(newValue == null){ + setCreditorSelected(ComboData.CreditorStatus[0]); + }else{ + setCreditorSelected(newValue); + } + }} getOptionLabel={(option) => option.label} renderInput={(params) => ( diff --git a/src/pages/Payment/Search_GLD/SearchForm.js b/src/pages/Payment/Search_GLD/SearchForm.js index 8d048c7..70c4c85 100644 --- a/src/pages/Payment/Search_GLD/SearchForm.js +++ b/src/pages/Payment/Search_GLD/SearchForm.js @@ -36,6 +36,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { }; function resetForm() { + setStatus(ComboData.paymentStatus[0]); reset(); } @@ -134,7 +135,9 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { getOptionLabel={(option) => option.label} inputValue={status?.label ? status?.label : ""} onChange={(event, newValue) => { - if (newValue !== null) { + if(newValue==null){ + setStatus(ComboData.paymentStatus[0]); + }else{ setStatus(newValue); } }} diff --git a/src/pages/Payment/Search_Public/SearchForm.js b/src/pages/Payment/Search_Public/SearchForm.js index b927123..84387d3 100644 --- a/src/pages/Payment/Search_Public/SearchForm.js +++ b/src/pages/Payment/Search_Public/SearchForm.js @@ -144,6 +144,8 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { onChange={(event, newValue) => { if (newValue !== null) { setStatus(newValue); + }else{ + setStatus(ComboData.paymentStatus[0]); } }} renderInput={(params) => ( diff --git a/src/pages/Proof/Search_Public/SearchForm.js b/src/pages/Proof/Search_Public/SearchForm.js index c721ad3..dcf3ef9 100644 --- a/src/pages/Proof/Search_Public/SearchForm.js +++ b/src/pages/Proof/Search_Public/SearchForm.js @@ -268,6 +268,8 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria, issueComboData onChange={(event, newValue) => { if (newValue !== null) { setStatus(newValue); + }else{ + setStatus(ComboData.proofStatus[0]); } }} renderInput={(params) => ( diff --git a/src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js b/src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js index 46a6b2f..12dcf6f 100644 --- a/src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js +++ b/src/pages/PublicNotice/ListPanel/SearchPublicNoticeForm.js @@ -22,7 +22,7 @@ import {FormattedMessage, useIntl} from "react-intl"; const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { const intl = useIntl(); const [type, setType] = React.useState([]); - const [status, setStatus] = React.useState({ key: 0, label: 'all', type: 'all' }); + const [status, setStatus] = React.useState(localStorage.getItem('userData').creditor?ComboData.publicNoticeStatic_Creditor[0]:ComboData.publicNoticeStatic[0]); const [minDate, setMinDate] = React.useState(searchCriteria.dateFrom); const [maxDate, setMaxDate] = React.useState(searchCriteria.dateTo); @@ -52,7 +52,7 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { function resetForm() { setType([]); - setStatus({ key: 0, label: 'All', labelCht: "全部", type: 'all' }); + setStatus(localStorage.getItem('userData').creditor?ComboData.publicNoticeStatic_Creditor[0]:ComboData.publicNoticeStatic[0]); reset(); } @@ -165,7 +165,11 @@ const SearchPublicNoticeForm = ({ applySearch, searchCriteria }) => { // inputValue={status?.labelCht} getOptionLabel={(option) => intl.formatMessage({id: option.label})} onChange={(event, newValue) => { + if(newValue ==null){ + setStatus(localStorage.getItem('userData').creditor?ComboData.publicNoticeStatic_Creditor[0]:ComboData.publicNoticeStatic[0]); + }else{ setStatus(newValue); + } }} renderInput={(params) => ( { - data.status = selectedStatus.type + data.status = selectedStatus?.type let typeArray = []; for (let i = 0; i < type.length; i++) { @@ -49,7 +49,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss dateFrom: data.dateFrom, dateTo: data.dateTo, contact: data.contact, - status: (data.status === '' || data.status.includes("all")) ? "" : data.status, + status: (data.status === '' || data.status?.includes("all")) ? "" : data.status, orgId: (orgSelected?.key && orgSelected?.key > 0) ? orgSelected?.key : "", issueId: issueSelected?.id, groupNo: data.groupNo, @@ -194,8 +194,11 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss options={ComboData.publicNoticeStatic_GLD} value={selectedStatus} onChange={(event, newValue) => { - setSelectedStatus(newValue); - + if(newValue==null){ + setSelectedStatus(ComboData.publicNoticeStatic_GLD[0]); + }else{ + setSelectedStatus(newValue); + } }} getOptionLabel={(option) => option.label} renderInput={(params) => ( @@ -255,9 +258,7 @@ const SearchPublicNoticeForm = ({ applySearch, orgComboData, searchCriteria, iss value={orgSelected} inputValue={(orgSelected?.label) ? orgSelected?.label : ""} onChange={(event, newValue) => { - if (newValue !== null) { setOrgSelected(newValue); - } }} renderInput={(params) => ( getIssueLabel(option)} onChange={(event, newValue) => { - if (newValue !== null) { setIssueSelected(newValue); - } }} renderInput={(params) => ( { const [type, setType] = useState([]); - const [accountFilter, setAccountFilter] = useState("Active"); + const [accountFilter, setAccountFilter] = useState("All"); const { reset, register, handleSubmit } = useForm() const onSubmit = (data) => { @@ -42,6 +42,7 @@ const UserSearchForm_Individual = ({ applySearch }) => { function resetForm() { setType([]); + setAccountFilter("All"); reset(); } @@ -120,6 +121,8 @@ const UserSearchForm_Individual = ({ applySearch }) => { onChange={(event, newValue) => { if (newValue !== null) { setAccountFilter(newValue); + }else{ + setAccountFilter("All"); } }} renderInput={(params) => ( diff --git a/src/pages/User/SearchPage_Organization/UserSearchForm_Organization.js b/src/pages/User/SearchPage_Organization/UserSearchForm_Organization.js index f9e41e1..d56a80b 100644 --- a/src/pages/User/SearchPage_Organization/UserSearchForm_Organization.js +++ b/src/pages/User/SearchPage_Organization/UserSearchForm_Organization.js @@ -147,6 +147,8 @@ const UserSearchForm_Organization = ({applySearch}) => { onChange={(event, newValue) => { if (newValue !== null){ setAccountFilter(newValue); + }else{ + setAccountFilter("All"); } }} renderInput={(params) => (