// 删除权限
async removeRightsById(roles,rightId){
// 弹出confirm提示框
const comfimResult = await this.$confirm('删除权限,是否继续','提示',{
confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning'
}).catch(err => err);//捕获异常
if(comfimResult !== 'confirm') return this.$message.info('取消删除!');
const {data:res} = await this.$http.delete('roles/'+ roles.id +'/rights/'+rightId);
if(res.meta.status !== 200) return this.$message.error('取消权限失败!');
this.$message.success('取消权限成功!');
// this.getRolesList(); 如果重新获取table数据,会关闭掉展开的权限明细
roles.children = res.data;//将返回的数据重新赋值即可,这样不会关闭table项
}
常规删除逻辑
最新推荐文章于 2023-03-28 17:46:43 发布
本文介绍了一个基于确认对话框的删除权限功能实现方法,通过asyncremoveRightsById函数,使用axios进行HTTP DELETE请求来移除指定角色的权限,并在操作前后提供用户反馈。
1644

被折叠的 条评论
为什么被折叠?



