From 0f26a2464c5d7d9a516f0c0be9f46dde0df7749c Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Tue, 31 Mar 2026 09:09:57 +0800 Subject: [PATCH] =?UTF-8?q?refactor(hotwork):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E5=88=97=E8=A1=A8=E7=BB=84=E4=BB=B6=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将流程图模态框组件拆分为独立的 FlowModal 组件 - 将强制终止模态框组件拆分为独立的 ForceTerminationModal 组件 --- src/components/FlowModal/index.js | 55 +++++++++++ src/components/ForceTerminationModal/index.js | 42 +++++++++ .../Enterprise/HotWork/Homework/List/index.js | 91 +------------------ 3 files changed, 100 insertions(+), 88 deletions(-) create mode 100644 src/components/FlowModal/index.js create mode 100644 src/components/ForceTerminationModal/index.js diff --git a/src/components/FlowModal/index.js b/src/components/FlowModal/index.js new file mode 100644 index 0000000..7f64532 --- /dev/null +++ b/src/components/FlowModal/index.js @@ -0,0 +1,55 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { ReactFlow, ReactFlowProvider } from "@xyflow/react"; +import { Button, Modal } from "antd"; +import { useEffect, useState } from "react"; +import { NS_EIGHTWORK } from "~/enumerate/namespace"; +import { getFlowData } from "~/utils/flow"; + +function FlowModal(props) { + const [flowNodes, setFlowNodes] = useState([]); + const [flowEdges, setFlowEdges] = useState([]); + + const getData = async () => { + const { data } = await props["eightworkTaskLogFlowChart"]({ workId: props.id }); + const { nodes, edges } = getFlowData(data); + setFlowNodes(nodes); + setFlowEdges(edges); + }; + + useEffect(() => { + getData(); + }, []); + + return ( + 取消, + ]} + > + +
+ + +
+
+
+ ); +} + +export default Connect([NS_EIGHTWORK], true)(FlowModal); diff --git a/src/components/ForceTerminationModal/index.js b/src/components/ForceTerminationModal/index.js new file mode 100644 index 0000000..c64737f --- /dev/null +++ b/src/components/ForceTerminationModal/index.js @@ -0,0 +1,42 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Modal } from "antd"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import { NS_EIGHTWORK } from "~/enumerate/namespace"; + +const ForceTerminationModal = (props) => { + const [form] = FormBuilder.useForm(); + + const onSubmit = async () => { + + }; + + return ( + +
+
请确认是否强制关闭作业票?
+ +
+
+ ); +}; + +export default Connect([NS_EIGHTWORK], true)(ForceTerminationModal); diff --git a/src/pages/Container/Enterprise/HotWork/Homework/List/index.js b/src/pages/Container/Enterprise/HotWork/Homework/List/index.js index a0723d3..17daf71 100644 --- a/src/pages/Container/Enterprise/HotWork/Homework/List/index.js +++ b/src/pages/Container/Enterprise/HotWork/Homework/List/index.js @@ -1,8 +1,6 @@ import { Connect } from "@cqsjjb/jjb-dva-runtime"; -import { ReactFlow, ReactFlowProvider } from "@xyflow/react"; -import { Button, Modal, Space } from "antd"; +import { Button, Space } from "antd"; import { useEffect, useState } from "react"; -import FormBuilder from "zy-react-library/components/FormBuilder"; import Page from "zy-react-library/components/Page"; import Search from "zy-react-library/components/Search"; import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj"; @@ -11,9 +9,10 @@ import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; import useTable from "zy-react-library/hooks/useTable"; import { getLabelName } from "zy-react-library/utils"; +import FlowModal from "~/components/FlowModal"; +import ForceTerminationModal from "~/components/ForceTerminationModal"; import { STATUS_ENUM, WORK_TYPE_ENUM } from "~/enumerate/constant"; import { NS_EIGHTWORK } from "~/enumerate/namespace"; -import { getFlowData } from "~/utils/flow"; import "@xyflow/react/dist/style.css"; function List(props) { @@ -179,88 +178,4 @@ function List(props) { ); } -const ForceTerminationModalComponent = (props) => { - const [form] = FormBuilder.useForm(); - - const onSubmit = async () => { - - }; - - return ( - -
-
请确认是否强制关闭作业票?
- -
-
- ); -}; - -function FlowModalComponent(props) { - const [flowNodes, setFlowNodes] = useState([]); - const [flowEdges, setFlowEdges] = useState([]); - - const getData = async () => { - const { data } = await props["eightworkTaskLogFlowChart"]({ workId: props.id }); - const { nodes, edges } = getFlowData(data); - setFlowNodes(nodes); - setFlowEdges(edges); - }; - - useEffect(() => { - getData(); - }, []); - - return ( - 取消, - ]} - > - -
- - -
-
-
- ); -} - -const ForceTerminationModal = Connect([NS_EIGHTWORK], true)(ForceTerminationModalComponent); -const FlowModal = Connect([NS_EIGHTWORK], true)(FlowModalComponent); export default Connect([NS_EIGHTWORK], true)(List);