From d1e73094b07a1d254e1c31bbfed1f16749949159 Mon Sep 17 00:00:00 2001 From: tangjie <122778500@qq.com> Date: Thu, 13 Aug 2026 16:39:24 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E9=A3=8E=E9=99=A9=E9=A2=84=E8=AD=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 0d01e0ba414833b54cae05b871c9868ac0e0bfca. --- src/components/AttachmentUpload/index.js | 141 +++++++----------- .../ProjectFlow/SurveyContent.js | 23 +-- 2 files changed, 56 insertions(+), 108 deletions(-) diff --git a/src/components/AttachmentUpload/index.js b/src/components/AttachmentUpload/index.js index 53b738a..3fe8cb4 100644 --- a/src/components/AttachmentUpload/index.js +++ b/src/components/AttachmentUpload/index.js @@ -4,20 +4,57 @@ import { PlusOutlined } from "@ant-design/icons"; const isImage = (url) => /\.(png|jpe?g|gif|bmp|webp|svg)(\?.*)?$/i.test(url || ""); -function UploadWithAddon({ addon, disabled, maxCount, accept, fileList, onChange, id }) { +export default function AttachmentUpload({ name, label, disabled = false, maxCount, accept, extra ,rules, style }) { const [previewImage, setPreviewImage] = useState(""); return ( <> -
+ { + if (Array.isArray(value)) { + return { fileList: value }; + } + if (typeof value === "string" && value) { + try { + const parsed = JSON.parse(value); + if (Array.isArray(parsed)) { + return { fileList: parsed }; + } + } catch {} + return { + fileList: value.split(",").map((item) => ({ + url: item, + uid: item, + status: "done", + name: "附件", + })), + }; + } + return { fileList: [] }; + }} + getValueFromEvent={({ fileList }) => { + return ( + fileList?.map((file) => ({ + url: file.response?.data?.url || file.url, + uid: file.uid, + status: file.status, + name: file.name, + percent: file.percent, + })) || [] + ); + }} + > 上传附件
- {addon ? ( -
- {addon} -
- ) : null} - - {previewImage && ( - { - if (!visible) setPreviewImage(""); - }, - }} - /> - )} + + {previewImage && { + if (!visible) setPreviewImage(""); + }, + }} + />} ); } - -export default function AttachmentUpload({ - name, - label, - disabled = false, - maxCount, - accept, - extra, - rules, - style, - addon, -}) { - return ( - { - if (Array.isArray(value)) { - return { fileList: value }; - } - if (typeof value === "string" && value) { - try { - const parsed = JSON.parse(value); - if (Array.isArray(parsed)) { - return { fileList: parsed }; - } - } catch {} - return { - fileList: value.split(",").map((item) => ({ - url: item, - uid: item, - status: "done", - name: "附件", - })), - }; - } - return { fileList: [] }; - }} - getValueFromEvent={({ fileList }) => { - return ( - fileList?.map((file) => ({ - url: file.response?.data?.url || file.url, - uid: file.uid, - status: file.status, - name: file.name, - percent: file.percent, - })) || [] - ); - }} - > - - - ); -} diff --git a/src/pages/Container/SafetyEvalBusiness/ProjectFlow/SurveyContent.js b/src/pages/Container/SafetyEvalBusiness/ProjectFlow/SurveyContent.js index 3cde032..13194d9 100644 --- a/src/pages/Container/SafetyEvalBusiness/ProjectFlow/SurveyContent.js +++ b/src/pages/Container/SafetyEvalBusiness/ProjectFlow/SurveyContent.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from "react"; -import { Form, Button, Flex, Typography, Steps, Tag, Card, Table, message, Popover, Image, Checkbox } from "antd"; +import { Form, Button, Flex, Typography, Steps, Tag, Card, Table, message, Popover, Image } from "antd"; import { CheckCircleFilled, DownloadOutlined } from "@ant-design/icons"; import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace"; @@ -160,17 +160,6 @@ const RectificationNoticePanel = ({ readOnly }) => ( accept=".pdf,.doc,.docx,.xls,.xlsx,.png,.jpg,.jpeg" disabled={readOnly} extra="支持 PDF、Word、Excel、PNG、JPG 格式,最多上传 10 个文件" - addon={ - (e.target.checked ? 1 : 0)} - getValueProps={(v) => ({ checked: Number(v) === 1 })} - > - 是否存在重大隐患 - - } /> ); @@ -246,13 +235,7 @@ const SurveyContent = ({ readOnly, ...props }) => { STAGES.forEach((s) => { values[s.key] = map[s.key] || []; }); - const noticeItem = (res?.data || []).find( - (item) => item.attachTypeCode === "RECTIFICATION_NOTICE", - ); - form.setFieldsValue({ - ...values, - checkbox: Number(noticeItem?.checkbox) === 1 ? 1 : 0, - }); + form.setFieldsValue(values); } }; @@ -323,8 +306,6 @@ const SurveyContent = ({ readOnly, ...props }) => { projectId, attachTypeCode: s.key, fileUrl: JSON.stringify(fileList), - checkbox: - s.key === "RECTIFICATION_NOTICE" ? Number(values.checkbox) || 0 : 0, }); } const res = await props.evalSurveySaveAttach(payload);