import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { Button, Form } from "antd"; import { useState } from "react"; import Page from "zy-react-library/components/Page"; 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"; function SuperviseAccident(props) { const [form] = Form.useForm(); const [accidentCountByCorpinfoAndType, setAccidentCountByCorpinfoAndType] = useState([]); const getAccidentCountByCorpinfoAndType = async (corpinfoIds, type) => { const { data } = await props["accidentCountByCorpinfoAndType"]({ corpinfoIds, eqAccidentType: type }); setAccidentCountByCorpinfoAndType(data); }; const { tableProps, getData } = useTable(props["getCorpInfoList"], { form, params: { inType: [0, 1, 6], }, onSuccess: ({ data }) => { getAccidentCountByCorpinfoAndType(data.map(item => item.id), form.getFieldValue("eqAccidentType")); }, }); const getAccidentTotal = (id, key) => { return accidentCountByCorpinfoAndType.find(item => item.corpinfoId === id)?.[key] || 0; }; return ( ( ), }, { dataIndex: "accidentCount", title: "事故总数", width: 180, render: (_, record) => ( ), }, ]} {...tableProps} /> ); } export default Connect([NS_ACCIDENT], true)(SuperviseAccident);