feat: 用户页面增加单位、角色、权限展示
This commit is contained in:
parent
215318e29e
commit
0b9e99d00f
@ -15,6 +15,11 @@ const logout = () => {
|
||||
router.replaceAll('/pages/login/index')
|
||||
}
|
||||
|
||||
const departmentMap = {
|
||||
4: '重庆眩生花科技有限公司',
|
||||
5: '重庆电子科技职业大学',
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
toast.loading({
|
||||
msg: '加载中...'
|
||||
@ -32,8 +37,9 @@ onMounted(() => {
|
||||
<WdCellGroup :border="true">
|
||||
<WdCell title="用户名" :value="user.userinfo?.username || '-'" />
|
||||
<WdCell title="邮箱" :value="user.userinfo?.email || '-'" />
|
||||
<WdCell title="单位" :value="user.userinfo?.department_id || '-'" />
|
||||
<WdCell title="角色" :value="user.userinfo?.roles.join('') || '-'" />
|
||||
<WdCell title="单位" :value="user.userinfo?.department_id ? departmentMap[user.userinfo.department_id] : '-'" />
|
||||
<WdCell title="角色" :value="user.userinfo?.roles.map(i => i.role_name).join(', ') || '-'" />
|
||||
<WdCell title="权限" :value="user.userinfo?.jobs.map(i => i.job_name).join(', ') || '-'" />
|
||||
</WdCellGroup>
|
||||
<div class="px-4">
|
||||
<wd-button plain hairline block type="error" @click="logout">退出账号</wd-button>
|
||||
|
@ -12,8 +12,8 @@ export interface User {
|
||||
updated_at: string;
|
||||
deleted_at: Date;
|
||||
permissions: Permission[];
|
||||
roles: any[];
|
||||
jobs: any[];
|
||||
roles: Role[];
|
||||
jobs: Job[];
|
||||
}
|
||||
|
||||
export interface Permission {
|
||||
@ -41,3 +41,39 @@ export enum PermissionModule {
|
||||
Permissions = "permissions",
|
||||
User = "user",
|
||||
}
|
||||
|
||||
export interface Job {
|
||||
id: number;
|
||||
job_name: string;
|
||||
coding: string;
|
||||
status: number;
|
||||
sort: number;
|
||||
description: string;
|
||||
creator_id: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
pivot: JobPivot;
|
||||
}
|
||||
|
||||
export interface JobPivot {
|
||||
user_id: number;
|
||||
job_id: number;
|
||||
}
|
||||
|
||||
export interface Role {
|
||||
id: number;
|
||||
role_name: string;
|
||||
identify: string;
|
||||
parent_id: number;
|
||||
description: string;
|
||||
data_range: number;
|
||||
creator_id: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
pivot: RolePivot;
|
||||
}
|
||||
|
||||
export interface RolePivot {
|
||||
user_id: number;
|
||||
role_id: number;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user