diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue index 90c29683c..321afec36 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue @@ -16,7 +16,7 @@
- { + this.$refs.addChartModal.isStable = 'stable' }) }, addChartByTemp () { @@ -441,6 +452,9 @@ export default { } }) } + this.$nextTick(() => { + this.$refs.addChartModal.isStable = 'stable' + }) } else { this.$message.error(res.msg) } @@ -774,6 +788,12 @@ export default { } }) }, + addChartBefore () { + this.$store.dispatch('dispatchEditChart', { + chart: '', + type: 'add' + }) + }, disposeChart () { const chartInfo = this.$store.getters.getChart const groupId = this.$store.getters.getGroupId @@ -882,6 +902,8 @@ export default { handler (n) { if (n) { this.disposeChart() + } else { + this.$refs.addChartModal.isStable = 'instability' } } }, diff --git a/nezha-fronted/src/components/common/js/tools.js b/nezha-fronted/src/components/common/js/tools.js index 15d89cee0..158f25ad7 100644 --- a/nezha-fronted/src/components/common/js/tools.js +++ b/nezha-fronted/src/components/common/js/tools.js @@ -13,8 +13,8 @@ export const clickoutside = { const unsavedChange = localStorage.getItem('nz-unsaved-change') let oldValue try { - oldValue = JSON.parse(JSON.stringify(binding.value.obj)) - el.__newValue__ = oldValue + el.__oldValue__ = JSON.parse(JSON.stringify(binding.value.obj)) + el.__newValue__ = el.__oldValue__ } catch (e) { } @@ -37,10 +37,9 @@ export const clickoutside = { if (!flag) { return false } - if (oldValue) { - console.log(oldValue, el.__newValue__) + if ( el.__oldValue__) { // const newValue = JSON.parse(JSON.stringify(binding.value.obj)) - if (unsavedChange == 'on' && !isEqual(oldValue, el.__newValue__) && !el.isShow) { + if (unsavedChange == 'on' && !isEqual( el.__oldValue__, el.__newValue__) && !el.isShow) { el.isShow = true MessageBox.confirm(i18n.t('tip.confirmCancel'), { confirmButtonText: i18n.t('tip.yes'), @@ -75,6 +74,9 @@ export const clickoutside = { }, 100) }, update (el, binding, vnode) { + if (binding.arg && binding.arg != 'stable') { + el.__oldValue__ = JSON.parse(JSON.stringify(binding.value.obj)) + } el.__newValue__ = binding.value.obj }, unbind (el, binding) { diff --git a/nezha-fronted/src/components/common/mixin/editRigthBox.js b/nezha-fronted/src/components/common/mixin/editRigthBox.js index 85198f626..7cf365ff7 100644 --- a/nezha-fronted/src/components/common/mixin/editRigthBox.js +++ b/nezha-fronted/src/components/common/mixin/editRigthBox.js @@ -9,7 +9,9 @@ export default { emit: '' }, closeMessage: null, - uuid: getUUID() + uuid: getUUID(), + isStable: 'instability', + stableTime: null } }, mounted () { diff --git a/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue b/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue index 8851bf20c..daa3efd48 100644 --- a/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue @@ -1,5 +1,5 @@