perf: 选择供应商: 默认值

main
Lei OT 6 months ago
parent 7433111bcb
commit 5d549e5ce3

@ -2,7 +2,7 @@ import React, { useMemo, useRef, useState, useEffect } from 'react';
import { Select, Spin } from 'antd';
import { debounce, objectMapper } from '@/utils/commons';
function DebounceSelect({ fetchOptions, debounceTimeout = 500, initLoad = false, defaultOptions=[], ...props }) {
function DebounceSelect({ fetchOptions, debounceTimeout = 500, initLoad = false, defaultOptions=[], onFetch=null, ...props }) {
const [fetching, setFetching] = useState(false);
const [options, setOptions] = useState([]);
const fetchRef = useRef(0);
@ -28,7 +28,7 @@ function DebounceSelect({ fetchOptions, debounceTimeout = 500, initLoad = false,
}
setOptions(mapperOptions);
setFetching(false);
props.onFetch && props.onFetch(mapperOptions);
onFetch && onFetch(mapperOptions);
});
};

@ -1,11 +1,12 @@
import { create } from 'zustand';
import { devtools } from 'zustand/middleware';
import { usingStorage } from '@/hooks/usingStorage'
export const useFormStore = create(
devtools((set, get) => ({
formValues: {},
setFormValues: (values) => set((state) => ({ formValues: { ...state.formValues, ...values } })),
formValuesToSub: {},
formValuesToSub: { agency: usingStorage().travelAgencyId },
setFormValuesToSub: (values) => set((state) => ({ formValuesToSub: { ...state.formValuesToSub, ...values } })),
cache: {},

Loading…
Cancel
Save