From c922fafd0b4637930d2e3b97b1b102f92314449d Mon Sep 17 00:00:00 2001 From: lorne <1991wangliang@gmail.com> Date: Tue, 17 Nov 2026 23:19:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=BC=BA=E5=88=B6=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=E7=A7=BB=E8=87=B3=E6=B5=81=E7=A8=8B=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=93=8D=E4=BD=9C=E6=A0=8F=E5=B9=B6=E6=8C=89=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E7=AE=A1=E7=90=86=E5=91=98=E6=9D=83=E9=99=90=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=20(#281)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除流程设计页头部的强制同步按钮,改为从 @coding-flow/flow-design 导出 DesignSyncInstance 组件,供列表复用; - 示例应用流程列表操作栏新增「强制同步」,仅流程管理员可见; - 新增强制同步权限查询接口封装(GET /api/query/workflow/permission/forceSync)。 Refs #281 --- apps/app-pc/src/api/workflow.ts | 7 +++++ .../src/components/workflow-list/index.tsx | 30 +++++++++++++++++-- .../components/design-panel/layout/header.tsx | 17 +---------- packages/flow-design/src/index.ts | 1 + 4 files changed, 37 insertions(+), 18 deletions(-) diff --git a/apps/app-pc/src/api/workflow.ts b/apps/app-pc/src/api/workflow.ts index fc100549..9aae186d 100644 --- a/apps/app-pc/src/api/workflow.ts +++ b/apps/app-pc/src/api/workflow.ts @@ -10,3 +10,10 @@ export const remove = (id:string) => { export const changeState = (id:string) => { return httpClient.post('/api/cmd/workflow/changeState',{id}); } + +/** + * 当前用户是否可执行「强制同步运行中实例」(仅流程管理员) + */ +export const forceSyncPermission = () => { + return httpClient.get('/api/query/workflow/permission/forceSync'); +} diff --git a/apps/app-pc/src/components/workflow-list/index.tsx b/apps/app-pc/src/components/workflow-list/index.tsx index a52aa7d7..77356662 100644 --- a/apps/app-pc/src/components/workflow-list/index.tsx +++ b/apps/app-pc/src/components/workflow-list/index.tsx @@ -2,8 +2,8 @@ import {Table, type TableProps} from "@coding-flow/flow-pc-ui"; import {type ActionType} from "@coding-flow/flow-core"; import React from "react"; import {Button, message, Popconfirm, Space} from "antd"; -import {DesignImport, DesignPanel} from "@coding-flow/flow-design"; -import {changeState, list, remove} from "@/api/workflow.ts"; +import {DesignImport, DesignPanel, DesignSyncInstance} from "@coding-flow/flow-design"; +import {changeState, forceSyncPermission, list, remove} from "@/api/workflow.ts"; import dayjs from "dayjs"; import { FlowMessageKey, FlowMessageRegistry } from "@coding-flow/flow-core"; @@ -13,6 +13,16 @@ export const WorkflowList = () => { const [currentId, setCurrentId] = React.useState(''); const [editable, setEditable] = React.useState(false); const [importVisible, setImportVisible] = React.useState(false); + const [syncVisible, setSyncVisible] = React.useState(false); + const [syncWorkCode, setSyncWorkCode] = React.useState(''); + // 强制同步属于流程管理员的干预操作,非管理员不展示该操作 + const [canForceSync, setCanForceSync] = React.useState(false); + + React.useEffect(() => { + forceSyncPermission().then(res => { + setCanForceSync(!!res.data); + }) + }, []); const handleChangeState = (id: any) => { @@ -108,6 +118,14 @@ export const WorkflowList = () => { setCurrentId(record.id); setEditable(true); }}>编辑 + { + canForceSync && ( + { + setSyncWorkCode(record.code); + setSyncVisible(true); + }}>强制同步 + ) + } { @@ -177,6 +195,14 @@ export const WorkflowList = () => { actionType.current?.reload(); }} /> + + { + setSyncVisible(false); + }} + /> ) } diff --git a/packages/flow-design/src/components/design-panel/layout/header.tsx b/packages/flow-design/src/components/design-panel/layout/header.tsx index 447c8a4e..bf0390b5 100644 --- a/packages/flow-design/src/components/design-panel/layout/header.tsx +++ b/packages/flow-design/src/components/design-panel/layout/header.tsx @@ -2,11 +2,10 @@ import React from "react"; import {Button, Divider, Form, Input, message, Popover, Space, Tabs} from "antd"; import {LayoutHeaderHeight, TabPanelType} from "../types"; import {useDesignContext} from "../hooks/use-design-context"; -import {CloseOutlined, ExportOutlined, ImportOutlined, SaveOutlined, SyncOutlined} from "@ant-design/icons"; +import {CloseOutlined, ExportOutlined, ImportOutlined, SaveOutlined} from "@ant-design/icons"; import {EventBus, FlowMessageKey, FlowMessageRegistry} from "@coding-flow/flow-core"; import {exportWorkflow} from "@/api/workflow"; import {DesignImport} from "@/components/design-import"; -import {DesignSyncInstance} from "@/components/design-sync-instance"; const Left = () => { return ( @@ -104,7 +103,6 @@ const SaveAsButton = () => { const Right = () => { const {state,context} = useDesignContext(); const [resetImportVisible, setResetImportVisible] = React.useState(false); - const [syncInstanceVisible, setSyncInstanceVisible] = React.useState(false); return ( <> @@ -124,12 +122,6 @@ const Right = () => { setResetImportVisible(true); }} >重置流程 -