fix:修改 block 刷新无效的问题
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
<chart-block
|
<chart-block
|
||||||
v-else-if="isBlock"
|
v-else-if="isBlock"
|
||||||
ref="chart"
|
ref="chart"
|
||||||
|
:timeFilter="queryParams"
|
||||||
:chart-info="chartInfo"
|
:chart-info="chartInfo"
|
||||||
:chart-data="chartData"
|
:chart-data="chartData"
|
||||||
:entity="entity"
|
:entity="entity"
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
|
|
||||||
<chart-group
|
<chart-group
|
||||||
v-else-if="isGroup"
|
v-else-if="isGroup"
|
||||||
|
:timeFilter="queryParams"
|
||||||
:chart-info="chartInfo"
|
:chart-info="chartInfo"
|
||||||
:chart-data="chartData"
|
:chart-data="chartData"
|
||||||
:entity="entity"
|
:entity="entity"
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ export default {
|
|||||||
},
|
},
|
||||||
dateTimeRangeChange (s, e, v) {
|
dateTimeRangeChange (s, e, v) {
|
||||||
this.chartTimeFilter = { startTime: s, endTime: e, dateRangeValue: v }
|
this.chartTimeFilter = { startTime: s, endTime: e, dateRangeValue: v }
|
||||||
|
this.$emit('refresh', this.chartTimeFilter)
|
||||||
},
|
},
|
||||||
tableLimitChange () {
|
tableLimitChange () {
|
||||||
this.$emit('tableChange')
|
this.$emit('tableChange')
|
||||||
|
|||||||
@@ -165,13 +165,15 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/* 参数 extraParams 额外请求参数,isRefresh 是否是刷新 */
|
/* 参数 extraParams 额外请求参数,isRefresh 是否是刷新 */
|
||||||
getChartData (url, extraParams = {}, isRefresh) {
|
getChartData (url, extraParams = {}, isRefresh, chartTimeFilter) {
|
||||||
const vm = this
|
const vm = this
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.standaloneTimeRange.use = !!isRefresh
|
this.standaloneTimeRange.use = !!isRefresh
|
||||||
try {
|
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) }
|
this.queryTimeRange = { startTime: getSecond(this.standaloneTimeRange.startTime), endTime: getSecond(this.standaloneTimeRange.endTime) }
|
||||||
} else if (this.timeFilter) {
|
} else if (this.timeFilter) {
|
||||||
this.queryTimeRange = { startTime: getSecond(this.timeFilter.startTime), endTime: getSecond(this.timeFilter.endTime) }
|
this.queryTimeRange = { startTime: getSecond(this.timeFilter.startTime), endTime: getSecond(this.timeFilter.endTime) }
|
||||||
@@ -227,6 +229,12 @@ export default {
|
|||||||
})
|
})
|
||||||
} else if (this.chartInfo.type === 94) {
|
} else if (this.chartInfo.type === 94) {
|
||||||
this.chartInfo.children = [...this.chartInfo.children]
|
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) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
@@ -253,14 +261,14 @@ export default {
|
|||||||
resize () {
|
resize () {
|
||||||
this.$refs.chart.resize()
|
this.$refs.chart.resize()
|
||||||
},
|
},
|
||||||
refresh () {
|
refresh (chartTimeFilter) {
|
||||||
const myEndTime = window.$dayJs.tz().valueOf()
|
const myEndTime = window.$dayJs.tz().valueOf()
|
||||||
const myStartTime = myEndTime - this.chartTimeFilter.dateRangeValue * 60 * 1000
|
const myStartTime = myEndTime - this.chartTimeFilter.dateRangeValue * 60 * 1000
|
||||||
this.standaloneTimeRange.use = true
|
this.standaloneTimeRange.use = true
|
||||||
this.standaloneTimeRange.startTime = myStartTime
|
this.standaloneTimeRange.startTime = myStartTime
|
||||||
this.standaloneTimeRange.endTime = myEndTime
|
this.standaloneTimeRange.endTime = myEndTime
|
||||||
this.emitter.emit('chart-pageNo')
|
this.emitter.emit('chart-pageNo')
|
||||||
this.getChartData(null, {}, true)
|
this.getChartData(null, {}, true, chartTimeFilter)
|
||||||
},
|
},
|
||||||
showFullscreen (show) {
|
showFullscreen (show) {
|
||||||
this.$emit('showFullscreen', show, this.chartInfo)
|
this.$emit('showFullscreen', show, this.chartInfo)
|
||||||
|
|||||||
@@ -20,24 +20,21 @@ export default {
|
|||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
dataList: [],
|
dataList: [],
|
||||||
|
time: {},
|
||||||
firstShow: false
|
firstShow: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
|
||||||
// 'chartInfo.children': {
|
|
||||||
// immediate: true,
|
|
||||||
// deep: true,
|
|
||||||
// handle (n) {
|
|
||||||
// if (!this.firstShow) {
|
|
||||||
// this.dataList = JSON.parse(JSON.stringify(this.chartInfo.children))
|
|
||||||
// this.firstShow = true
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
mounted () {
|
mounted () {
|
||||||
this.dataList = JSON.parse(JSON.stringify(this.chartInfo.children))
|
this.dataList = JSON.parse(JSON.stringify(this.chartInfo.children))
|
||||||
|
// this.time = JSON.parse(JSON.stringify(this.timeFilter))
|
||||||
this.firstShow = true
|
this.firstShow = true
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
reload () {
|
||||||
|
console.log(123132)
|
||||||
|
this.dataList = JSON.parse(JSON.stringify(this.chartInfo.children))
|
||||||
|
// this.time = JSON.parse(JSON.stringify(this.timeFilter))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user