|
@@ -51,7 +51,7 @@
|
|
|
<el-form-item v-if="form.delayType === '1'">
|
|
|
<el-input v-model="fixedDuration" style="max-width: 300px" type="number" min="0" class="input-with-select">
|
|
|
<template #append>
|
|
|
- <el-select v-model="fixedDurationType" style="width: 115px" @change="getLabelValue">
|
|
|
+ <el-select v-model="fixedDurationType" style="width: 115px">
|
|
|
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
|
|
</el-select>
|
|
|
</template> </el-input
|
|
@@ -77,6 +77,11 @@
|
|
|
<script>
|
|
|
import addNode from './addNode'
|
|
|
import { delayProcessSelfOptions } from './config'
|
|
|
+const mapTip = {
|
|
|
+ d: '天',
|
|
|
+ h: '小时',
|
|
|
+ m: '分钟'
|
|
|
+}
|
|
|
export default {
|
|
|
components: {
|
|
|
addNode
|
|
@@ -91,6 +96,15 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ nodeConfig: {},
|
|
|
+ drawer: false,
|
|
|
+ isEditTitle: false,
|
|
|
+ form: {},
|
|
|
+ options: [
|
|
|
+ { label: '天', value: 'd' },
|
|
|
+ { label: '小时', value: 'h' },
|
|
|
+ { label: '分钟', value: 'm' }
|
|
|
+ ],
|
|
|
// 固定时长 start
|
|
|
fixedDuration: 0,
|
|
|
fixedDurationType: 'm',
|
|
@@ -100,16 +114,7 @@ export default {
|
|
|
// 自动计算 start
|
|
|
automaticComputed: '',
|
|
|
// 自动计算 end
|
|
|
- delayProcessSelfOptions,
|
|
|
- nodeConfig: {},
|
|
|
- drawer: false,
|
|
|
- isEditTitle: false,
|
|
|
- form: {},
|
|
|
- options: [
|
|
|
- { label: '天', value: 'd' },
|
|
|
- { label: '小时', value: 'h' },
|
|
|
- { label: '分钟', value: 'm' }
|
|
|
- ]
|
|
|
+ delayProcessSelfOptions
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
@@ -119,35 +124,21 @@ export default {
|
|
|
},
|
|
|
mounted() {
|
|
|
this.nodeConfig = this.modelValue
|
|
|
+ const extendConfig = this.nodeConfig.extendConfig.time.split(':')
|
|
|
+ if (this.nodeConfig.delayType === '1') {
|
|
|
+ this.fixedDuration = extendConfig[0]
|
|
|
+ this.fixedDurationType = extendConfig[1]
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.form.delayType === '2') {
|
|
|
+ this.automaticComputed = this.nodeConfig.extendConfig.time
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
- getLabelValue() {
|
|
|
- // 通过遍历options数组,找到与selectedValue相等的那个对象
|
|
|
- const findItem = this.options.find(item => item.value === this.fixedDurationType)
|
|
|
- // 如果找到了对应的对象,就把它的label值赋给selectedLabel
|
|
|
- if (findItem) {
|
|
|
- this.selectedLabel = findItem.label
|
|
|
- } else {
|
|
|
- this.selectedLabel = ''
|
|
|
- }
|
|
|
- },
|
|
|
show() {
|
|
|
if (this.disabled) return
|
|
|
this.form = {}
|
|
|
this.form = JSON.parse(JSON.stringify(this.nodeConfig))
|
|
|
- console.log(this.form)
|
|
|
- // automaticComputed: '', // 自动计算
|
|
|
- // fixedDuration: 0, // 固定时长
|
|
|
- // fixedDurationType: '3' // 固定时长
|
|
|
- const extendConfig = this.nodeConfig.extendConfig.time.split(':')
|
|
|
- if (extendConfig.length === 2) {
|
|
|
- this.fixedDuration = extendConfig[0]
|
|
|
- this.fixedDurationType = extendConfig[1]
|
|
|
- }
|
|
|
-
|
|
|
- if (extendConfig.length === 3) {
|
|
|
- this.automaticComputed = this.nodeConfig.extendConfig.time
|
|
|
- }
|
|
|
this.drawer = true
|
|
|
},
|
|
|
editTitle(refName) {
|
|
@@ -174,8 +165,9 @@ export default {
|
|
|
},
|
|
|
toText(nodeConfig) {
|
|
|
if (nodeConfig.delayType === '1') {
|
|
|
- return `等待${this.fixedDuration}${this.selectedLabel}`
|
|
|
+ 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
|