fix:修改 block 刷新无效的问题

This commit is contained in:
zhangyu
2022-01-26 18:34:38 +08:00
parent a8e0bc1795
commit b5a7ed482b
4 changed files with 24 additions and 16 deletions

View File

@@ -165,13 +165,15 @@ export default {
},
methods: {
/* 参数 extraParams 额外请求参数isRefresh 是否是刷新 */
getChartData (url, extraParams = {}, isRefresh) {
getChartData (url, extraParams = {}, isRefresh, chartTimeFilter) {
const vm = this
this.loading = true
this.standaloneTimeRange.use = !!isRefresh
try {
// 单个图表刷新时,使用单独的时间
if (this.standaloneTimeRange.use) {
if (chartTimeFilter) {
this.queryTimeRange = { startTime: getSecond(chartTimeFilter.startTime), endTime: getSecond(chartTimeFilter.endTime) }
} else if (this.standaloneTimeRange.use) {
this.queryTimeRange = { startTime: getSecond(this.standaloneTimeRange.startTime), endTime: getSecond(this.standaloneTimeRange.endTime) }
} else if (this.timeFilter) {
this.queryTimeRange = { startTime: getSecond(this.timeFilter.startTime), endTime: getSecond(this.timeFilter.endTime) }
@@ -227,6 +229,12 @@ export default {
})
} else if (this.chartInfo.type === 94) {
this.chartInfo.children = [...this.chartInfo.children]
} else if (this.chartInfo.type === 95) {
if (!this.chartInfo.firstShow) {
this.chartInfo.firstShow = true
} else {
this.$refs.chart.$refs.chart.reload()
}
}
} catch (e) {
console.error(e)
@@ -253,14 +261,14 @@ export default {
resize () {
this.$refs.chart.resize()
},
refresh () {
refresh (chartTimeFilter) {
const myEndTime = window.$dayJs.tz().valueOf()
const myStartTime = myEndTime - this.chartTimeFilter.dateRangeValue * 60 * 1000
this.standaloneTimeRange.use = true
this.standaloneTimeRange.startTime = myStartTime
this.standaloneTimeRange.endTime = myEndTime
this.emitter.emit('chart-pageNo')
this.getChartData(null, {}, true)
this.getChartData(null, {}, true, chartTimeFilter)
},
showFullscreen (show) {
this.$emit('showFullscreen', show, this.chartInfo)