From deefea6a184d3473732250fdb1b102b616475d34 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Sun, 25 May 2025 08:46:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?perf:=20review=20todo=20=E7=9A=84=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/bpm/model/form/index.vue | 19 +------------------ apps/web-antd/src/views/bpm/model/index.vue | 2 +- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/apps/web-antd/src/views/bpm/model/form/index.vue b/apps/web-antd/src/views/bpm/model/form/index.vue index 0ea84ac7..2c2f61fb 100644 --- a/apps/web-antd/src/views/bpm/model/form/index.vue +++ b/apps/web-antd/src/views/bpm/model/form/index.vue @@ -26,6 +26,7 @@ import { } from '#/api/bpm/model'; import { getSimpleDeptList } from '#/api/system/dept'; import { getSimpleUserList } from '#/api/system/user'; +import { BpmAutoApproveType, BpmModelFormType, BpmModelType } from '#/utils'; import BasicInfo from './modules/basic-info.vue'; import FormDesign from './modules/form-design.vue'; @@ -33,24 +34,6 @@ import ProcessDesign from './modules/process-design.vue'; defineOptions({ name: 'BpmModelCreate' }); -// TODO 这个常量是不是所有 apps 都可以使用, 放 @utils/constant.ts 不能共享, @芋艿 这些常量放哪里合适! -// TODO @jason:/Users/yunai/Java/yudao-ui-admin-vben-v5/apps/web-antd/src/utils/constants.ts;先不多个 apps 共享哈; -const BpmModelType = { - BPMN: 10, // BPMN 设计器 - SIMPLE: 20, // 简易设计器 -}; - -const BpmModelFormType = { - NORMAL: 10, // 流程表单 - CUSTOM: 20, // 业务表单 -}; - -const BpmAutoApproveType = { - NONE: 0, // 不自动通过 - APPROVE_ALL: 1, // 仅审批一次,后续重复的审批节点均自动通过 - APPROVE_SEQUENT: 2, // 仅针对连续审批的节点自动通过 -}; - // 流程定义类型 type BpmProcessDefinitionType = Omit< BpmProcessDefinitionApi.ProcessDefinitionVO, diff --git a/apps/web-antd/src/views/bpm/model/index.vue b/apps/web-antd/src/views/bpm/model/index.vue index 64ef6646..32028843 100644 --- a/apps/web-antd/src/views/bpm/model/index.vue +++ b/apps/web-antd/src/views/bpm/model/index.vue @@ -162,7 +162,7 @@ const handleCategorySortSubmit = async () => { - + Date: Mon, 26 May 2025 14:20:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20Simple=20=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B-=20=E5=8F=91=E8=B5=B7=E4=BA=BA=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nodes-config/start-user-node-config.vue | 284 ++++++++++++++++++ .../components/nodes/start-user-node.vue | 10 +- .../components/simple-process-designer.vue | 65 ++-- .../components/simple-process-model.vue | 24 +- .../styles/simple-process-designer.scss | 3 +- .../bpm/model/form/modules/process-design.vue | 4 +- .../form/modules/simple-model-design.vue | 8 +- 7 files changed, 339 insertions(+), 59 deletions(-) create mode 100644 apps/web-antd/src/components/simple-process-design/components/nodes-config/start-user-node-config.vue diff --git a/apps/web-antd/src/components/simple-process-design/components/nodes-config/start-user-node-config.vue b/apps/web-antd/src/components/simple-process-design/components/nodes-config/start-user-node-config.vue new file mode 100644 index 00000000..80b7b3a1 --- /dev/null +++ b/apps/web-antd/src/components/simple-process-design/components/nodes-config/start-user-node-config.vue @@ -0,0 +1,284 @@ + + + + + + + + {{ nodeName }} + + + + + + + + + 全部成员可以发起流程 + + + + {{ getUserNicknames(startUserIds) }} 可发起流程 + + + + {{ getUserNicknames(startUserIds.slice(0, 2)) }} 等 + {{ startUserIds.length }} 人可发起流程 + + + + + + {{ getDeptNames(startDeptIds) }} 可发起流程 + + + + {{ getDeptNames(startDeptIds.slice(0, 2)) }} 等 + {{ startDeptIds.length }} 个部门可发起流程 + + + + + + + 字段权限 + + 字段名称 + + + 只读 + + + 可编辑 + + + 隐藏 + + + + + {{ item.title }} + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/web-antd/src/components/simple-process-design/components/nodes/start-user-node.vue b/apps/web-antd/src/components/simple-process-design/components/nodes/start-user-node.vue index 748acef3..2edb1093 100644 --- a/apps/web-antd/src/components/simple-process-design/components/nodes/start-user-node.vue +++ b/apps/web-antd/src/components/simple-process-design/components/nodes/start-user-node.vue @@ -11,6 +11,7 @@ import { Input } from 'ant-design-vue'; import { NODE_DEFAULT_TEXT, NodeType } from '../../consts'; import { useNodeName2, useTaskStatusClass, useWatchNode } from '../../helpers'; +import StartUserNodeConfig from '../nodes-config/start-user-node-config.vue'; import NodeHandler from './node-handler.vue'; defineOptions({ name: 'StartUserNode' }); @@ -55,8 +56,7 @@ const nodeClick = () => { 'TODO 编辑模式,打开节点配置、把当前节点传递给配置组件', nodeSetting.value, ); - // nodeSetting.value.showStartUserNodeConfig(currentNode.value); - // nodeSetting.value.openDrawer(); + nodeSetting.value.showStartUserNodeConfig(currentNode.value); } }; @@ -108,12 +108,12 @@ const nodeClick = () => { /> - + /> diff --git a/apps/web-antd/src/components/simple-process-design/components/simple-process-designer.vue b/apps/web-antd/src/components/simple-process-design/components/simple-process-designer.vue index f817963c..7f2762ca 100644 --- a/apps/web-antd/src/components/simple-process-design/components/simple-process-designer.vue +++ b/apps/web-antd/src/components/simple-process-design/components/simple-process-designer.vue @@ -3,21 +3,19 @@ import type { Ref } from 'vue'; import type { SimpleFlowNode } from '../consts'; -import type { BpmFormApi } from '#/api/bpm/form'; import type { BpmUserGroupApi } from '#/api/bpm/userGroup'; import type { SystemDeptApi } from '#/api/system/dept'; import type { SystemPostApi } from '#/api/system/post'; import type { SystemRoleApi } from '#/api/system/role'; import type { SystemUserApi } from '#/api/system/user'; -import { inject, onMounted, provide, ref } from 'vue'; +import { inject, onMounted, provide, ref, watch } from 'vue'; import { handleTree } from '@vben/utils'; import { Button, Modal } from 'ant-design-vue'; import { getFormDetail } from '#/api/bpm/form'; -import { getModel } from '#/api/bpm/model'; import { getUserGroupSimpleList } from '#/api/bpm/userGroup'; import { getSimpleDeptList } from '#/api/system/dept'; import { getSimplePostList } from '#/api/system/post'; @@ -33,21 +31,23 @@ defineOptions({ }); const props = defineProps({ - modelId: { - type: String, - required: false, - default: undefined, - }, - modelKey: { - type: String, - required: false, - default: undefined, - }, modelName: { type: String, required: false, default: undefined, }, + // 流程表单 ID + modelFormId: { + type: Number, + required: false, + default: undefined, + }, + // 表单类型 + modelFormType: { + type: Number, + required: false, + default: BpmModelFormType.NORMAL, + }, // 可发起流程的人员编号 startUserIds: { type: Array, @@ -66,7 +66,31 @@ const emits = defineEmits(['success']); const processData = inject('processData') as Ref; const loading = ref(false); const formFields = ref([]); -const formType = ref(20); +const formType = ref(props.modelFormType); + +// 监听 modelFormType 变化 +watch( + () => props.modelFormType, + (newVal) => { + formType.value = newVal; + }, +); + +// 监听 modelFormId 变化 +watch( + () => props.modelFormId, + async (newVal) => { + if (newVal) { + const form = await getFormDetail(newVal); + formFields.value = form?.fields; + } else { + // 如果 modelFormId 为空,清空表单字段 + formFields.value = []; + } + }, + { immediate: true }, +); + const roleOptions = ref([]); // 角色列表 const postOptions = ref([]); // 岗位列表 const userOptions = ref([]); // 用户列表 @@ -172,19 +196,6 @@ const validateNode = ( onMounted(async () => { try { loading.value = true; - // 获取表单字段 - if (props.modelId) { - const bpmnModel = await getModel(props.modelId); - if (bpmnModel) { - formType.value = bpmnModel.formType; - if (formType.value === BpmModelFormType.NORMAL && bpmnModel.formId) { - const bpmnForm = (await getFormDetail( - bpmnModel.formId, - )) as unknown as BpmFormApi.FormVO; - formFields.value = bpmnForm?.fields; - } - } - } // 获得角色列表 roleOptions.value = await getSimpleRoleList(); // 获得岗位列表 diff --git a/apps/web-antd/src/components/simple-process-design/components/simple-process-model.vue b/apps/web-antd/src/components/simple-process-design/components/simple-process-model.vue index 2495a68f..cfd2e6a8 100644 --- a/apps/web-antd/src/components/simple-process-design/components/simple-process-model.vue +++ b/apps/web-antd/src/components/simple-process-design/components/simple-process-model.vue @@ -198,8 +198,8 @@ onMounted(() => { }); - - + + @@ -247,6 +247,7 @@ onMounted(() => { /> + { - + diff --git a/apps/web-antd/src/components/simple-process-design/styles/simple-process-designer.scss b/apps/web-antd/src/components/simple-process-design/styles/simple-process-designer.scss index 817e7a76..dbda6573 100644 --- a/apps/web-antd/src/components/simple-process-design/styles/simple-process-designer.scss +++ b/apps/web-antd/src/components/simple-process-design/styles/simple-process-designer.scss @@ -209,8 +209,8 @@ .simple-process-model-container { width: 100%; height: 100%; + padding-top: 32px; overflow-x: auto; - background: url('./svg/simple-process-bg.svg') 0 0 repeat; background-color: #fafafa; .simple-process-model { @@ -219,6 +219,7 @@ align-items: center; justify-content: center; min-width: fit-content; + background: url('./svg/simple-process-bg.svg') 0 0 repeat; transform: scale(1); transform-origin: 50% 0 0; transition: transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1); diff --git a/apps/web-antd/src/views/bpm/model/form/modules/process-design.vue b/apps/web-antd/src/views/bpm/model/form/modules/process-design.vue index 10f99f8d..f9fb0754 100644 --- a/apps/web-antd/src/views/bpm/model/form/modules/process-design.vue +++ b/apps/web-antd/src/views/bpm/model/form/modules/process-design.vue @@ -55,9 +55,9 @@ defineExpose({ {