lmx 3 dias atrás
pai
commit
d6a708ca5c
1 arquivos alterados com 24 adições e 0 exclusões
  1. 24 0
      src/views/company/companyWorkflow/design.vue

+ 24 - 0
src/views/company/companyWorkflow/design.vue

@@ -1430,6 +1430,12 @@ export default {
     startConnect(e, node, anchor) {
         if (this.readonlyMode) return
 
+        // 结束节点不能作为连线的起点(不允许结束节点有出边)
+        if (this.isEndNodeType(node.nodeType)) {
+          this.$message.warning('结束节点不能作为连线的起点')
+          return
+        }
+
         this.connecting = true
         const anchorPos = this.getAnchorPos(node, anchor)
         this.connectStart = {
@@ -1471,6 +1477,13 @@ export default {
         e.sourceNodeKey === sourceKey && e.targetNodeKey === targetKey)
       if (exists) return
 
+      // 不允许结束节点作为连线的起点(结束节点不能有出边)
+      const sourceNode = this.nodes.find(n => n.nodeKey === sourceKey)
+      if (sourceNode && this.isEndNodeType(sourceNode.nodeType)) {
+        this.$message.warning('结束节点不能作为连线的起点')
+        return
+      }
+
       this.edges.push({
         edgeKey: 'edge_' + Date.now(),
         sourceNodeKey: sourceKey,
@@ -1659,6 +1672,17 @@ export default {
         }
       }
 
+      // 校验除结束节点外,其他节点都必须有出边(只有结束节点才能作为最后一个节点)
+      const sourceNodeKeys = new Set(this.edges.map(e => e.sourceNodeKey))
+      const tailNodes = this.nodes.filter(node =>
+        !this.isEndNodeType(node.nodeType) && !sourceNodeKeys.has(node.nodeKey)
+      )
+      if (tailNodes.length > 0) {
+        const tailNames = tailNodes.map(n => n.nodeName).join('、')
+        this.$message.warning(`以下节点没有出线连接,只有结束节点才能作为最后一个节点:${tailNames}`)
+        return
+      }
+
       // 校验短信节点和外呼节点配置
       for (const node of this.nodes) {
         // 短信节点校验:短信模版必选