mirror of
https://github.com/chillzhuang/Saber.git
synced 2024-11-22 10:29:28 +08:00
feat role menu
This commit is contained in:
parent
9a84c3b812
commit
d0cf933810
@ -16,6 +16,21 @@ export const getTree = () => {
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export const grant = (roleIds, menuIds) => {
|
||||
return request({
|
||||
url: 'api/blade-system/role/grant',
|
||||
method: 'post',
|
||||
data: {
|
||||
roleIds,
|
||||
menuIds
|
||||
},
|
||||
meta: {
|
||||
isSerialize: true,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const remove = (ids) => {
|
||||
return request({
|
||||
url: 'api/blade-system/role/remove',
|
||||
|
@ -156,7 +156,6 @@ export default {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getDept(this.form.id).then(res => {
|
||||
this.form = res.data.data;
|
||||
this.form.parentId = this.form.parentId + "";
|
||||
});
|
||||
}
|
||||
done();
|
||||
|
@ -158,7 +158,6 @@ export default {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getDict(this.form.id).then(res => {
|
||||
this.form = res.data.data;
|
||||
this.form.parentId = this.form.parentId + "";
|
||||
});
|
||||
}
|
||||
done();
|
||||
|
@ -36,6 +36,7 @@
|
||||
<el-tree :data="list"
|
||||
show-checkbox
|
||||
node-key="id"
|
||||
ref="tree"
|
||||
:default-expanded-keys="defaultObj"
|
||||
:default-checked-keys="defaultObj"
|
||||
:props="props">
|
||||
@ -44,7 +45,7 @@
|
||||
class="dialog-footer">
|
||||
<el-button @click="box = false">取 消</el-button>
|
||||
<el-button type="primary"
|
||||
@click="box = false">确 定</el-button>
|
||||
@click="submit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</basic-container>
|
||||
@ -56,6 +57,7 @@ import {
|
||||
remove,
|
||||
update,
|
||||
add,
|
||||
grant,
|
||||
getTree,
|
||||
getRole
|
||||
} from "@/api/system/role";
|
||||
@ -112,6 +114,13 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
const menuLIst = this.$refs.tree.getCheckedKeys().join(",");
|
||||
grant(this.ids[0], menuLIst).then(() => {
|
||||
this.box = false;
|
||||
this.onLoad(this.page);
|
||||
});
|
||||
},
|
||||
rowSave(row, loading) {
|
||||
add(row).then(() => {
|
||||
loading();
|
||||
@ -160,11 +169,11 @@ export default {
|
||||
getTree()
|
||||
.then(res => {
|
||||
this.list = res.data.data;
|
||||
this.box = true;
|
||||
return getRole(this.ids[0]);
|
||||
})
|
||||
.then(res => {
|
||||
this.defaultObj = res.data.data;
|
||||
this.box = true;
|
||||
});
|
||||
},
|
||||
handleDelete() {
|
||||
|
@ -213,8 +213,6 @@ export default {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getUser(this.form.id).then(res => {
|
||||
this.form = res.data.data;
|
||||
this.form.deptId = this.form.deptId + "";
|
||||
this.form.roleId = this.form.roleId + "";
|
||||
});
|
||||
}
|
||||
done();
|
||||
|
Loading…
Reference in New Issue
Block a user