提交 34810522 authored 作者: wangjiahao's avatar wangjiahao

fix: 快速切换视图时,加载的数据集可能不属于当前视图的问题

上级 9939b439
export function getItemType(dimensionData, quotaData, item) { export function getItemType(dimensionData, quotaData, item) {
// Check whether the current view is in template status
// ( dimensionData and quotaData have no data). If yes, return 'success' directly
if (dimensionData.length === 0 && quotaData.length === 0) {
return 'success'
}
// 将item的字段在数据集维度、指标字段中查询一遍,如果遇到id不存在、字段类型不一致、维度指标不一致,则提示 // 将item的字段在数据集维度、指标字段中查询一遍,如果遇到id不存在、字段类型不一致、维度指标不一致,则提示
const status = item.groupType const status = item.groupType
let checked = false let checked = false
......
...@@ -1472,7 +1472,8 @@ export default { ...@@ -1472,7 +1472,8 @@ export default {
}) })
this.pluginRenderOptions = [...this.renderOptions, ...pluginOptions] this.pluginRenderOptions = [...this.renderOptions, ...pluginOptions]
}, },
emptyTableData() { emptyTableData(id) {
console.log('emptyTableData:' + id)
this.table = {} this.table = {}
this.dimension = [] this.dimension = []
this.quota = [] this.quota = []
...@@ -1500,8 +1501,11 @@ export default { ...@@ -1500,8 +1501,11 @@ export default {
initTableData(id, optType) { initTableData(id, optType) {
if (id != null) { if (id != null) {
post('/dataset/table/getWithPermission/' + id, null).then(response => { post('/dataset/table/getWithPermission/' + id, null).then(response => {
// If click too fast on the panel, the data here may be inconsistent, so make a verification
if (this.view.tableId === id) {
this.table = response.data this.table = response.data
this.initTableField(id, optType) this.initTableField(id, optType)
}
}).catch(err => { }).catch(err => {
this.table = null this.table = null
this.resetDatasetField() this.resetDatasetField()
...@@ -1514,6 +1518,8 @@ export default { ...@@ -1514,6 +1518,8 @@ export default {
initTableField(id, optType) { initTableField(id, optType) {
if (this.table) { if (this.table) {
post('/dataset/table/getFieldsFromDE', this.table).then(response => { post('/dataset/table/getFieldsFromDE', this.table).then(response => {
// If click too fast on the panel, the data here may be inconsistent, so make a verification
if (this.view.tableId === id) {
this.dimension = response.data.dimension this.dimension = response.data.dimension
this.quota = response.data.quota this.quota = response.data.quota
this.dimensionData = JSON.parse(JSON.stringify(this.dimension)) this.dimensionData = JSON.parse(JSON.stringify(this.dimension))
...@@ -1526,6 +1532,7 @@ export default { ...@@ -1526,6 +1532,7 @@ export default {
this.calcData() this.calcData()
}) })
} }
}
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
this.resetView() this.resetView()
...@@ -1911,8 +1918,10 @@ export default { ...@@ -1911,8 +1918,10 @@ export default {
getChart(id, queryFrom = 'panel_edit') { getChart(id, queryFrom = 'panel_edit') {
if (id) { if (id) {
getChartDetails(id, this.panelInfo.id, { queryFrom: queryFrom }).then(response => { getChartDetails(id, this.panelInfo.id, { queryFrom: queryFrom }).then(response => {
// If click too fast on the panel, the data here may be inconsistent, so make a verification
if (response.data.id === this.param.id) {
if (response.data.dataFrom === 'template') { if (response.data.dataFrom === 'template') {
this.emptyTableData() this.emptyTableData(response.data.id)
} else { } else {
this.initTableData(response.data.tableId) this.initTableData(response.data.tableId)
} }
...@@ -1932,6 +1941,7 @@ export default { ...@@ -1932,6 +1941,7 @@ export default {
// 将视图传入echart组件 // 将视图传入echart组件
this.chart = response.data this.chart = response.data
this.data = response.data.data this.data = response.data.data
}
}).catch(err => { }).catch(err => {
this.httpRequest.status = err.response.data.success this.httpRequest.status = err.response.data.success
this.httpRequest.msg = err.response.data.message this.httpRequest.msg = err.response.data.message
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论