diff --git a/src/pages/Container/SafetyEvalBusiness/ProjectFlow/ControlContent.js b/src/pages/Container/SafetyEvalBusiness/ProjectFlow/ControlContent.js index 3eef06a..a171a23 100644 --- a/src/pages/Container/SafetyEvalBusiness/ProjectFlow/ControlContent.js +++ b/src/pages/Container/SafetyEvalBusiness/ProjectFlow/ControlContent.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from "react"; -import { Tag, Button, Card, Table, Select, Input, Flex, Typography, message, Popover } from "antd"; +import { Tag, Button, Card, Table, Select, Input, Flex, Typography, message, Popover, Image } from "antd"; import { CheckCircleFilled } from "@ant-design/icons"; import { Connect } from "@cqsjjb/jjb-dva-runtime"; import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace"; @@ -26,6 +26,7 @@ const ControlContent = (props) => { // 项目归档 const [files, setFiles] = useState([]); + // 机构负责人签发 const [approvalOpinion, setApprovalOpinion] = useState(""); @@ -178,6 +179,9 @@ const ControlContent = (props) => { }, ]; + const isImage = (name) => + /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i.test(name || ""); + const fileColumns = [ { title: "流程名称", dataIndex: "processName", ellipsis: true }, { title: "条目名称", dataIndex: "itemName", ellipsis: true }, @@ -198,29 +202,33 @@ const ControlContent = (props) => { - {files.map((f, i) => ( - - 📎 {f.name || f.url || "查看文件"} - - ))} + {files.map((f, i) => { + const url = f.url || f.response?.url; + return isImage(f.name) ? ( + + {( + + )} + + ) : ( + window.open(url)} + > + {f.name || "查看文件"} + + ); + })} } trigger="hover" + placement="topLeft" > e.preventDefault()} diff --git a/src/pages/Container/SafetyEvalBusiness/ProjectFlow/RiskAnalysisContent.js b/src/pages/Container/SafetyEvalBusiness/ProjectFlow/RiskAnalysisContent.js index 5517ce9..9f8264e 100644 --- a/src/pages/Container/SafetyEvalBusiness/ProjectFlow/RiskAnalysisContent.js +++ b/src/pages/Container/SafetyEvalBusiness/ProjectFlow/RiskAnalysisContent.js @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react"; +import React, { useEffect, useState, useRef } from "react"; import { Tag, Button, @@ -14,6 +14,7 @@ import { Flex, message, Spin, + Modal, } from "antd"; import dayjs from "dayjs"; import { Connect } from "@cqsjjb/jjb-dva-runtime"; @@ -49,6 +50,10 @@ const RiskAnalysisContent = (props) => { } = safetyEvalBusiness || {}; // 查询风险分析数据回显 + const [participantModalOpen, setParticipantModalOpen] = useState(false); + const [selectedParticipantIds, setSelectedParticipantIds] = useState([]); + const addParticipantRef = useRef(null); + const fetchData = async () => { if (!projectId) return; @@ -293,7 +298,9 @@ const RiskAnalysisContent = (props) => { - {(fields, { add, remove }) => ( + {(fields, { add, remove }) => { + addParticipantRef.current = add; + return ( <> { > @@ -331,6 +339,7 @@ const RiskAnalysisContent = (props) => { > @@ -386,16 +395,66 @@ const RiskAnalysisContent = (props) => { type="dashed" size="small" style={{ marginTop: 8 }} - onClick={() => - add({ personnelName: "", deptName: "", opinion: "" }) - } + onClick={() => { + setSelectedParticipantIds([]); + setParticipantModalOpen(true); + }} > + 添加参与人员 - )} + ); + }} + + setParticipantModalOpen(false)} + onOk={() => { + const selected = (evalProjectDetailData?.participants || []).filter( + (p) => selectedParticipantIds.includes(p.id), + ); + selected.forEach((p) => { + addParticipantRef.current?.({ + personnelName: p.name, + deptName: p.deptName, + opinion: "", + }); + }); + setParticipantModalOpen(false); + }} + > +
{ + const existing = (form.getFieldValue("participants") || []).map( + (p) => p.personnelName, + ); + return (evalProjectDetailData?.participants || []).filter( + (p) => !existing.includes(p.name), + ); + })()} + rowKey="id" + rowSelection={{ + type: "checkbox", + selectedRowKeys: selectedParticipantIds, + onChange: (keys) => setSelectedParticipantIds(keys), + getCheckboxProps: (record) => ({ + disabled: false, + }), + }} + columns={[ + { title: "姓名", dataIndex: "name", width: 100 }, + { title: "部门", dataIndex: "deptName", width: 120 }, + { title: "岗位", dataIndex: "posName", width: 120 }, + { title: "能力", dataIndex: "capacity", width: 120 }, + ]} + pagination={false} + size="small" + locale={{ emptyText: "所有人员均已添加" }} + /> +