diff --git a/components/HiddenInfo/gwj/index.js b/components/HiddenInfo/gwj/index.js index d002e0f..0a3e661 100644 --- a/components/HiddenInfo/gwj/index.js +++ b/components/HiddenInfo/gwj/index.js @@ -1,5 +1,5 @@ import { request } from "@cqsjjb/jjb-common-lib/http"; -import {Button, Descriptions, Divider, Space, Spin} from "antd"; +import { Button, Descriptions, Divider, Space, Spin } from "antd"; import dayjs from "dayjs"; import { useEffect, useState } from "react"; import { HIDDEN_SOURCE_ENUM, HIDDEN_STATE_ENUM } from "../../../enum/hidden/gwj"; @@ -52,26 +52,36 @@ function HiddenInfo(props) { setLoading(false); onGetData?.(res.data); }); + const hiddenImageFiles = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["3"], eqForeignKey: hiddenId || query[hiddenIdKey] }); setHiddenImageFiles(hiddenImageFiles); const hiddenVideoFiles = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["102"], eqForeignKey: hiddenId || query[hiddenIdKey] }); setHiddenVideoFiles(hiddenVideoFiles); - const afterRectificationImageFiles = await getFile({ - eqType: UPLOAD_FILE_TYPE_ENUM["4"], - eqForeignKey: hiddenId || query[hiddenIdKey], - }); - setAfterRectificationImageFiles(afterRectificationImageFiles); - const rectificationPlanImageFiles = await getFile({ - eqType: UPLOAD_FILE_TYPE_ENUM["8"], - eqForeignKey: hiddenId || query[hiddenIdKey], - }); - setRectificationPlanImageFiles(rectificationPlanImageFiles); - const acceptImageFiles = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["5"], eqForeignKey: hiddenId || query[hiddenIdKey] }); - setAcceptImageFiles(acceptImageFiles); + + if (info.hiddenRectifyUserCO && Object.keys(info.hiddenRectifyUserCO).length > 0) { + const afterRectificationImageFiles = await getFile({ + eqType: UPLOAD_FILE_TYPE_ENUM["4"], + eqForeignKey: hiddenId || query[hiddenIdKey], + }); + setAfterRectificationImageFiles(afterRectificationImageFiles); + + if ((info.hiddenRectifyUserCO.isRectificationScheme === 1 && info.hiddenRectifyUserCO.hiddenSchemeCO && Object.keys(info.hiddenRectifyUserCO.hiddenSchemeCO).length > 0)) { + const rectificationPlanImageFiles = await getFile({ + eqType: UPLOAD_FILE_TYPE_ENUM["8"], + eqForeignKey: hiddenId || query[hiddenIdKey], + }); + setRectificationPlanImageFiles(rectificationPlanImageFiles); + } + } + + if (info.isQualified === 1 && (info.hiddenAcceptUserCO && Object.keys(info.hiddenAcceptUserCO).length > 0)) { + const acceptImageFiles = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["5"], eqForeignKey: hiddenId || query[hiddenIdKey] }); + setAcceptImageFiles(acceptImageFiles); + } }; useEffect(() => { getData(); - }, []); + }, [props.id, props.hiddenId]); return (
@@ -89,18 +99,18 @@ function HiddenInfo(props) { { label: "隐患级别", children: info.hiddenLevelName }, { label: "隐患状态", children: getLabelName({ list: HIDDEN_STATE_ENUM, status: info.state }) }, { label: "隐患描述", children: info.hiddenDesc }, - { label: "隐患部位", children: info.hiddenPart }, + { label: "隐患部位", children: info.hiddenPartName }, ...( (info.source === 2 || info.source === 3) && (info.hiddenCheckListCO && Object.keys(info.hiddenCheckListCO).length > 0) - ? [ - { label: "风险点(单元)", children: info.hiddenCheckListCO.listRiskPoints }, - { label: "辨识部位", children: info.hiddenCheckListCO.identifiedLocations }, - { label: "存在风险", children: info.hiddenCheckListCO.existingRisks }, - { label: "风险分级", children: info.hiddenCheckListCO.riskLevel }, - { label: "隐患清单", children: info.hiddenCheckListCO.listName }, - { label: "检查内容", children: info.hiddenCheckListCO.inspectionContent }, - ] - : [] + ? [ + { label: "风险点(单元)", children: info.hiddenCheckListCO.listRiskPoints }, + { label: "辨识部位", children: info.hiddenCheckListCO.identifiedLocations }, + { label: "存在风险", children: info.hiddenCheckListCO.existingRisks }, + { label: "风险分级", children: info.hiddenCheckListCO.riskLevel }, + { label: "隐患清单", children: info.hiddenCheckListCO.listName }, + { label: "检查内容", children: info.hiddenCheckListCO.inspectionContent }, + ] + : [] ), { label: "隐患上报位置(经纬度)",