This commit is contained in:
橙子
2021-10-19 17:44:37 +08:00
parent d31bf1af9d
commit 1d33fa487d
5 changed files with 30 additions and 5 deletions

View File

@@ -114,8 +114,14 @@ namespace Yi.Framework.ApiMicroservice.Controllers
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public async Task<Result> GetRolesByUserId(int userId) public async Task<Result> GetRolesByUserId(int userId)
<<<<<<< Updated upstream
{ {
var roleList = await _userService.GetRolesByUser(new user() { id=userId}); var roleList = await _userService.GetRolesByUser(new user() { id=userId});
=======
{
var _user =await _userService.GetEntityById(userId);
var roleList = await _userService.GetRolesByUser(_user);
>>>>>>> Stashed changes
return Result.Success().SetData(roleList); return Result.Success().SetData(roleList);
} }
/// <summary> /// <summary>

View File

@@ -7,10 +7,17 @@ export default {
data: { "ids1": userIds, "ids2": roleIds } data: { "ids1": userIds, "ids2": roleIds }
}) })
}, },
GetRolesByUser() { GetRolesByUser() {
return myaxios({ return myaxios({
url: '/User/GetRolesByUser', url: '/User/GetRolesByUser',
method: 'get' method: 'get'
}) })
},
GetRolesByUserId(userId) {
return myaxios({
url: `/User/GetRolesByUserId?userId=${userId}`,
method: 'get'
})
} }
} }

View File

@@ -116,6 +116,7 @@ export default {
position: "top-right", position: "top-right",
timeout: 5000, timeout: 5000,
}); });
this.init();
}); });
}, },

View File

@@ -49,6 +49,18 @@ export default {
created() { created() {
this.init(); this.init();
}, },
watch: {
selectionRole:{
handler(val, oldVal){
if(val.length==1)
{
////
this.selectionMenu=[{id:38},{id:39}]
}
},
deep:true
},
},
methods: { methods: {
setMenu(){ setMenu(){
var roleIds=[]; var roleIds=[];

View File

@@ -36,14 +36,13 @@ export default {
methods: { methods: {
async showItem(item) { async showItem(item) {
var strInfo = ""; var strInfo = "";
roleApi.GetRolesByUser().then(resp=>{
})
Object.keys(item).forEach(function (key) { Object.keys(item).forEach(function (key) {
strInfo += key + ":" + item[key] + "<br>"; strInfo += key + ":" + item[key] + "<br>";
}); });
userApi.GetRolesByUserId(item.id).then(resp=>{
const roleData=resp.data;
roleData.forEach(u=>{strInfo+="角色名:"+u.role_name})
})
await this.$dialog.confirm({ await this.$dialog.confirm({
text: strInfo, text: strInfo,
title: "信息详情", title: "信息详情",