import { FC, useEffect, useMemo, useState } from "react"; import { Table } from "antd"; import style from "../../index.module.scss"; import { DageLoading } from "@dage/pc-components"; import { getAssIndexDetailApi } from "@/api"; import { IAssIndexDetail, YES_OR_NO } from "@/types"; import { CONNECT_WITH_SYMBOL_OPTIONS, SYMBOL_OPTIONS } from "../../constants"; export interface ContainerProps { currentId: number | null; } export const Container: FC = ({ currentId }) => { const [loading, setLoading] = useState(false); const [detail, setDetail] = useState(null); // 打分点 const isPoint = detail?.isPoint === YES_OR_NO.YES; const point = useMemo( () => (detail && isPoint ? JSON.parse(detail.jsonPoint) : null), [detail] ); // 告警阈值 const isWarn = detail?.isWarn === YES_OR_NO.YES; const warnStr = useMemo(() => { if (!isWarn) return; const data = JSON.parse(detail.jsonWarn); const symbol = SYMBOL_OPTIONS.find((i) => i.value === data.symbol); let str = `${symbol?.label}${data.num}`; const connect = CONNECT_WITH_SYMBOL_OPTIONS.find( (i) => i.value === data.and ); const symbol2 = SYMBOL_OPTIONS.find((i) => i.value === data.symbol2); if (connect && symbol2 && data.num2) { str += ` ${connect.label} ${symbol2.label}${data.num2}`; } return str; }, [detail]); const getDetail = async () => { if (!currentId) return; try { setLoading(true); const data = await getAssIndexDetailApi(currentId); setDetail(data); } finally { setLoading(false); } }; useEffect(() => { getDetail(); }, [currentId]); return (

指标详情

指标名称

{detail?.name}

指标编号

{detail?.num}

指标说明

{detail?.remark}

是否为打分点

{!isPoint ? "否" : "是"}
{isPoint && point && ( <>

数据API

{point.api || "--"}

是否为加分项

{point.isAdd === 1 ? "是" : "否"}

分值

{point.score}
)}

告警阈值

{!isWarn ? ( "未开启" ) : (
{warnStr}
)}

需上传资料

(e.isUpload === YES_OR_NO.YES ? "是" : "否"), }, { title: "模板", dataIndex: "fileName", key: "fileName", align: "center", }, ]} />

排序值

{detail?.sort}

编辑时间

{detail?.updateTime}

编辑人

{detail?.creatorName}
{loading && } ); };