Переглянути джерело

feat: 触发器 联调完毕100%

luoyali 1 рік тому
батько
коміт
9be6350ece
1 змінених файлів з 26 додано та 18 видалено
  1. 26 18
      src/components/scWorkflow/nodes/trigger.vue

+ 26 - 18
src/components/scWorkflow/nodes/trigger.vue

@@ -41,7 +41,7 @@
 			</template>
 			<el-container>
 				<el-main>
-					<el-radio-group v-model="form.triggerType" style="margin-bottom: 15px;">
+					<el-radio-group v-model="form.triggerType" style="margin-bottom: 15px">
 						<el-radio value="1">立即执行</el-radio>
 						<el-radio value="2">延迟执行</el-radio>
 					</el-radio-group>
@@ -130,7 +130,7 @@ export default {
 			// 自动计算 start
 			automaticComputed: '',
 			// 自动计算 end
-			delayProcessSelfOptions,
+			delayProcessSelfOptions
 		}
 	},
 	watch: {
@@ -140,13 +140,14 @@ export default {
 	},
 	mounted() {
 		this.nodeConfig = this.modelValue
-		const extendConfig = this.nodeConfig.extendConfig.time.split(':')
-		if (this.nodeConfig.delayType === '1') {
+		const { delayType, triggerType } = this.nodeConfig
+		if (triggerType === '1') return
+		const extendConfig = this.nodeConfig?.extendConfig?.time.split(':')
+		if (delayType === '1') {
 			this.fixedDuration = extendConfig[0]
 			this.fixedDurationType = extendConfig[1]
 		}
-
-		if (this.form.delayType === '2') {
+		if (delayType === '2') {
 			this.automaticComputed = this.nodeConfig.extendConfig.time
 		}
 	},
@@ -170,9 +171,12 @@ export default {
 			this.isEditTitle = false
 		},
 		save() {
-			this.form.extendConfig = {
-				time: this.form.delayType === '1' ? `${this.fixedDuration}:${this.fixedDurationType}` : `${this.automaticComputed}`
-			}
+			this.form.extendConfig.time =
+				this.form.triggerType === '2'
+					? this.form.delayType === '1'
+						? `${this.fixedDuration}:${this.fixedDurationType}`
+						: `${this.automaticComputed}`
+					: ''
 			this.$emit('update:modelValue', this.form)
 			this.drawer = false
 		},
@@ -180,15 +184,19 @@ export default {
 			this.$emit('update:modelValue', this.nodeConfig.childNode)
 		},
 		toText(nodeConfig) {
-			return false
-			// if (nodeConfig.delayType === '1') {
-			// 	return `等待${this.fixedDuration}${mapTip[this.fixedDurationType]}`
-			// } else if (nodeConfig.delayType === '2') {
-			// 	this.automaticComputed = this.nodeConfig.extendConfig.time
-			// 	return !this.automaticComputed ? `至当天` : `至当天${this.automaticComputed}`
-			// } else {
-			// 	return false
-			// }
+			const { triggerType, delayType } = nodeConfig
+			if (triggerType === '1') {
+				return `立即执行`
+			} else if (triggerType === '2') {
+				if (delayType === '1') {
+					return `延迟执行,等待${this.fixedDuration}${mapTip[this.fixedDurationType]}`
+				} else if (delayType === '2') {
+					const tip = `延迟执行,至当天`
+					return !this.automaticComputed ? tip : `${tip}${this.automaticComputed}`
+				}
+			} else {
+				return false
+			}
 		}
 	}
 }