fix(数据集): 当编辑数据集时,修改了数据集内容后,那么自动弹出右侧的字段列表

This commit is contained in:
dataeaseShu 2024-03-25 16:41:17 +08:00
parent 463921c84d
commit 30979ec868
2 changed files with 51 additions and 15 deletions

View File

@ -1107,7 +1107,7 @@ export default {
select_year: '选择年',
sql_variable_limit_1: '1SQL 变量只能在 WHERE 条件中使用',
sql_variable_limit_2:
"2、示例select * from table_name where column_name1='${'{'}param_name1{'}'}' and column_name2 in (${'{'}param_name2{'}'})",
"2、示例:select * from table_name where column_name1='${'{'}param_name1{'}'}' and column_name2 in (${'{'}param_name2{'}'})",
select_month: '选择月',
select_date: '选择日期',
select_time: '选择时间',

View File

@ -163,14 +163,24 @@ const saveSqlNode = (val: SqlNode, cb) => {
info: state.visualNode.info,
tableName,
type: 'sql'
}).then(res => {
;((res as unknown as Field[]) || []).forEach(ele => {
ele.checked = true
})
state.nodeList[0].currentDsFields = cloneDeep(res)
cb?.()
confirmEditUnion()
})
.then(res => {
const idOriginNameMap = allfields.value.reduce((pre, next) => {
pre[`${next.datasetTableId}${next.originName}`] = next.id
return pre
}, {})
nodeField.value = res as unknown as Field[]
nodeField.value.forEach(ele => {
ele.id = idOriginNameMap[`${id}${ele.originName}`]
ele.checked = true
})
state.nodeList[0].currentDsFields = cloneDeep(res)
cb?.()
confirmEditUnion()
})
.finally(() => {
editUnion.value = true
})
confirm()
}
return
@ -212,6 +222,12 @@ const changeNodeFields = val => {
}
const closeEditUnion = () => {
const [fir] = state.nodeList
if (fir.isShadow) {
delete fir.isShadow
state.nodeList = []
emits('addComplete')
}
editUnion.value = false
}
let num = +new Date()
@ -242,6 +258,10 @@ const delUpdateDsFields = (id, arr: Node[]) => {
const confirmEditUnion = () => {
delUpdateDsFields(currentNode.value.id, state.nodeList)
const [fir] = state.nodeList
if (fir.isShadow) {
delete fir.isShadow
}
closeEditUnion()
nextTick(() => {
emits('updateAllfields')
@ -675,6 +695,7 @@ const drop_handler = ev => {
state.nodeList.push({
tableName,
type,
isShadow: true,
datasourceId,
id: guid(),
...extraData
@ -688,13 +709,22 @@ const drop_handler = ev => {
info: currentNode.value.info,
tableName,
type
}).then(res => {
;((res as unknown as Field[]) || []).forEach(ele => {
ele.checked = true
})
state.nodeList[0].currentDsFields = cloneDeep(res)
confirmEditUnion()
})
.then(res => {
const idOriginNameMap = allfields.value.reduce((pre, next) => {
pre[`${next.datasetTableId}${next.originName}`] = next.id
return pre
}, {})
nodeField.value = res as unknown as Field[]
nodeField.value.forEach(ele => {
ele.id = idOriginNameMap[`${currentNode.value.id}${ele.originName}`]
ele.checked = true
})
state.nodeList[0].currentDsFields = cloneDeep(res)
})
.finally(() => {
editUnion.value = true
})
nextTick(() => {
emits('addComplete')
})
@ -945,7 +975,13 @@ const emits = defineEmits(['addComplete', 'joinEditor', 'updateAllfields'])
</span>
</template>
</el-dialog>
<el-drawer v-model="editUnion" custom-class="union-item-drawer" size="600px" direction="rtl">
<el-drawer
:before-close="closeEditUnion"
v-model="editUnion"
custom-class="union-item-drawer"
size="600px"
direction="rtl"
>
<template #header v-if="currentNode">
<div class="info">
<span class="name">{{ currentNode.tableName }}</span>