NEZ-1751 fix: panel 添加window。resize的事件

This commit is contained in:
zhangyu
2022-03-30 15:04:34 +08:00
parent e7f6947908
commit db69c0eb12
10 changed files with 46 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
<template>
<div :style="showHeader&&chartInfo.param.showHeader ? '' : 'padding-top: 15px;'" class="nz-chart" :class="showHeader&&chartInfo.param.showHeader ? '' : 'no-header'" >
<loading :loading="loading"></loading>
<chart-no-data v-if="isNoData || isError || chartChildrenData"></chart-no-data>
<chart-no-data v-if="isNoData || isError || chartChildrenData"></chart-no-data>
<template v-else>
<chart-time-series
v-if="isTimeSeries(chartInfo.type)"
@@ -297,6 +297,7 @@ export default {
this.chartChildrenData = flag
},
resize () {
console.log(this.$refs['chart' + this.chartInfo.id])
this.$refs['chart' + this.chartInfo.id] && this.$refs['chart' + this.chartInfo.id].resize()
},
refreshLogs (params) {

View File

@@ -16,6 +16,11 @@ export default {
data () {
return {
}
},
methods: {
resize () {
}
}
}

View File

@@ -16,6 +16,11 @@ export default {
data () {
return {
}
},
methods: {
resize () {
}
}
}

View File

@@ -213,9 +213,11 @@ export default {
})
},
resize () {
this.getLayout().then(layout => {
this.renderGauge(layout).then(() => {
this.gaugeChartResize()
setTimeout(() => {
this.getLayout().then(layout => {
this.renderGauge(layout).then(() => {
this.gaugeChartResize()
})
})
})
},

View File

@@ -6,6 +6,11 @@
<script>
export default {
name: 'chartNoData'
name: 'chartNoData',
methods: {
resize () {
}
}
}
</script>

View File

@@ -21,6 +21,9 @@ export default {
}
},
methods: {
resize () {
}
},
watch: {
chartInfo: {

View File

@@ -331,7 +331,10 @@ export default {
}
},
resize () {
getChart(this.chartId).resize()
console.log(213)
setTimeout(() => {
getChart(this.chartId) && getChart(this.chartId).resize()
}, 100)
}
},
mounted () {

View File

@@ -334,6 +334,15 @@ export default {
})
}, 200)
},
resize () {
this.init()
this.copyDataList.forEach(item => {
if (item.type === 'group') {
this.$refs['chart' + item.id][0] && this.$refs['chart' + item.id][0].$refs.chart && this.$refs['chart' + item.id][0].$refs.chart.$refs['chart' + item.id] && this.$refs['chart' + item.id][0].$refs.chart.$refs['chart' + item.id].$refs.chartList.resize()
}
this.$refs['chart' + item.id][0] && this.$refs['chart' + item.id][0].resize()
})
},
refreshPanel () {
bus.$emit('refreshPanel')
}
@@ -346,9 +355,11 @@ export default {
if (!this.isGroup) {
bus.$on('groupMove', this.changeGroupHeight)
this.$store.commit('setChartListId', `chartList${this.timestamp}`)
window.addEventListener('resize', this.resize)
}
},
beforeDestroy () {
window.removeEventListener('resize', this.resize)
},
watch: {
dataList: {

View File

@@ -261,7 +261,10 @@ export default {
}
},
resize () {
getChart(this.chartId) && getChart(this.chartId).resize()
console.log('reszie')
setTimeout(() => {
getChart(this.chartId) && getChart(this.chartId).resize()
}, 100)
}
},
watch: {

View File

@@ -386,7 +386,7 @@ export default {
})
},
resize () {
this.$refs.chart.resize()
this.$refs.chart && this.$refs.chart.resize()
},
refresh () {
this.getChartData(true)