feat: chartBox 添加关闭页面的编辑
This commit is contained in:
17
nezha-fronted/src/components/common/mixin/rightBox.js
Normal file
17
nezha-fronted/src/components/common/mixin/rightBox.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
isEdit: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
if (this.isEdit) {
|
||||||
|
window.onbeforeunload = function () {
|
||||||
|
return window.confirm('还没有完成,确认退出吗?')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
window.onbeforeunload = null
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -499,6 +499,7 @@ import nezhaColor from '../../common/nezhaColor'
|
|||||||
import i18n from '../../common/i18n'
|
import i18n from '../../common/i18n'
|
||||||
import { fromRoute } from '@/components/common/js/constants'
|
import { fromRoute } from '@/components/common/js/constants'
|
||||||
import diagram from '@/components/common/ChartDiagram/diagram'
|
import diagram from '@/components/common/ChartDiagram/diagram'
|
||||||
|
import rightBoxMain from '@/components/common/mixin/rightBox'
|
||||||
const rz = {
|
const rz = {
|
||||||
methods: {
|
methods: {
|
||||||
rz (e) {
|
rz (e) {
|
||||||
@@ -519,7 +520,7 @@ export default {
|
|||||||
default: false
|
default: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mixins: [rz],
|
mixins: [rz, rightBoxMain],
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
fromRoute,
|
fromRoute,
|
||||||
@@ -1753,12 +1754,16 @@ export default {
|
|||||||
created () {
|
created () {
|
||||||
this.getSuggestMetric()
|
this.getSuggestMetric()
|
||||||
this.queryMetrics()
|
this.queryMetrics()
|
||||||
|
console.log(this.isEdit)
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
chart: {
|
chart: {
|
||||||
deep: true,
|
deep: true,
|
||||||
immediate: true,
|
immediate: true,
|
||||||
handler (n) {
|
handler (n) {
|
||||||
|
if (n.id) {
|
||||||
|
this.isEdit = true
|
||||||
|
}
|
||||||
if ((n.param && n.param.valueMapping) && (n.type === 'singleStat' || n.type === 'table')) {
|
if ((n.param && n.param.valueMapping) && (n.type === 'singleStat' || n.type === 'table')) {
|
||||||
n.param.valueMapping.mapping.forEach(item => {
|
n.param.valueMapping.mapping.forEach(item => {
|
||||||
this.showPicker.push({ bac: false, text: false })
|
this.showPicker.push({ bac: false, text: false })
|
||||||
|
|||||||
Reference in New Issue
Block a user