diff --git a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue index cc080562a..8d8f5c832 100644 --- a/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue +++ b/nezha-fronted/src/components/chart/chart/chartTimeSeries.vue @@ -250,11 +250,41 @@ export default { } }) } + + // 修复echarts bug(dataZoom设置为inside 未按住ctrl 页面无法滚动) + // 监听按键按下事件 + document.addEventListener('keydown', this.keydown) + // 监听按键松开事件 + document.addEventListener('keyup', this.keyup) } this.chartLoading = false this.isInit = false }, 200) }, + keydown (event) { + // 监听按键按下事件 + // 判断是否按下了Ctrl键 + if (event.ctrlKey) { + // 如果按下了Ctrl键,则启用Echarts的dataZoom功能 + getChart(this.chartId).setOption({ + dataZoom: [{ + disabled: false + }] + }) + } + }, + keyup (event) { + // 监听按键松开事件 + // 判断是否释放了Ctrl键 + if (!event.ctrlKey) { + // 如果释放了Ctrl键,则禁用Echarts的dataZoom功能 + getChart(this.chartId).setOption({ + dataZoom: [{ + disabled: true + }] + }) + } + }, getMinMaxFromData (originalDatas, chartUnit = 2) { let minTime = null let maxTime = null @@ -724,6 +754,10 @@ export default { this.isStack = this.chartInfo.param.stack } catch (e) {} this.chartInfo.loaded && this.initChart(this.chartOption) + }, + beforeDestroy () { + document.removeEventListener('keydown', this.keydown) + document.removeEventListener('keyup', this.keyup) } } diff --git a/nezha-fronted/src/components/chart/chart/options/chartTimeSeries.js b/nezha-fronted/src/components/chart/chart/options/chartTimeSeries.js index 006781d4e..7009af48a 100644 --- a/nezha-fronted/src/components/chart/chart/options/chartTimeSeries.js +++ b/nezha-fronted/src/components/chart/chart/options/chartTimeSeries.js @@ -50,6 +50,7 @@ export const chartTimeSeriesLineOption = { }, dataZoom: [ { + disabled: true, type: 'inside', zoomOnMouseWheel: 'ctrl' } diff --git a/nezha-fronted/src/components/common/alert/alertMessageInfoTab.vue b/nezha-fronted/src/components/common/alert/alertMessageInfoTab.vue index 04f701af7..3b2a54ef9 100644 --- a/nezha-fronted/src/components/common/alert/alertMessageInfoTab.vue +++ b/nezha-fronted/src/components/common/alert/alertMessageInfoTab.vue @@ -118,7 +118,7 @@ export default { }) // && n.alertRule.dashboardId // n.alertRule && (n.alertRule.dashboardId = 101534) - if (n.alertRule && n.alertRule.dashboardId) { + if (n.alertRule && n.alertRule.dashboardId && n.alertRule.dashboardId != -1) { // this.cardNames.push({ key: 'dashboard', diff --git a/nezha-fronted/src/components/common/rightBox/administration/userBox.vue b/nezha-fronted/src/components/common/rightBox/administration/userBox.vue index 5df121323..ed97ae57c 100644 --- a/nezha-fronted/src/components/common/rightBox/administration/userBox.vue +++ b/nezha-fronted/src/components/common/rightBox/administration/userBox.vue @@ -113,7 +113,7 @@