diff --git a/src/components/charts/ChartTablePagination.vue b/src/components/charts/ChartTablePagination.vue index 945a2fc8..521d861c 100644 --- a/src/components/charts/ChartTablePagination.vue +++ b/src/components/charts/ChartTablePagination.vue @@ -45,6 +45,10 @@ export default { } }, mounted () { + const _this = this + this.emitter.on('chart-pageNo', function () { + _this.resetPageNo() + }) this.$el.querySelector('.el-pagination__jump').childNodes[0].nodeValue = '' } } diff --git a/src/main.js b/src/main.js index e837fc6a..f7887aa1 100644 --- a/src/main.js +++ b/src/main.js @@ -13,6 +13,8 @@ import 'highlight.js/styles/color-brewer.css' import '@/assets/css/main.scss' // 样式入口 import VueGridLayout from 'vue-grid-layout' import ElementPlus from 'element-plus' +import bus from 'tiny-emitter' +const emitter = new bus() import dayjs from 'dayjs' import utc from 'dayjs/plugin/utc' // dependent on utc plugin import timezone from 'dayjs/plugin/timezone' @@ -54,4 +56,6 @@ app.component('time-refresh', TimeRefresh) app.component('panel-chart-list', PanelChartList) app.mount('#app') + +app.config.globalProperties.emitter = emitter export default app diff --git a/src/views/charts/PanelChart.vue b/src/views/charts/PanelChart.vue index e1b7cf96..a6775668 100644 --- a/src/views/charts/PanelChart.vue +++ b/src/views/charts/PanelChart.vue @@ -232,6 +232,7 @@ export default { this.standaloneTimeRange.use = true this.standaloneTimeRange.startTime = myStartTime this.standaloneTimeRange.endTime = myEndTime + this.emitter.emit('chart-pageNo') this.getChartData(null, {}, true) }, showFullscreen (show) { @@ -288,6 +289,7 @@ export default { this.loading = show }, tableChange () { + this.emitter.emit('chart-pageNo') this.getChartData() }, getTargetPageData (pageNum, pageSize, tableData) {