import {Table} from 'antd'; import React, {useEffect, useState} from 'react'; import useInitial from "@/hooks/useInitail"; import {getList, ListVO} from "@/pages/pms/partPlan/PlanPool/api"; import DetailModal from './DetailModal'; import {useStore} from "@/pages/pms/partPlan/PlanPool"; import _ from 'lodash'; const { Column } = Table; interface Props { showAnalyse?: boolean type?: number, // 类型1区域库2库房3车系4车型5配件 // eslint-disable-next-line react/no-unused-prop-types detailType?: number, // 类型1区域库2库房3车系4车型5配件 id?: number, // 上一个列表ID } export default function Index(props: Props = {}) { const { dfParams, key, setItem, setOutVisible, setCustVisible } = useStore(); const {showAnalyse=true} = props; const { data: parts, setParams, loading } = useInitial(getList, [], {...dfParams, ...props}); const [visible, setVisible] = useState(false); // 类型1区域库2库房3车系4车型5配件 const [detailType, setDetailType] = useState(); const [id, setId] = useState(); useEffect(() => { if (key == props.type) { setParams(dfParams, true); } }, [dfParams, key]); return (
`${v.id}`} scroll={{y: 500, x: 2500}} dataSource={parts || []} pagination={false} loading={loading}> (t ? t.toFixed(2) : "--")} /> (t ? t.toFixed(2) : "--")} /> (r.buyCnt ? { setCustVisible(true); setItem(r); }}>{r.buyCnt} : r.buyCnt)} /> (r.outStockCnt ? { setOutVisible(true); setItem(r); }}>{_.floor(r.outStockCnt/3)} : r.outStockCnt)} /> {showAnalyse && ( <> ( { setVisible(true); setId(_.id); setDetailType(2); }} > 查看 )} /> ( { setVisible(true); setId(_.id); setDetailType(3); }} > 查看 )} /> ( { setVisible(true); setId(_.id); setDetailType(5); }} > 查看 )} /> )}
setVisible(false)} id={id} detailType={detailType} type={1} />
); }