NEZ-2494 feat: role 编辑框修改保存提示优化
This commit is contained in:
@@ -11,10 +11,9 @@ export const clickoutside = {
|
||||
setTimeout(() => {
|
||||
if (!binding.expression) return
|
||||
const unsavedChange = localStorage.getItem('nz-unsaved-change')
|
||||
let oldValue
|
||||
try {
|
||||
el.__oldValue__ = JSON.parse(JSON.stringify(binding.value.obj))
|
||||
el.__newValue__ = el.__oldValue__
|
||||
el.__newValue__ = el.__oldValue__
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
@@ -37,9 +36,9 @@ export const clickoutside = {
|
||||
if (!flag) {
|
||||
return false
|
||||
}
|
||||
if ( el.__oldValue__) {
|
||||
if (el.__oldValue__) {
|
||||
// const newValue = JSON.parse(JSON.stringify(binding.value.obj))
|
||||
if (unsavedChange == 'on' && !isEqual( el.__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'),
|
||||
@@ -215,10 +214,10 @@ export const cancelWithChange = {
|
||||
setTimeout(() => {
|
||||
if (!binding.value || !binding.value.obj) return
|
||||
const unsavedChange = localStorage.getItem('nz-unsaved-change')
|
||||
const oldValue = JSON.parse(JSON.stringify(binding.value.obj))
|
||||
el.__newValue__ = oldValue
|
||||
el.__oldValue__ = JSON.parse(JSON.stringify(binding.value.obj))
|
||||
el.__newValue__ = el.__oldValue__
|
||||
function domClick (e) {
|
||||
if (unsavedChange == 'on' && !isEqual(oldValue, el.__newValue__)) {
|
||||
if (unsavedChange == 'on' && !isEqual(el.__oldValue__, el.__newValue__)) {
|
||||
MessageBox.confirm(i18n.t('tip.confirmCancel'), {
|
||||
confirmButtonText: i18n.t('tip.yes'),
|
||||
cancelButtonText: i18n.t('tip.no'),
|
||||
@@ -237,6 +236,9 @@ export const cancelWithChange = {
|
||||
}, 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: function (el, binding) {
|
||||
|
||||
Reference in New Issue
Block a user