优化HiddenInfo、Pdf、PreviewPdf
parent
5fd8c36fc2
commit
7b004d00cb
|
|
@ -1,16 +1,17 @@
|
|||
import { request } from "@cqsjjb/jjb-common-lib/http";
|
||||
import { Descriptions, Divider, Spin } from "antd";
|
||||
import { Button, Descriptions, Divider, Spin } from "antd";
|
||||
import dayjs from "dayjs";
|
||||
import { useEffect, useState } from "react";
|
||||
import { HIDDEN_SOURCE_ENUM, HIDDEN_STATE_ENUM } from "../../../enum/hidden/gwj";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "../../../enum/uploadFile/gwj";
|
||||
import useDownloadFile from "../../../hooks/useDownloadFile";
|
||||
import useGetFile from "../../../hooks/useGetFile";
|
||||
import useGetUrlQuery from "../../../hooks/useGetUrlQuery";
|
||||
import { getFileName, getFileSuffix, getLabelName } from "../../../utils";
|
||||
import HeaderBack from "../../HeaderBack";
|
||||
import VideoIcon from "../../Icon/VideoIcon";
|
||||
import PreviewImg from "../../PreviewImg";
|
||||
import PreviewPdf from "../../PreviewPdf";
|
||||
import { UPLOAD_FILE_TYPE_ENUM } from "../../../enum/uploadFile/gwj";
|
||||
import useGetFile from "../../../hooks/useGetFile";
|
||||
import { getLabelName, getFileName } from "../../../utils";
|
||||
import { HIDDEN_SOURCE_ENUM, HIDDEN_STATE_ENUM } from "../../../enum/hidden/gwj";
|
||||
import useGetUrlQuery from "../../../hooks/useGetUrlQuery";
|
||||
|
||||
/**
|
||||
* 隐患查看组件(港务局版本)
|
||||
|
|
@ -43,6 +44,7 @@ function HiddenInfo(props) {
|
|||
const [loading, setLoading] = useState(true);
|
||||
const { getFile } = useGetFile();
|
||||
const query = useGetUrlQuery();
|
||||
const { loading: downloadFileLoading, downloadFile } = useDownloadFile();
|
||||
|
||||
const getData = async () => {
|
||||
request(`/hidden/hidden/${id || query[idKey]}`, "get").then((res) => {
|
||||
|
|
@ -74,292 +76,306 @@ function HiddenInfo(props) {
|
|||
return (
|
||||
<div>
|
||||
{isShowHeaderBack && <HeaderBack title="查看" />}
|
||||
<Spin spinning={loading}>
|
||||
<Spin spinning={loading || downloadFileLoading}>
|
||||
<div style={{ padding: 20 }}>
|
||||
<Divider orientation="left">隐患信息</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "隐患来源", children: getLabelName({ list: HIDDEN_SOURCE_ENUM, status: info.source }) },
|
||||
{ label: "隐患类型", children: info.hiddenTypeName },
|
||||
{ label: "隐患级别", children: info.hiddenLevelName },
|
||||
{ label: "隐患状态", children: getLabelName({ list: HIDDEN_STATE_ENUM, status: info.state }) },
|
||||
{ label: "隐患描述", children: info.hiddenDesc },
|
||||
{ label: "隐患部位", children: info.hiddenPart },
|
||||
...(info.source === 2 || info.source === 3
|
||||
? [
|
||||
{ label: "风险点(单元)", children: "todo" },
|
||||
{ label: "辨识部位", children: "todo" },
|
||||
{ label: "存在风险", children: "todo" },
|
||||
{ label: "风险分级", children: "todo" },
|
||||
{ label: "隐患清单", children: "todo" },
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: "隐患上报位置(经纬度)",
|
||||
children: [info.longitude && `经度:${info.longitude}`, info.latitude && `纬度:${info.latitude}`].filter(Boolean).join(" "),
|
||||
},
|
||||
{ label: "隐患位置描述", children: info.positionDesc },
|
||||
{ label: "隐患发现人", children: info.creatorName },
|
||||
{ label: "隐患发现时间", children: dayjs(info.hiddenFindTime).format("YYYY-MM-DD hh:mm:ss") },
|
||||
{
|
||||
label: "整改类型",
|
||||
children: getLabelName({
|
||||
list: [{ bianma: "1", name: "立即整改" }, { bianma: "2", name: "延期整改" }],
|
||||
status: info.rectificationType,
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: "是否相关方",
|
||||
children: getLabelName({
|
||||
list: [{ bianma: "1", name: "是" }, { bianma: "2", name: "否" }],
|
||||
status: info.isRelated,
|
||||
}),
|
||||
},
|
||||
{ label: "隐患图片", children: <PreviewImg files={hiddenImageFiles} /> },
|
||||
...(hiddenVideoFiles.length > 0 ? [{ label: "隐患视频", children: <VideoIcon /> }] : []),
|
||||
]}
|
||||
/>
|
||||
{
|
||||
(info.hiddenUserPresetsCO && Object.keys(info.hiddenUserPresetsCO).length > 0) && (
|
||||
<>
|
||||
<Divider orientation="left">整改信息(发现人预填)</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "整改部门", children: info.hiddenUserPresetsCO.rectifyDeptName },
|
||||
{ label: "整改人", children: info.hiddenUserPresetsCO.rectifyUserName },
|
||||
...(info.rectificationType === 2
|
||||
? [
|
||||
{ label: "整改期限", children: dayjs(info.hiddenUserPresetsCO.rectifyDeadline).format("YYYY-MM-DD") },
|
||||
]
|
||||
: []),
|
||||
...(info.rectificationType === 1
|
||||
? [
|
||||
{ label: "验收部门", children: info.hiddenUserPresetsCO.checkDeptName },
|
||||
{ label: "验收人", children: info.hiddenUserPresetsCO.checkUserName },
|
||||
]
|
||||
: []),
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
{
|
||||
(info.isConfirm === 1 && info.hiddenConfirmUserCO && Object.keys(info.hiddenConfirmUserCO).length > 0) && (
|
||||
<>
|
||||
<Divider orientation="left">隐患确认</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "隐患级别", children: info.hiddenConfirmUserCO.hiddenLevelName },
|
||||
{ label: "隐患确认人", children: info.hiddenConfirmUserCO.userName },
|
||||
{ label: "隐患确认时间", children: info.hiddenConfirmUserCO.rectificationTime },
|
||||
{ label: "整改负责人部门", children: info.hiddenConfirmUserCO.rectifyDeptName },
|
||||
{ label: "整改负责人", children: info.hiddenConfirmUserCO.rectifyUserName },
|
||||
{ label: "整改完成期限", children: info.hiddenConfirmUserCO.rectificationDeadline },
|
||||
{ label: "验收部门", children: info.hiddenConfirmUserCO.checkDeptName },
|
||||
{ label: "验收人", children: info.hiddenConfirmUserCO.checkUserName },
|
||||
...(info.hiddenConfirmUserCO.repulseCause
|
||||
? [
|
||||
{ label: "打回意见", children: info.hiddenConfirmUserCO.repulseCause },
|
||||
{ label: "打回时间", children: info.hiddenConfirmUserCO.rectificationTime },
|
||||
]
|
||||
: []),
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
{
|
||||
info.hiddenExtensionList && info.hiddenExtensionList.length > 0 && (
|
||||
<>
|
||||
<Divider orientation="left">延期信息</Divider>
|
||||
<Divider orientation="left">隐患信息</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "隐患来源", children: getLabelName({ list: HIDDEN_SOURCE_ENUM, status: info.source }) },
|
||||
{ label: "隐患类型", children: info.hiddenTypeName },
|
||||
{ label: "隐患级别", children: info.hiddenLevelName },
|
||||
{ label: "隐患状态", children: getLabelName({ list: HIDDEN_STATE_ENUM, status: info.state }) },
|
||||
{ label: "隐患描述", children: info.hiddenDesc },
|
||||
{ label: "隐患部位", children: info.hiddenPart },
|
||||
...(info.source === 2 || info.source === 3
|
||||
? [
|
||||
{ label: "风险点(单元)", children: "todo" },
|
||||
{ label: "辨识部位", children: "todo" },
|
||||
{ label: "存在风险", children: "todo" },
|
||||
{ label: "风险分级", children: "todo" },
|
||||
{ label: "隐患清单", children: "todo" },
|
||||
]
|
||||
: []),
|
||||
{
|
||||
info.hiddenExtensionList.map(item => (
|
||||
<Descriptions
|
||||
key={item.id}
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "申请延期日期", children: item.createTime },
|
||||
{ label: "延期日期", children: item.delayTime },
|
||||
{ label: "审核人", children: item.updateName },
|
||||
...(item.state === 3
|
||||
? [
|
||||
{ label: "处置方案", children: item.disposalPlan },
|
||||
{ label: "处置方案附件", children: <PreviewPdf name={getFileName(item.disposalFile)} url={item.disposalFile} /> },
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: "延期审核状态",
|
||||
children: (
|
||||
<>
|
||||
{item.state === 1 && <span>待审核</span>}
|
||||
{item.state === 2 && <span>审批中</span>}
|
||||
{item.state === 3 && <span>已通过</span>}
|
||||
{item.state === 4 && <span>已拒绝</span>}
|
||||
{item.state === 5 && <span>已撤回</span>}
|
||||
</>
|
||||
),
|
||||
},
|
||||
...((item.state === 3 || item.state === 4) ? [{ label: "延期审核时间", children: item.updateTime }] : []),
|
||||
]}
|
||||
/>
|
||||
),
|
||||
)
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
{
|
||||
info.hiddenSpecialList && info.hiddenSpecialList.length > 0 && (
|
||||
<>
|
||||
<Divider orientation="left">特殊处置审核信息</Divider>
|
||||
label: "隐患上报位置(经纬度)",
|
||||
children: [info.longitude && `经度:${info.longitude}`, info.latitude && `纬度:${info.latitude}`].filter(Boolean).join(" "),
|
||||
},
|
||||
{ label: "隐患位置描述", children: info.positionDesc },
|
||||
{ label: "隐患发现人", children: info.creatorName },
|
||||
{ label: "隐患发现时间", children: dayjs(info.hiddenFindTime).format("YYYY-MM-DD hh:mm:ss") },
|
||||
{
|
||||
info.hiddenSpecialList.map(item => (
|
||||
<Descriptions
|
||||
key={item.id}
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
...((item.state === 3 || item.state === 4)
|
||||
? [
|
||||
{ label: "审核人", children: item.updateName },
|
||||
{ label: "审核时间", children: item.updateTime },
|
||||
]
|
||||
: []),
|
||||
{ label: "无法整改原因", children: item.examine },
|
||||
...(item.state === 3
|
||||
? [
|
||||
{ label: "处置方案", children: item.disposalPlan },
|
||||
{ label: "处置方案附件", children: <PreviewPdf name={getFileName(item.disposalFile)} url={item.disposalFile} /> },
|
||||
{ label: "是否更换整改负责人", children: item.rectifyUserCO && Object.keys(item.rectifyUserCO).length > 0 ? "是" : "否" },
|
||||
...(
|
||||
item.rectifyUserCO && Object.keys(item.rectifyUserCO).length > 0
|
||||
? [{ label: "整改负责人", children: item.rectifyUserCO.userName }]
|
||||
: []),
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: "特殊处置审核状态",
|
||||
children: (
|
||||
<>
|
||||
{item.state === 1 && <span>待审核</span>}
|
||||
{item.state === 2 && <span>审批中</span>}
|
||||
{item.state === 3 && <span>已通过</span>}
|
||||
{item.state === 4 && <span>已拒绝</span>}
|
||||
{item.state === 5 && <span>已撤回</span>}
|
||||
</>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
),
|
||||
label: "整改类型",
|
||||
children: getLabelName({
|
||||
list: [{ bianma: "1", name: "立即整改" }, { bianma: "2", name: "延期整改" }],
|
||||
status: info.rectificationType,
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: "是否相关方",
|
||||
children: getLabelName({
|
||||
list: [{ bianma: "1", name: "是" }, { bianma: "2", name: "否" }],
|
||||
status: info.isRelated,
|
||||
}),
|
||||
},
|
||||
{ label: "隐患图片", children: <PreviewImg files={hiddenImageFiles} /> },
|
||||
...(hiddenVideoFiles.length > 0 ? [{ label: "隐患视频", children: <VideoIcon /> }] : []),
|
||||
]}
|
||||
/>
|
||||
{
|
||||
(info.hiddenUserPresetsCO && Object.keys(info.hiddenUserPresetsCO).length > 0) && (
|
||||
<>
|
||||
<Divider orientation="left">整改信息(发现人预填)</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "整改部门", children: info.hiddenUserPresetsCO.rectifyDeptName },
|
||||
{ label: "整改人", children: info.hiddenUserPresetsCO.rectifyUserName },
|
||||
...(info.rectificationType === 2
|
||||
? [
|
||||
{ label: "整改期限", children: dayjs(info.hiddenUserPresetsCO.rectifyDeadline).format("YYYY-MM-DD") },
|
||||
]
|
||||
: []),
|
||||
...(info.rectificationType === 1
|
||||
? [
|
||||
{ label: "验收部门", children: info.hiddenUserPresetsCO.checkDeptName },
|
||||
{ label: "验收人", children: info.hiddenUserPresetsCO.checkUserName },
|
||||
]
|
||||
: []),
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
{
|
||||
(info.isConfirm === 1 && info.hiddenConfirmUserCO && Object.keys(info.hiddenConfirmUserCO).length > 0) && (
|
||||
<>
|
||||
<Divider orientation="left">隐患确认</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "隐患级别", children: info.hiddenConfirmUserCO.hiddenLevelName },
|
||||
{ label: "隐患确认人", children: info.hiddenConfirmUserCO.userName },
|
||||
{ label: "隐患确认时间", children: info.hiddenConfirmUserCO.rectificationTime },
|
||||
{ label: "整改负责人部门", children: info.hiddenConfirmUserCO.rectifyDeptName },
|
||||
{ label: "整改负责人", children: info.hiddenConfirmUserCO.rectifyUserName },
|
||||
{ label: "整改完成期限", children: info.hiddenConfirmUserCO.rectificationDeadline },
|
||||
{ label: "验收部门", children: info.hiddenConfirmUserCO.checkDeptName },
|
||||
{ label: "验收人", children: info.hiddenConfirmUserCO.checkUserName },
|
||||
...(info.hiddenConfirmUserCO.repulseCause
|
||||
? [
|
||||
{ label: "打回意见", children: info.hiddenConfirmUserCO.repulseCause },
|
||||
{ label: "打回时间", children: info.hiddenConfirmUserCO.rectificationTime },
|
||||
]
|
||||
: []),
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
{
|
||||
info.hiddenExtensionList && info.hiddenExtensionList.length > 0 && (
|
||||
<>
|
||||
<Divider orientation="left">延期信息</Divider>
|
||||
{
|
||||
info.hiddenExtensionList.map(item => (
|
||||
<Descriptions
|
||||
key={item.id}
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "申请延期日期", children: item.createTime },
|
||||
{ label: "延期日期", children: item.delayTime },
|
||||
{ label: "审核人", children: item.updateName },
|
||||
...(item.state === 3
|
||||
? [
|
||||
{ label: "处置方案", children: item.disposalPlan },
|
||||
{
|
||||
label: "处置方案附件",
|
||||
children: (
|
||||
getFileSuffix(item.disposalFile) === "pdf"
|
||||
? <PreviewPdf name={getFileName(item.disposalFile)} url={item.disposalFile} />
|
||||
: <Button type="primary" size="small" onClick={() => downloadFile(item.disposalFile)}>预览</Button>
|
||||
),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: "延期审核状态",
|
||||
children: (
|
||||
<>
|
||||
{item.state === 1 && <span>待审核</span>}
|
||||
{item.state === 2 && <span>审批中</span>}
|
||||
{item.state === 3 && <span>已通过</span>}
|
||||
{item.state === 4 && <span>已拒绝</span>}
|
||||
{item.state === 5 && <span>已撤回</span>}
|
||||
</>
|
||||
),
|
||||
},
|
||||
...((item.state === 3 || item.state === 4) ? [{ label: "延期审核时间", children: item.updateTime }] : []),
|
||||
]}
|
||||
/>
|
||||
),
|
||||
)
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
{
|
||||
info.hiddenSpecialList && info.hiddenSpecialList.length > 0 && (
|
||||
<>
|
||||
<Divider orientation="left">特殊处置审核信息</Divider>
|
||||
{
|
||||
info.hiddenSpecialList.map(item => (
|
||||
<Descriptions
|
||||
key={item.id}
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
...((item.state === 3 || item.state === 4)
|
||||
? [
|
||||
{ label: "审核人", children: item.updateName },
|
||||
{ label: "审核时间", children: item.updateTime },
|
||||
]
|
||||
: []),
|
||||
{ label: "无法整改原因", children: item.examine },
|
||||
...(item.state === 3
|
||||
? [
|
||||
{ label: "处置方案", children: item.disposalPlan },
|
||||
{
|
||||
label: "处置方案附件",
|
||||
children: (
|
||||
getFileSuffix(item.disposalFile) === "pdf"
|
||||
? <PreviewPdf name={getFileName(item.disposalFile)} url={item.disposalFile} />
|
||||
: <Button type="primary" size="small" onClick={() => downloadFile(item.disposalFile)}>预览</Button>
|
||||
),
|
||||
},
|
||||
{ label: "是否更换整改负责人", children: item.rectifyUserCO && Object.keys(item.rectifyUserCO).length > 0 ? "是" : "否" },
|
||||
...(
|
||||
item.rectifyUserCO && Object.keys(item.rectifyUserCO).length > 0
|
||||
? [{ label: "整改负责人", children: item.rectifyUserCO.userName }]
|
||||
: []),
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: "特殊处置审核状态",
|
||||
children: (
|
||||
<>
|
||||
{item.state === 1 && <span>待审核</span>}
|
||||
{item.state === 2 && <span>审批中</span>}
|
||||
{item.state === 3 && <span>已通过</span>}
|
||||
{item.state === 4 && <span>已拒绝</span>}
|
||||
{item.state === 5 && <span>已撤回</span>}
|
||||
</>
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
),
|
||||
)
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
{
|
||||
(info.hiddenRectifyUserCO && Object.keys(info.hiddenRectifyUserCO).length > 0) && (
|
||||
<>
|
||||
<Divider orientation="left">整改信息</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "整改部门", children: info.hiddenRectifyUserCO.deptName },
|
||||
{ label: "整改人", children: info.hiddenRectifyUserCO.userName },
|
||||
{ label: "整改时间", children: info.hiddenRectifyUserCO.rectificationTime },
|
||||
{ label: "整改描述", children: info.hiddenRectifyUserCO.descr },
|
||||
{ label: "投入资金", children: info.hiddenRectifyUserCO.investmentFunds },
|
||||
{ label: "临时安全措施", children: info.tempSafeMeasure },
|
||||
{ label: "整改后图片", children: <PreviewImg files={afterRectificationImageFiles} /> },
|
||||
{ label: "整改方案", children: info.hiddenRectifyUserCO.isRectificationScheme === 0 ? "无" : "有" },
|
||||
...((info.hiddenRectifyUserCO.isRectificationScheme === 1 && info.hiddenRectifyUserCO.hiddenSchemeCO && Object.keys(info.hiddenRectifyUserCO.hiddenSchemeCO).length > 0)
|
||||
? [
|
||||
{ label: "治理标准", children: info.hiddenRectifyUserCO.hiddenSchemeCO.governStanDards },
|
||||
{ label: "治理方法", children: info.hiddenRectifyUserCO.hiddenSchemeCO.governMethod },
|
||||
{ label: "经费落实", children: info.hiddenRectifyUserCO.hiddenSchemeCO.expenditure },
|
||||
{ label: "负责人员", children: info.hiddenRectifyUserCO.hiddenSchemeCO.principal },
|
||||
{ label: "工时安排", children: info.hiddenRectifyUserCO.hiddenSchemeCO.programming },
|
||||
{ label: "时限要求", children: info.hiddenRectifyUserCO.hiddenSchemeCO.timeLimitFor },
|
||||
{ label: "工作要求", children: info.hiddenRectifyUserCO.hiddenSchemeCO.jobRequireMent },
|
||||
{ label: "其他事项", children: info.hiddenRectifyUserCO.hiddenSchemeCO.otherBusiness },
|
||||
{ label: "方案图片", children: <PreviewImg files={rectificationPlanImageFiles} /> },
|
||||
]
|
||||
: []),
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
{
|
||||
info.isQualified === 1
|
||||
? (
|
||||
(info.hiddenAcceptUserCO && Object.keys(info.hiddenAcceptUserCO).length > 0)
|
||||
? (
|
||||
<>
|
||||
<Divider orientation="left">验收信息</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "验收部门", children: info.hiddenAcceptUserCO.deptName },
|
||||
{ label: "验收人", children: info.hiddenAcceptUserCO.userName },
|
||||
{ label: "验收时间", children: info.hiddenAcceptUserCO.rectificationTime },
|
||||
{ label: "验收打回意见", children: info.hiddenAcceptUserCO.repulseCause },
|
||||
{ label: "是否合格", children: "合格" },
|
||||
{ label: "验收描述", children: info.hiddenAcceptUserCO.descr },
|
||||
{ label: "验收图片", children: <PreviewImg files={acceptImageFiles} /> },
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
: (
|
||||
<>
|
||||
<Divider orientation="left">验收打回信息</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "验收部门", children: info.hiddenAcceptUserCO.deptName },
|
||||
{ label: "验收人", children: info.hiddenAcceptUserCO.userName },
|
||||
{ label: "验收时间", children: info.hiddenAcceptUserCO.rectificationTime },
|
||||
{ label: "验收打回意见", children: info.hiddenAcceptUserCO.repulseCause },
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
)
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
{
|
||||
(info.hiddenRectifyUserCO && Object.keys(info.hiddenRectifyUserCO).length > 0) && (
|
||||
<>
|
||||
<Divider orientation="left">整改信息</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "整改部门", children: info.hiddenRectifyUserCO.deptName },
|
||||
{ label: "整改人", children: info.hiddenRectifyUserCO.userName },
|
||||
{ label: "整改时间", children: info.hiddenRectifyUserCO.rectificationTime },
|
||||
{ label: "整改描述", children: info.hiddenRectifyUserCO.descr },
|
||||
{ label: "投入资金", children: info.hiddenRectifyUserCO.investmentFunds },
|
||||
{ label: "临时安全措施", children: info.tempSafeMeasure },
|
||||
{ label: "整改后图片", children: <PreviewImg files={afterRectificationImageFiles} /> },
|
||||
{ label: "整改方案", children: info.hiddenRectifyUserCO.isRectificationScheme === 0 ? "无" : "有" },
|
||||
...((info.hiddenRectifyUserCO.isRectificationScheme === 1 && info.hiddenRectifyUserCO.hiddenSchemeCO && Object.keys(info.hiddenRectifyUserCO.hiddenSchemeCO).length > 0)
|
||||
? [
|
||||
{ label: "治理标准", children: info.hiddenRectifyUserCO.hiddenSchemeCO.governStanDards },
|
||||
{ label: "治理方法", children: info.hiddenRectifyUserCO.hiddenSchemeCO.governMethod },
|
||||
{ label: "经费落实", children: info.hiddenRectifyUserCO.hiddenSchemeCO.expenditure },
|
||||
{ label: "负责人员", children: info.hiddenRectifyUserCO.hiddenSchemeCO.principal },
|
||||
{ label: "工时安排", children: info.hiddenRectifyUserCO.hiddenSchemeCO.programming },
|
||||
{ label: "时限要求", children: info.hiddenRectifyUserCO.hiddenSchemeCO.timeLimitFor },
|
||||
{ label: "工作要求", children: info.hiddenRectifyUserCO.hiddenSchemeCO.jobRequireMent },
|
||||
{ label: "其他事项", children: info.hiddenRectifyUserCO.hiddenSchemeCO.otherBusiness },
|
||||
{ label: "方案图片", children: <PreviewImg files={rectificationPlanImageFiles} /> },
|
||||
]
|
||||
: []),
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
{
|
||||
info.isQualified === 1
|
||||
? (
|
||||
(info.hiddenAcceptUserCO && Object.keys(info.hiddenAcceptUserCO).length > 0)
|
||||
? (
|
||||
<>
|
||||
<Divider orientation="left">验收信息</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "验收部门", children: info.hiddenAcceptUserCO.deptName },
|
||||
{ label: "验收人", children: info.hiddenAcceptUserCO.userName },
|
||||
{ label: "验收时间", children: info.hiddenAcceptUserCO.rectificationTime },
|
||||
{ label: "验收打回意见", children: info.hiddenAcceptUserCO.repulseCause },
|
||||
{ label: "是否合格", children: "合格" },
|
||||
{ label: "验收描述", children: info.hiddenAcceptUserCO.descr },
|
||||
{ label: "验收图片", children: <PreviewImg files={acceptImageFiles} /> },
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
: (
|
||||
<>
|
||||
<Divider orientation="left">验收打回信息</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "验收部门", children: info.hiddenAcceptUserCO.deptName },
|
||||
{ label: "验收人", children: info.hiddenAcceptUserCO.userName },
|
||||
{ label: "验收时间", children: info.hiddenAcceptUserCO.rectificationTime },
|
||||
{ label: "验收打回意见", children: info.hiddenAcceptUserCO.repulseCause },
|
||||
]}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
)
|
||||
: null
|
||||
}
|
||||
<Divider orientation="left">安全环保验收信息</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "验收人", children: "todo" },
|
||||
{ label: "验收时间", children: "todo" },
|
||||
{ label: "是否合格", children: "todo" },
|
||||
{ label: "验收描述", children: "todo" },
|
||||
{ label: "验收图片", children: "todo" },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
: null
|
||||
}
|
||||
<Divider orientation="left">安全环保验收信息</Divider>
|
||||
<Descriptions
|
||||
bordered
|
||||
column={1}
|
||||
labelStyle={{ width: 200 }}
|
||||
items={[
|
||||
{ label: "验收人", children: "todo" },
|
||||
{ label: "验收时间", children: "todo" },
|
||||
{ label: "是否合格", children: "todo" },
|
||||
{ label: "验收描述", children: "todo" },
|
||||
{ label: "验收图片", children: "todo" },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</Spin>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ import type { CSSProperties, FC } from "react";
|
|||
export interface PdfProps {
|
||||
/** pdf 文件地址 */
|
||||
file: string;
|
||||
/** pdf 文件名 */
|
||||
name?: string;
|
||||
/** 是否显示弹窗 */
|
||||
visible?: boolean;
|
||||
/** 关闭弹窗的方法 */
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Button, message, Modal, Spin } from "antd";
|
||||
import { message, Modal, Spin } from "antd";
|
||||
import { useState } from "react";
|
||||
import { Document, Page, pdfjs } from "react-pdf";
|
||||
import useDownloadFile from "../../hooks/useDownloadFile";
|
||||
import { getFileUrl } from "../../utils/index";
|
||||
|
||||
/**
|
||||
|
|
@ -11,6 +12,7 @@ function Pdf(props) {
|
|||
visible = false,
|
||||
onCancel,
|
||||
file,
|
||||
name,
|
||||
inline = false,
|
||||
style = {},
|
||||
} = props;
|
||||
|
|
@ -70,6 +72,21 @@ function Pdf(props) {
|
|||
return renderPdfContent();
|
||||
}
|
||||
|
||||
const { loading: downloadFileLoading, downloadFile } = useDownloadFile();
|
||||
|
||||
const onDownloadFile = () => {
|
||||
Modal.confirm({
|
||||
title: "提示",
|
||||
content: "确定要下载此文件吗?",
|
||||
onOk: () => {
|
||||
downloadFile({
|
||||
url: fileUrl,
|
||||
name,
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// 默认弹窗模式
|
||||
return (
|
||||
<Modal
|
||||
|
|
@ -77,7 +94,10 @@ function Pdf(props) {
|
|||
width={pdfWidth + 100}
|
||||
title="PDF预览"
|
||||
onCancel={onCancel}
|
||||
footer={<Button onClick={onCancel}>关闭</Button>}
|
||||
cancelText="关闭"
|
||||
okText="下载"
|
||||
onOk={onDownloadFile}
|
||||
loading={downloadFileLoading}
|
||||
>
|
||||
{renderPdfContent()}
|
||||
</Modal>
|
||||
|
|
|
|||
|
|
@ -15,16 +15,19 @@ const PreviewPdf = (props) => {
|
|||
} = props;
|
||||
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [src, setSrc] = useState("");
|
||||
const [currentSrc, setCurrentSrc] = useState("");
|
||||
const [currentName, setCurrentName] = useState("");
|
||||
|
||||
const previewPdf = (src) => {
|
||||
const previewPdf = (src, name) => {
|
||||
setVisible(true);
|
||||
setSrc(src);
|
||||
setCurrentSrc(src);
|
||||
setCurrentName(name);
|
||||
};
|
||||
|
||||
const onCancel = () => {
|
||||
setVisible(false);
|
||||
setSrc("");
|
||||
setCurrentSrc("");
|
||||
setCurrentName("");
|
||||
};
|
||||
|
||||
// 单个文件预览模式
|
||||
|
|
@ -33,13 +36,14 @@ const PreviewPdf = (props) => {
|
|||
<>
|
||||
<Space>
|
||||
<span>{name}</span>
|
||||
<Button type="primary" size="small" onClick={() => previewPdf(url)}>
|
||||
<Button type="primary" size="small" onClick={() => previewPdf(url, name)}>
|
||||
预览
|
||||
</Button>
|
||||
</Space>
|
||||
<Pdf
|
||||
visible={visible}
|
||||
file={src}
|
||||
file={currentSrc}
|
||||
name={currentName}
|
||||
onCancel={onCancel}
|
||||
/>
|
||||
</>
|
||||
|
|
@ -57,7 +61,7 @@ const PreviewPdf = (props) => {
|
|||
<Button
|
||||
type="primary"
|
||||
size="small"
|
||||
onClick={() => previewPdf(item.filePath || item[urlKey])}
|
||||
onClick={() => previewPdf(item.filePath || item[urlKey], item.name || item.fileName || item[nameKey])}
|
||||
>
|
||||
预览
|
||||
</Button>
|
||||
|
|
@ -66,7 +70,8 @@ const PreviewPdf = (props) => {
|
|||
))}
|
||||
<Pdf
|
||||
visible={visible}
|
||||
file={src}
|
||||
file={currentSrc}
|
||||
name={currentName}
|
||||
onCancel={onCancel}
|
||||
/>
|
||||
</>
|
||||
|
|
|
|||
Loading…
Reference in New Issue