mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 19:42:56 +08:00
fix(数据集): 修复MySQL 和 SQL Server 数据库的表跨源关联后,MySQL 数据表的字段重复显示,SQL Server 数据表的字段缺少的问题
This commit is contained in:
parent
8818b50959
commit
25f66408b4
@ -701,10 +701,10 @@ let num = +new Date()
|
|||||||
|
|
||||||
const expandedD = ref(true)
|
const expandedD = ref(true)
|
||||||
const expandedQ = ref(true)
|
const expandedQ = ref(true)
|
||||||
const setGuid = (arr, id, datasourceId) => {
|
const setGuid = (arr, id, datasourceId, oldArr) => {
|
||||||
arr.forEach(ele => {
|
arr.forEach(ele => {
|
||||||
if (!ele.id) {
|
if (!ele.id) {
|
||||||
ele.id = `${++num}`
|
ele.id = oldArr.find(itx => itx.originName === ele.originName)?.id || `${++num}`
|
||||||
ele.datasetTableId = id
|
ele.datasetTableId = id
|
||||||
ele.datasourceId = datasourceId
|
ele.datasourceId = datasourceId
|
||||||
}
|
}
|
||||||
@ -756,6 +756,17 @@ const setFieldAll = () => {
|
|||||||
tabChange('manage')
|
tabChange('manage')
|
||||||
fieldUnion.value?.clearState()
|
fieldUnion.value?.clearState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dfsNode = (arr, id) => {
|
||||||
|
return arr.reduce((pre, next) => {
|
||||||
|
if (next.id === id) {
|
||||||
|
pre = [...next.currentDsFields]
|
||||||
|
} else if (next.children?.length) {
|
||||||
|
pre = dfsNode(next.children, id)
|
||||||
|
}
|
||||||
|
return pre
|
||||||
|
}, [])
|
||||||
|
}
|
||||||
const confirmEditUnion = () => {
|
const confirmEditUnion = () => {
|
||||||
const { node, parent } = fieldUnion.value
|
const { node, parent } = fieldUnion.value
|
||||||
const to = node.id
|
const to = node.id
|
||||||
@ -770,8 +781,11 @@ const confirmEditUnion = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
setGuid(node.currentDsFields, node.id, node.datasourceId)
|
const nodeOldCurrentDsFields = dfsNode(datasetDrag.value.getNodeList(), to)
|
||||||
setGuid(parent.currentDsFields, parent.id, parent.datasourceId)
|
const parentOldCurrentDsFields = dfsNode(datasetDrag.value.getNodeList(), from)
|
||||||
|
|
||||||
|
setGuid(node.currentDsFields, node.id, node.datasourceId, nodeOldCurrentDsFields)
|
||||||
|
setGuid(parent.currentDsFields, parent.id, parent.datasourceId, parentOldCurrentDsFields)
|
||||||
const top = cloneDeep(node)
|
const top = cloneDeep(node)
|
||||||
const bottom = cloneDeep(parent)
|
const bottom = cloneDeep(parent)
|
||||||
datasetDrag.value.setStateBack(top, bottom)
|
datasetDrag.value.setStateBack(top, bottom)
|
||||||
|
Loading…
Reference in New Issue
Block a user