增加UPLOAD_FILE_TYPE_ENUM、HIDDEN_STATE_ENUM

HiddenInfo修改
master
LiuJiaNan 2025-12-05 14:17:41 +08:00
parent 34187378ad
commit 3b2558a76e
4 changed files with 173 additions and 111 deletions

View File

@ -14,6 +14,8 @@ export interface HiddenInfoProps {
hiddenIdKey?: string;
/** 是否显示头部的返回,默认 true */
isShowHeaderBack?: boolean;
/** 是否是过往记录,后端会返回详细的步骤信息,默认 false */
history?: boolean;
/** 获取数据 */
onGetData?: (data: Record<string, any>) => void;
}

View File

@ -24,14 +24,15 @@ function HiddenInfo(props) {
hiddenId = "",
hiddenIdKey = "hiddenId",
isShowHeaderBack = true,
history = false,
onGetData,
} = props;
const [info, setInfo] = useState({
hiddenUserPresetsCO: {},
hiddenRectifyUserCO: {},
hiddenConfirmUserCO: {},
hiddenAcceptUserCO: {},
hiddenRectifyUserCO: [],
hiddenConfirmUserCO: [],
hiddenAcceptUserCO: [],
hiddenInspecCO: {},
hiddenSpecialList: [],
hiddenExtensionList: [],
@ -50,30 +51,43 @@ function HiddenInfo(props) {
const { loading: downloadFileLoading, downloadFile } = useDownloadFile();
const getFileData = async (info) => {
const hiddenImageFiles = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["3"], eqForeignKey: hiddenId || query[hiddenIdKey] });
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] });
const hiddenVideoFiles = await getFile({
eqType: UPLOAD_FILE_TYPE_ENUM["102"],
eqForeignKey: hiddenId || query[hiddenIdKey],
});
setHiddenVideoFiles(hiddenVideoFiles);
if (info.hiddenRectifyUserCO && Object.keys(info.hiddenRectifyUserCO).length > 0) {
if (info.hiddenRectifyUserCO && 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);
for (let i = 0; i < info.hiddenRectifyUserCO.length; i++) {
if ((info.hiddenRectifyUserCO[i].isRectificationScheme === 1 && info.hiddenRectifyUserCO[i].hiddenSchemeCO && Object.keys(info.hiddenRectifyUserCO[i].hiddenSchemeCO).length > 0)) {
const rectificationPlanImageFiles = await getFile({
eqType: UPLOAD_FILE_TYPE_ENUM["8"],
eqForeignKey: hiddenId || query[hiddenIdKey],
});
setRectificationPlanImageFiles(prevState => [...prevState, ...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);
if (info.isQualified === 1 && (info.hiddenAcceptUserCO && info.hiddenAcceptUserCO.length > 0)) {
for (let i = 0; i < info.hiddenAcceptUserCO.length; i++) {
const acceptImageFiles = await getFile({
eqType: UPLOAD_FILE_TYPE_ENUM["5"],
eqForeignKey: hiddenId || query[hiddenIdKey],
});
setAcceptImageFiles(prevState => [...prevState, ...acceptImageFiles]);
}
}
if (info.hiddenInspecCO && Object.keys(info.hiddenInspecCO).length > 0) {
@ -86,7 +100,7 @@ function HiddenInfo(props) {
};
const getData = async () => {
request(`/hidden/hidden/${id || query[idKey]}`, "get").then((res) => {
request(!history ? `/hidden/hidden/${id || query[idKey]}` : `/hidden/hidden/history/${id || query[idKey]}`, "get").then((res) => {
setInfo(res.data);
getFileData(res.data);
setLoading(false);
@ -106,7 +120,7 @@ function HiddenInfo(props) {
<Descriptions
bordered
column={1}
labelStyle={{ width: 200 }}
styles={{ label: { width: 200 } }}
items={[
{ label: "隐患来源", children: getLabelName({ list: HIDDEN_SOURCE_ENUM, status: info.source }) },
{ label: "隐患类型", children: info.hiddenTypeName },
@ -149,12 +163,15 @@ function HiddenInfo(props) {
},
{ label: "隐患图片", children: <PreviewImg files={hiddenImageFiles} /> },
...(hiddenVideoFiles.length > 0
? [{ label: "隐患视频", children: (
<VideoIcon onClick={() => {
setVideoModalOpen(true);
}}
/>
) }]
? [{
label: "隐患视频",
children: (
<VideoIcon onClick={() => {
setVideoModalOpen(true);
}}
/>
),
}]
: []),
]}
/>
@ -165,13 +182,16 @@ function HiddenInfo(props) {
<Descriptions
bordered
column={1}
labelStyle={{ width: 200 }}
styles={{ label: { 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") },
{
label: "整改期限",
children: dayjs(info.hiddenUserPresetsCO.rectifyDeadline).format("YYYY-MM-DD"),
},
]
: []),
...(info.rectificationType === 1
@ -186,30 +206,35 @@ function HiddenInfo(props) {
)
}
{
(info.isConfirm === 1 && info.hiddenConfirmUserCO && Object.keys(info.hiddenConfirmUserCO).length > 0) && (
(info.isConfirm === 1 && (info.hiddenConfirmUserCO && 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.hiddenConfirmUserCO.map(item => (
<Descriptions
key={item.id}
bordered
column={1}
styles={{ label: { width: 200 } }}
items={[
{ label: "隐患级别", children: item.hiddenLevelName },
{ label: "隐患确认人", children: item.userName },
{ label: "隐患确认时间", children: item.rectificationTime },
{ label: "整改负责人部门", children: item.rectifyDeptName },
{ label: "整改负责人", children: item.rectifyUserName },
{ label: "整改完成期限", children: item.rectificationDeadline },
{ label: "验收部门", children: item.checkDeptName },
{ label: "验收人", children: item.checkUserName },
...(item.repulseCause
? [
{ label: "打回意见", children: item.repulseCause },
{ label: "打回时间", children: item.rectificationTime },
]
: []),
]}
/>
))
}
</>
)
}
@ -223,7 +248,7 @@ function HiddenInfo(props) {
key={item.id}
bordered
column={1}
labelStyle={{ width: 200 }}
styles={{ label: { width: 200 } }}
items={[
{ label: "申请延期日期", children: item.createTime },
{ label: "延期日期", children: item.delayTime },
@ -239,7 +264,13 @@ function HiddenInfo(props) {
: (
<Space>
<span>{getFileName(item.disposalFile)}</span>
<Button type="primary" size="small" onClick={() => downloadFile(item.disposalFile)}>预览</Button>
<Button
type="primary"
size="small"
onClick={() => downloadFile(item.disposalFile)}
>
预览
</Button>
</Space>
)
),
@ -258,7 +289,12 @@ function HiddenInfo(props) {
</>
),
},
...((item.state === 3 || item.state === 4) ? [{ label: "延期审核时间", children: item.updateTime }] : []),
...((item.state === 3 || item.state === 4)
? [{
label: "延期审核时间",
children: item.updateTime,
}]
: []),
]}
/>
),
@ -277,7 +313,7 @@ function HiddenInfo(props) {
key={item.id}
bordered
column={1}
labelStyle={{ width: 200 }}
styles={{ label: { width: 200 } }}
items={[
...((item.state === 3 || item.state === 4)
? [
@ -297,12 +333,21 @@ function HiddenInfo(props) {
: (
<Space>
<span>{getFileName(item.disposalFile)}</span>
<Button type="primary" size="small" onClick={() => downloadFile(item.disposalFile)}>预览</Button>
<Button
type="primary"
size="small"
onClick={() => downloadFile(item.disposalFile)}
>
预览
</Button>
</Space>
)
),
},
{ label: "是否更换整改负责人", children: item.rectifyUserCO && Object.keys(item.rectifyUserCO).length > 0 ? "是" : "否" },
{
label: "是否更换整改负责人",
children: item.rectifyUserCO && Object.keys(item.rectifyUserCO).length > 0 ? "是" : "否",
},
...(
item.rectifyUserCO && Object.keys(item.rectifyUserCO).length > 0
? [{ label: "整改负责人", children: item.rectifyUserCO.userName }]
@ -330,77 +375,92 @@ function HiddenInfo(props) {
)
}
{
(info.hiddenRectifyUserCO && Object.keys(info.hiddenRectifyUserCO).length > 0) && (
(info.hiddenRectifyUserCO && 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.hiddenSpecialList.map((item, index) => (
<Descriptions
key={item.id}
bordered
column={1}
styles={{ label: { width: 200 } }}
items={[
{ label: "整改部门", children: item.deptName },
{ label: "整改人", children: item.userName },
{ label: "整改时间", children: item.rectificationTime },
{ label: "整改描述", children: item.descr },
{ label: "投入资金", children: item.investmentFunds },
{ label: "临时安全措施", children: info.tempSafeMeasure },
{ label: "整改后图片", children: <PreviewImg files={afterRectificationImageFiles} /> },
{ label: "整改方案", children: item.isRectificationScheme === 0 ? "无" : "有" },
...((item.isRectificationScheme === 1 && item.hiddenSchemeCO && Object.keys(item.hiddenSchemeCO).length > 0)
? [
{ label: "治理标准", children: item.hiddenSchemeCO.governStanDards },
{ label: "治理方法", children: item.hiddenSchemeCO.governMethod },
{ label: "经费落实", children: item.hiddenSchemeCO.expenditure },
{ label: "负责人员", children: item.hiddenSchemeCO.principal },
{ label: "工时安排", children: item.hiddenSchemeCO.programming },
{ label: "时限要求", children: item.hiddenSchemeCO.timeLimitFor },
{ label: "工作要求", children: item.hiddenSchemeCO.jobRequireMent },
{ label: "其他事项", children: item.hiddenSchemeCO.otherBusiness },
{ label: "方案图片", children: <PreviewImg files={rectificationPlanImageFiles[index]} /> },
]
: []),
]}
/>
))
}
</>
)
}
{
(info.hiddenAcceptUserCO && Object.keys(info.hiddenAcceptUserCO).length > 0)
(info.hiddenAcceptUserCO && info.hiddenAcceptUserCO.length > 0)
? (
info.isQualified === 1
? (
<>
<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} /> },
]}
/>
{
info.hiddenSpecialList.map((item, index) => (
<Descriptions
key={item.id}
bordered
column={1}
styles={{ label: { width: 200 } }}
items={[
{ label: "验收部门", children: item.deptName },
{ label: "验收人", children: item.userName },
{ label: "验收时间", children: item.rectificationTime },
{ label: "验收打回意见", children: item.repulseCause },
{ label: "是否合格", children: "合格" },
{ label: "验收描述", children: item.descr },
{ label: "验收图片", children: <PreviewImg files={acceptImageFiles[index]} /> },
]}
/>
))
}
</>
)
: (
<>
<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.hiddenSpecialList.map(item => (
<Descriptions
key={item.id}
bordered
column={1}
styles={{ label: { width: 200 } }}
items={[
{ label: "验收部门", children: item.deptName },
{ label: "验收人", children: item.userName },
{ label: "验收时间", children: item.rectificationTime },
{ label: "验收打回意见", children: item.repulseCause },
]}
/>
))
}
</>
)
)
@ -414,7 +474,7 @@ function HiddenInfo(props) {
<Descriptions
bordered
column={1}
labelStyle={{ width: 200 }}
styles={{ label: { width: 200 } }}
items={[
{ label: "验收人", children: info.hiddenInspecCO.finalCheckOr },
{ label: "验收时间", children: info.hiddenInspecCO.finalCheckTime },

View File

@ -17,7 +17,7 @@ export const HIDDEN_STATE_ENUM = [
{ bianma: "301", name: "已验收" },
{ bianma: "302", name: "验收打回" },
{ bianma: "400", name: "归档" },
{ bianma: "99", name: "用户暂存" },
{ bianma: "99", name: "关闭" },
{ bianma: "98", name: "安全环保检查/清单排查暂存" },
{ bianma: "102", name: "安全环保检查,隐患带指派" },
{ bianma: "97", name: "已过期" },

View File

@ -78,7 +78,7 @@ export const UPLOAD_FILE_TYPE_ENUM = {
145: 145, // qualified_list_inspection - 清单检查合格
147: 147, // hidden_qualified_listInspection_signature - 隐患清单排查签字
148: 148, // special_qualification - 相关方-专项资质
149: 149, // safety_qualification - 相关方-安全资质
149: 149, // safety_qualification - 相关方-安全资质弃用全部改成使用148
150: 150, // promise_bookmark_photo - 安全承诺签字
151: 151, // project_related_materials - 相关方-项目相关资料
};