NEZ-2712 fix:点击chart编辑按钮未对内容操作的情况下退出出现更改保存提示
This commit is contained in:
@@ -13,6 +13,7 @@ export const clickoutside = {
|
|||||||
const unsavedChange = localStorage.getItem('nz-unsaved-change')
|
const unsavedChange = localStorage.getItem('nz-unsaved-change')
|
||||||
try {
|
try {
|
||||||
el.__oldValue__ = JSON.parse(JSON.stringify(binding.value.obj))
|
el.__oldValue__ = JSON.parse(JSON.stringify(binding.value.obj))
|
||||||
|
el.__oldData__ = JSON.parse(JSON.stringify(binding.value.oldData))
|
||||||
el.__newValue__ = el.__oldValue__
|
el.__newValue__ = el.__oldValue__
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
@@ -38,7 +39,8 @@ export const clickoutside = {
|
|||||||
}
|
}
|
||||||
if (el.__oldValue__) {
|
if (el.__oldValue__) {
|
||||||
// const newValue = JSON.parse(JSON.stringify(binding.value.obj))
|
// 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
|
el.isShow = true
|
||||||
MessageBox.confirm(i18n.t('tip.confirmCancel'), {
|
MessageBox.confirm(i18n.t('tip.confirmCancel'), {
|
||||||
confirmButtonText: i18n.t('tip.yes'),
|
confirmButtonText: i18n.t('tip.yes'),
|
||||||
@@ -79,6 +81,7 @@ export const clickoutside = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
el.__newValue__ = binding.value.obj
|
el.__newValue__ = binding.value.obj
|
||||||
|
el.__oldData__ = binding.value.oldData
|
||||||
},
|
},
|
||||||
unbind (el, binding) {
|
unbind (el, binding) {
|
||||||
// 解除事件监听
|
// 解除事件监听
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ export default {
|
|||||||
closeMessage: null,
|
closeMessage: null,
|
||||||
uuid: getUUID(),
|
uuid: getUUID(),
|
||||||
isStable: 'instability',
|
isStable: 'instability',
|
||||||
stableTime: null
|
stableTime: null,
|
||||||
|
oldData: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-clickoutside:[isStable]="{obj: editChart, func:clickOutside}" :class="boxClass" class="right-box right-box-chart">
|
<div v-clickoutside:[isStable]="{obj: editChart,oldData: oldData, func:clickOutside}" :class="boxClass" class="right-box right-box-chart">
|
||||||
<transition v-if="from !== 'chartTemp'" name="right-box">
|
<transition v-if="from !== 'chartTemp'" name="right-box">
|
||||||
<!-- <panel-box v-if="!showPanel.type" ref="panelBox2" :panel="panel" @reload="panelReload"></panel-box>-->
|
<!-- <panel-box v-if="!showPanel.type" ref="panelBox2" :panel="panel" @reload="panelReload"></panel-box>-->
|
||||||
</transition>
|
</transition>
|
||||||
@@ -602,6 +602,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.editChart = obj
|
this.editChart = obj
|
||||||
|
this.oldData = this.$loadsh.cloneDeep(obj)
|
||||||
if (this.stableTime) {
|
if (this.stableTime) {
|
||||||
clearTimeout(this.stableTime)
|
clearTimeout(this.stableTime)
|
||||||
this.stableTime = null
|
this.stableTime = null
|
||||||
|
|||||||
Reference in New Issue
Block a user