Skip to content

Commit bd0f44e

Browse files
committed
fix: validate required fields in FunctionNodeForm
--bug=1055176 --user=刘瑞斌 【github#2996】函数引用前置节点参数,前置节点删除后,函数参数为空可以发布应用 https://www.tapd.cn/57709429/s/1739785
1 parent 23fcb0e commit bd0f44e

File tree

1 file changed

+10
-1
lines changed
  • ui/src/workflow/nodes/function-lib-node

1 file changed

+10
-1
lines changed

ui/src/workflow/nodes/function-lib-node/index.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ import { ref, computed, onMounted } from 'vue'
9191
import { isLastNode } from '@/workflow/common/data'
9292
import applicationApi from '@/api/application'
9393
import { app } from '@/main'
94+
import {t} from "@/locales";
9495
const props = defineProps<{ nodeModel: any }>()
9596
9697
const nodeCascaderRef = ref()
@@ -119,8 +120,16 @@ const chat_data = computed({
119120
const FunctionNodeFormRef = ref<FormInstance>()
120121
121122
const validate = () => {
123+
for (const item of chat_data.value.input_field_list) {
124+
if (item.source === 'reference' && item.is_required && item.value[0] !== 'global') {
125+
if (props.nodeModel.graphModel.nodes.filter((node: any) => node.id === item.value[0]).length === 0 ) {
126+
item.value = []
127+
return Promise.reject({node: props.nodeModel, errMessage: item.name + t('dynamicsForm.tip.requiredMessage')})
128+
}
129+
}
130+
}
122131
return FunctionNodeFormRef.value?.validate().catch((err) => {
123-
return Promise.reject({ node: props.nodeModel, errMessage: err })
132+
return Promise.reject({node: props.nodeModel, errMessage: err})
124133
})
125134
}
126135

0 commit comments

Comments
 (0)