前端对接接口
This commit is contained in:
@@ -75,7 +75,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
|
||||
return Result.Success();
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<Result> GetMenuByRloeIds(int roleId)
|
||||
public async Task<Result> GetMenuByRloe(int roleId)
|
||||
{
|
||||
var menuList =await _roleService.GetMenusByRoleId(roleId);
|
||||
return Result.Success().SetData(menuList);
|
||||
|
||||
Binary file not shown.
@@ -12,5 +12,12 @@ export default {
|
||||
method: 'post',
|
||||
data: { ids1: roleList, ids2: menuList }
|
||||
})
|
||||
},
|
||||
getMenuByRloe(roleId) {
|
||||
return myaxios({
|
||||
url: `/Role/getMenuByRloe?roleId=${roleId}`,
|
||||
method: 'get'
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<app-btn dark class="ma-4" @click="dialog = true"> 添加新项 </app-btn>
|
||||
<app-btn dark class="ma-4" color="secondary" @click="deleteItem(null)">
|
||||
<app-btn dark class="my-4" color="secondary" @click="deleteItem(null)">
|
||||
删除所选
|
||||
</app-btn>
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
</v-dialog>
|
||||
|
||||
<v-treeview
|
||||
open-on-click
|
||||
selectable
|
||||
:items="desserts"
|
||||
:selection-type="selectionType"
|
||||
@@ -52,6 +53,8 @@
|
||||
<v-btn class="mr-2">编号:{{ item.id }}</v-btn>
|
||||
<v-btn class="mr-2">图标:{{ item.icon }}</v-btn>
|
||||
<v-btn class="mr-2">路由:{{ item.router }}</v-btn>
|
||||
<v-btn v-if="item.mould" class="mr-2">接口名:{{ item.mould.mould_name }}</v-btn>
|
||||
<v-btn v-if="item.mould" class="mr-2">接口地址:{{ item.mould.url }}</v-btn>
|
||||
<ccCombobox
|
||||
headers="设置接口权限"
|
||||
itemText="mould_name"
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
<template>
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<material-card color="primary" icon="mdi-account-outline">
|
||||
<template #title>
|
||||
角色菜单分配管理 — <small class="text-body-1">你可以在这里多角色分配多菜单</small>
|
||||
</template><app-btn class="ma-4" @click="setMenu">确定分配</app-btn></material-card>
|
||||
<material-card color="primary" icon="mdi-account-outline">
|
||||
<template #title>
|
||||
角色菜单分配管理 —
|
||||
<small class="text-body-1"
|
||||
>你可以在这里多角色分配多菜单/选中一个可查看</small
|
||||
> </template
|
||||
><app-btn class="ma-4" @click="setMenu">确定分配</app-btn
|
||||
><app-btn class="my-4" color="secondary" @click="clear">清空选择</app-btn></material-card
|
||||
>
|
||||
</v-col>
|
||||
<v-col cols="12" md="4" lg="4">
|
||||
<v-card class="mx-auto" width="100%">
|
||||
|
||||
<v-treeview
|
||||
selectable
|
||||
:items="RoleItems"
|
||||
@@ -25,6 +29,7 @@
|
||||
<v-col cols="12" md="8" lg="8">
|
||||
<v-card class="mx-auto" width="100%">
|
||||
<v-treeview
|
||||
open-on-click
|
||||
selectable
|
||||
:items="Menuitems"
|
||||
selection-type="leaf"
|
||||
@@ -47,36 +52,40 @@ import roleApi from "../api/roleApi";
|
||||
import menuApi from "../api/menuApi";
|
||||
export default {
|
||||
created() {
|
||||
this.init();
|
||||
this.init();
|
||||
},
|
||||
watch: {
|
||||
selectionRole:{
|
||||
handler(val, oldVal){
|
||||
if(val.length==1)
|
||||
{
|
||||
////
|
||||
this.selectionMenu=[{id:38},{id:39}]
|
||||
}
|
||||
},
|
||||
deep:true
|
||||
},
|
||||
watch: {
|
||||
selectionRole: {
|
||||
handler(val, oldVal) {
|
||||
if (val.length == 1) {
|
||||
roleApi.getMenuByRloe(val[0].id).then((resp) => {
|
||||
this.selectionMenu = resp.data;
|
||||
});
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
setMenu(){
|
||||
var roleIds=[];
|
||||
var menuIds=[];
|
||||
this.selectionRole.forEach((ele)=>{
|
||||
roleIds.push(ele.id)
|
||||
})
|
||||
this.selectionMenu.forEach((ele)=>{
|
||||
menuIds.push(ele.id)
|
||||
})
|
||||
roleApi.setMenuByRole(roleIds,menuIds).then(resp=>{
|
||||
this.$dialog.notify.info(resp.msg, {
|
||||
clear() {
|
||||
this.selectionMenu = [];
|
||||
this.selectionRole = [];
|
||||
},
|
||||
setMenu() {
|
||||
var roleIds = [];
|
||||
var menuIds = [];
|
||||
this.selectionRole.forEach((ele) => {
|
||||
roleIds.push(ele.id);
|
||||
});
|
||||
this.selectionMenu.forEach((ele) => {
|
||||
menuIds.push(ele.id);
|
||||
});
|
||||
roleApi.setMenuByRole(roleIds, menuIds).then((resp) => {
|
||||
this.$dialog.notify.info(resp.msg, {
|
||||
position: "top-right",
|
||||
timeout: 5000,
|
||||
});
|
||||
})
|
||||
});
|
||||
},
|
||||
init() {
|
||||
roleApi.getRole().then((resp) => {
|
||||
|
||||
Reference in New Issue
Block a user