NEZ=824 fix;修改切换时间后报错的问题

This commit is contained in:
zhangyu
2021-07-14 10:37:20 +08:00
parent 0eca16c195
commit 3adb337934

View File

@@ -82,6 +82,7 @@
</div> </div>
<el-dialog id="viewGraphDialog" <el-dialog id="viewGraphDialog"
:modal-append-to-body='false' :modal-append-to-body='false'
destroy-on-close
:title="$t('overall.detail')" :title="$t('overall.detail')"
:visible.sync="graphShow" :visible.sync="graphShow"
class="line-chart-block-modal nz-dialog endpoint-dialog" class="line-chart-block-modal nz-dialog endpoint-dialog"
@@ -286,6 +287,7 @@ export default {
this.currentMsg = { ...row, alertRule: { ...res.data } } this.currentMsg = { ...row, alertRule: { ...res.data } }
this.graphShow = true this.graphShow = true
this.$nextTick(() => { this.$nextTick(() => {
this.searchTimeDialog = [bus.computeTimezoneTime(new Date().getTime() - 1 * 30 * 60 * 1000), bus.computeTimezoneTime(new Date().getTime())]
this.queryChartDate() this.queryChartDate()
}) })
}) })
@@ -298,8 +300,8 @@ export default {
}, },
queryChartDate () { queryChartDate () {
const $temp = this const $temp = this
const start = this.searchTime[0] ? this.searchTime[0] : bus.computeTimezoneTime(new Date().getTime() - 1 * 30 * 60 * 1000) const start = this.searchTimeDialog[0] ? this.searchTimeDialog[0] : bus.computeTimezoneTime(new Date().getTime() - 1 * 30 * 60 * 1000)
const end = this.searchTime[1] ? this.searchTime[1] : bus.computeTimezoneTime(new Date().getTime()) const end = this.searchTimeDialog[1] ? this.searchTimeDialog[1] : bus.computeTimezoneTime(new Date().getTime())
this.searchTimeDialog = [start, end] this.searchTimeDialog = [start, end]
const timeDiff = (new Date(end).getTime() - new Date(start).getTime()) / 1000 / (24 * 60 * 60) const timeDiff = (new Date(end).getTime() - new Date(start).getTime()) / 1000 / (24 * 60 * 60)
let step = '15s' let step = '15s'
@@ -463,7 +465,8 @@ export default {
} }
}) })
}, },
promQueryParamConvert (obj) { promQueryParamConvert (alert) {
const obj = { ...alert }
let r = '(' + obj.alertRule.expr.replace(/\"/g, '\'') + ')' let r = '(' + obj.alertRule.expr.replace(/\"/g, '\'') + ')'
let intoLabels = false let intoLabels = false
obj.labels = JSON.parse(obj.labels) obj.labels = JSON.parse(obj.labels)