import {Connect} from "@cqsjjb/jjb-dva-runtime"; import {Button, Form, Space} from "antd"; import {useEffect, useState} from "react"; import Search from "zy-react-library/components/Search"; import Table from "zy-react-library/components/Table"; import useTable from "zy-react-library/hooks/useTable"; import {NS_ACCIDENT} from "~/enumerate/namespace"; import useDictionary from "zy-react-library/hooks/useDictionary"; import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; import useUrlQueryCriteria from "zy-react-library/hooks/useUrlQueryCriteria"; const TYPE = [ {name: "事件", bianma: "1"}, {name: "事故", bianma: "2"}, ] function SuperviseAccident(props) { const [selectedRowKeys, setSelectedRowKeys] = useState([]); const [form] = Form.useForm(); const {getDictionary} = useDictionary(); const [accidentType, setAccidentType] = useState([]); const {getUrlCriteriaQuery} = useUrlQueryCriteria(); const [accidentCountByCorpinfoAndType, setAccidentCountByCorpinfoAndType] = useState([]); useEffect(() => { getDictionary({dictValue: "accidentType"}).then(res => { setAccidentType(res); }); }, []); const getAccidentCountByCorpinfoAndType=async (corpinfoIds,type)=>{ const {data} = await props["accidentCountByCorpinfoAndType"]({corpinfoIds,eqAccidentType:type}) setAccidentCountByCorpinfoAndType(data) } const {tableProps, getData} = useTable(props["getCorpInfoList"], { form, onSuccess: ({data}) => { getAccidentCountByCorpinfoAndType(data.map(item => item.id),form.getFieldValue("eqAccidentType")) }, }); const getAccidentCount=(id,type)=>{ return accidentCountByCorpinfoAndType.find(item => item.corpinfoId === id && item.incidentType === type)?.[`count`] || 0; } const searchType = getUrlCriteriaQuery("searchFormKeys","searchFormValues").eqAccidentType; return (