From 579105bbff24f15c281073fde3dde9e9a8bbabe9 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Mon, 7 Jul 2025 19:11:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B5=81=E7=A8=8B=E8=A1=A8=E8=BE=BE?= =?UTF-8?q?=E5=BC=8F=20&=20=E8=8F=9C=E5=8D=95=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 1 + apps/web-antd/src/api/workflow/spel/index.tsx | 25 +++ .../web-antd/src/api/workflow/spel/model.d.ts | 10 ++ .../web-antd/src/views/workflow/spel/data.tsx | 122 +++++++++++++++ .../src/views/workflow/spel/index.vue | 147 ++++++++++++++++++ .../src/views/workflow/spel/spel-drawer.vue | 101 ++++++++++++ .../views/workflow/spel/spel-previewer.vue | 27 ++++ .../icons/src/iconify-offline/menu-icons.ts | 3 + scripts/菜单图标替换sql/update_icon.sql | 1 + 9 files changed, 437 insertions(+) create mode 100644 apps/web-antd/src/api/workflow/spel/index.tsx create mode 100644 apps/web-antd/src/api/workflow/spel/model.d.ts create mode 100644 apps/web-antd/src/views/workflow/spel/data.tsx create mode 100644 apps/web-antd/src/views/workflow/spel/index.vue create mode 100644 apps/web-antd/src/views/workflow/spel/spel-drawer.vue create mode 100644 apps/web-antd/src/views/workflow/spel/spel-previewer.vue diff --git a/.vscode/settings.json b/.vscode/settings.json index 3884c71f..7e5d3765 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -242,6 +242,7 @@ "napi", "nolebase", "rollup", + "Spel", "tinymce", "vitest" ] diff --git a/apps/web-antd/src/api/workflow/spel/index.tsx b/apps/web-antd/src/api/workflow/spel/index.tsx new file mode 100644 index 00000000..176ac387 --- /dev/null +++ b/apps/web-antd/src/api/workflow/spel/index.tsx @@ -0,0 +1,25 @@ +import type { Spel } from './model'; + +import type { ID, PageQuery, PageResult } from '#/api/common'; + +import { requestClient } from '#/api/request'; + +export function spelList(params?: PageQuery) { + return requestClient.get>('/workflow/spel/list', { params }); +} + +export function spelInfo(id: ID) { + return requestClient.get(`/workflow/spel/${id}`); +} + +export function spelAdd(data: Partial) { + return requestClient.postWithMsg('/workflow/spel', data); +} + +export function spelUpdate(data: Partial) { + return requestClient.putWithMsg('/workflow/spel', data); +} + +export function spelDelete(ids: ID[]) { + return requestClient.deleteWithMsg(`/workflow/spel/${ids}`); +} diff --git a/apps/web-antd/src/api/workflow/spel/model.d.ts b/apps/web-antd/src/api/workflow/spel/model.d.ts new file mode 100644 index 00000000..78131d89 --- /dev/null +++ b/apps/web-antd/src/api/workflow/spel/model.d.ts @@ -0,0 +1,10 @@ +export interface Spel { + id: number; + componentName: string; + methodName: string; + methodParams: string; + viewSpel: string; + status: string; + remark: string; + createTime: string; +} diff --git a/apps/web-antd/src/views/workflow/spel/data.tsx b/apps/web-antd/src/views/workflow/spel/data.tsx new file mode 100644 index 00000000..167c0ed0 --- /dev/null +++ b/apps/web-antd/src/views/workflow/spel/data.tsx @@ -0,0 +1,122 @@ +import type { FormSchemaGetter } from '#/adapter/form'; +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { DictEnum } from '@vben/constants'; + +import { getDictOptions } from '#/utils/dict'; +import { renderDict } from '#/utils/render'; + +export const querySchema: FormSchemaGetter = () => [ + { + component: 'Input', + fieldName: 'componentName', + label: '组件名称', + }, + { + component: 'Input', + fieldName: 'methodName', + label: '方法名称', + }, +]; + +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60 }, + { + title: '组件名称', + field: 'componentName', + formatter: ({ cellValue }) => cellValue ?? '-', + }, + { + title: '方法名称', + field: 'methodName', + formatter: ({ cellValue }) => cellValue ?? '-', + }, + { + title: '参数名称', + field: 'methodParams', + }, + { + title: 'Spel表达式', + field: 'viewSpel', + }, + { + title: '状态', + field: 'status', + width: 120, + slots: { + default: ({ row }) => { + return renderDict(row.status, DictEnum.SYS_NORMAL_DISABLE); + }, + }, + }, + { + title: '备注', + field: 'remark', + }, + { + title: '创建时间', + field: 'createTime', + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '操作', + resizable: false, + width: 'auto', + }, +]; + +export const drawerSchema: FormSchemaGetter = () => [ + { + component: 'Input', + dependencies: { + show: () => false, + triggerFields: [''], + }, + fieldName: 'id', + label: 'id', + }, + { + component: 'Input', + fieldName: 'componentName', + label: '组件名称', + // rules: 'required', + }, + { + component: 'Input', + fieldName: 'methodName', + label: '方法名称', + // rules: 'required', + }, + { + component: 'Input', + fieldName: 'methodParams', + label: '参数名称', + // rules: 'required', + }, + { + component: 'Input', + fieldName: 'viewSpel', + label: 'Spel表达式', + // rules: 'required', + }, + { + component: 'RadioGroup', + componentProps: { + buttonStyle: 'solid', + options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE), + optionType: 'button', + }, + defaultValue: '0', + fieldName: 'status', + label: '状态', + rules: 'required', + }, + { + component: 'Textarea', + fieldName: 'remark', + formItemClass: 'items-start', + label: '备注', + }, +]; diff --git a/apps/web-antd/src/views/workflow/spel/index.vue b/apps/web-antd/src/views/workflow/spel/index.vue new file mode 100644 index 00000000..559887c1 --- /dev/null +++ b/apps/web-antd/src/views/workflow/spel/index.vue @@ -0,0 +1,147 @@ + + + diff --git a/apps/web-antd/src/views/workflow/spel/spel-drawer.vue b/apps/web-antd/src/views/workflow/spel/spel-drawer.vue new file mode 100644 index 00000000..0e2bc833 --- /dev/null +++ b/apps/web-antd/src/views/workflow/spel/spel-drawer.vue @@ -0,0 +1,101 @@ + + + diff --git a/apps/web-antd/src/views/workflow/spel/spel-previewer.vue b/apps/web-antd/src/views/workflow/spel/spel-previewer.vue new file mode 100644 index 00000000..a916ed18 --- /dev/null +++ b/apps/web-antd/src/views/workflow/spel/spel-previewer.vue @@ -0,0 +1,27 @@ + + + diff --git a/packages/icons/src/iconify-offline/menu-icons.ts b/packages/icons/src/iconify-offline/menu-icons.ts index 64273b50..85a0f285 100644 --- a/packages/icons/src/iconify-offline/menu-icons.ts +++ b/packages/icons/src/iconify-offline/menu-icons.ts @@ -35,6 +35,7 @@ import table from '@iconify/icons-lucide/table'; import cloudDoneOutlineRounded from '@iconify/icons-material-symbols/cloud-done-outline-rounded'; import generatingTokensOutline from '@iconify/icons-material-symbols/generating-tokens-outline'; import LogoDevOutline from '@iconify/icons-material-symbols/logo-dev-outline'; +import expressionIcon from '@iconify/icons-material-symbols/regular-expression-rounded'; import ccOutline from '@iconify/icons-mdi/cc-outline'; import tools from '@iconify/icons-mdi/tools'; import workflowOutline from '@iconify/icons-mdi/workflow-outline'; @@ -118,3 +119,5 @@ addIcon('ant-design:setting-outlined', settingOutline); addIcon('flat-color-icons:leave', leave); // flow addIcon('fluent-mdl2:flow', flow); +// 流程表达式 +addIcon('material-symbols:regular-expression-rounded', expressionIcon); diff --git a/scripts/菜单图标替换sql/update_icon.sql b/scripts/菜单图标替换sql/update_icon.sql index d8832181..afca3c31 100644 --- a/scripts/菜单图标替换sql/update_icon.sql +++ b/scripts/菜单图标替换sql/update_icon.sql @@ -44,6 +44,7 @@ UPDATE sys_menu SET icon = 'material-symbols:cloud-done-outline-rounded' WHERE m UPDATE sys_menu SET icon = 'mdi:cc-outline' WHERE menu_id = 11633; UPDATE sys_menu SET icon = 'fluent-mdl2:leave-user' WHERE menu_id = 11638; UPDATE sys_menu SET icon = 'fluent:form-24-regular' WHERE menu_id = 11628; +UPDATE sys_menu SET icon = 'material-symbols:regular-expression-rounded' WHERE menu_id = 11801; /* 从本地迁移菜单管理的跳转菜单 */ UPDATE sys_menu SET icon = 'tabler:code' WHERE menu_id = 116; UPDATE sys_menu SET icon = 'eos-icons:role-binding-outlined' WHERE menu_id = 130;