import React, {useEffect, useState} from 'react'; import {Modal, Button, Select, message} from 'antd'; import useInitail from "@/hooks/useInitail"; import {getDealerApi} from "@/common/api"; interface Props { onCancel: () => any, visible: boolean, dealerList: any[], onOk: (dealer: any) => any } const {Option} = Select; export default function Index({ onCancel, visible, onOk, dealerList = [] }: Props) { const [dealer, setDealer] = useState({ settleDealerId: null, settleDealerName: null}); const { data: dealers } = useInitail(getDealerApi, [], {}); const suIds = dealerList.map(it => it.settleDealerId); useEffect(() => { if (!visible) { setDealer({}); } }, [visible]); const handSave = () => { if (!dealer.settleDealerId) { message.error('请选择采购商家'); return; } onOk && onOk(dealer); onCancel && onCancel(); }; return ( 取消, ]} >
商家:
); }