【功能完善】仿钉钉流程浏览功能完善

pull/582/head
jason 2024-10-29 21:24:03 +08:00
parent c9b12c8b39
commit 0284893b4a
8 changed files with 34 additions and 26 deletions

View File

@ -1,7 +1,10 @@
<template> <template>
<div class="node-wrapper"> <div class="node-wrapper">
<div class="node-container"> <div class="node-container">
<div class="node-box" :class="{ 'node-config-error': !currentNode.showText }"> <div
class="node-box"
:class="[{ 'node-config-error': !currentNode.showText }, `${useTaskStatusClass(currentNode?.activityStatus)}`]"
>
<div class="node-title-container"> <div class="node-title-container">
<div class="node-title-icon copy-task"><span class="iconfont icon-copy"></span></div> <div class="node-title-icon copy-task"><span class="iconfont icon-copy"></span></div>
<input <input
@ -36,13 +39,17 @@
<!-- 传递子节点给添加节点组件会在子节点前面添加节点 --> <!-- 传递子节点给添加节点组件会在子节点前面添加节点 -->
<NodeHandler v-if="currentNode" v-model:child-node="currentNode.childNode" /> <NodeHandler v-if="currentNode" v-model:child-node="currentNode.childNode" />
</div> </div>
<CopyTaskNodeConfig v-if="!readonly && currentNode" ref="nodeSetting" :flow-node="currentNode" /> <CopyTaskNodeConfig
v-if="!readonly && currentNode"
ref="nodeSetting"
:flow-node="currentNode"
/>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { SimpleFlowNode, NodeType, NODE_DEFAULT_TEXT } from '../consts' import { SimpleFlowNode, NodeType, NODE_DEFAULT_TEXT } from '../consts'
import NodeHandler from '../NodeHandler.vue' import NodeHandler from '../NodeHandler.vue'
import { useNodeName2, useWatchNode } from '../node' import { useNodeName2, useWatchNode, useTaskStatusClass } from '../node'
import CopyTaskNodeConfig from '../nodes-config/CopyTaskNodeConfig.vue' import CopyTaskNodeConfig from '../nodes-config/CopyTaskNodeConfig.vue'
defineOptions({ defineOptions({
name: 'CopyTaskNode' name: 'CopyTaskNode'
@ -58,7 +65,7 @@ const emits = defineEmits<{
'update:flowNode': [node: SimpleFlowNode | undefined] 'update:flowNode': [node: SimpleFlowNode | undefined]
}>() }>()
// //
const readonly = inject<Boolean>('readonly') const readonly = inject<Boolean>('readonly')
// //
const currentNode = useWatchNode(props) const currentNode = useWatchNode(props)
// //

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="end-node-wrapper"> <div class="end-node-wrapper">
<div class="end-node-box" :class="taskStatusClass"> <div class="end-node-box" :class="`${useTaskStatusClass(currentNode?.activityStatus)}`">
<span class="node-fixed-name" title="结束">结束</span> <span class="node-fixed-name" title="结束">结束</span>
</div> </div>
</div> </div>
@ -20,8 +20,6 @@ const props = defineProps({
}) })
// //
const currentNode = useWatchNode(props) const currentNode = useWatchNode(props)
//
const taskStatusClass = useTaskStatusClass(currentNode.value?.activityStatus)
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="branch-node-wrapper"> <div class="branch-node-wrapper">
<div class="branch-node-container"> <div class="branch-node-container">
<div v-if="readonly" class="branch-node-readonly" :class="taskStatusClass"> <div v-if="readonly" class="branch-node-readonly" :class="`${useTaskStatusClass(currentNode?.activityStatus)}`">
<span class="iconfont icon-exclusive icon-size"></span> <span class="iconfont icon-exclusive icon-size condition"></span>
</div> </div>
<el-button v-else class="branch-node-add" color="#67c23a" @click="addCondition" plain <el-button v-else class="branch-node-add" color="#67c23a" @click="addCondition" plain
>添加条件</el-button >添加条件</el-button
@ -122,9 +122,6 @@ const emits = defineEmits<{
// //
const readonly = inject<Boolean>('readonly') const readonly = inject<Boolean>('readonly')
const currentNode = ref<SimpleFlowNode>(props.flowNode) const currentNode = ref<SimpleFlowNode>(props.flowNode)
//
const taskStatusClass = useTaskStatusClass(currentNode.value?.activityStatus)
watch( watch(
() => props.flowNode, () => props.flowNode,
(newValue) => { (newValue) => {

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="branch-node-wrapper"> <div class="branch-node-wrapper">
<div class="branch-node-container"> <div class="branch-node-container">
<div v-if="readonly" class="branch-node-readonly"> <div v-if="readonly" class="branch-node-readonly" :class="`${useTaskStatusClass(currentNode?.activityStatus)}`" >
<span class="iconfont icon-inclusive icon-size"></span> <span class="iconfont icon-inclusive icon-size inclusive"></span>
</div> </div>
<el-button v-else class="branch-node-add" color="#345da2" @click="addCondition" plain>添加条件</el-button> <el-button v-else class="branch-node-add" color="#345da2" @click="addCondition" plain>添加条件</el-button>
<div <div
@ -20,7 +20,7 @@
</template> </template>
<div class="node-wrapper"> <div class="node-wrapper">
<div class="node-container"> <div class="node-container">
<div class="node-box" :class="{ 'node-config-error': !item.showText }"> <div class="node-box" :class="[{ 'node-config-error': !item.showText }, `${useTaskStatusClass(item.activityStatus)}`]">
<div class="branch-node-title-container"> <div class="branch-node-title-container">
<div v-if="showInputs[index]"> <div v-if="showInputs[index]">
<input <input
@ -88,6 +88,7 @@
import NodeHandler from '../NodeHandler.vue' import NodeHandler from '../NodeHandler.vue'
import ProcessNodeTree from '../ProcessNodeTree.vue' import ProcessNodeTree from '../ProcessNodeTree.vue'
import { SimpleFlowNode, NodeType, NODE_DEFAULT_TEXT } from '../consts' import { SimpleFlowNode, NodeType, NODE_DEFAULT_TEXT } from '../consts'
import { useTaskStatusClass } from '../node'
import { getDefaultInclusiveConditionNodeName } from '../utils' import { getDefaultInclusiveConditionNodeName } from '../utils'
import { generateUUID } from '@/utils' import { generateUUID } from '@/utils'
import ConditionNodeConfig from '../nodes-config/ConditionNodeConfig.vue' import ConditionNodeConfig from '../nodes-config/ConditionNodeConfig.vue'

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="branch-node-wrapper"> <div class="branch-node-wrapper">
<div class="branch-node-container"> <div class="branch-node-container">
<div v-if="readonly" class="branch-node-readonly"> <div v-if="readonly" class="branch-node-readonly" :class="`${useTaskStatusClass(currentNode?.activityStatus)}`">
<span class="iconfont icon-parallel icon-size"></span> <span class="iconfont icon-parallel icon-size parallel"></span>
</div> </div>
<el-button v-else class="branch-node-add" color="#626aef" @click="addCondition" plain>添加分支</el-button> <el-button v-else class="branch-node-add" color="#626aef" @click="addCondition" plain>添加分支</el-button>
<div <div
@ -20,7 +20,7 @@
</template> </template>
<div class="node-wrapper"> <div class="node-wrapper">
<div class="node-container"> <div class="node-container">
<div class="node-box"> <div class="node-box" :class="`${useTaskStatusClass(item.activityStatus)}`">
<div class="branch-node-title-container"> <div class="branch-node-title-container">
<div v-if="showInputs[index]"> <div v-if="showInputs[index]">
<input <input
@ -73,8 +73,8 @@
import NodeHandler from '../NodeHandler.vue' import NodeHandler from '../NodeHandler.vue'
import ProcessNodeTree from '../ProcessNodeTree.vue' import ProcessNodeTree from '../ProcessNodeTree.vue'
import { SimpleFlowNode, NodeType, NODE_DEFAULT_TEXT } from '../consts' import { SimpleFlowNode, NodeType, NODE_DEFAULT_TEXT } from '../consts'
import { useTaskStatusClass } from '../node'
import { generateUUID } from '@/utils' import { generateUUID } from '@/utils'
const { proxy } = getCurrentInstance() as any const { proxy } = getCurrentInstance() as any
defineOptions({ defineOptions({
name: 'ParallelNode' name: 'ParallelNode'

View File

@ -3,7 +3,7 @@
<div class="node-container"> <div class="node-container">
<div <div
class="node-box" class="node-box"
:class="[{ 'node-config-error': !currentNode.showText }, `${taskStatusClass}`]" :class="[{ 'node-config-error': !currentNode.showText }, `${useTaskStatusClass(currentNode?.activityStatus)}`]"
> >
<div class="node-title-container"> <div class="node-title-container">
<div class="node-title-icon start-user" <div class="node-title-icon start-user"
@ -59,8 +59,6 @@ const emits = defineEmits<{
}>() }>()
// //
const currentNode = useWatchNode(props) const currentNode = useWatchNode(props)
//
const taskStatusClass = useTaskStatusClass(currentNode.value?.activityStatus)
// //
const { showInput, blurEvent, clickTitle } = useNodeName2(currentNode, NodeType.START_USER_NODE) const { showInput, blurEvent, clickTitle } = useNodeName2(currentNode, NodeType.START_USER_NODE)

View File

@ -3,7 +3,7 @@
<div class="node-container"> <div class="node-container">
<div <div
class="node-box" class="node-box"
:class="[{ 'node-config-error': !currentNode.showText }, `${taskStatusClass}`]" :class="[{ 'node-config-error': !currentNode.showText }, `${useTaskStatusClass(currentNode?.activityStatus)}`]"
> >
<div class="node-title-container"> <div class="node-title-container">
<div class="node-title-icon user-task"><span class="iconfont icon-approve"></span></div> <div class="node-title-icon user-task"><span class="iconfont icon-approve"></span></div>
@ -69,8 +69,7 @@ const emits = defineEmits<{
const readonly = inject<Boolean>('readonly') const readonly = inject<Boolean>('readonly')
// //
const currentNode = useWatchNode(props) const currentNode = useWatchNode(props)
//
const taskStatusClass = useTaskStatusClass(currentNode.value?.activityStatus)
// //
const { showInput, blurEvent, clickTitle } = useNodeName2(currentNode, NodeType.START_USER_NODE) const { showInput, blurEvent, clickTitle } = useNodeName2(currentNode, NodeType.START_USER_NODE)
const nodeSetting = ref() const nodeSetting = ref()

View File

@ -1096,7 +1096,15 @@
.icon-size { .icon-size {
font-size: 22px; font-size: 22px;
color: #67c23a; &.condition {
color: #67c23a;
}
&.parallel {
color: #626aef;
}
&.inclusive {
color: #345da2;
}
} }
} }