NEZ-2494 feat: role 编辑框修改保存提示优化
This commit is contained in:
@@ -582,7 +582,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
orderBy (key, type, order) {
|
orderBy (key, type, order) {
|
||||||
console.log(key, type, order)
|
|
||||||
let orderType = type
|
let orderType = type
|
||||||
if (!orderType) {
|
if (!orderType) {
|
||||||
orderType = this[key] === 'asc' ? 'desc' : 'asc'
|
orderType = this[key] === 'asc' ? 'desc' : 'asc'
|
||||||
@@ -592,7 +591,6 @@ export default {
|
|||||||
this[key] = 0
|
this[key] = 0
|
||||||
this.fileList = this.oldFileList
|
this.fileList = this.oldFileList
|
||||||
} else if (orderType == 'nameOrderType') {
|
} else if (orderType == 'nameOrderType') {
|
||||||
console.log(3)
|
|
||||||
this[key] = orderType
|
this[key] = orderType
|
||||||
let isDirArr = this.oldFileList.filter(item => item.isDir)
|
let isDirArr = this.oldFileList.filter(item => item.isDir)
|
||||||
let isRegArr = this.oldFileList.filter(item => !item.isDir)
|
let isRegArr = this.oldFileList.filter(item => !item.isDir)
|
||||||
@@ -605,7 +603,6 @@ export default {
|
|||||||
this.fileList = this.fileList.concat(isRegArr, isDirArr)
|
this.fileList = this.fileList.concat(isRegArr, isDirArr)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(4)
|
|
||||||
this[key] = orderType
|
this[key] = orderType
|
||||||
let isDirArr = this.oldFileList.filter(item => item.isDir)
|
let isDirArr = this.oldFileList.filter(item => item.isDir)
|
||||||
let isRegArr = this.oldFileList.filter(item => !item.isDir)
|
let isRegArr = this.oldFileList.filter(item => !item.isDir)
|
||||||
|
|||||||
@@ -11,10 +11,9 @@ export const clickoutside = {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!binding.expression) return
|
if (!binding.expression) return
|
||||||
const unsavedChange = localStorage.getItem('nz-unsaved-change')
|
const unsavedChange = localStorage.getItem('nz-unsaved-change')
|
||||||
let oldValue
|
|
||||||
try {
|
try {
|
||||||
el.__oldValue__ = JSON.parse(JSON.stringify(binding.value.obj))
|
el.__oldValue__ = JSON.parse(JSON.stringify(binding.value.obj))
|
||||||
el.__newValue__ = el.__oldValue__
|
el.__newValue__ = el.__oldValue__
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -37,9 +36,9 @@ export const clickoutside = {
|
|||||||
if (!flag) {
|
if (!flag) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
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) {
|
if (unsavedChange == 'on' && !isEqual(el.__oldValue__, 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'),
|
||||||
@@ -215,10 +214,10 @@ export const cancelWithChange = {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!binding.value || !binding.value.obj) return
|
if (!binding.value || !binding.value.obj) return
|
||||||
const unsavedChange = localStorage.getItem('nz-unsaved-change')
|
const unsavedChange = localStorage.getItem('nz-unsaved-change')
|
||||||
const oldValue = JSON.parse(JSON.stringify(binding.value.obj))
|
el.__oldValue__ = JSON.parse(JSON.stringify(binding.value.obj))
|
||||||
el.__newValue__ = oldValue
|
el.__newValue__ = el.__oldValue__
|
||||||
function domClick (e) {
|
function domClick (e) {
|
||||||
if (unsavedChange == 'on' && !isEqual(oldValue, el.__newValue__)) {
|
if (unsavedChange == 'on' && !isEqual(el.__oldValue__, el.__newValue__)) {
|
||||||
MessageBox.confirm(i18n.t('tip.confirmCancel'), {
|
MessageBox.confirm(i18n.t('tip.confirmCancel'), {
|
||||||
confirmButtonText: i18n.t('tip.yes'),
|
confirmButtonText: i18n.t('tip.yes'),
|
||||||
cancelButtonText: i18n.t('tip.no'),
|
cancelButtonText: i18n.t('tip.no'),
|
||||||
@@ -237,6 +236,9 @@ export const cancelWithChange = {
|
|||||||
}, 100)
|
}, 100)
|
||||||
},
|
},
|
||||||
update (el, binding, vnode) {
|
update (el, binding, vnode) {
|
||||||
|
if (binding.arg && binding.arg != 'stable') {
|
||||||
|
el.__oldValue__ = JSON.parse(JSON.stringify(binding.value.obj))
|
||||||
|
}
|
||||||
el.__newValue__ = binding.value.obj
|
el.__newValue__ = binding.value.obj
|
||||||
},
|
},
|
||||||
unbind: function (el, binding) {
|
unbind: function (el, binding) {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-clickoutside="{obj: editRole, func: esc}" class="right-box right-box-role">
|
<div v-clickoutside:[isStable]="{obj: editRole, func: esc}" class="right-box right-box-role">
|
||||||
<div class="right-box__header">
|
<div class="right-box__header">
|
||||||
<div class="header__title">{{editRole.id ? $t('config.roles.editRole') : $t('overall.createRole')}}</div>
|
<div class="header__title">{{editRole.id ? $t('config.roles.editRole') : $t('overall.createRole')}}</div>
|
||||||
<div class="header__operation">
|
<div class="header__operation">
|
||||||
<span v-cancel="{obj: editRole, func: esc}"><i class="nz-icon nz-icon-close" :title="$t('overall.close')"></i></span>
|
<span v-cancel:[isStable]="{obj: editRole, func: esc}"><i class="nz-icon nz-icon-close" :title="$t('overall.close')"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-box__container right-box-container__left">
|
<div class="right-box__container right-box-container__left">
|
||||||
@@ -23,7 +23,17 @@
|
|||||||
<button type="button" class="nz-btn nz-btn-size-small-new nz-btn-style-light option-btn" style="margin-left: 0px;" @click="expandAllOrNone" :class="{'btn-active':expandAllFlag}">展开/收缩</button>
|
<button type="button" class="nz-btn nz-btn-size-small-new nz-btn-style-light option-btn" style="margin-left: 0px;" @click="expandAllOrNone" :class="{'btn-active':expandAllFlag}">展开/收缩</button>
|
||||||
<button type="button" class="nz-btn nz-btn-size-small-new nz-btn-style-light option-btn" @click="selectAllOrNone" :class="{'btn-active':selectAllFlag}"><span ><i class="nz-icon nz-icon-delete"></i></span></button>
|
<button type="button" class="nz-btn nz-btn-size-small-new nz-btn-style-light option-btn" @click="selectAllOrNone" :class="{'btn-active':selectAllFlag}"><span ><i class="nz-icon nz-icon-delete"></i></span></button>
|
||||||
</div>-->
|
</div>-->
|
||||||
<el-tree :data="menus" :default-expand-all="expandAllFlag" :props="{label:labelFormatter}" :default-checked-keys="[312]" class="tree-border" node-key="id" ref="menuTree" show-checkbox id="role-box-input-menus">
|
<el-tree
|
||||||
|
:data="menus"
|
||||||
|
:default-expand-all="expandAllFlag"
|
||||||
|
:props="{label:labelFormatter}"
|
||||||
|
:default-checked-keys="[312]"
|
||||||
|
class="tree-border"
|
||||||
|
node-key="id"
|
||||||
|
ref="menuTree"
|
||||||
|
show-checkbox id="role-box-input-menus"
|
||||||
|
@check="checkChange"
|
||||||
|
>
|
||||||
<div slot-scope="{ node, data }">
|
<div slot-scope="{ node, data }">
|
||||||
<span>
|
<span>
|
||||||
<i v-if="data.type == '1'" class="el-icon-menu"></i>
|
<i v-if="data.type == '1'" class="el-icon-menu"></i>
|
||||||
@@ -37,7 +47,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="right-box__footer">
|
<div class="right-box__footer">
|
||||||
<button id="asset-edit-cancel" v-cancel="{obj: editRole, func: esc}" class="footer__btn footer__btn--light">
|
<button id="asset-edit-cancel" v-cancel:[isStable]="{obj: editRole, func: esc}" class="footer__btn footer__btn--light">
|
||||||
<span>{{$t('overall.cancel')}}</span>
|
<span>{{$t('overall.cancel')}}</span>
|
||||||
</button>
|
</button>
|
||||||
<button id="asset-edit-save" :class="{'footer__btn--disabled': prevent_opt.save}" :disabled="prevent_opt.save" class="footer__btn" @click="save">
|
<button id="asset-edit-save" :class="{'footer__btn--disabled': prevent_opt.save}" :disabled="prevent_opt.save" class="footer__btn" @click="save">
|
||||||
@@ -100,6 +110,12 @@ export default {
|
|||||||
}
|
}
|
||||||
if (this.$refs.menuTree && this.selectedIds && this.selectedIds.length > 0) {
|
if (this.$refs.menuTree && this.selectedIds && this.selectedIds.length > 0) {
|
||||||
this.$refs.menuTree.setCheckedKeys(this.selectedIds, true)
|
this.$refs.menuTree.setCheckedKeys(this.selectedIds, true)
|
||||||
|
this.editRole.menuIds = this.$refs.menuTree.getCheckedKeys(true)
|
||||||
|
setTimeout(() => {
|
||||||
|
this.isStable = 'stable'
|
||||||
|
}, 100)
|
||||||
|
} else {
|
||||||
|
this.isStable = 'stable'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -162,6 +178,11 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
checkChange () {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.editRole.menuIds = this.$refs.menuTree.getCheckedKeys(true)
|
||||||
|
})
|
||||||
|
},
|
||||||
save () {
|
save () {
|
||||||
if (this.prevent_opt.save) { return } ;
|
if (this.prevent_opt.save) { return } ;
|
||||||
this.prevent_opt.save = true
|
this.prevent_opt.save = true
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<div class="header__title" v-if="from !== 'chartTemp'">{{editChart.id ? $t("dashboard.panel.editChartTitle") : $t("overall.createChart")}}</div>
|
<div class="header__title" v-if="from !== 'chartTemp'">{{editChart.id ? $t("dashboard.panel.editChartTitle") : $t("overall.createChart")}}</div>
|
||||||
<div class="header__title" v-if="from === 'chartTemp'">{{editChart.id ? $t("dashboard.panel.editChartTempTitle") : $t("dashboard.panel.createChartTempTitle")}}</div>
|
<div class="header__title" v-if="from === 'chartTemp'">{{editChart.id ? $t("dashboard.panel.editChartTempTitle") : $t("dashboard.panel.createChartTempTitle")}}</div>
|
||||||
<div class="header__operation">
|
<div class="header__operation">
|
||||||
<span v-cancel="{obj: editChart, func: clickOutside}"><i class="nz-icon nz-icon-close" :title="$t('overall.close')"></i></span>
|
<span v-cancel:[isStable]="{obj: editChart, func: clickOutside}"><i class="nz-icon nz-icon-close" :title="$t('overall.close')"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--底部按钮-->
|
<!--底部按钮-->
|
||||||
<div class="right-box__footer">
|
<div class="right-box__footer">
|
||||||
<button id="chart-box-esc" v-cancel="{obj:editChart,func:esc}" class="footer__btn footer__btn--light">
|
<button id="chart-box-esc" v-cancel:[isStable]="{obj:editChart,func:esc}" class="footer__btn footer__btn--light">
|
||||||
<span>{{$t('overall.cancel')}}</span>
|
<span>{{$t('overall.cancel')}}</span>
|
||||||
</button>
|
</button>
|
||||||
<button v-if="showPanel.type && showPanel.type == 'model'" id="chart-box-Sync" v-has="'main_edit'" class="footer__btn">
|
<button v-if="showPanel.type && showPanel.type == 'model'" id="chart-box-Sync" v-has="'main_edit'" class="footer__btn">
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
</template>
|
</template>
|
||||||
</nz-data-list>
|
</nz-data-list>
|
||||||
<transition name="right-box">
|
<transition name="right-box">
|
||||||
<role-box v-if="rightBox.show" :copyFlag="copyFlag" :obj="object" @close="closeRightBox"></role-box>
|
<role-box ref="roleBox" v-if="rightBox.show" :copyFlag="copyFlag" :obj="object" @close="closeRightBox"></role-box>
|
||||||
</transition>
|
</transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -77,7 +77,9 @@ export default {
|
|||||||
url: 'sys/role',
|
url: 'sys/role',
|
||||||
tableId: 'rolesTable', // 需要分页的table的id,用于记录每页数量
|
tableId: 'rolesTable', // 需要分页的table的id,用于记录每页数量
|
||||||
blankObject: { // 空白对象
|
blankObject: { // 空白对象
|
||||||
name: ''
|
name: '',
|
||||||
|
remark: '',
|
||||||
|
menuIds: [312]
|
||||||
},
|
},
|
||||||
copyFlag: false,
|
copyFlag: false,
|
||||||
searchMsg: { // 给搜索框子组件传递的信息
|
searchMsg: { // 给搜索框子组件传递的信息
|
||||||
@@ -108,6 +110,15 @@ export default {
|
|||||||
this.edit(u, true)
|
this.edit(u, true)
|
||||||
this.copyFlag = true
|
this.copyFlag = true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'rightBox.show': {
|
||||||
|
handler (n) {
|
||||||
|
if (!n) {
|
||||||
|
this.$refs.roleBox.isStable = 'instability'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -93,7 +93,6 @@ const user = {
|
|||||||
localStorage.setItem(`nz-user-${res.data.user.id}-theme`, currentTheme)
|
localStorage.setItem(`nz-user-${res.data.user.id}-theme`, currentTheme)
|
||||||
const body = document.getElementsByTagName('body')[0]
|
const body = document.getElementsByTagName('body')[0]
|
||||||
body.setAttribute('class', `theme-${currentTheme}`)
|
body.setAttribute('class', `theme-${currentTheme}`)
|
||||||
console.log(res)
|
|
||||||
localStorage.setItem('timezoneOffset', moment.tz(res.data.timezone || defaultAppearance.timezone).format('Z'))
|
localStorage.setItem('timezoneOffset', moment.tz(res.data.timezone || defaultAppearance.timezone).format('Z'))
|
||||||
localStorage.setItem('nz-sys-default-cabinet-usize', res.data.defaultCabinetUsize)
|
localStorage.setItem('nz-sys-default-cabinet-usize', res.data.defaultCabinetUsize)
|
||||||
localStorage.setItem('nz-sys-max-terminal-num', res.data.maxTerminalNum)
|
localStorage.setItem('nz-sys-max-terminal-num', res.data.maxTerminalNum)
|
||||||
|
|||||||
Reference in New Issue
Block a user