feat role menu

This commit is contained in:
smallwei 2019-02-15 09:13:51 +08:00
parent 9a84c3b812
commit d0cf933810
5 changed files with 26 additions and 6 deletions

View File

@ -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',

View File

@ -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();

View File

@ -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();

View File

@ -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() {

View File

@ -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();