perf: 供应商选择: 默认选项参数

main
Lei OT 5 months ago
parent 6691ae60a0
commit 2b5c35b837

@ -13,7 +13,7 @@ function DebounceSelect({ fetchOptions, debounceTimeout = 500, initLoad = false,
if (initLoad && defaultOptions.length===0) {
loadOptions(' ');
}
}, [initLoad]);
}, [initLoad, defaultOptions]);
const loadOptions = (value) => {
fetchRef.current += 1;
@ -50,13 +50,8 @@ function DebounceSelect({ fetchOptions, debounceTimeout = 500, initLoad = false,
onSearch={debounceFetcher}
notFoundContent={fetching ? <Spin size='small' /> : null}
optionFilterProp='label'
>
{options.map((d) => (
<Select.Option key={d.value} title={d.label}>
{d.label}
</Select.Option>
))}
</Select>
options={options}
/>
);
}

@ -20,12 +20,13 @@ const VendorSelector = ({ ...props }) => {
const { travelAgencyId: myAgencyId } = usingStorage();
const [{ travelAgencyName: myAgencyName }] = useAuthStore((state) => [state.currentUser]);
const { t } = useTranslation();
const [{ vendorList }, setCache] = useFormStore(state => [state.cache, state.setCache]);
const [{ vendorList }, setCache] = useFormStore(state => [state.cache, state.setCache]);
return (
<>
<SearchInput initLoad={false}
placeholder={t('products:Vendor')}
labelInValue
mode={'multiple'}
maxTagCount={0}
{...props}

@ -3,6 +3,7 @@ import { useParams, useNavigate } from 'react-router-dom';
import { App, Row, Col, Space, Typography, Divider, Form, Input, Select, Button, Tag } from 'antd';
import { useTranslation } from 'react-i18next';
import { fetchNotifsDetail, fetchNotifsStatusAgency, postNotifsNewOrEdit } from '@/stores/Notice';
import useFormStore from "@/stores/Form";
import BackBtn from '@/components/BackBtn';
import { usingStorage } from '@/hooks/usingStorage';
import VendorSelector from '@/components/VendorSelector';
@ -11,6 +12,21 @@ import Editor from '@/components/Editor';
const { Title, Paragraph } = Typography;
const allOverseasAgency = [
{ key: 30008, value: 30008, label: 'Luxe Voyage Tours-已签海纳协议' },
{ key: 31596, value: 31596, label: '印度Legend' },
{ key: 32531, value: 32531, label: '越南ANP TRAVEL' },
{ key: 32704, value: 32704, label: '泰北 NUT ' },
{ key: 32717, value: 32717, label: 'JCT株式会社' },
{ key: 32865, value: 32865, label: '泰国IAT' },
{ key: 32876, value: 32876, label: 'Japan Fleet' },
// { key: 33031, value: 33031, label: 'testA' },
// { key: 33032, value: 33032, label: 'testB' },
{ key: 33200, value: 33200, label: '新加坡途游' },
{ key: 33508, value: 33508, label: '日本DJ(注意加服务交通费)' },
{ key: 33796, value: 33796, label: '韩国 Halla Tour' },
];
const Edit = ({ ...props }) => {
const { t } = useTranslation();
const { message } = App.useApp();
@ -22,6 +38,8 @@ const Edit = ({ ...props }) => {
const [form] = Form.useForm();
const clickedButton = useRef('');
const quillRef = useRef();
const setCache = useFormStore(state => state.setCache);
const [showAgencySelector, setShowAgencySelector] = useState(1);
const [showAgencySeleted, setShowAgencySeleted] = useState(0);
@ -45,7 +63,10 @@ const Edit = ({ ...props }) => {
form.setFieldsValue({
agency_list: _list,
});
setCache({ vendorList: _list })
});
} else {
setCache({ vendorList: allOverseasAgency })
}
}, []);

Loading…
Cancel
Save