NEZ-1346 fix:选择具体 chart 进行同步,同步后图表未刷新

This commit is contained in:
zhangyu
2021-11-26 15:42:06 +08:00
parent 9b8b5daa7e
commit 81f205a637
3 changed files with 13 additions and 5 deletions

View File

@@ -320,7 +320,7 @@ export default {
dragging: null,
// chartDataCacheGroup:new Map,//图表数据缓存用于查询id:{}
stepHeight: 50,
childrenScrollTop: 0,
tempDom: { height: '', width: '' }
// showShadow:false,
}
@@ -439,6 +439,7 @@ export default {
this.cleanData()
// 内含 panelId,开始时间,结束时间
this.filter = filter
this.childrenScrollTop = 0
this.pagePanelId = this.filter.panelId
this.getData(this.filter)
},
@@ -541,10 +542,11 @@ export default {
// this.getChartData(item, index, this.filter)
this.setChartSize(item, index)
const chartBox = document.getElementById('chart-' + item.id)// this.$refs['editChart'+item.id][0];
this.handleElementInViewport(chartBox, 0, item, index, true)
this.handleElementInViewport(chartBox, this.childrenScrollTop, item, index, true)
})
},
loadChartData (scrollTop) {
this.childrenScrollTop = scrollTop
if (this.dataList.length > 0) {
this.dataList.forEach((item, index) => {
this.setChartSize(item, index)

View File

@@ -349,7 +349,8 @@ export default {
// chartDataCacheGroup:new Map,//图表数据缓存用于查询id:{}
stepWidth: null,
tempDom: { height: '', width: '' }
tempDom: { height: '', width: '' },
childrenScrollTop: 0
// showShadow:false,
}
},
@@ -508,6 +509,7 @@ export default {
this.cleanData()
// 内含 panelId,开始时间,结束时间
this.filter = filter
this.childrenScrollTop = 0
this.pagePanelId = this.filter.panelId
this.getData(this.filter)
},
@@ -766,7 +768,7 @@ export default {
if (!item.isLoaded) {
// 获得当前显示在浏览器的图表,从后台获取数据
const chartBox = document.getElementById('chart-' + item.id)
this.handleElementInViewport(chartBox, 0, item, index)
this.handleElementInViewport(chartBox, this.childrenScrollTop, item, index)
}
if (item.type === 'group') {
this.$refs['editChart' + item.id][0].$refs.listGroup.getData(params)
@@ -778,6 +780,7 @@ export default {
})
},
loadChartData (scrollTop) {
this.childrenScrollTop = scrollTop
if (this.dataList.length > 0) {
this.dataList.forEach((item, index) => {
if (!item.isLoaded) {
@@ -1898,6 +1901,9 @@ export default {
this.$post('visual/panel/chart/syncTmpl', { ids: [item.id] }).then(res => {
if (res.code === 200) {
this.getData(this.filter)
// setTimeout(() => {
// this.refreshChart(item.id)
// }, 100)
this.$message.success(this.$t('tip.syncSuccess'))
} else {
this.$message.error(res.msg)

View File

@@ -96,7 +96,7 @@ export default {
})
}
if (this.detailType === 'view') {
this.$refs.dataDetail.$refs.dataTable.scrollTop = 0
this.$refs.dataDetail && (this.$refs.dataDetail.$refs.dataTable.scrollTop = 0)
}
}
})