fix(数据集): 关联MySQL数据表时刷新数据错误 #17531

This commit is contained in:
dataeaseShu
2025-12-08 17:21:31 +08:00
committed by dataeaseShu
parent e8fd6c4294
commit 035dd10fc8
3 changed files with 9 additions and 9 deletions

View File

@@ -20,7 +20,7 @@ import { guid } from './util'
import { HandleMore } from '@/components/handle-more'
import { propTypes } from '@/utils/propTypes'
import UnionFieldList from './UnionFieldList.vue'
import type { Node, Field } from './util'
import { type Node, type Field, num } from './util'
import { getTableField } from '@/api/dataset'
import type { SqlNode } from './AddSql.vue'
import { cloneDeep } from 'lodash-es'
@@ -344,12 +344,11 @@ const closeEditUnion = () => {
}
editUnion.value = false
}
let num = +new Date()
const setGuid = (arr, id, datasourceId) => {
arr.forEach(ele => {
if (!ele.id) {
ele.id = `${++num}`
ele.id = `${++num.value}`
ele.datasetTableId = id
ele.datasourceId = datasourceId
}

View File

@@ -51,7 +51,7 @@ import UnionEdit from './UnionEdit.vue'
import type { FormInstance } from 'element-plus-secondary'
import type { BusiTreeNode } from '@/models/tree/TreeNode'
import CreatDsGroup from './CreatDsGroup.vue'
import { guid, getFieldName, timeTypes, type DataSource } from './util'
import { guid, getFieldName, timeTypes, num, type DataSource } from './util'
import { fieldType } from '@/utils/attr'
import { cancelMap } from '@/config/axios/service'
import { useEmbedded } from '@/store/modules/embedded'
@@ -852,14 +852,12 @@ const allfields = ref([])
provide('allfields', allfields)
provide('isCross', isCross)
let num = +new Date()
const expandedD = ref(true)
const expandedQ = ref(true)
const setGuid = (arr, id, datasourceId, oldArr) => {
arr.forEach(ele => {
if (!ele.id) {
ele.id = oldArr.find(itx => itx.originName === ele.originName)?.id || `${++num}`
ele.id = oldArr.find(itx => itx.originName === ele.originName)?.id || `${++num.value}`
ele.datasetTableId = id
ele.datasourceId = datasourceId
}
@@ -969,7 +967,6 @@ const confirmEditUnion = () => {
setGuid(parent.currentDsFields, parent.id, parent.datasourceId, parentOldCurrentDsFields)
const top = cloneDeep(node)
const bottom = cloneDeep(parent)
let arr = []
dfsFieldsTips(arr, datasetDrag.value.getNodeList(), [node.id, parent.id])
arr = [...arr, ...node.currentDsFields, ...parent.currentDsFields]

View File

@@ -1,13 +1,16 @@
import { useI18n } from '@/hooks/web/useI18n'
import SnowflakeId from 'snowflake-id'
const snowflake = new SnowflakeId()
import { ref } from 'vue'
const snowflake = new SnowflakeId()
const { t } = useI18n()
const guid = () => {
return snowflake.generate()
}
const num = ref(+new Date())
const timestampFormatDate = (timestamp, showMs?: boolean) => {
if (!timestamp || timestamp === -1) {
return '-'
@@ -168,5 +171,6 @@ export {
fieldOptions,
guid,
getFieldName,
num,
timeTypes
}