dev_1.2
tangjie 2026-07-24 15:27:56 +08:00
parent 77af783720
commit 09800a2b2a
2 changed files with 92 additions and 25 deletions

View File

@ -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";
@ -27,6 +27,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) => {
<Flex vertical gap={2}>
<Popover
title="附件列表"
placement="topLeft"
content={
<Flex vertical gap={4} >
{files.map((f, i) => (
{files.map((f, i) => {
const url = f.url || f.response?.url;
return isImage(f.name) ? (
<Flex key={f.uid || i} align="center" gap={4}>
{(
<Image
src={url}
width={80}
/>
)}
</Flex>
) : (
<a
key={f.uid || i}
href={f.url }
target="_blank"
rel="noreferrer"
style={{
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
display: "inline-block",
maxWidth: 280,
}}
style={{ cursor: "pointer" }}
onClick={() => window.open(url)}
>
📎 {f.name || f.url || "查看文件"}
{f.name || "查看文件"}
</a>
))}
);
})}
</Flex>
}
trigger="hover"
placement="topLeft"
>
<a
onClick={(e) => e.preventDefault()}

View File

@ -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) => {
<Card type="inner" size="small" title="参与风险分析人员签字">
<Form.List name="participants">
{(fields, { add, remove }) => (
{(fields, { add, remove }) => {
addParticipantRef.current = add;
return (
<>
<Table
dataSource={fields}
@ -311,6 +318,7 @@ const RiskAnalysisContent = (props) => {
>
<Input
placeholder="姓名"
disabled
maxLength={20}
allowClear
/>
@ -331,6 +339,7 @@ const RiskAnalysisContent = (props) => {
>
<Input
placeholder="部门/岗位"
disabled
maxLength={20}
allowClear
/>
@ -386,16 +395,66 @@ const RiskAnalysisContent = (props) => {
type="dashed"
size="small"
style={{ marginTop: 8 }}
onClick={() =>
add({ personnelName: "", deptName: "", opinion: "" })
}
onClick={() => {
setSelectedParticipantIds([]);
setParticipantModalOpen(true);
}}
>
添加参与人员
</Button>
</>
)}
);
}}
</Form.List>
</Card>
<Modal
title="选择参与人员"
open={participantModalOpen}
onCancel={() => 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);
}}
>
<Table
dataSource={(() => {
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: "所有人员均已添加" }}
/>
</Modal>
</Form>
</Card>