diff --git a/src/api/menu.js b/src/api/menu.js index 9b64f2d3318aea037ee1c8f0ac8fa4e8abef9056..8cc8ca604a24c9d453c69983e5182508cad2944b 100644 --- a/src/api/menu.js +++ b/src/api/menu.js @@ -1,4 +1,4 @@ -import { delReq, getReq, postReq } from '@/utils'; +import { delReq, getReq, postReq, putReq } from '@/utils'; export function delMenuApi(id) { return delReq(`/api/v1/menus/${id}`); @@ -15,3 +15,11 @@ export function addMenuApi(data) { export function addRoleApi(data) { return postReq('/api/v1/roles', data); } + +export function getRoleApi(id) { + return getReq(`/api/v1/roles/${id}`); +} + +export function updateRoleApi(data) { + return putReq('/api/v1/roles', data); +} diff --git a/src/components/menu_tree/index.vue b/src/components/menu_tree/index.vue index 269625f776a5e369914ff0f0e3433e23645744e7..020365eb4d7ff3e91f57b69212c3e6dcd5075ede 100644 --- a/src/components/menu_tree/index.vue +++ b/src/components/menu_tree/index.vue @@ -7,6 +7,7 @@ :tree-data="treeData" style="max-height:400px" class="tw-overflow-y-auto" + :expandedKeys.sync="expandedKeys" v-bind="$attrs" v-on="$listeners" /> @@ -24,6 +25,7 @@ export default { props: { value: [Object, Array], showMenu: Boolean, + defaultCheckedKeys: Array, }, data() { return { @@ -32,11 +34,21 @@ export default { title: 'menuName', key: 'menuId', }, + expandedKeys: [], }; }, async mounted() { this.rawData = await getMenuDataApi(); this.treeData = convertListToTree(this.rawData, !this.showMenu); + this.$emit('check', this.defaultCheckedKeys); + this.expandedKeys = this.defaultCheckedKeys; + }, + + watch: { + defaultCheckedKeys(val) { + this.$emit('check', val); + this.expandedKeys = val; + }, }, methods: { diff --git a/src/pages/system/view/role/form.vue b/src/pages/system/view/role/form.vue index 41b3a61f1d2433d586d26f4deec9e9fedc866862..61d916596ecc44b8e5c50edc0af83ae5d42b7732 100644 --- a/src/pages/system/view/role/form.vue +++ b/src/pages/system/view/role/form.vue @@ -11,14 +11,20 @@ - + diff --git a/src/router/async/router.map.js b/src/router/async/router.map.js index 4249088000b3bb6ae5954f55708fb9928f6666ce..b781cffed72a9265b078599f76856779d28735c4 100644 --- a/src/router/async/router.map.js +++ b/src/router/async/router.map.js @@ -59,10 +59,6 @@ const routerMap = { name: '组织管理', component: () => import('@/pages/system/view/organization'), }, - user_management: { - name: '用户管理', - component: () => import('@/pages/system/view/user'), - }, role_management: { name: '角色管理', component: () => import('@/pages/system/view/role'),