import TabsContent from '@/components/TabsContent'; import ThresholdDetail from '@/components/ThresholdDetail'; import { Popover, Table } from 'antd'; import dayjs from 'dayjs'; import { useEffect, useMemo, useState } from 'react'; import styles from '../PatrolReportDetail.less'; import Empty from './Empty'; export default function LiquidLevelCom(props) { const { sendMessageToUnity, select, allData, type, statusCheck, changeStatus, } = props; const [activeKey, setActiveKey] = useState('1'); const handleTabsChange = (activeKey) => { setActiveKey(activeKey); }; const { errorTableData, normalData } = useMemo(() => { let data = { errorTableData: [], normalData: [] }; allData?.forEach((item) => { if (item.status == 1 && statusCheck.includes(1)) { data.errorTableData.push(item); } else if (item.status == 0 && statusCheck.includes(0)) { data.normalData.push(item); } }); return data; }, [statusCheck, allData]); const items = useMemo(() => { let items = []; let showAllTabs = statusCheck.length == 3; if (showAllTabs || errorTableData.length > 0) { items.push({ key: '1', label: `异常(${errorTableData.length || 0})`, children:
, }); } if (showAllTabs || normalData.length > 0) { items.push({ key: '0', label: `历史记录(${normalData.length || 0})`, children:
, }); } return items; }, [statusCheck, allData]); useEffect(() => { if (items.length == 0) { changeStatus(0); } else { setActiveKey(items[0].key); changeStatus(1); } }, [items]); const content = (

固定液位1为H1,固定液位2为H2,实际液位为H实

液位差值:液位标准值(H1)与液位实际值(H2)的差值

液位差比值:H1标准值与实际值的差值与H2的标准值与实际值的差值的比值

); if (items.length == 0) return null; return (
液位校验
{activeKey === '1' && ( )} {activeKey === '0' && ( )}
); } function LiquidTable(props) { const { items } = props; const columns = [ { title: '设备名称', width: '12%', dataIndex: 'device_name', }, { title: '时间', dataIndex: 'record_time', render: (text) => { if (text) { return dayjs(text).format('YYYY.MM.DD HH:mm'); } return '-'; }, }, { title: '类型', key: 'template_item_name', dataIndex: 'template_item_name', }, { title: '液位数', dataIndex: 'origin_value', }, { title: '差值/比值', dataIndex: 'value', }, { title: '设定值范围', width: '18%', render: (record) => ( ), }, { title: '状态', dataIndex: 'status', width: '1.25rem', render: (status) => { switch (status) { case -1: case 0: return (
正常
); case 1: return (
异常
); case 2: return (
警告
); } }, }, ]; return ( , }} pagination={false} /> ); }