|
@@ -161,9 +161,7 @@
|
|
|
<script>
|
|
|
import addNode from './addNode.vue'
|
|
|
import { operatorType } from './config'
|
|
|
-import useFlowStore from '@/store/modules/flow'
|
|
|
import { Delete, Plus, ArrowLeft, Close, ArrowRight, Edit } from '@element-plus/icons-vue'
|
|
|
-import { mapState } from 'pinia'
|
|
|
import { getNodeKey } from '@/utils/workflow'
|
|
|
import { ElMessage } from 'element-plus'
|
|
|
import { $log } from '@/utils'
|
|
@@ -172,6 +170,7 @@ export default {
|
|
|
components: {
|
|
|
addNode
|
|
|
},
|
|
|
+ inject: ['getProcessForm'],
|
|
|
props: {
|
|
|
modelValue: { type: Object, default: () => {} },
|
|
|
disabled: {
|
|
@@ -191,29 +190,26 @@ export default {
|
|
|
local_formStructure: {}
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- ...mapState(useFlowStore, ['processForm']) //映射函数,取出processForm
|
|
|
- },
|
|
|
watch: {
|
|
|
modelValue() {
|
|
|
this.nodeConfig = this.modelValue
|
|
|
- },
|
|
|
- processForm: {
|
|
|
- handler(processForm) {
|
|
|
- // console.error(processForm, 'processForm change...', typeof processForm)
|
|
|
- const { formStructure } = JSON.parse(processForm) // 表单设计字段
|
|
|
- this.local_formStructure = formStructure
|
|
|
- // 使用 filter 方法找到 required 属性为 true 的对象
|
|
|
- this.expressionFormList = (formStructure?.fields || []).filter(item => item.options && item.options.required === true)
|
|
|
- $log(this.expressionFormList, '这里打印出符合条件的表单对象')
|
|
|
- },
|
|
|
- immediate: true
|
|
|
+ this.getExpressionFormList()
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
this.nodeConfig = this.modelValue
|
|
|
+ this.getExpressionFormList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ getExpressionFormList() {
|
|
|
+ // const { formStructure } = JSON.parse(processForm) // 表单设计字段
|
|
|
+ const { formStructure } = this.getProcessForm() // 表单设计字段
|
|
|
+ this.local_formStructure = formStructure
|
|
|
+ // 使用 filter 方法找到 required 属性为 true 的对象
|
|
|
+ this.expressionFormList = (formStructure?.fields || []).filter(item => item.options && item.options.required === true)
|
|
|
+ // console.error(formStructure, 'formStructure')
|
|
|
+ // $log(this.expressionFormList, '这里打印出符合条件的表单对象')
|
|
|
+ },
|
|
|
show(index) {
|
|
|
if (this.disabled) return
|
|
|
if (index === this.nodeConfig.conditionNodes.length - 1) {
|
|
@@ -336,6 +332,7 @@ export default {
|
|
|
const currentCondition = this.form.conditionList[conditionIdx]
|
|
|
const field = currentCondition[idx].field
|
|
|
const labelObj = this.expressionFormList.find(i => i.key === field)
|
|
|
+ // console.error(labelObj, 'labelObj getCurrentItemLabel')
|
|
|
currentCondition[idx].showLabel = labelObj.label
|
|
|
currentCondition[idx].label = field
|
|
|
},
|