提交 9fbf01bd 编写于 作者: laizhilong's avatar laizhilong

权限重复处理的问题

上级 292e19ec
...@@ -364,9 +364,13 @@ ...@@ -364,9 +364,13 @@
if(this.formDruipart){ if(this.formDruipart){
this.formDruipart.subscribe((res:any) =>{ this.formDruipart.subscribe((res:any) =>{
if(Object.is(res.action,'load')){ if(Object.is(res.action,'load')){
// 父数据保存时调用当前视图的点击确定事件 // 父数据保存时调用当前视图的事件
if(this.selectData.length>0){ if(this.selectData.length>0){
// 选中了数据
this.onClickOk(); this.onClickOk();
}else{
// 没选中数据
this.onClear();
} }
} }
}); });
...@@ -439,6 +443,10 @@ ...@@ -439,6 +443,10 @@
* @memberof SYS_ROLE_PERMISSIONCustomViewBase * @memberof SYS_ROLE_PERMISSIONCustomViewBase
*/ */
public beforeDestroy() { public beforeDestroy() {
// 清空选中数据
this.selectData = {};
// 清空视图选中数据
this.viewSelections = [];
this.$store.commit('viewaction/removeView', this.viewtag); this.$store.commit('viewaction/removeView', this.viewtag);
} }
...@@ -473,7 +481,6 @@ ...@@ -473,7 +481,6 @@
if (this.selectData && this.selectData.length > 0) { if (this.selectData && this.selectData.length > 0) {
// 判断选中的数据和初始数据 // 判断选中的数据和初始数据
if (JSON.stringify(this.selectData) == JSON.stringify(this.ininselectData)) { if (JSON.stringify(this.selectData) == JSON.stringify(this.ininselectData)) {
this.$emit('close', null);
return; return;
} }
this.selectData.forEach((item: any) => { this.selectData.forEach((item: any) => {
...@@ -498,15 +505,30 @@ ...@@ -498,15 +505,30 @@
} }
}).catch((e) => { }).catch((e) => {
}); });
} else {
this.$Notice.error({title: '错误', desc: '未选中数据!'});
} }
// 清空视图选中数据,避免重复添加
this.viewSelections = [];
} }
/**
* 清除
*/
private onClear(){
// 未选中数据,即没有赋予任何权限,需要清除当前角色的所有权限
if (this.selectData.length==0) {
// 保存选中的权限信息
let url = '/sysroles/'+this.srfparentkey+'/sysrolepermissions/refreshbatch';
this.$http.post(url,[]).then((response: any) => {
if (!(!response || response.status !== 200)) {
} else {
this.$Notice.error({title: '错误', desc: response.message});
return;
}
}).catch((e) => {
});
}
}
} }
</script> </script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册