fix: 小组角色权限修改时,父节点勾选时,如果存在多个子节点,节点勾选事件会触发同一个方法,进而发起多个相同请求,导致页面闪烁的问题修改。
This commit is contained in:
parent
9e333c318a
commit
18446a1e8e
@ -211,7 +211,10 @@
|
||||
checkAllUpdate: false,
|
||||
checkAllDelete: false,
|
||||
checkAllVersion: false,
|
||||
refreshTree: false
|
||||
refreshTree: false,
|
||||
|
||||
isParentChecking: false, // 标志变量,用于标记是否正在进行父节点的勾选操作
|
||||
isAllDataPermChecking: false, // 标志变量,用于标记是否正在进行全选操作
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -459,6 +462,10 @@
|
||||
checkedNode(data, checked, subChecked) {// 节点选中事件
|
||||
// 获取所有子节点
|
||||
const that = this;
|
||||
if (that.isParentChecking || that.isAllDataPermChecking){
|
||||
return; // 如果正在进行父节点勾选操作或者全选操作,直接返回,避免子节点触发额外请求
|
||||
}
|
||||
that.isParentChecking = true; // 标记开始父节点勾选操作
|
||||
that.loading = true;
|
||||
const params = {
|
||||
url:'jd',
|
||||
@ -553,6 +560,9 @@
|
||||
that.checkAllProcess = num == that.teamPermFileSize;
|
||||
that.loading = false;
|
||||
console.log('计算全选按钮', that.teamPermFileSize, '实际勾选', num);
|
||||
that.$nextTick(()=>{
|
||||
that.isParentChecking = false;
|
||||
})
|
||||
}).catch(error=>{
|
||||
console.log(error);
|
||||
})
|
||||
@ -648,8 +658,9 @@
|
||||
checkAllProcessChange(value){
|
||||
const that = this;
|
||||
|
||||
that.loading = true;
|
||||
if (value){//选中
|
||||
that.loading = true;
|
||||
that.isAllDataPermChecking = value; // 标记开始全选勾选操作
|
||||
const params = {
|
||||
url:'jd',
|
||||
data:{
|
||||
@ -672,6 +683,9 @@
|
||||
that.$refs.tree.setCheckedKeys(checkedVerIds);
|
||||
|
||||
that.loading = false;
|
||||
that.$nextTick(() => {
|
||||
that.isAllDataPermChecking = false;
|
||||
})
|
||||
}).catch(error=>{
|
||||
console.log(error);
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user