From d0cf933810b50d5c5af34e1e7ca8b8d6c967f42c Mon Sep 17 00:00:00 2001 From: smallwei <1634566606@qq.com> Date: Fri, 15 Feb 2019 09:13:51 +0800 Subject: [PATCH] feat role menu --- src/api/system/role.js | 15 +++++++++++++++ src/views/system/dept.vue | 1 - src/views/system/dict.vue | 1 - src/views/system/role.vue | 13 +++++++++++-- src/views/system/user.vue | 2 -- 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/api/system/role.js b/src/api/system/role.js index 5f68976..501aa42 100644 --- a/src/api/system/role.js +++ b/src/api/system/role.js @@ -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', diff --git a/src/views/system/dept.vue b/src/views/system/dept.vue index 82a0391..bb50c50 100644 --- a/src/views/system/dept.vue +++ b/src/views/system/dept.vue @@ -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(); diff --git a/src/views/system/dict.vue b/src/views/system/dict.vue index ebe5e92..74ca308 100644 --- a/src/views/system/dict.vue +++ b/src/views/system/dict.vue @@ -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(); diff --git a/src/views/system/role.vue b/src/views/system/role.vue index c301713..2ade652 100644 --- a/src/views/system/role.vue +++ b/src/views/system/role.vue @@ -36,6 +36,7 @@ @@ -44,7 +45,7 @@ class="dialog-footer"> 取 消 确 定 + @click="submit">确 定 @@ -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() { diff --git a/src/views/system/user.vue b/src/views/system/user.vue index 4b2c341..f225f63 100644 --- a/src/views/system/user.vue +++ b/src/views/system/user.vue @@ -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();