fix: 及时更新流程图里的变量

This commit is contained in:
CaptainB 2024-09-14 15:46:35 +08:00 committed by 刘瑞斌
parent 61cf6a8fdd
commit 3499332b74
2 changed files with 11 additions and 1 deletions

View File

@ -412,6 +412,7 @@ function openAddDialog(data?: any, index?: any) {
function deleteField(index: any) { function deleteField(index: any) {
inputFieldList.value.splice(index, 1) inputFieldList.value.splice(index, 1)
props.nodeModel.graphModel.eventCenter.emit('refreshFieldList', inputFieldList.value)
} }
function refreshFieldList(data: any) { function refreshFieldList(data: any) {
@ -428,6 +429,7 @@ function refreshFieldList(data: any) {
} }
currentIndex.value = null currentIndex.value = null
FieldFormDialogRef.value.close() FieldFormDialogRef.value.close()
props.nodeModel.graphModel.eventCenter.emit('refreshFieldList', inputFieldList.value)
} }
onMounted(() => { onMounted(() => {

View File

@ -41,7 +41,7 @@ const showicon = ref(false)
const inputFieldList = ref<any[]>([]) const inputFieldList = ref<any[]>([])
onMounted(() => { function handleRefreshFieldList(data: any[]) {
props.nodeModel.graphModel.nodes props.nodeModel.graphModel.nodes
.filter((v: any) => v.id === 'base-node') .filter((v: any) => v.id === 'base-node')
.map((v: any) => { .map((v: any) => {
@ -56,6 +56,14 @@ onMounted(() => {
] ]
inputFieldList.value = v.properties.input_field_list inputFieldList.value = v.properties.input_field_list
}) })
}
props.nodeModel.graphModel.eventCenter.on('refreshFieldList', (data: any) => {
handleRefreshFieldList(data)
})
onMounted(() => {
handleRefreshFieldList([])
}) })
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>