From 9b59a8acdb7fdf33499bc18e85caee357ad50d99 Mon Sep 17 00:00:00 2001
From: dap <15891557205@163.com>
Date: Mon, 20 Oct 2025 14:23:51 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E5=AE=A1?=
=?UTF-8?q?=E6=89=B9=E8=AF=A6=E6=83=85footer=E5=8F=8A=E7=9B=B8=E5=85=B3?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81=20=E7=A7=BB=E9=99=A4=E4=B9=8B=E5=89=8Diframe?=
=?UTF-8?q?=E6=96=B9=E6=A1=88=E8=BF=87=E6=97=B6=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
新增 `FlowActions` 审批操作按钮组件,统一处理我的申请、审批、管理员等不同场景下的操作逻辑。
重构 `ApprovalPanel` 组件,将操作按钮抽离为独立组件,简化原有代码结构。
移除了 `ApprovalDetails` 中冗余的 iframe 高度控制属性。
优化 `FlowPreview` 组件,调整 iframe 样式并增强主题切换时与子页面的通信逻辑。
新增 `ApprovalType` 类型定义文件,明确各审批场景类型。
---
.../components/actions/flow-actions.vue | 420 +++++++++++++++
.../workflow/components/actions/index.ts | 1 +
.../workflow/components/approval-details.vue | 2 -
.../workflow/components/approval-panel.vue | 491 ++----------------
.../workflow/components/flow-preview.vue | 18 +-
.../src/views/workflow/components/hook.ts | 22 +-
.../src/views/workflow/components/type.d.ts | 8 +
7 files changed, 510 insertions(+), 452 deletions(-)
create mode 100644 apps/web-antd/src/views/workflow/components/actions/flow-actions.vue
create mode 100644 apps/web-antd/src/views/workflow/components/actions/index.ts
create mode 100644 apps/web-antd/src/views/workflow/components/type.d.ts
diff --git a/apps/web-antd/src/views/workflow/components/actions/flow-actions.vue b/apps/web-antd/src/views/workflow/components/actions/flow-actions.vue
new file mode 100644
index 00000000..d9ccf8de
--- /dev/null
+++ b/apps/web-antd/src/views/workflow/components/actions/flow-actions.vue
@@ -0,0 +1,420 @@
+
+
+
+
+
+
+
+ 撤销申请
+
+
+ 重新编辑
+
+
+ 删除
+
+
+
+
+ 通过
+
+
+ 终止
+
+
+ 驳回
+
+
+
+
+
+
+ 其他
+
+
+
+
+
+
+
+
+
+
+ 流程干预
+ updateAssigneeModalApi.open()">
+ 修改办理人
+
+
+
+
+
+
+
diff --git a/apps/web-antd/src/views/workflow/components/actions/index.ts b/apps/web-antd/src/views/workflow/components/actions/index.ts
new file mode 100644
index 00000000..3daaedf1
--- /dev/null
+++ b/apps/web-antd/src/views/workflow/components/actions/index.ts
@@ -0,0 +1 @@
+export { default as FlowActions } from './flow-actions.vue';
diff --git a/apps/web-antd/src/views/workflow/components/approval-details.vue b/apps/web-antd/src/views/workflow/components/approval-details.vue
index 1673e9c7..e6c6587f 100644
--- a/apps/web-antd/src/views/workflow/components/approval-details.vue
+++ b/apps/web-antd/src/views/workflow/components/approval-details.vue
@@ -20,8 +20,6 @@ defineOptions({
defineProps<{
currentFlowInfo: FlowInfoResponse;
- iframeHeight: number;
- iframeLoaded: boolean;
task: TaskInfo;
}>();
diff --git a/apps/web-antd/src/views/workflow/components/approval-panel.vue b/apps/web-antd/src/views/workflow/components/approval-panel.vue
index 4069c7bb..32b2d91c 100644
--- a/apps/web-antd/src/views/workflow/components/approval-panel.vue
+++ b/apps/web-antd/src/views/workflow/components/approval-panel.vue
@@ -1,87 +1,52 @@
-
+
diff --git a/apps/web-antd/src/views/workflow/components/hook.ts b/apps/web-antd/src/views/workflow/components/hook.ts
index d08e6dbd..7a6cf1d5 100644
--- a/apps/web-antd/src/views/workflow/components/hook.ts
+++ b/apps/web-antd/src/views/workflow/components/hook.ts
@@ -10,20 +10,26 @@ export function useWarmflowIframe() {
const iframeRef = useTemplateRef('iframeRef');
const { isDark } = usePreferences();
+ async function iframeLoadEvent() {
+ /**
+ * TODO: 这里可以优化 因为拿不到内部vue的mount状态
+ */
+ await new Promise((resolve) => setTimeout(resolve, 500));
+ const theme = isDark.value ? 'theme-dark' : 'theme-light';
+ iframeRef.value?.contentWindow?.postMessage({ type: theme });
+ }
+
onMounted(() => {
/**
* load只是iframe加载完 而非vue加载完
*/
- iframeRef.value?.addEventListener('load', async () => {
- /**
- * TODO: 这里可以优化 因为拿不到内部vue的mount状态
- */
- await new Promise((resolve) => setTimeout(resolve, 500));
- const theme = isDark.value ? 'theme-dark' : 'theme-light';
- iframeRef.value?.contentWindow?.postMessage({ type: theme });
- });
+ iframeRef.value?.addEventListener('load', iframeLoadEvent);
});
+ // onBeforeUnmount(() => {
+ // iframeRef.value?.removeEventListener('load', iframeLoadEvent);
+ // });
+
// 监听主题切换 通知iframe切换
watch(isDark, (dark) => {
if (!iframeRef.value) {
diff --git a/apps/web-antd/src/views/workflow/components/type.d.ts b/apps/web-antd/src/views/workflow/components/type.d.ts
new file mode 100644
index 00000000..b7cbaa4a
--- /dev/null
+++ b/apps/web-antd/src/views/workflow/components/type.d.ts
@@ -0,0 +1,8 @@
+export {};
+/**
+ * myself 我发起的
+ * readonly 只读 只用于查看
+ * approve 审批(我的待办)
+ * admin 流程监控 - 待办任务使用
+ */
+export type ApprovalType = 'admin' | 'approve' | 'myself' | 'readonly';