You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OneAuth/ui/page/app/user.html

101 lines
2.5 KiB
HTML

7 months ago
<!doctype html>
<html>
<head>
<title>用户管理</title>
</head>
<style>
body {
padding: 20px;
}
.header {
font-size: 24px;
line-height: 1.5;
margin-bottom: 20px;
font-weight: 600;
}
.dialog {
height: 60vh;
width: 60vw;
background-color: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
padding: 2rem;
border-radius: 0.5rem;
}
</style>
<body>
<div class="header">应用用户管理</div>
<v-table :axios='$axios' :keys="keys" api='/api/user'>
<v-btn vslot='_addon' size='sm' @click='show_user(row)' color='#2c9'>权限表</v-btn>
7 months ago
</v-table>
<v-dialog v:show='show'>
<div class="dialog">
<div class="text-2xl">{{selected.username}} 角色表</div>
3 months ago
<v-table :axios='$axios' :keys="au_keys" :api='`/api/user/${$G.app.id}/user_role`'></v-table>
7 months ago
</div>
</v-dialog>
</body>
<script setup>
show = false
console.log($env)
7 months ago
auOpts = {
0: ['正常', 'positive'],
1: ['拒绝', 'warning'],
2: ['申请中', 'primary'],
3: ['禁用', 'warning'],
}
keys = [
{
name: 'id',
label: 'ID',
style: '',
},
{
name: 'username',
label: '用户名',
style: 'text-align: left',
sortable: true
},
{
name: 'nickname',
label: '昵称',
style: 'text-align: left',
7 months ago
editable: true,
7 months ago
sortable: true
},
{name: 'created_at', label: '创建时间', field: (r) => new Date(r.created_at).toLocaleString()},
{name: 'updated_at', label: '更新时间', field: (r) => new Date(r.updated_at).toLocaleString()},
{name: 'status', label: '账号状态', sortable: true},
]
au_keys = [
{name: 'id', label: 'ID', no_create: true},
{name: 'role_name', label: 'role_name'},
7 months ago
{name: 'created_at', label: '创建时间', no_create: true, field: (r) => new Date(r.created_at).toLocaleString()},
{name: 'updated_at', label: '更新时间', no_create: true, field: (r) => new Date(r.updated_at).toLocaleString()},
{name: 'status', label: '账号状态', sortable: true},
]
user_role_data = []
selected = {}
show_user = async (row) => {
selected = row
console.log(row)
user_role_url = `/api/user/${row.id}/user_role`
7 months ago
// accessData = await access_api.next(0, 10)
// user_role_data = await user_role_api.next(0, 10)
7 months ago
show = true
}
user_role_api = {
next: async (page, size) => {
return await $axios.get(user_role_url, {params: {page, size}})
7 months ago
}
}
</script>
</html>