|
|
@@ -1,10 +1,6 @@
|
|
|
<template>
|
|
|
<div :class="{ 'ep-node': true, 'ep-node-arrows': !isStart }">
|
|
|
- <div
|
|
|
- :class="{ 'ep-node-content': true, 'ep-node-error': isError }"
|
|
|
- @mouseenter="mouseenter(true)"
|
|
|
- @mouseleave="mouseleave(false)"
|
|
|
- >
|
|
|
+ <div :class="{ 'ep-node-content': true, 'ep-node-error': isError }">
|
|
|
<!-- header -->
|
|
|
<div
|
|
|
class="ep-node-header"
|
|
|
@@ -29,28 +25,6 @@
|
|
|
:node="props.node"
|
|
|
/>
|
|
|
</div>
|
|
|
- <!-- 同级节点左移动 -->
|
|
|
- <div class="ep-node-move ep-node-move-left" v-if="isShowLeftMoveBtn">
|
|
|
- <svg-icon
|
|
|
- icon-class="left"
|
|
|
- class="ep-node-move-icon"
|
|
|
- :color="isSelectedLeftMoveBtn ? '#1e83e9' : '#696969'"
|
|
|
- @click="moveNode(1)"
|
|
|
- @mouseenter="selectedMoveBtn(1, true)"
|
|
|
- @mouseleave="selectedMoveBtn(1, false)"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <!-- 同级节点右移动 -->
|
|
|
- <div class="ep-node-move ep-node-move-right" v-if="isShowRightMoveBtn">
|
|
|
- <svg-icon
|
|
|
- icon-class="right"
|
|
|
- class="ep-node-move-icon"
|
|
|
- :color="isSelectedRightMoveBtn ? '#1e83e9' : '#696969'"
|
|
|
- @click="moveNode(2)"
|
|
|
- @mouseenter="selectedMoveBtn(2, true)"
|
|
|
- @mouseleave="selectedMoveBtn(2, false)"
|
|
|
- />
|
|
|
- </div>
|
|
|
<!-- 校验错误提示 -->
|
|
|
<div class="ep-node-error-msg" v-if="isError">
|
|
|
<div class="ep-node-error-msg-box">
|
|
|
@@ -90,8 +64,8 @@
|
|
|
onUnmounted,
|
|
|
inject
|
|
|
} from 'vue'
|
|
|
- import { nodeConfig } from '../../config/nodeConfig'
|
|
|
- import { getUUID } from '../../utils/tools'
|
|
|
+ import { nodeConfigData } from '../../common/data.ts'
|
|
|
+ import { getUUID } from '../../common/common.util.ts'
|
|
|
import { START, CONDITION } from '../../config/nodeType'
|
|
|
import { KEY_VALIDATOR } from '../../config/keys'
|
|
|
|
|
|
@@ -119,7 +93,7 @@
|
|
|
const tempNodeId = getUUID()
|
|
|
|
|
|
// 节点配置数据
|
|
|
- const config = ref(nodeConfig[props.node.nodeType])
|
|
|
+ const config = ref(nodeConfigData[props.node.nodeType])
|
|
|
|
|
|
// 获取流程验证器实例
|
|
|
const validator = inject(KEY_VALIDATOR)
|
|
|
@@ -129,7 +103,7 @@
|
|
|
watch(
|
|
|
() => props.node,
|
|
|
() => {
|
|
|
- config.value = nodeConfig[props.node.nodeType]
|
|
|
+ config.value = nodeConfigData[props.node.nodeType]
|
|
|
validator.validate()
|
|
|
}
|
|
|
)
|
|
|
@@ -137,19 +111,11 @@
|
|
|
const modules = import.meta.glob('../*/*Node.vue')
|
|
|
const nodeComponents = shallowRef({})
|
|
|
|
|
|
- Object.keys(nodeConfig).forEach((key) => {
|
|
|
- let item = nodeConfig[key]
|
|
|
- // 加载节点组件
|
|
|
+ Object.keys(nodeConfigData).forEach((key) => {
|
|
|
let component = defineAsyncComponent(modules[`../${key}/${key}Node.vue`])
|
|
|
nodeComponents.value[key] = component
|
|
|
})
|
|
|
|
|
|
- // 节点左右移动按钮状态
|
|
|
- const isShowLeftMoveBtn = ref(false)
|
|
|
- const isSelectedLeftMoveBtn = ref(false)
|
|
|
- const isShowRightMoveBtn = ref(false)
|
|
|
- const isSelectedRightMoveBtn = ref(false)
|
|
|
-
|
|
|
onMounted(async () => {})
|
|
|
|
|
|
onUnmounted(async () => {
|
|
|
@@ -210,60 +176,6 @@
|
|
|
const emit = defineEmits(['removeNode'])
|
|
|
const removeNode = () => {
|
|
|
emit('removeNode')
|
|
|
- isShowLeftMoveBtn.value = false
|
|
|
- isShowRightMoveBtn.value = false
|
|
|
- }
|
|
|
-
|
|
|
- // 鼠标移入事件
|
|
|
- const mouseenter = () => {
|
|
|
- showMoveBtn(1, true)
|
|
|
- showMoveBtn(2, true)
|
|
|
- }
|
|
|
-
|
|
|
- // 鼠标移出事件
|
|
|
- const mouseleave = () => {
|
|
|
- showMoveBtn(1, false)
|
|
|
- showMoveBtn(2, false)
|
|
|
- }
|
|
|
-
|
|
|
- // 节点左右移动按钮状态
|
|
|
- const showMoveBtn = (direction, flag) => {
|
|
|
- let index = props.conditionIndex
|
|
|
- let length = props.conditionNodes.length
|
|
|
- if (isCondition() && !isLastCondition()) {
|
|
|
- if (direction == 1 && index != 0) {
|
|
|
- isShowLeftMoveBtn.value = flag
|
|
|
- } else if (direction == 2 && index != length - 2) {
|
|
|
- isShowRightMoveBtn.value = flag
|
|
|
- } else {
|
|
|
- isShowRightMoveBtn.value = false
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- const selectedMoveBtn = (direction, flag) => {
|
|
|
- if (direction == 1) {
|
|
|
- isSelectedLeftMoveBtn.value = flag
|
|
|
- } else {
|
|
|
- isSelectedRightMoveBtn.value = flag
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 移动节点
|
|
|
- * @param direction 方向:1-左移 2-右移
|
|
|
- */
|
|
|
- const moveNode = (direction) => {
|
|
|
- let index = props.conditionIndex
|
|
|
- if (direction == 1) {
|
|
|
- let c = props.conditionNodes[index]
|
|
|
- props.conditionNodes[index] = props.conditionNodes[index - 1]
|
|
|
- props.conditionNodes[index - 1] = c
|
|
|
- } else {
|
|
|
- let c = props.conditionNodes[index]
|
|
|
- props.conditionNodes[index] = props.conditionNodes[index + 1]
|
|
|
- props.conditionNodes[index + 1] = c
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
// 更新节点配置属性
|