From fb842eae3418b64d7e88e5e30c2d9a28df855bcc Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 21 Nov 2025 11:01:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BE=9B=E5=BA=94=E5=95=86=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E4=B8=8E=E8=87=AA=E5=8A=A8=E5=A1=AB=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SearchForm.jsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/SearchForm.jsx b/src/components/SearchForm.jsx index b53db2d..2772997 100644 --- a/src/components/SearchForm.jsx +++ b/src/components/SearchForm.jsx @@ -1,19 +1,18 @@ import { useEffect } from "react"; -import { Form, Input, Row, Col, Select, DatePicker, Space, Button, Checkbox, Alert, Tag } from "antd"; -import { objectMapper, at } from "@/utils/commons"; +import { Form, Input, Row, Col, Select, DatePicker, Space, Button, Checkbox, Tag } from "antd"; +import { objectMapper, at, isEmpty } from "@/utils/commons"; import { DATE_FORMAT, SMALL_DATETIME_FORMAT, PERM_AGENCY_ALL } from "@/config"; import useFormStore from "@/stores/Form"; import { useDatePresets } from "@/hooks/useDatePresets"; import { useTranslation } from "react-i18next"; import useAuthStore from '@/stores/Auth' import { SearchOutlined } from '@ant-design/icons'; -import SearchInput from "./SearchInput"; import AuditStateSelector from "./AuditStateSelector"; import DeptSelector from "./DeptSelector"; import ProductsTypesSelector from "./ProductsTypesSelector"; import CitySelector from "@/components/CitySelector"; import VendorSelector from "@/components/VendorSelector"; -import { InfoCircleFilled, InfoCircleOutlined } from "@ant-design/icons"; +import { InfoCircleOutlined } from "@ant-design/icons"; const { RangePicker } = DatePicker; @@ -32,6 +31,7 @@ const SearchForm = ({ initialValue, onSubmit, onReset, onMounted, confirmText, f const agencyFieldsProps = hasAgencyField ? {} : { agency: { col: 24, hidden: !showVendorSwitcher }, }; const agencyFieldsComProps = hasAgencyField ? {} : { agency: { mode: null, allowClear: false }, }; const agencyInitialValue = hasAgencyField ? {} : { agency: { key: myAgencyId, value: myAgencyId, label: myAgencyName }}; + const keepSelectedAgency = isEmpty(formValues?.agency) ? agencyInitialValue : { agency: formValues.agency } ; const { sort, hides, shows, fieldProps, fieldComProps } = { sort: "", @@ -42,7 +42,7 @@ const SearchForm = ({ initialValue, onSubmit, onReset, onMounted, confirmText, f fieldProps: { ...agencyFieldsProps, ...(props.fieldsConfig?.fieldProps || {}) }, fieldComProps: { ...agencyFieldsComProps, ...(props.fieldsConfig?.fieldComProps || {}) }, }; - const readValues = { ...agencyInitialValue, ...initialValue, ...formValues }; + const readValues = hasAgencyField ? { ...agencyInitialValue, ...initialValue, ...formValues } : { ...initialValue, ...formValues, ...keepSelectedAgency }; const formValuesMapper = values => { const destinationObject = {