1 parent
de8bcc682a
commit
920a2103cd
6 files changed
+329
-14
No files matched your search
@@ -23,7 +23,12 @@
|
||||
border: 1px solid var(--pm-border-color);
|
||||
border-radius: var(--pm-radius-sm);
|
||||
overflow: hidden;
|
||||
margin-bottom: 24px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.modern-table {
|
||||
--el-table-header-bg-color: var(--pm-bg-secondary);
|
||||
--el-table-row-hover-bg-color: color-mix(in srgb, var(--el-color-primary) 6%, transparent);
|
||||
}
|
||||
|
||||
.modern-table :deep(th.el-table__cell) {
|
||||
@@ -32,25 +37,58 @@
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.modern-table :deep(.el-table__cell) {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.modern-table :deep(.cell) {
|
||||
padding: 0 6px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.modern-table :deep(th.el-table__cell .cell) {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
border-radius: var(--pm-radius-sm);
|
||||
min-width: 48px;
|
||||
justify-content: center;
|
||||
padding: 0 5px;
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.role-tag {
|
||||
min-width: 72px;
|
||||
}
|
||||
|
||||
.new-btn {
|
||||
border-radius: var(--pm-radius-sm);
|
||||
padding: 5px 7px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
border-radius: var(--pm-radius-sm);
|
||||
padding: 4px 12px;
|
||||
padding: 4px 8px;
|
||||
}
|
||||
|
||||
.pagination-wrapper {
|
||||
margin-top: 20px;
|
||||
margin-top: 16px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@container settings-content (max-width: 760px) {
|
||||
.settings-header {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.modern-table :deep(.el-table__cell) {
|
||||
padding: 8px 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dialog Styles */
|
||||
.premium-dialog :deep(.el-dialog__header) {
|
||||
border-bottom: 1px solid var(--pm-border-color);
|
||||
|
||||
@@ -8,6 +8,37 @@ import {ElNotification} from "element-plus";
|
||||
|
||||
import {Plus} from "@element-plus/icons-vue";
|
||||
|
||||
const roleOptions = {
|
||||
super_admin: { label: '超级管理员', type: 'danger' },
|
||||
admin: { label: '管理员', type: 'primary' },
|
||||
user: { label: '普通用户', type: 'info' }
|
||||
}
|
||||
|
||||
export function roleMeta(role) {
|
||||
return roleOptions[role] || { label: '未知权限', type: 'warning' }
|
||||
}
|
||||
|
||||
export function recoveryCodeMeta(configured) {
|
||||
return configured
|
||||
? { label: '已开启', type: 'success' }
|
||||
: { label: '未开启', type: 'info' }
|
||||
}
|
||||
|
||||
export function externalEmailMeta(enabled, configured) {
|
||||
if (!enabled) {
|
||||
return { label: '已关闭', type: 'warning' }
|
||||
}
|
||||
return configured
|
||||
? { label: '已绑定', type: 'success' }
|
||||
: { label: '未绑定', type: 'info' }
|
||||
}
|
||||
|
||||
export function accountStatusMeta(disabled) {
|
||||
return disabled === 1
|
||||
? { label: '已禁用', type: 'danger' }
|
||||
: { label: '正常', type: 'success' }
|
||||
}
|
||||
|
||||
export function usePage() {
|
||||
const userList = reactive([])
|
||||
|
||||
@@ -121,7 +152,11 @@ export function usePage() {
|
||||
reflushList,
|
||||
handleEdit,
|
||||
createUser,
|
||||
submit
|
||||
submit,
|
||||
roleMeta,
|
||||
recoveryCodeMeta,
|
||||
externalEmailMeta,
|
||||
accountStatusMeta
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,22 +7,58 @@
|
||||
|
||||
<div class="table-container">
|
||||
<el-table :data="userList" class="modern-table" style="width: 100%" empty-text="暂无用户">
|
||||
<el-table-column label="ID" prop="ID" width="80" />
|
||||
<el-table-column :label="lang.account" prop="Account" min-width="150" show-overflow-tooltip />
|
||||
<el-table-column :label="lang.user_name" prop="Name" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column :label="lang.disabled" prop="Disabled" width="120">
|
||||
<el-table-column label="ID" prop="ID" width="44" />
|
||||
<el-table-column :label="lang.account" prop="Account" width="88" show-overflow-tooltip />
|
||||
<el-table-column :label="lang.user_name" prop="Name" width="76" show-overflow-tooltip />
|
||||
<el-table-column label="权限级别" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag
|
||||
:type="scope.row.Disabled === 1 ? 'info' : 'success'"
|
||||
:type="roleMeta(scope.row.Role).type"
|
||||
size="small"
|
||||
effect="light"
|
||||
class="status-tag role-tag"
|
||||
>
|
||||
{{ roleMeta(scope.row.Role).label }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="安全码" width="72">
|
||||
<template #default="scope">
|
||||
<el-tag
|
||||
:type="recoveryCodeMeta(scope.row.RecoveryCodeConfigured).type"
|
||||
size="small"
|
||||
effect="plain"
|
||||
class="status-tag"
|
||||
>
|
||||
{{ scope.row.Disabled === 1 ? lang.disabled : lang.enabled }}
|
||||
{{ recoveryCodeMeta(scope.row.RecoveryCodeConfigured).label }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="right" width="100">
|
||||
<el-table-column label="外部邮箱" width="76">
|
||||
<template #default="scope">
|
||||
<el-tag
|
||||
:type="externalEmailMeta(scope.row.ExternalEmailEnabled, scope.row.ExternalEmailConfigured).type"
|
||||
size="small"
|
||||
effect="plain"
|
||||
class="status-tag"
|
||||
>
|
||||
{{ externalEmailMeta(scope.row.ExternalEmailEnabled, scope.row.ExternalEmailConfigured).label }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="账号状态" width="72">
|
||||
<template #default="scope">
|
||||
<el-tag
|
||||
:type="accountStatusMeta(scope.row.Disabled).type"
|
||||
size="small"
|
||||
effect="plain"
|
||||
class="status-tag"
|
||||
>
|
||||
{{ accountStatusMeta(scope.row.Disabled).label }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="right" width="68">
|
||||
<template #header>
|
||||
<el-button type="primary" size="small" @click="createUser" class="new-btn" plain>
|
||||
<el-icon><Plus /></el-icon> 新建
|
||||
@@ -47,7 +83,7 @@
|
||||
<div class="pagination-wrapper">
|
||||
<el-pagination
|
||||
v-model:current-page="currentPage"
|
||||
small
|
||||
size="small"
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:page-count="totalPage"
|
||||
@@ -115,7 +151,11 @@ const {
|
||||
title,
|
||||
submit,
|
||||
editModel,
|
||||
editUserInfo
|
||||
editUserInfo,
|
||||
roleMeta,
|
||||
recoveryCodeMeta,
|
||||
externalEmailMeta,
|
||||
accountStatusMeta
|
||||
} = usePage();
|
||||
</script>
|
||||
|
||||
|
||||
Reference in new issue
Block a user