diff --git a/nezha-fronted/src/components/chart/ChartScreenHeader.vue b/nezha-fronted/src/components/chart/ChartScreenHeader.vue index f3d1893c1..dff00b288 100644 --- a/nezha-fronted/src/components/chart/ChartScreenHeader.vue +++ b/nezha-fronted/src/components/chart/ChartScreenHeader.vue @@ -175,8 +175,10 @@ export default { }, mounted () { if (this.$refs.pickTime) { - this.$refs.pickTime.$refs.multipleTime.showDropdown = false - this.$refs.pickTime.$refs.timePicker.setCustomTime(this.nowType) + if (this.$refs.pickTime.$refs.multipleTime) { + this.$refs.pickTime.$refs.multipleTime.showDropdown = false + this.$refs.pickTime.$refs.timePicker.setCustomTime(this.nowType) + } this.setSearchTime(this.nowType.type, this.nowType.value, this.nowType) this.searchTime[0] = bus.timeFormate(this.timeRange[0], 'yyyy-MM-dd hh:mm:ss') this.searchTime[1] = bus.timeFormate(this.timeRange[1], 'yyyy-MM-dd hh:mm:ss') diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue index 86c279f97..19398549c 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartConfig.vue @@ -392,13 +392,13 @@
{{$t('dashboard.panel.chartForm.threshold')}}
- + {{$t('overall.SyncSave')}} - + + + + @@ -99,6 +119,9 @@ import selectPanel from '@/components/common/popBox/selectPanel' import chartConfig from '@/components/common/rightBox/chart/chartConfig' import otherChartConfig from '@/components/common/rightBox/chart/otherChartConfig' import systemChartConfig from '@/components/common/rightBox/chart/systemChartConfig' +import panelChart from '@/components/chart/panelChart' +import lodash from 'lodash' + const rz = { methods: { rz (e) { @@ -124,7 +147,8 @@ export default { selectPanel, chartConfig, systemChartConfig, - otherChartConfig + otherChartConfig, + panelChart }, computed: { chartLastPosition () { @@ -134,6 +158,7 @@ export default { data () { return { fromRoute, + previewShow: false, editChart: { name: '', remark: '' @@ -142,6 +167,8 @@ export default { id: '', name: '' }, + timeRange: [], + prevChart: {}, filterPanel: '', groupArr: [], panelName: '', @@ -349,6 +376,17 @@ export default { groupId: this.editChart.groupId, panelName: this.editChart.panelName } + }, + preview (show) { + if (show) { + this.timeRange = [new Date().setHours(new Date().getHours() - 1), new Date()] + this.prevChart = lodash.cloneDeep(this.editChart) + this.prevChart.loaded = true + this.prevChart.param.showHeader = true + } + this.$nextTick(() => { + this.previewShow = show + }) } }, created () {