From ee895d07525ba684e976b72d304e45ae6a59f4d8 Mon Sep 17 00:00:00 2001 From: jason <2667446@qq.com> Date: Sat, 27 Apr 2024 22:17:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BF=E9=92=89=E9=92=89=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8-=E6=8A=84=E9=80=81=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E6=94=B9=E9=80=A0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/NodeHandler.vue | 27 +- .../src/ProcessNodeTree.vue | 6 +- .../src/SimpleProcessDesigner.vue | 6 + .../SimpleProcessDesignerV2/src/consts.ts | 9 +- .../src/nodes-config/CopyTaskNodeConfig.vue | 302 ++++++++++++++++++ .../src/nodes-config/UserTaskNodeConfig.vue | 10 +- .../src/nodes/CopyTaskNode.vue | 103 ++++++ .../src/nodes/UserTaskNode.vue | 31 +- .../theme/simple-process-designer.scss | 18 +- src/views/bpm/simpleWorkflow/index.vue | 25 ++ 10 files changed, 500 insertions(+), 37 deletions(-) create mode 100644 src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue create mode 100644 src/components/SimpleProcessDesignerV2/src/nodes/CopyTaskNode.vue diff --git a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue index 61672c27..6824fa1f 100644 --- a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue +++ b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue @@ -9,12 +9,12 @@
审批人
- +
抄送
+ diff --git a/src/components/SimpleProcessDesignerV2/src/ProcessNodeTree.vue b/src/components/SimpleProcessDesignerV2/src/ProcessNodeTree.vue index 39721c6e..e0b01500 100644 --- a/src/components/SimpleProcessDesignerV2/src/ProcessNodeTree.vue +++ b/src/components/SimpleProcessDesignerV2/src/ProcessNodeTree.vue @@ -5,7 +5,10 @@ - + + @@ -16,6 +19,7 @@ import StartEventNode from './nodes/StartEventNode.vue'; import EndEventNode from './nodes/EndEventNode.vue'; import UserTaskNode from './nodes/UserTaskNode.vue'; +import CopyTaskNode from './nodes/CopyTaskNode.vue'; import { SimpleFlowNode, NodeType } from './consts'; defineOptions({ name: 'ProcessNodeTree' diff --git a/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue b/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue index 741a786c..24006ad7 100644 --- a/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue +++ b/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue @@ -102,6 +102,12 @@ const validateNode = (node: SimpleFlowNode | undefined, errorNodes: SimpleFlowNo } validateNode(node.childNode, errorNodes) } + if (type === NodeType.COPY_TASK_NODE) { + if (!showText) { + errorNodes.push(node) + } + validateNode(node.childNode, errorNodes) + } if (type === NodeType.CONDITION_NODE) { if (!showText) { errorNodes.push(node) diff --git a/src/components/SimpleProcessDesignerV2/src/consts.ts b/src/components/SimpleProcessDesignerV2/src/consts.ts index e3998079..54af0563 100644 --- a/src/components/SimpleProcessDesignerV2/src/consts.ts +++ b/src/components/SimpleProcessDesignerV2/src/consts.ts @@ -15,6 +15,11 @@ export enum NodeType { * 审批人节点 */ USER_TASK_NODE = 1, + + /** + * 抄送人节点 + */ + COPY_TASK_NODE = 2, /** * 条件节点 @@ -92,11 +97,13 @@ export type SimpleFlowNode = { } export const NODE_DEFAULT_TEXT = new Map() -NODE_DEFAULT_TEXT.set(NodeType.USER_TASK_NODE, '请配置该节点') +NODE_DEFAULT_TEXT.set(NodeType.USER_TASK_NODE, '请配置审批人') +NODE_DEFAULT_TEXT.set(NodeType.COPY_TASK_NODE, '请配置抄送人') NODE_DEFAULT_TEXT.set(NodeType.CONDITION_NODE, '请设置条件') export const NODE_DEFAULT_NAME = new Map() NODE_DEFAULT_NAME.set(NodeType.USER_TASK_NODE, '审批人') +NODE_DEFAULT_NAME.set(NodeType.COPY_TASK_NODE, '抄送人') NODE_DEFAULT_NAME.set(NodeType.CONDITION_NODE, '条件') diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue new file mode 100644 index 00000000..8b07dca2 --- /dev/null +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue @@ -0,0 +1,302 @@ + + + + diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue index 8716fd92..7ddb43fa 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue @@ -204,7 +204,7 @@ const saveConfig = () => { emits('update:modelValue', currentNode.value) settingVisible.value = false } -const getShowText = (): string => { +const getShowText = () : string => { let showText = '' // 指定成员 if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.USER) { @@ -290,11 +290,11 @@ const getShowText = (): string => { const open = () => { settingVisible.value = true } -defineExpose({ open }) // 提供 open 方法,用于打开弹窗 +defineExpose({ open }) // 提供 open 方法,用于打开抽屉 const changeCandidateStrategy = () => { candidateParamArray.value = [] currentNode.value.attributes.approveMethod = 1 - if (currentNode.value.attributes.candidateStrategy === 30) { + if (currentNode.value.attributes.candidateStrategy === CandidateStrategy.USER) { notAllowedMultiApprovers.value = true } else { notAllowedMultiApprovers.value = false @@ -302,7 +302,7 @@ const changeCandidateStrategy = () => { } const changedCandidateUsers = () => { - if (candidateParamArray.value?.length <= 1 && currentNode.value.attributes?.candidateStrategy === 30) { + if (candidateParamArray.value?.length <= 1 && currentNode.value.attributes?.candidateStrategy === CandidateStrategy.USER) { currentNode.value.attributes.approveMethod = 1; notAllowedMultiApprovers.value = true } else { @@ -323,7 +323,7 @@ onMounted(async () => { console.log('candidateParam', currentNode.value.attributes?.candidateParam) candidateParamArray.value = currentNode.value.attributes?.candidateParam?.split(',').map(item=> +item) console.log('candidateParamArray.value', candidateParamArray.value) - if (currentNode.value.attributes?.candidateStrategy === 30 && candidateParamArray.value?.length <= 1) { + if (currentNode.value.attributes?.candidateStrategy === CandidateStrategy.USER && candidateParamArray.value?.length <= 1) { notAllowedMultiApprovers.value = true } else { notAllowedMultiApprovers.value = false diff --git a/src/components/SimpleProcessDesignerV2/src/nodes/CopyTaskNode.vue b/src/components/SimpleProcessDesignerV2/src/nodes/CopyTaskNode.vue new file mode 100644 index 00000000..76266e6c --- /dev/null +++ b/src/components/SimpleProcessDesignerV2/src/nodes/CopyTaskNode.vue @@ -0,0 +1,103 @@ + + + + diff --git a/src/components/SimpleProcessDesignerV2/src/nodes/UserTaskNode.vue b/src/components/SimpleProcessDesignerV2/src/nodes/UserTaskNode.vue index 46d0b85c..630f1809 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes/UserTaskNode.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes/UserTaskNode.vue @@ -3,13 +3,12 @@
-
+
-
+
{{ flowNode.showText }}
@@ -32,8 +31,6 @@
- -
@@ -51,7 +48,7 @@ import NodeHandler from '../NodeHandler.vue' import UserTaskNodeConfig from '../nodes-config/UserTaskNodeConfig.vue'; import { generateUUID } from '@/utils' defineOptions({ - name: 'CommonNode' + name: 'UserTaskNode' }) const props = defineProps({ flowNode: { @@ -62,32 +59,27 @@ const props = defineProps({ const emits = defineEmits<{ 'update:modelValue': [node: SimpleFlowNode | undefined] }>() -const nodeSetting = ref() -const commonNodeConfig = () => { - console.log('nodeSetting', nodeSetting) - nodeSetting.value.open() -} const currentNode = ref(props.flowNode) -console.log('current common node is ', currentNode) - -// 不加这个 COPY 会有问题 +const nodeSetting = ref() +// 打开节点配置 +const openNodeConfig = () => { + nodeSetting.value.open() +} watch( () => props.flowNode, (newValue) => { - console.log('new value is ', newValue) currentNode.value = newValue } ) +// 显示节点名称输入框 const showInput = ref(false) +// 节点名称输入框失去焦点 const blurEvent = (event) => { - console.log('blurEvent', event) showInput.value = false currentNode.value.name = currentNode.value.name || NODE_DEFAULT_NAME.get(NodeType.USER_TASK_NODE) as string } -const focusEvent = (event: FocusEvent) => { - console.log('focusEvent', event) -} +// 点击节点标题进行输入 const clickEvent = () => { showInput.value = true } @@ -115,7 +107,6 @@ const copyNode = () => { childNode: currentNode.value } currentNode.value = newCopyNode - console.log('current node value', currentNode.value) emits('update:modelValue', currentNode.value) } diff --git a/src/components/SimpleProcessDesignerV2/theme/simple-process-designer.scss b/src/components/SimpleProcessDesignerV2/theme/simple-process-designer.scss index 6d2b4130..8b6e96e0 100644 --- a/src/components/SimpleProcessDesignerV2/theme/simple-process-designer.scss +++ b/src/components/SimpleProcessDesignerV2/theme/simple-process-designer.scss @@ -108,6 +108,13 @@ .node-title-icon { display: flex; align-items: center; + + &.user-task { + color: #ff943e; + } + &.copy-task { + color: #3296fa; + } } .node-title { @@ -118,7 +125,7 @@ overflow: hidden; text-overflow: ellipsis; color: #1f1f1f; - // vertical-align: middle; + line-height: 18px; } } @@ -458,7 +465,7 @@ text-align: center; &:hover { - background: #3296fa; + background: #e2e2e2; box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1); } @@ -466,11 +473,14 @@ font-size: 35px; line-height: 80px; } - } + } .approve { color: #ff943e; - } + } + .copy { + color: #3296fa; + } .handler-item-text { margin-top: 4px; diff --git a/src/views/bpm/simpleWorkflow/index.vue b/src/views/bpm/simpleWorkflow/index.vue index 619b9c4a..de5095a0 100644 --- a/src/views/bpm/simpleWorkflow/index.vue +++ b/src/views/bpm/simpleWorkflow/index.vue @@ -5,6 +5,11 @@ import { SimpleProcessDesigner } from '@/components/SimpleProcessDesignerV2/src/'; import { getModel } from '@/api/bpm/model' import { getForm, FormVO } from '@/api/bpm/form' +import * as RoleApi from '@/api/system/role' +import * as DeptApi from '@/api/system/dept' +import * as PostApi from '@/api/system/post' +import * as UserApi from '@/api/system/user' +import * as UserGroupApi from '@/api/bpm/userGroup' defineOptions({ name: 'SimpleWorkflowDesignEditor' }) @@ -12,8 +17,18 @@ const { query } = useRoute() // 路由的查询 const modelId : string | undefined = query.modelId as string; const formFields = ref([]) const formType = ref(20); +const roleOptions = ref([]) // 角色列表 +const postOptions = ref([]) // 岗位列表 +const userOptions = ref([]) // 用户列表 +const deptOptions = ref([]) // 部门列表 +const userGroupOptions = ref([]) // 用户组列表 provide('formFields', formFields) provide('formType', formType) +provide('roleList', roleOptions) +provide('postList', postOptions) +provide('userList', userOptions) +provide('deptList', deptOptions) +provide('userGroupList', userGroupOptions) onMounted( async () => { const bpmnModel = await getModel(modelId); if (bpmnModel) { @@ -23,6 +38,16 @@ onMounted( async () => { formFields.value = bpmnForm?.fields } } + // 获得角色列表 + roleOptions.value = await RoleApi.getSimpleRoleList() + postOptions.value = await PostApi.getSimplePostList() + // 获得用户列表 + userOptions.value = await UserApi.getSimpleUserList() + // 获得部门列表 + deptOptions.value = await DeptApi.getSimpleDeptList() + console.log('index deptOptions value is' , deptOptions.value) + // 用户组列表 + userGroupOptions.value = await UserGroupApi.getUserGroupSimpleList() })