This commit is contained in:
Your Name
2026-07-23 13:13:31 +08:00
parent 1a3c2d15c8
commit 5b93e4536f
16 changed files with 302 additions and 68 deletions
+3 -10
View File
@@ -58,7 +58,7 @@
</el-table-column>
<el-table-column label="最后登录" width="170">
<template #default="scope">
{{ scope.row.last_login_at ? formatDate(scope.row.last_login_at) : '-' }}
{{ scope.row.last_login_at ? formatDateTime(scope.row.last_login_at) : '-' }}
</template>
</el-table-column>
<el-table-column label="操作" width="280" align="center" fixed="right">
@@ -162,6 +162,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus, Search, Refresh } from '@element-plus/icons-vue'
import { userApi } from '@/api/auth'
import { formatDateTime, formatDate, formatRelative } from '@/utils/datetime'
import { authStore } from '@/utils/auth'
const loading = ref(false)
@@ -206,15 +207,7 @@ function roleTagType(r) { return ROLE_MAP[r]?.tagType || '' }
function statusLabel(s) { return STATUS_MAP[s]?.label || s || '-' }
function statusTagType(s) { return STATUS_MAP[s]?.tagType || '' }
function formatDate(d) {
if (!d) return '-'
try {
const dt = new Date(d)
if (isNaN(dt.getTime())) return d
const pad = n => String(n).padStart(2, '0')
return `${dt.getFullYear()}-${pad(dt.getMonth()+1)}-${pad(dt.getDate())} ${pad(dt.getHours())}:${pad(dt.getMinutes())}`
} catch { return d }
}
// 旧 formatDate 已由 @/utils/datetime 统一替代
async function loadUsers() {
loading.value = true