diff --git a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue index 3e56e793..b5ba51bf 100644 --- a/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue +++ b/src/components/SimpleProcessDesignerV2/src/NodeHandler.vue @@ -47,8 +47,7 @@ import { NodeType, NODE_DEFAULT_NAME, ApproveMethodType, - RejectHandlerType, - CandidateStrategy + RejectHandlerType } from './consts' import { generateUUID } from '@/utils' defineOptions({ @@ -80,7 +79,6 @@ const addNode = (type: number) => { showText: '', type: NodeType.USER_TASK_NODE, approveMethod: ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE, - candidateStrategy: CandidateStrategy.USER, // 超时处理 rejectHandler: { type: RejectHandlerType.FINISH_PROCESS @@ -88,7 +86,6 @@ const addNode = (type: number) => { timeoutHandler: { enable: false }, - childNode: props.childNode } emits('update:childNode', data) @@ -99,9 +96,6 @@ const addNode = (type: number) => { name: NODE_DEFAULT_NAME.get(NodeType.COPY_TASK_NODE) as string, showText: '', type: NodeType.COPY_TASK_NODE, - candidateStrategy: CandidateStrategy.USER, - candidateParam: undefined, - fieldsPermission: undefined, childNode: props.childNode } emits('update:childNode', data) diff --git a/src/components/SimpleProcessDesignerV2/src/ProcessNodeTree.vue b/src/components/SimpleProcessDesignerV2/src/ProcessNodeTree.vue index c7589089..d11e67cc 100644 --- a/src/components/SimpleProcessDesignerV2/src/ProcessNodeTree.vue +++ b/src/components/SimpleProcessDesignerV2/src/ProcessNodeTree.vue @@ -3,20 +3,19 @@ - - + @@ -65,11 +64,14 @@ const props = defineProps({ } }) const emits = defineEmits<{ - 'update:flowNode', - 'find:recursiveFindParentNode': [nodeList: SimpleFlowNode[], curentNode: SimpleFlowNode, nodeType: number] + 'update:flowNode': [node: SimpleFlowNode | undefined] + 'find:recursiveFindParentNode': [ + nodeList: SimpleFlowNode[], + curentNode: SimpleFlowNode, + nodeType: number + ] }>() - const currentNode = ref(props.flowNode) // 重要:监控节点变化. 重新绘制节点 @@ -79,16 +81,12 @@ watch( currentNode.value = newValue } ) - +// 用于删除节点 const handleModelValueUpdate = (updateValue) => { - console.log('Process Node Tree handleModelValueUpdate', updateValue) emits('update:flowNode', updateValue) } -const findFromParentNode = ( - nodeList: SimpleFlowNode[], - nodeType: number -) => { +const findFromParentNode = (nodeList: SimpleFlowNode[], nodeType: number) => { emits('find:recursiveFindParentNode', nodeList, props.parentNode, nodeType) } diff --git a/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue b/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue index d3d0b44c..b26c2fea 100644 --- a/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue +++ b/src/components/SimpleProcessDesignerV2/src/SimpleProcessDesigner.vue @@ -15,25 +15,29 @@
- +
以下节点内容不完善,请修改后保存
-
- {{ item.name }} : {{ NODE_DEFAULT_TEXT.get(item.type) }} +
+ {{ item.name }} : {{ NODE_DEFAULT_TEXT.get(item.type) }}
diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue index ee863c99..b1ee7e1f 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/CopyTaskNodeConfig.vue @@ -14,11 +14,11 @@ class="config-editable-input" @blur="blurEvent()" v-mountedFocus - v-model="currentNode.name" - :placeholder="currentNode.name" + v-model="configForm.name" + :placeholder="configForm.name" />
{{ currentNode.name }} + >{{ configForm.name }}
@@ -223,8 +223,15 @@ const props = defineProps({ }) // 是否可见 const settingVisible = ref(false) -// 当前节点信息 +// 当前节点 const currentNode = ref(props.flowNode) +// 监控节点变化 +watch( + () => props.flowNode, + (newValue) => { + currentNode.value = newValue + } +) const roleOptions = inject>('roleList') // 角色列表 const postOptions = inject>('postList') // 岗位列表 const userOptions = inject>('userList') // 用户列表 @@ -247,13 +254,14 @@ const activeTabName = ref('user') const formRef = ref() // 表单 Ref const configForm = ref({ + name: NODE_DEFAULT_NAME.get(NodeType.COPY_TASK_NODE), candidateParamArray: [], candidateStrategy: CandidateStrategy.USER, fieldsPermission: [] }) // 表单校验规则 const formRules = reactive({ - candidateStrategy: [{ required: true }], + candidateStrategy: [{ required: true, message: '抄送人设置不能为空', trigger: 'change' }], candidateParamArray: [{ required: true, message: '选项不能为空', trigger: 'blur' }] }) @@ -269,6 +277,7 @@ const saveConfig = async () => { if (!valid) return false const showText = getShowText() if (!showText) return false + currentNode.value.name = configForm.value.name currentNode.value.candidateParam = configForm.value.candidateParamArray?.join(',') currentNode.value.candidateStrategy = configForm.value.candidateStrategy currentNode.value.showText = showText @@ -280,11 +289,10 @@ const saveConfig = async () => { const open = () => { settingVisible.value = true } -// 修改当前编辑的节点, 由父组件传过来 +// 设置抄送节点 const setCurrentNode = (node: SimpleFlowNode) => { - currentNode.value = node - configForm.value.fieldsPermission = - cloneDeep(node.fieldsPermission) || getDefaultFieldsPermission(formFields?.value) + configForm.value.name = node.name + // 抄送人设置 configForm.value.candidateStrategy = node.candidateStrategy const strCandidateParam = node?.candidateParam if (node.candidateStrategy === CandidateStrategy.EXPRESSION) { @@ -294,6 +302,9 @@ const setCurrentNode = (node: SimpleFlowNode) => { configForm.value.candidateParamArray = strCandidateParam.split(',').map((item) => +item) } } + // 表单字段权限 + configForm.value.fieldsPermission = + cloneDeep(node.fieldsPermission) || getDefaultFieldsPermission(formFields?.value) } defineExpose({ open, setCurrentNode }) // 暴露方法给父组件 @@ -387,16 +398,9 @@ const clickIcon = () => { // 输入框失去焦点 const blurEvent = () => { showInput.value = false - currentNode.value.name = - currentNode.value.name || (NODE_DEFAULT_NAME.get(NodeType.COPY_TASK_NODE) as string) + configForm.value.name = + configForm.value.name || (NODE_DEFAULT_NAME.get(NodeType.COPY_TASK_NODE) as string) } - + diff --git a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue index 6254ebeb..cb55341e 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes-config/UserTaskNodeConfig.vue @@ -15,11 +15,11 @@ class="config-editable-input" @blur="blurEvent()" v-mountedFocus - v-model="currentNode.name" - :placeholder="currentNode.name" + v-model="configForm.name" + :placeholder="configForm.name" />
{{ currentNode.name }} + >{{ configForm.name }}
@@ -394,8 +394,15 @@ const emits = defineEmits<{ 'find:returnTaskNodes': [nodeList: SimpleFlowNode[]] }>() -const notAllowedMultiApprovers = ref(false) const currentNode = ref(props.flowNode) +// 监控节点变化 +watch( + () => props.flowNode, + (newValue) => { + currentNode.value = newValue + } +) +const notAllowedMultiApprovers = ref(false) const settingVisible = ref(false) const roleOptions = inject>('roleList') // 角色列表 const postOptions = inject>('postList') // 岗位列表 @@ -410,6 +417,7 @@ const returnTaskList = ref([]) const formRef = ref() // 表单 Ref const activeTabName = ref('user') // 激活的 Tab 标签页 const configForm = ref({ + name: NODE_DEFAULT_NAME.get(NodeType.USER_TASK_NODE), candidateParamArray: [], candidateStrategy: CandidateStrategy.USER, approveMethod: ApproveMethodType.RRANDOM_SELECT_ONE_APPROVE, @@ -425,7 +433,7 @@ const configForm = ref({ }) // 表单校验规则 const formRules = reactive({ - candidateStrategy: [{ required: true }], + candidateStrategy: [{ required: true, message: '审批人设置不能为空', trigger: 'change' }], candidateParamArray: [{ required: true, message: '该选项不能为空', trigger: 'change' }], approveMethod: [{ required: true, message: '多人审批方式不能为空', trigger: 'change' }], approveRatio: [{ required: true, message: '通过比例不能为空', trigger: 'blur' }], @@ -447,6 +455,7 @@ const saveConfig = async () => { if (!valid) return false const showText = getShowText() if (!showText) return false + currentNode.value.name = configForm.value.name currentNode.value.candidateStrategy = configForm.value.candidateStrategy currentNode.value.candidateParam = configForm.value.candidateParamArray?.join(',') // 设置审批方式 @@ -566,12 +575,10 @@ const getShowText = (): string => { const open = () => { settingVisible.value = true } -// 修改当前编辑的节点, 由父组件传过来 +// 配置审批节点, 由父组件传过来 const setCurrentNode = (node: SimpleFlowNode) => { - currentNode.value = node - configForm.value.fieldsPermission = - cloneDeep(node.fieldsPermission) || getDefaultFieldsPermission(formFields?.value) - configForm.value.buttonsSetting = cloneDeep(node.buttonsSetting) || DEFAULT_BUTTON_SETTING + configForm.value.name = node.name + //1.1 审批人设置 configForm.value.candidateStrategy = node.candidateStrategy const strCandidateParam = node?.candidateParam if (node.candidateStrategy === CandidateStrategy.EXPRESSION) { @@ -580,7 +587,6 @@ const setCurrentNode = (node: SimpleFlowNode) => { if (strCandidateParam) { configForm.value.candidateParamArray = strCandidateParam.split(',').map((item) => +item) } - configForm.value.candidateStrategy = node.candidateStrategy } if ( (configForm.value.candidateParamArray?.length <= 1 && @@ -591,13 +597,18 @@ const setCurrentNode = (node: SimpleFlowNode) => { } else { notAllowedMultiApprovers.value = false } - // 设置审批方式 + //1.2 设置审批方式 configForm.value.approveMethod = node.approveMethod if (node.approveMethod == ApproveMethodType.APPROVE_BY_RATIO) { configForm.value.approveRatio = node.approveRatio } + // 1.3 设置审批拒绝处理 configForm.value.rejectHandlerType = node.rejectHandler?.type configForm.value.returnNodeId = node.rejectHandler?.returnNodeId + const matchNodeList = [] + emits('find:returnTaskNodes', matchNodeList) + returnTaskList.value = matchNodeList + // 1.4 设置审批超时处理 configForm.value.timeoutHandlerEnable = node.timeoutHandler?.enable if (node.timeoutHandler?.enable && node.timeoutHandler?.timeDuration) { const strTimeDuration = node.timeoutHandler.timeDuration @@ -608,10 +619,11 @@ const setCurrentNode = (node: SimpleFlowNode) => { } configForm.value.timeoutHandlerAction = node.timeoutHandler?.action configForm.value.maxRemindCount = node.timeoutHandler?.maxRemindCount - // 查找可以驳回的用户节点 - const matchNodeList = [] - emits('find:returnTaskNodes', matchNodeList) - returnTaskList.value = matchNodeList + // 2. 操作按钮设置 + configForm.value.buttonsSetting = cloneDeep(node.buttonsSetting) || DEFAULT_BUTTON_SETTING + // 3. 表单字段权限配置 + configForm.value.fieldsPermission = + cloneDeep(node.fieldsPermission) || getDefaultFieldsPermission(formFields?.value) } defineExpose({ open, setCurrentNode }) // 暴露方法给父组件 @@ -650,8 +662,8 @@ const clickIcon = () => { // 节点名称输入框失去焦点 const blurEvent = () => { showInput.value = false - currentNode.value.name = - currentNode.value.name || (NODE_DEFAULT_NAME.get(NodeType.USER_TASK_NODE) as string) + configForm.value.name = + configForm.value.name || (NODE_DEFAULT_NAME.get(NodeType.USER_TASK_NODE) as string) } const approveMethodChanged = () => { diff --git a/src/components/SimpleProcessDesignerV2/src/nodes/CopyTaskNode.vue b/src/components/SimpleProcessDesignerV2/src/nodes/CopyTaskNode.vue index ca9ff0ea..9448174d 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes/CopyTaskNode.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes/CopyTaskNode.vue @@ -1,7 +1,7 @@ - - + diff --git a/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue b/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue index e2e5a92c..568afa28 100644 --- a/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue +++ b/src/components/SimpleProcessDesignerV2/src/nodes/ExclusiveNode.vue @@ -2,9 +2,13 @@
添加条件
-
+