瀏覽代碼

feat: 替换属性值 parallelNodes

luoyali 11 月之前
父節點
當前提交
ddb9c5cd1f
共有 2 個文件被更改,包括 20 次插入20 次删除
  1. 1 1
      src/components/scWorkflow/nodes/addNode.vue
  2. 19 19
      src/components/scWorkflow/nodes/parallelBranch.vue

+ 1 - 1
src/components/scWorkflow/nodes/addNode.vue

@@ -156,7 +156,7 @@ export default {
 					nodeName: '并行路由',
 					nodeKey: _key,
 					type: 8,
-					conditionNodes: [
+					parallelNodes: [
 						{
 							nodeName: '分支1',
 							nodeKey: _key + 1,

+ 19 - 19
src/components/scWorkflow/nodes/parallelBranch.vue

@@ -3,7 +3,7 @@
 		<div class="branch-box-wrap">
 			<div class="branch-box" style="margin-bottom: 15px">
 				<el-button class="add-branch" color="#626aef" plain round @click="addTerm"> 添加分支 </el-button>
-				<div v-for="(item, index) in nodeConfig.conditionNodes" :key="index" class="col-box">
+				<div v-for="(item, index) in nodeConfig.parallelNodes" :key="index" class="col-box">
 					<div class="condition-node">
 						<div class="condition-node-box">
 							<div class="auto-judge" @click="show(index)">
@@ -24,7 +24,7 @@
 								<div class="content">
 									<span class="placeholder"> 并行任务(同时进行) </span>
 								</div>
-								<div v-if="index != nodeConfig.conditionNodes.length - 1" class="sort-right" @click.stop="arrTransfer(index)">
+								<div v-if="index != nodeConfig.parallelNodes.length - 1" class="sort-right" @click.stop="arrTransfer(index)">
 									<el-icon><ArrowRight /></el-icon>
 								</div>
 							</div>
@@ -34,8 +34,8 @@
 					<slot v-if="item.childNode" :node="item"></slot>
 					<div v-if="index == 0" class="top-left-cover-line"></div>
 					<div v-if="index == 0" class="bottom-left-cover-line"></div>
-					<div v-if="index == nodeConfig.conditionNodes.length - 1" class="top-right-cover-line"></div>
-					<div v-if="index == nodeConfig.conditionNodes.length - 1" class="bottom-right-cover-line"></div>
+					<div v-if="index == nodeConfig.parallelNodes.length - 1" class="top-right-cover-line"></div>
+					<div v-if="index == nodeConfig.parallelNodes.length - 1" class="bottom-right-cover-line"></div>
 				</div>
 				<div
 					style="
@@ -105,7 +105,7 @@ export default {
 		show(index) {
 			this.index = index
 			this.form = {}
-			this.form = JSON.parse(JSON.stringify(this.nodeConfig.conditionNodes[index]))
+			this.form = JSON.parse(JSON.stringify(this.nodeConfig.parallelNodes[index]))
 			this.drawer = true
 		},
 		editTitle() {
@@ -118,13 +118,13 @@ export default {
 			this.isEditTitle = false
 		},
 		save() {
-			this.nodeConfig.conditionNodes[this.index] = this.form
+			this.nodeConfig.parallelNodes[this.index] = this.form
 			this.$emit('update:modelValue', this.nodeConfig)
 			this.drawer = false
 		},
 		addTerm() {
-			let len = this.nodeConfig.conditionNodes.length + 1
-			this.nodeConfig.conditionNodes.push({
+			let len = this.nodeConfig.parallelNodes.length + 1
+			this.nodeConfig.parallelNodes.push({
 				nodeName: '分支' + len,
 				type: 3,
 				nodeKey: getNodeKey(),
@@ -134,29 +134,29 @@ export default {
 			})
 		},
 		delTerm(index) {
-			this.nodeConfig.conditionNodes.splice(index, 1)
-			if (this.nodeConfig.conditionNodes.length == 1) {
+			this.nodeConfig.parallelNodes.splice(index, 1)
+			if (this.nodeConfig.parallelNodes.length == 1) {
 				if (this.nodeConfig.childNode) {
-					if (this.nodeConfig.conditionNodes[0].childNode) {
-						this.reData(this.nodeConfig.conditionNodes[0].childNode, this.nodeConfig.childNode)
+					if (this.nodeConfig.parallelNodes[0].childNode) {
+						this.reData(this.nodeConfig.parallelNodes[0].childNode, this.nodeConfig.childNode)
 					} else {
-						this.nodeConfig.conditionNodes[0].childNode = this.nodeConfig.childNode
+						this.nodeConfig.parallelNodes[0].childNode = this.nodeConfig.childNode
 					}
 				}
-				this.$emit('update:modelValue', this.nodeConfig.conditionNodes[0].childNode)
+				this.$emit('update:modelValue', this.nodeConfig.parallelNodes[0].childNode)
 			}
 		},
 		// 复制分支
 		copyTerm(index) {
-			let len = this.nodeConfig.conditionNodes.length + 1
-			const currentNode = this.nodeConfig.conditionNodes[index]
+			let len = this.nodeConfig.parallelNodes.length + 1
+			const currentNode = this.nodeConfig.parallelNodes[index]
 			const item = {
 				...currentNode,
 				nodeKey: getNodeKey(),
 				nodeName: currentNode.nodeName + '-Copy',
 				priorityLevel: len
 			}
-			this.nodeConfig.conditionNodes.push(item)
+			this.nodeConfig.parallelNodes.push(item)
 			this.$emit('update:modelValue', this.nodeConfig)
 		},
 		reData(data, addData) {
@@ -167,8 +167,8 @@ export default {
 			}
 		},
 		arrTransfer(index, type = 1) {
-			this.nodeConfig.conditionNodes[index] = this.nodeConfig.conditionNodes.splice(index + type, 1, this.nodeConfig.conditionNodes[index])[0]
-			this.nodeConfig.conditionNodes.map((item, index) => {
+			this.nodeConfig.parallelNodes[index] = this.nodeConfig.parallelNodes.splice(index + type, 1, this.nodeConfig.parallelNodes[index])[0]
+			this.nodeConfig.parallelNodes.map((item, index) => {
 				item.priorityLevel = index + 1
 			})
 			this.$emit('update:modelValue', this.nodeConfig)