import { FC, useEffect, useRef, useState } from "react"; import { Button, Tabs, Tag } from "antd"; import { FormPageFooter, PageContainer } from "@/components"; import { OverallAssessment } from "./components/OverallAssessment"; import { IndexAssessment } from "./components/IndexAssessment"; import style from "./index.module.scss"; import { useHashQuery } from "@/hooks"; import { DEPT_STATUS_MAP, PUBLISH_STATUS_MAP } from "@/constants"; import { useParams } from "react-router-dom"; import { getManageEvaluationDetailApi, getManageFormDetailApi, getManageIndexDetailApi, } from "@/api"; import { IManageFormDetail, IManageIndexDetail } from "@/types"; import { DageLoading } from "@dage/pc-components"; import { isNumber } from "lodash"; const AssessmentDetailPage: FC = () => { // 判断是否为考核填报进入 const isReportDetail = useRef(window.location.hash.indexOf("form") > -1); // 判断是否为考核评定进入 const isEvalutionDetail = useRef( window.location.hash.indexOf("evaluation") > -1 ); // 判断是否为考核管理进入 const isIndexDetail = useRef(window.location.hash.indexOf("index") > -1); const [tab, setTab] = useHashQuery("tab", "1"); const [loading, setLoading] = useState(false); const [detail, setDetail] = useState< IManageIndexDetail | IManageFormDetail | null >(null); const params = useParams(); const getDetail = async () => { try { setLoading(true); const data = await (isReportDetail.current ? getManageFormDetailApi : isEvalutionDetail.current ? getManageEvaluationDetailApi : getManageIndexDetailApi)(params.id as string); setDetail(data); } finally { setLoading(false); } }; useEffect(() => { getDetail(); }, []); return ( <> {!isIndexDetail.current ? ( { DEPT_STATUS_MAP[(detail as IManageFormDetail).deptStatus] .label } ) : ( { PUBLISH_STATUS_MAP[(detail as IManageIndexDetail).status] .label } )} ) : undefined } > {loading && }
{isNumber(detail?.score) ? detail?.score : "--"}
{detail?.dateStart}~{detail?.dateEnd}
{detail?.createTime}
), }, { key: "2", label: "指标考核", children: ( ), }, ]} onChange={(v) => setTab(v)} />
{isReportDetail.current && ( )} {isEvalutionDetail.current && ( )} ); }; export default AssessmentDetailPage;