From 51ec11b82a920a4aa4660102c2b09fd002e6a061 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Fri, 17 Mar 2023 14:38:32 +0800 Subject: [PATCH] =?UTF-8?q?NEZ-2712=20fix=EF=BC=9A=E7=82=B9=E5=87=BBchart?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=8C=89=E9=92=AE=E6=9C=AA=E5=AF=B9=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E6=93=8D=E4=BD=9C=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=E9=80=80=E5=87=BA=E5=87=BA=E7=8E=B0=E6=9B=B4=E6=94=B9=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/common/js/tools.js | 5 ++++- nezha-fronted/src/components/common/mixin/editRigthBox.js | 3 ++- .../src/components/common/rightBox/chart/chartRightBox.vue | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/nezha-fronted/src/components/common/js/tools.js b/nezha-fronted/src/components/common/js/tools.js index e8f29fd82..73f7146f1 100644 --- a/nezha-fronted/src/components/common/js/tools.js +++ b/nezha-fronted/src/components/common/js/tools.js @@ -13,6 +13,7 @@ export const clickoutside = { const unsavedChange = localStorage.getItem('nz-unsaved-change') try { el.__oldValue__ = JSON.parse(JSON.stringify(binding.value.obj)) + el.__oldData__ = JSON.parse(JSON.stringify(binding.value.oldData)) el.__newValue__ = el.__oldValue__ } catch (e) { @@ -38,7 +39,8 @@ export const clickoutside = { } if (el.__oldValue__) { // const newValue = JSON.parse(JSON.stringify(binding.value.obj)) - if (unsavedChange == 'on' && !isEqual(el.__oldValue__, el.__newValue__) && !el.isShow) { + const oldData = el.__oldData__ || el.__oldValue__ + if (unsavedChange == 'on' && !isEqual(oldData, el.__newValue__) && !el.isShow) { el.isShow = true MessageBox.confirm(i18n.t('tip.confirmCancel'), { confirmButtonText: i18n.t('tip.yes'), @@ -79,6 +81,7 @@ export const clickoutside = { } } el.__newValue__ = binding.value.obj + el.__oldData__ = binding.value.oldData }, unbind (el, binding) { // 解除事件监听 diff --git a/nezha-fronted/src/components/common/mixin/editRigthBox.js b/nezha-fronted/src/components/common/mixin/editRigthBox.js index 7cf365ff7..375ccfd55 100644 --- a/nezha-fronted/src/components/common/mixin/editRigthBox.js +++ b/nezha-fronted/src/components/common/mixin/editRigthBox.js @@ -11,7 +11,8 @@ export default { closeMessage: null, uuid: getUUID(), isStable: 'instability', - stableTime: null + stableTime: null, + oldData: {} } }, mounted () { diff --git a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue index 14abf4637..7c47f3942 100644 --- a/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue +++ b/nezha-fronted/src/components/common/rightBox/chart/chartRightBox.vue @@ -1,5 +1,5 @@