feat
parent
77af783720
commit
09800a2b2a
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useState, useEffect } from "react";
|
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 { CheckCircleFilled } from "@ant-design/icons";
|
||||||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace";
|
import { NS_SAFETY_EVAL_BUSINESS } from "~/enumerate/namespace";
|
||||||
|
|
@ -27,6 +27,7 @@ const ControlContent = (props) => {
|
||||||
// 项目归档
|
// 项目归档
|
||||||
const [files, setFiles] = useState([]);
|
const [files, setFiles] = useState([]);
|
||||||
|
|
||||||
|
|
||||||
// 机构负责人签发
|
// 机构负责人签发
|
||||||
const [approvalOpinion, setApprovalOpinion] = 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 = [
|
const fileColumns = [
|
||||||
{ title: "流程名称", dataIndex: "processName", ellipsis: true },
|
{ title: "流程名称", dataIndex: "processName", ellipsis: true },
|
||||||
{ title: "条目名称", dataIndex: "itemName", ellipsis: true },
|
{ title: "条目名称", dataIndex: "itemName", ellipsis: true },
|
||||||
|
|
@ -198,29 +202,33 @@ const ControlContent = (props) => {
|
||||||
<Flex vertical gap={2}>
|
<Flex vertical gap={2}>
|
||||||
<Popover
|
<Popover
|
||||||
title="附件列表"
|
title="附件列表"
|
||||||
placement="topLeft"
|
|
||||||
content={
|
content={
|
||||||
<Flex vertical gap={4} >
|
<Flex vertical gap={4} >
|
||||||
{files.map((f, i) => (
|
{files.map((f, i) => {
|
||||||
<a
|
const url = f.url || f.response?.url;
|
||||||
key={f.uid || i}
|
return isImage(f.name) ? (
|
||||||
href={f.url }
|
<Flex key={f.uid || i} align="center" gap={4}>
|
||||||
target="_blank"
|
{(
|
||||||
rel="noreferrer"
|
<Image
|
||||||
style={{
|
src={url}
|
||||||
overflow: "hidden",
|
width={80}
|
||||||
textOverflow: "ellipsis",
|
/>
|
||||||
whiteSpace: "nowrap",
|
)}
|
||||||
display: "inline-block",
|
</Flex>
|
||||||
maxWidth: 280,
|
) : (
|
||||||
}}
|
<a
|
||||||
>
|
key={f.uid || i}
|
||||||
📎 {f.name || f.url || "查看文件"}
|
style={{ cursor: "pointer" }}
|
||||||
</a>
|
onClick={() => window.open(url)}
|
||||||
))}
|
>
|
||||||
|
{f.name || "查看文件"}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</Flex>
|
</Flex>
|
||||||
}
|
}
|
||||||
trigger="hover"
|
trigger="hover"
|
||||||
|
placement="topLeft"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
onClick={(e) => e.preventDefault()}
|
onClick={(e) => e.preventDefault()}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState, useRef } from "react";
|
||||||
import {
|
import {
|
||||||
Tag,
|
Tag,
|
||||||
Button,
|
Button,
|
||||||
|
|
@ -14,6 +14,7 @@ import {
|
||||||
Flex,
|
Flex,
|
||||||
message,
|
message,
|
||||||
Spin,
|
Spin,
|
||||||
|
Modal,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
import { Connect } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
|
@ -49,6 +50,10 @@ const RiskAnalysisContent = (props) => {
|
||||||
} = safetyEvalBusiness || {};
|
} = safetyEvalBusiness || {};
|
||||||
|
|
||||||
// 查询风险分析数据回显
|
// 查询风险分析数据回显
|
||||||
|
const [participantModalOpen, setParticipantModalOpen] = useState(false);
|
||||||
|
const [selectedParticipantIds, setSelectedParticipantIds] = useState([]);
|
||||||
|
const addParticipantRef = useRef(null);
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
if (!projectId) return;
|
if (!projectId) return;
|
||||||
|
|
||||||
|
|
@ -293,7 +298,9 @@ const RiskAnalysisContent = (props) => {
|
||||||
|
|
||||||
<Card type="inner" size="small" title="参与风险分析人员签字">
|
<Card type="inner" size="small" title="参与风险分析人员签字">
|
||||||
<Form.List name="participants">
|
<Form.List name="participants">
|
||||||
{(fields, { add, remove }) => (
|
{(fields, { add, remove }) => {
|
||||||
|
addParticipantRef.current = add;
|
||||||
|
return (
|
||||||
<>
|
<>
|
||||||
<Table
|
<Table
|
||||||
dataSource={fields}
|
dataSource={fields}
|
||||||
|
|
@ -311,6 +318,7 @@ const RiskAnalysisContent = (props) => {
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
placeholder="姓名"
|
placeholder="姓名"
|
||||||
|
disabled
|
||||||
maxLength={20}
|
maxLength={20}
|
||||||
allowClear
|
allowClear
|
||||||
/>
|
/>
|
||||||
|
|
@ -331,6 +339,7 @@ const RiskAnalysisContent = (props) => {
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
placeholder="部门/岗位"
|
placeholder="部门/岗位"
|
||||||
|
disabled
|
||||||
maxLength={20}
|
maxLength={20}
|
||||||
allowClear
|
allowClear
|
||||||
/>
|
/>
|
||||||
|
|
@ -386,16 +395,66 @@ const RiskAnalysisContent = (props) => {
|
||||||
type="dashed"
|
type="dashed"
|
||||||
size="small"
|
size="small"
|
||||||
style={{ marginTop: 8 }}
|
style={{ marginTop: 8 }}
|
||||||
onClick={() =>
|
onClick={() => {
|
||||||
add({ personnelName: "", deptName: "", opinion: "" })
|
setSelectedParticipantIds([]);
|
||||||
}
|
setParticipantModalOpen(true);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
+ 添加参与人员
|
+ 添加参与人员
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
)}
|
);
|
||||||
|
}}
|
||||||
</Form.List>
|
</Form.List>
|
||||||
</Card>
|
</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>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue