import React from "react"; import { Button, Col, Popconfirm, Row, Select, Input, message } from "antd"; import { useStore } from "../index"; import { CompanyCategoryTypeEnum } from "@/pages/finance/entitys"; import { debounce } from "lodash"; import { deleteCompanyRelationApi } from '@/pages/finance/CompanyRelationAuth/api'; import { history } from 'umi'; const Search = Input.Search; const { Option } = Select; export default function Filter() { const { setVisible, dealerList, setCompanyParams, dealerLoading, disabled, setDisabled, setSelected, companyList, comBussinessList, selectedRelation, submitLoading, setSubmitLoading, companyParams, setLoading, } = useStore(); const searchDealer = (dealerId: number) => { setCompanyParams({ ...companyParams, dealerId }, true); }; function searchType(compCategory: number) { setCompanyParams({ ...companyParams, compCategory }, true); } function searchCompanyType(companyType: number) { setCompanyParams({ ...companyParams, companyType }, true); } const fetchListByName = debounce((value) => { setCompanyParams({ ...companyParams, keywords: value }, true); }, 500); function onCancel() { setDisabled(true); setSelected([...companyList]); } function onEdit() { setDisabled(false); } // 新增 function onAdd() { history.push("/finance2/companyRelationAuth/create"); } /** * @param compId */ async function onDelete() { const compIdList = selectedRelation.map((item) => item.compId); try { const pa = { ...companyParams, compIdList}; setSubmitLoading(true); const { success, result } = await deleteCompanyRelationApi(pa); setSubmitLoading(false); if (!success) { return message.error(result); } else { message.success(result); setLoading(true); } } catch (e) { setSubmitLoading(false); message.error(e.message); } } return (
fetchListByName(e.target.value || undefined)} style={{ width: 200 }} />
); }