import React, { useState, useRef, useEffect } from 'react'; import AutoTable from '@/components/AutoTable/mtable'; import { useRequest } from 'ahooks'; import { doFetch } from '@/utils/doFetch'; import styles from "./index.less"; import { Tooltip } from "antd"; import { MenuUnfoldOutlined, MenuFoldOutlined } from '@ant-design/icons'; const columnsa = [ { title: '客户名称', dataIndex: 'ledgerCustomer', key: 'ledgerCustomer' }, { title: '台数', dataIndex: 'deviceNum', key: 'deviceNum', search: false, width: 80 }, { title: '使用率', dataIndex: 'rate', key: 'rate', search: false, width: 80 }, ], columnsb = [ { title: '合同单号', dataIndex: 'contractNo', key: 'contractNo' }, { title: '设备编号', dataIndex: 'equipmentNo', key: 'equipmentNo' }, { title: '设备名称', dataIndex: 'equipmentName', key: 'equipmentName' }, { title: '设备型号', dataIndex: 'equipmentModelName', key: 'equipmentModelId', valueType: 'select', options: { path: '/asset/equipmentModel/query/selection', params: {} }, fieldProps: { showSearch: true } }, { title: '设备品牌', dataIndex: 'brand', key: 'brand' }, { title: '状态', dataIndex: 'collectStatusName', key: 'collectStatus', valueType: 'select', options: [ { value: 1, label: '工作' }, { value: 2, label: '待机' }, { value: 3, label: '关机' }, { value: 4, label: '报警' }, ], width: 60 }, { title: '工作', dataIndex: 'runRate', key: 'runRate', search: false, render: (_, row) => { return {row.runRate}% }, width: 60 }, { title: '待机', dataIndex: 'standbyRate', key: 'standbyRate', search: false, render: (_, row) => { return {row.standbyRate}% }, width: 60 }, { title: '报警', dataIndex: 'alarmRate', key: 'alarmRate', search: false, render: (_, row) => { return {row.alarmRate}% }, width: 60 }, { title: '关机', dataIndex: 'offRate', key: 'offRate', search: false, render: (_, row) => { return {row.offRate}% }, width: 60 }, ]; const LeftTable = ({ onChange }) => { const [searchParams, csp] = useState({}), [clickrow, cr] = useState({}), [flag, setFlag] = useState(true); const ledgerCustomer = useRequest(async () => { let res = await doFetch({ url: "/lease/umLeaseLedger/ledgerCustomerEquipmentUseRate", params: { ...searchParams } }); // cr(res?.data?.dataList?.[0]); return res?.data?.dataList ?? []; }, { refreshDeps: [searchParams] }); useEffect(() => { onChange(clickrow?.ledgerCustomerId) }, [clickrow?.ledgerCustomerId]) return