From 3b2558a76e90b4aacf8cbf0794bc9fed4b275793 Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Fri, 5 Dec 2025 14:17:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0UPLOAD=5FFILE=5FTYPE=5FENUM?= =?UTF-8?q?=E3=80=81HIDDEN=5FSTATE=5FENUM=20HiddenInfo=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/HiddenInfo/gwj/index.d.ts | 2 + components/HiddenInfo/gwj/index.js | 278 ++++++++++++++++----------- enum/hidden/gwj/index.js | 2 +- enum/uploadFile/gwj/index.js | 2 +- 4 files changed, 173 insertions(+), 111 deletions(-) diff --git a/components/HiddenInfo/gwj/index.d.ts b/components/HiddenInfo/gwj/index.d.ts index b71d541..d51f292 100644 --- a/components/HiddenInfo/gwj/index.d.ts +++ b/components/HiddenInfo/gwj/index.d.ts @@ -14,6 +14,8 @@ export interface HiddenInfoProps { hiddenIdKey?: string; /** 是否显示头部的返回,默认 true */ isShowHeaderBack?: boolean; + /** 是否是过往记录,后端会返回详细的步骤信息,默认 false */ + history?: boolean; /** 获取数据 */ onGetData?: (data: Record) => void; } diff --git a/components/HiddenInfo/gwj/index.js b/components/HiddenInfo/gwj/index.js index 740a7fe..e4b3f7b 100644 --- a/components/HiddenInfo/gwj/index.js +++ b/components/HiddenInfo/gwj/index.js @@ -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) { }, ...(hiddenVideoFiles.length > 0 - ? [{ label: "隐患视频", children: ( - { - setVideoModalOpen(true); - }} - /> - ) }] + ? [{ + label: "隐患视频", + children: ( + { + setVideoModalOpen(true); + }} + /> + ), + }] : []), ]} /> @@ -165,13 +182,16 @@ function HiddenInfo(props) { 0) && ( + (info.isConfirm === 1 && (info.hiddenConfirmUserCO && info.hiddenConfirmUserCO.length > 0)) && ( <> 隐患确认 - + { + info.hiddenConfirmUserCO.map(item => ( + + )) + } ) } @@ -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) { : ( {getFileName(item.disposalFile)} - + ) ), @@ -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) { : ( {getFileName(item.disposalFile)} - + ) ), }, - { 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) && ( <> 整改信息 - }, - { 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.hiddenSpecialList.map((item, index) => ( + }, + { 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: }, + ] + : []), + ]} + /> + )) + } ) } { - (info.hiddenAcceptUserCO && Object.keys(info.hiddenAcceptUserCO).length > 0) + (info.hiddenAcceptUserCO && info.hiddenAcceptUserCO.length > 0) ? ( info.isQualified === 1 ? ( <> 验收信息 - }, - ]} - /> + { + info.hiddenSpecialList.map((item, index) => ( + }, + ]} + /> + )) + } ) : ( <> 验收打回信息 - + { + info.hiddenSpecialList.map(item => ( + + )) + } ) ) @@ -414,7 +474,7 @@ function HiddenInfo(props) {