diff --git a/components/HiddenInfo/gwj/index.d.ts b/components/HiddenInfo/gwj/index.d.ts new file mode 100644 index 0000000..039d75d --- /dev/null +++ b/components/HiddenInfo/gwj/index.d.ts @@ -0,0 +1,24 @@ +import type { FC } from "react"; + +/** + * 组件属性 + */ +export interface HiddenInfoProps { + /** id,默认取 query.id */ + id?: string; + /** id 的字段,默认 id */ + idKey?: string; + /** hiddenId,默认取 query.hiddenId */ + hiddenId?: string; + /** hiddenId 的字段,默认 hiddenId */ + hiddenIdKey?: string; + /** 是否显示头部的返回,默认 true */ + isShowHeaderBack?: boolean; +} + +/** + * 隐患查看组件(港务局版本) + */ +declare const HiddenInfo: FC; + +export default HiddenInfo; diff --git a/components/HiddenInfo/gwj/index.js b/components/HiddenInfo/gwj/index.js new file mode 100644 index 0000000..d58082a --- /dev/null +++ b/components/HiddenInfo/gwj/index.js @@ -0,0 +1,363 @@ +import { tools } from "@cqsjjb/jjb-common-lib"; +import { request } from "@cqsjjb/jjb-common-lib/http"; +import { Descriptions, Divider } from "antd"; +import dayjs from "dayjs"; +import { useEffect, useState } from "react"; +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 } from "../../../utils"; +import { HIDDEN_SOURCE_ENUM, HIDDEN_STATE_ENUM } from "../../../enum/hidden/gwj"; + +const { query } = tools.router; + +/** + * 隐患查看组件(港务局版本) + */ +function HiddenInfo(props) { + const { + id = "", + idKey = "id", + hiddenId = "", + hiddenIdKey = "hiddenId", + isShowHeaderBack = true, + } = props; + + const [info, setInfo] = useState({ + hiddenUserPresetsCO: {}, + hiddenRectifyUserCO: { + hiddenSchemeCO: {}, + }, + hiddenConfirmUserCO: {}, + hiddenAcceptUserCO: {}, + hiddenSpecialList: [], + hiddenExtensionList: [], + }); + const [hiddenImageFiles, setHiddenImageFiles] = useState([]); + const [hiddenVideoFiles, setHiddenVideoFiles] = useState([]); + const [afterRectificationImageFiles, setAfterRectificationImageFiles] = useState([]); + const [rectificationPlanImageFiles, setRectificationPlanImageFiles] = useState([]); + const [acceptImageFiles, setAcceptImageFiles] = useState([]); + const { getFile } = useGetFile(); + + const getData = async () => { + request(`/hidden/hidden/${id || query[idKey]}`, "get").then((res) => { + setInfo(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); + }; + useEffect(() => { + getData(); + }, []); + + return ( +
+ {isShowHeaderBack && } +
+ 隐患信息 + }, + ...(hiddenVideoFiles.length > 0 ? [{ label: "隐患视频", children: }] : []), + ]} + /> + { + (info.hiddenUserPresetsCO && Object.keys(info.hiddenUserPresetsCO).length > 0) && ( + <> + 整改信息(发现人预填) + + + ) + } + { + (info.isConfirm === 1 && info.hiddenConfirmUserCO && Object.keys(info.hiddenConfirmUserCO).length > 0) && ( + <> + 隐患确认 + + + ) + } + { + info.hiddenExtensionList && info.hiddenExtensionList.length > 0 && ( + <> + 延期信息 + { + info.hiddenExtensionList.map(item => ( + }, + ] + : []), + { + label: "延期审核状态", + children: ( + <> + {item.state === 1 && 待审核} + {item.state === 2 && 审批中} + {item.state === 3 && 已通过} + {item.state === 4 && 已拒绝} + {item.state === 5 && 已撤回} + + ), + }, + ...((item.state === 3 || item.state === 4) ? [{ label: "延期审核时间", children: item.updateTime }] : []), + ]} + /> + ), + ) + } + + ) + } + { + info.hiddenSpecialList && info.hiddenSpecialList.length > 0 && ( + <> + 特殊处置审核信息 + { + info.hiddenSpecialList.map(item => ( + }, + { 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 && 待审核} + {item.state === 2 && 审批中} + {item.state === 3 && 已通过} + {item.state === 4 && 已拒绝} + {item.state === 5 && 已撤回} + + ), + }, + ]} + /> + ), + ) + } + + ) + } + { + (info.hiddenRectifyUserCO && Object.keys(info.hiddenRectifyUserCO).length > 0) && ( + <> + 整改信息 + }, + { 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: }, + ] + : []), + ]} + /> + + ) + } + { + info.isQualified === 1 + ? ( + (info.hiddenAcceptUserCO && Object.keys(info.hiddenAcceptUserCO).length > 0) + ? ( + <> + 验收信息 + }, + ]} + /> + + ) + : ( + <> + 验收打回信息 + + + ) + ) + : null + } + 安全环保验收信息 + +
+
+ ); +} + +export default HiddenInfo; diff --git a/components/Upload/index.d.ts b/components/Upload/index.d.ts index 7741a09..768e9a9 100644 --- a/components/Upload/index.d.ts +++ b/components/Upload/index.d.ts @@ -20,7 +20,7 @@ export interface UploadProps extends Omit { /** 要上传的文件类型,默认为 image */ fileType?: "image" | "video" | "document"; /** 获取上传过服务器删除的附件 */ - onGetRemoveFile?: (file: UploadFile) => void; + onGetRemoveFile?: (file: Omit) => void; } /** diff --git a/enum/hidden/gwj/index.js b/enum/hidden/gwj/index.js new file mode 100644 index 0000000..00bf9b0 --- /dev/null +++ b/enum/hidden/gwj/index.js @@ -0,0 +1,30 @@ +// 隐患来源 +export const HIDDEN_SOURCE_ENUM = [ + { bianma: "1", name: "隐患快报" }, + { bianma: "2", name: "清单排查" }, + { bianma: "3", name: "清单排查" }, + { bianma: "4", name: "安全环保检查(监管端)" }, + { bianma: "5", name: "安全环保检查(企业端)" }, + { bianma: "6", name: "消防检查" }, +]; + +// 隐患状态 +export const HIDDEN_STATE_ENUM = [ + { bianma: "100", name: "待确认" }, + { bianma: "200", name: "待整改" }, + { bianma: "201", name: "确认打回" }, + { bianma: "300", name: "待验收" }, + { bianma: "301", name: "已验收" }, + { bianma: "302", name: "验收打回" }, + { bianma: "400", name: "归档" }, + { bianma: "99", name: "用户暂存" }, + { bianma: "98", name: "安全环保检查/清单排查暂存" }, + { bianma: "97", name: "已过期" }, + { bianma: "101", name: "忽略隐患" }, +]; + +// 隐患整改类型 +export const HIDDEN_RECTIFICATION_TYPE_ENUM = [ + { bianma: 1, name: "立即整改" }, + { bianma: 2, name: "延期整改" }, +];