chore: 🔨 用户管理-角色排序 (#212)

[skip ci]

Co-authored-by: tk <fiyne1a@dingtalk.com>
This commit is contained in:
nsnail 2024-11-22 12:11:10 +08:00 committed by GitHub
parent 69dc407002
commit 6d87d8e9cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 16 deletions

View File

@ -240,7 +240,9 @@ public sealed class UserService(
.Count(out var total)
.ToListAsync(listUserExp)
.ConfigureAwait(false);
return new PagedQueryRsp<QueryUserRsp>(req.Page, req.PageSize, total, list.Adapt<IEnumerable<QueryUserRsp>>());
return new PagedQueryRsp<QueryUserRsp>(req.Page, req.PageSize, total
, list.Select(x => x with { Roles = x.Roles.OrderBy(y => y.Sort).ThenBy(y => y.Id).ToList() })
.Adapt<IEnumerable<QueryUserRsp>>());
}
/// <inheritdoc />

View File

@ -36,14 +36,6 @@
placeholder: $t('用户编号 / 用户名 / 手机号 / 邮箱 / 备注'),
style: 'width:25rem',
},
{
type: 'remote-select',
field: ['filter', 'roleId'],
api: $API.sys_role.query,
config: { props: { label: 'name', value: 'id' } },
placeholder: $t('所属角色'),
style: 'width:15rem',
},
{
type: 'cascader',
field: ['filter', 'deptId'],
@ -52,6 +44,14 @@
placeholder: $t('所属部门'),
style: 'width:15rem',
},
{
type: 'remote-select',
field: ['filter', 'roleId'],
api: $API.sys_role.query,
config: { props: { label: 'name', value: 'id' } },
placeholder: $t('所属角色'),
style: 'width:15rem',
},
]"
:vue="this"
@reset="onReset"
@ -103,18 +103,18 @@
<na-col-id :label="$t('用户编号')" prop="id" sortable="custom" width="170" />
<na-col-avatar :label="$t('用户名')" prop="userName" width="170" />
<el-table-column :label="$t('手机号')" align="center" prop="mobile" sortable="custom" width="120" />
<el-table-column :label="$t('邮箱')" align="right" prop="email" sortable="custom" />
<na-col-tags
:label="$t('所属角色')"
@click="(item) => (this.dialog.roleSave = { row: item, mode: 'view' })"
field="name"
prop="roles" />
<el-table-column :label="$t('邮箱')" align="right" prop="email" sortable="custom" width="250" />
<na-col-tags
:label="$t('所属部门')"
@click="(item) => (this.dialog.deptSave = { row: item, mode: 'view' })"
field="name"
prop="dept"
width="200" />
width="120" />
<na-col-tags
:label="$t('所属角色')"
@click="(item) => (this.dialog.roleSave = { row: item, mode: 'view' })"
field="name"
prop="roles" />
<el-table-column :label="$t('最后登录')" align="right" prop="lastLoginTime" sortable="custom" width="120">
<template #default="{ row }">
<span v-time.tip="row.lastLoginTime" :title="row.lastLoginTime"></span>