fix: 供应商选择与自动填充

main
Lei OT 5 months ago
parent ef2d9ba365
commit fb842eae34

@ -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 = {

Loading…
Cancel
Save