Browse Source

feat: 流程创建-自定义输入+表单

luoyali 1 năm trước cách đây
mục cha
commit
321760a2ba
1 tập tin đã thay đổi với 23 bổ sung6 xóa
  1. 23 6
      src/components/scWorkflow/nodes/branch.vue

+ 23 - 6
src/components/scWorkflow/nodes/branch.vue

@@ -93,8 +93,14 @@
 									</div>
 									<div class="condition-content">
 										<div class="condition-content-box">
-											<el-input v-show="false" v-model="condition.label" placeholder="描述" />
-											<el-select v-model="condition.field" filterable placeholder="条件字段" @change="getCurrentItemLabel(conditionGroupIdx, idx)">
+											<el-input v-if="condition.type === 'custom'" v-model="condition.label" placeholder="自定义条件字段" />
+											<el-select
+												v-if="condition.type === 'form'"
+												v-model="condition.field"
+												filterable
+												placeholder="表单条件字段"
+												@change="getCurrentItemLabel(conditionGroupIdx, idx)"
+											>
 												<el-option v-for="{ id, label, key } in expressionFormList" :key="id" :label="label" :value="key" />
 											</el-select>
 											<el-select v-model="condition.operator" placeholder="请选择表达式">
@@ -113,7 +119,17 @@
 								</div>
 							</div>
 							<div class="sub-content">
-								<el-button link type="primary" :icon="Plus" @click="addConditionList(conditionGroup)"> 添加条件 </el-button>
+								<el-button link type="primary" :icon="Plus" @click="addConditionList(conditionGroup, 'custom')"> 添加自定义条件 </el-button>
+								<el-button
+									v-if="expressionFormList.length"
+									link
+									type="primary"
+									:icon="Plus"
+									style="margin-left: 8px"
+									@click="addConditionList(conditionGroup, 'form')"
+								>
+									添加表单条件
+								</el-button>
 							</div>
 						</div>
 					</template>
@@ -237,19 +253,20 @@ export default {
 			})
 			this.$emit('update:modelValue', this.nodeConfig)
 		},
-		addConditionList(conditionList) {
+		addConditionList(conditionList, type) {
 			conditionList.push({
 				label: '',
 				field: '',
 				operator: '==',
-				value: ''
+				value: '',
+				type
 			})
 		},
 		deleteConditionList(conditionList, index) {
 			conditionList.splice(index, 1)
 		},
 		addConditionGroup() {
-			this.addConditionList(this.form.conditionList[this.form.conditionList.push([]) - 1])
+			this.addConditionList(this.form.conditionList[this.form.conditionList.push([]) - 1], 'custom')
 		},
 		deleteConditionGroup(index) {
 			this.form.conditionList.splice(index, 1)