🔀 合并回收站后台改动到生产分支
This commit is contained in:
commit
08772a8305
22 files changed
+531
-35
No files matched your search
@@ -85,6 +85,22 @@ textarea {
|
||||
box-shadow: 0 16px 34px rgba(114, 143, 150, 0.26);
|
||||
}
|
||||
|
||||
.fcb-interactive-row {
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
transition:
|
||||
background-color 180ms ease,
|
||||
border-color 180ms ease,
|
||||
box-shadow 180ms ease,
|
||||
transform 180ms ease;
|
||||
}
|
||||
|
||||
.fcb-interactive-row:hover {
|
||||
z-index: 1;
|
||||
box-shadow: inset 3px 0 0 rgba(95, 135, 150, 0.7), 0 10px 22px rgba(86, 118, 126, 0.16);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.dark .theme-2026-card {
|
||||
border-color: rgba(68, 86, 94, 0.82);
|
||||
background:
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
export { useAdminActivities } from './useAdminActivities'
|
||||
export { useAdminTrash } from './useAdminTrash'
|
||||
export { useAdminFiles } from './useAdminFiles'
|
||||
export { useAdminLogin } from './useAdminLogin'
|
||||
export { useAdminSession } from './useAdminSession'
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { ActivityService } from '@/services'
|
||||
import type { AdminActivityListParams, AdminActivityListResponse } from '@/types'
|
||||
|
||||
export function useAdminActivities() {
|
||||
const fetchAdminActivities = async (
|
||||
params: AdminActivityListParams
|
||||
): Promise<AdminActivityListResponse | null> => {
|
||||
const response = await ActivityService.getAdminActivities(params)
|
||||
return response.detail || null
|
||||
}
|
||||
|
||||
return { fetchAdminActivities }
|
||||
}
|
||||
@@ -9,8 +9,13 @@ export function useAdminSession() {
|
||||
|
||||
try {
|
||||
const response = await AuthService.verifyToken()
|
||||
if (response.code === 200 && response.detail?.token) {
|
||||
adminStore.login(response.detail)
|
||||
// The current stored bearer token is what was just verified by the server.
|
||||
// Do not redirect a valid session merely because an adapter omits a token
|
||||
// field in the verification payload; only replace it when one is supplied.
|
||||
if (response.code === 200) {
|
||||
if (response.detail?.token) {
|
||||
adminStore.login(response.detail)
|
||||
}
|
||||
return true
|
||||
}
|
||||
} catch {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TrashService } from '@/services'
|
||||
import type { TrashListParams, TrashListResponse } from '@/types'
|
||||
|
||||
export function useAdminTrash() {
|
||||
const fetchTrash = async (params: TrashListParams): Promise<TrashListResponse | null> => {
|
||||
const response = await TrashService.list(params)
|
||||
return response.detail || null
|
||||
}
|
||||
|
||||
const restoreTrashItem = async (id: number) => TrashService.restore(id)
|
||||
const purgeTrashItem = async (id: number) => TrashService.purge(id)
|
||||
const updateTrashRetention = async (id: number, retentionDays: number) =>
|
||||
TrashService.updateRetention(id, retentionDays)
|
||||
|
||||
return { fetchTrash, restoreTrashItem, purgeTrashItem, updateTrashRetention }
|
||||
}
|
||||
@@ -68,6 +68,8 @@ export const ROUTES = {
|
||||
LOGIN: '/login',
|
||||
DASHBOARD: '/admin/dashboard',
|
||||
FILE_MANAGE: '/admin/files',
|
||||
TRASH: '/admin/trash',
|
||||
ACTIVITY_LOG: '/admin/activities',
|
||||
SETTINGS: '/admin/settings'
|
||||
} as const
|
||||
|
||||
@@ -78,6 +80,8 @@ export const ROUTE_NAMES = {
|
||||
LOGIN: 'Login',
|
||||
DASHBOARD: 'Dashboard',
|
||||
FILE_MANAGE: 'FileManage',
|
||||
TRASH: 'Trash',
|
||||
ACTIVITY_LOG: 'ActivityLog',
|
||||
SETTINGS: 'Settings'
|
||||
} as const
|
||||
|
||||
@@ -85,7 +89,7 @@ export const ROUTE_NAMES = {
|
||||
export const REGEX_PATTERNS = {
|
||||
EMAIL: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
||||
PHONE: /^1[3-9]\d{9}$/,
|
||||
CODE: /^[A-Za-z0-9]{4,8}$/ // 取件码格式
|
||||
CODE: /^[A-Za-z0-9]{4,16}$/ // 兼容旧码并支持当前 8 位及未来扩容
|
||||
} as const
|
||||
|
||||
// 默认配置
|
||||
|
||||
@@ -210,6 +210,8 @@ export default {
|
||||
count: 'Download Count'
|
||||
},
|
||||
maxSaveTime: 'Max Retention Period',
|
||||
trashRetentionDays: 'Recycle Bin Default Retention',
|
||||
trashRetentionDaysNote: 'Changing this recalculates cleanup time for dated items currently in the recycle bin. Permanent and already purged items are not affected.',
|
||||
timeUnits: {
|
||||
second: 'sec',
|
||||
minute: 'min',
|
||||
@@ -757,6 +759,8 @@ export default {
|
||||
count: 'Download Count'
|
||||
},
|
||||
maxSaveTime: 'Max Retention Period',
|
||||
trashRetentionDays: 'Recycle Bin Default Retention',
|
||||
trashRetentionDaysNote: 'Changing this recalculates cleanup time for dated items currently in the recycle bin. Permanent and already purged items are not affected.',
|
||||
timeUnits: {
|
||||
second: 'sec',
|
||||
minute: 'min',
|
||||
@@ -839,6 +843,8 @@ export default {
|
||||
count: 'Download Count'
|
||||
},
|
||||
maxSaveTime: 'Max Retention Period',
|
||||
trashRetentionDays: 'Recycle Bin Default Retention',
|
||||
trashRetentionDaysNote: 'Changing this recalculates cleanup time for dated items currently in the recycle bin. Permanent and already purged items are not affected.',
|
||||
timeUnits: {
|
||||
second: 'sec',
|
||||
minute: 'min',
|
||||
|
||||
@@ -210,6 +210,8 @@ export default {
|
||||
count: '按下载次数'
|
||||
},
|
||||
maxSaveTime: '文件最长保存时间',
|
||||
trashRetentionDays: '回收站默认保留期',
|
||||
trashRetentionDaysNote: '修改后会重新计算当前回收站中有期限文件的清理时间;已设为永久或已清理的文件不受影响。',
|
||||
timeUnits: {
|
||||
second: '秒',
|
||||
minute: '分钟',
|
||||
@@ -778,6 +780,8 @@ export default {
|
||||
count: '按下载次数'
|
||||
},
|
||||
maxSaveTime: '文件最长保存时间',
|
||||
trashRetentionDays: '回收站默认保留期',
|
||||
trashRetentionDaysNote: '修改后会重新计算当前回收站中有期限文件的清理时间;已设为永久或已清理的文件不受影响。',
|
||||
s3AccessKeyId: 'Access Key ID',
|
||||
s3SecretAccessKey: 'Secret Access Key',
|
||||
s3BucketName: '存储桶名称',
|
||||
@@ -926,6 +930,8 @@ export default {
|
||||
count: '按下载次数'
|
||||
},
|
||||
maxSaveTime: '文件最长保存时间',
|
||||
trashRetentionDays: '回收站默认保留期',
|
||||
trashRetentionDaysNote: '修改后会重新计算当前回收站中有期限文件的清理时间;已设为永久或已清理的文件不受影响。',
|
||||
timeUnits: {
|
||||
second: '秒',
|
||||
minute: '分钟',
|
||||
|
||||
@@ -126,8 +126,10 @@ import {
|
||||
MenuIcon,
|
||||
XIcon,
|
||||
FolderIcon,
|
||||
Trash2Icon,
|
||||
CogIcon,
|
||||
LayoutDashboardIcon,
|
||||
ClipboardListIcon,
|
||||
LogOutIcon
|
||||
} from 'lucide-vue-next'
|
||||
import { RouterLink, useRoute, useRouter } from 'vue-router'
|
||||
@@ -146,7 +148,7 @@ const router = useRouter()
|
||||
const route = useRoute()
|
||||
const { t } = useI18n()
|
||||
const isDarkMode = inject('isDarkMode')
|
||||
const { verifySession, logout } = useAdminSession()
|
||||
const { logout } = useAdminSession()
|
||||
const menuItems: MenuItem[] = [
|
||||
{
|
||||
id: ROUTE_NAMES.DASHBOARD,
|
||||
@@ -160,6 +162,18 @@ const menuItems: MenuItem[] = [
|
||||
icon: FolderIcon,
|
||||
redirect: ROUTES.FILE_MANAGE
|
||||
},
|
||||
{
|
||||
id: ROUTE_NAMES.TRASH,
|
||||
name: '回收站',
|
||||
icon: Trash2Icon,
|
||||
redirect: ROUTES.TRASH
|
||||
},
|
||||
{
|
||||
id: ROUTE_NAMES.ACTIVITY_LOG,
|
||||
name: '操作记录',
|
||||
icon: ClipboardListIcon,
|
||||
redirect: ROUTES.ACTIVITY_LOG
|
||||
},
|
||||
{
|
||||
id: ROUTE_NAMES.SETTINGS,
|
||||
name: t('admin.settings.title'),
|
||||
@@ -212,11 +226,6 @@ onMounted(() => {
|
||||
handleResize()
|
||||
window.addEventListener('resize', handleResize)
|
||||
window.addEventListener('keydown', handleEscape)
|
||||
void verifySession().then((isValid) => {
|
||||
if (!isValid) {
|
||||
void router.push(ROUTES.LOGIN)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
|
||||
@@ -59,6 +59,24 @@ const routes: RouteRecordRaw[] = [
|
||||
title: 'files'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'trash',
|
||||
name: ROUTE_NAMES.TRASH,
|
||||
component: () => import('@/views/manage/TrashView.vue'),
|
||||
meta: {
|
||||
...adminPageMeta,
|
||||
title: 'trash'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'activities',
|
||||
name: ROUTE_NAMES.ACTIVITY_LOG,
|
||||
component: () => import('@/views/manage/ActivityLogView.vue'),
|
||||
meta: {
|
||||
...adminPageMeta,
|
||||
title: 'activities'
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'settings',
|
||||
name: ROUTE_NAMES.SETTINGS,
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import api from './client'
|
||||
import type { AdminActivityListParams, AdminActivityListResponse, ApiResponse } from '@/types'
|
||||
|
||||
export class ActivityService {
|
||||
static async getAdminActivities(
|
||||
params: AdminActivityListParams
|
||||
): Promise<ApiResponse<AdminActivityListResponse>> {
|
||||
return api.get('/admin/activities', { params })
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
export { AUTH_EVENTS } from './client'
|
||||
export { ActivityService } from './activity'
|
||||
export { AuthService } from './auth'
|
||||
export { ConfigService } from './config'
|
||||
export { FileService } from './file'
|
||||
export { PresignUploadService } from './presign-upload'
|
||||
export { StatsService } from './stats'
|
||||
export { TrashService } from './trash'
|
||||
export { uploadChunkedFile } from './upload-strategy'
|
||||
@@ -0,0 +1,20 @@
|
||||
import api from './client'
|
||||
import type { ApiResponse, TrashListParams, TrashListResponse } from '@/types'
|
||||
|
||||
export class TrashService {
|
||||
static async list(params: TrashListParams): Promise<ApiResponse<TrashListResponse>> {
|
||||
return api.get('/admin/trash/list', { params })
|
||||
}
|
||||
|
||||
static async restore(id: number): Promise<ApiResponse> {
|
||||
return api.post('/admin/trash/restore', { id })
|
||||
}
|
||||
|
||||
static async purge(id: number): Promise<ApiResponse> {
|
||||
return api.delete('/admin/trash/purge', { data: { id } })
|
||||
}
|
||||
|
||||
static async updateRetention(id: number, retentionDays: number): Promise<ApiResponse> {
|
||||
return api.post('/admin/trash/retention', { id, retentionDays })
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
export interface AdminActivityEvent {
|
||||
id: string
|
||||
action: string
|
||||
targetType: string
|
||||
target_type?: string
|
||||
targetId?: string | number | null
|
||||
target_id?: string | number | null
|
||||
targetName: string
|
||||
target_name?: string
|
||||
count: number
|
||||
meta: Record<string, unknown>
|
||||
createdAt: string
|
||||
created_at?: string
|
||||
}
|
||||
|
||||
export interface AdminActivityOption {
|
||||
value: string
|
||||
label: string
|
||||
count: number
|
||||
}
|
||||
|
||||
export interface AdminActivityListResponse {
|
||||
activities?: AdminActivityEvent[]
|
||||
items?: AdminActivityEvent[]
|
||||
page: number
|
||||
size: number
|
||||
total: number
|
||||
storedTotal?: number
|
||||
stored_total?: number
|
||||
filters?: {
|
||||
action?: string
|
||||
targetType?: string
|
||||
target_type?: string
|
||||
keyword?: string
|
||||
}
|
||||
actionOptions?: AdminActivityOption[]
|
||||
action_options?: AdminActivityOption[]
|
||||
targetTypeOptions?: AdminActivityOption[]
|
||||
target_type_options?: AdminActivityOption[]
|
||||
}
|
||||
|
||||
export interface AdminActivityListParams {
|
||||
page: number
|
||||
size: number
|
||||
action?: string
|
||||
targetType?: string
|
||||
keyword?: string
|
||||
}
|
||||
@@ -43,6 +43,7 @@ export interface ConfigState {
|
||||
storage_path: string
|
||||
uploadMinute: number
|
||||
max_save_seconds: number
|
||||
trashRetentionDays: number
|
||||
opacity: number
|
||||
enableChunk: number
|
||||
s3_access_key_id: string
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
export * from './activity'
|
||||
export * from './api'
|
||||
export * from './auth'
|
||||
export * from './config'
|
||||
export * from './dashboard'
|
||||
export * from './file'
|
||||
export * from './presign-upload'
|
||||
export * from './trash'
|
||||
export * from './ui'
|
||||
@@ -0,0 +1,27 @@
|
||||
export interface TrashFileItem {
|
||||
id: number
|
||||
code: string
|
||||
name?: string
|
||||
prefix?: string
|
||||
suffix?: string
|
||||
size: number
|
||||
text?: string | null
|
||||
trashedAt?: string | null
|
||||
trashExpiresAt?: string | null
|
||||
trashReason?: string | null
|
||||
trashPurgedAt?: string | null
|
||||
isTrashPermanent?: boolean
|
||||
isTrashPurged?: boolean
|
||||
}
|
||||
|
||||
export interface TrashListResponse {
|
||||
page: number
|
||||
size: number
|
||||
total: number
|
||||
data: TrashFileItem[]
|
||||
}
|
||||
|
||||
export interface TrashListParams {
|
||||
page: number
|
||||
size: number
|
||||
}
|
||||
@@ -41,6 +41,7 @@ export const DEFAULT_CONFIG_STATE: ConfigState = {
|
||||
storage_path: '',
|
||||
uploadMinute: 1,
|
||||
max_save_seconds: DEFAULT_PUBLIC_CONFIG.max_save_seconds,
|
||||
trashRetentionDays: 30,
|
||||
opacity: 0.9,
|
||||
enableChunk: DEFAULT_PUBLIC_CONFIG.enableChunk,
|
||||
s3_access_key_id: '',
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<div class="p-4 sm:p-6">
|
||||
<header class="mb-5 flex flex-col gap-3 sm:mb-6 sm:flex-row sm:items-end sm:justify-between">
|
||||
<div>
|
||||
<p class="text-xs font-medium tracking-[0.16em]" :class="mutedTextClass">ADMIN AUDIT</p>
|
||||
<h2 class="mt-1 text-2xl font-bold" :class="primaryTextClass">操作记录</h2>
|
||||
<p class="mt-1 text-sm" :class="mutedTextClass">查看后台管理、回收站和配置变更的可追溯记录。</p>
|
||||
</div>
|
||||
<BaseButton variant="secondary" :loading="isLoading" @click="loadActivities">
|
||||
<template #icon><RefreshCwIcon class="mr-2 h-4 w-4" /></template>
|
||||
刷新记录
|
||||
</BaseButton>
|
||||
</header>
|
||||
|
||||
<section class="theme-2026-card theme-2026-card-hover mb-5 rounded-[24px] border p-3 shadow-md sm:mb-6 sm:rounded-[30px] sm:p-4" :class="panelClass">
|
||||
<div class="grid gap-3 sm:grid-cols-2 xl:grid-cols-[minmax(0,1fr)_220px_220px_auto]">
|
||||
<label class="min-w-0">
|
||||
<span class="sr-only">搜索操作、对象或文件名</span>
|
||||
<span class="relative block">
|
||||
<SearchIcon class="absolute left-3 top-3 h-4 w-4" :class="mutedTextClass" />
|
||||
<input v-model="filters.keyword" class="min-h-11 w-full rounded-xl border py-2.5 pl-10 pr-3 text-sm outline-none focus:ring-2 focus:ring-[#8fb2bf]" :class="fieldClass" placeholder="搜索操作、对象或文件名" @keyup.enter="applyFilters" />
|
||||
</span>
|
||||
</label>
|
||||
<label>
|
||||
<span class="mb-1 block text-xs font-medium" :class="mutedTextClass">操作类型</span>
|
||||
<select v-model="filters.action" class="min-h-11 w-full rounded-xl border px-3 text-sm outline-none focus:ring-2 focus:ring-[#8fb2bf]" :class="fieldClass" @change="applyFilters">
|
||||
<option value="">全部操作</option>
|
||||
<option v-for="option in actionOptions" :key="option.value" :value="option.value">{{ actionLabel(option.label) }} · {{ option.count }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
<span class="mb-1 block text-xs font-medium" :class="mutedTextClass">对象类型</span>
|
||||
<select v-model="filters.targetType" class="min-h-11 w-full rounded-xl border px-3 text-sm outline-none focus:ring-2 focus:ring-[#8fb2bf]" :class="fieldClass" @change="applyFilters">
|
||||
<option value="">全部对象</option>
|
||||
<option v-for="option in targetTypeOptions" :key="option.value" :value="option.value">{{ targetTypeLabel(option.label) }} · {{ option.count }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<div class="flex items-end gap-2">
|
||||
<BaseButton class="flex-1" :loading="isLoading" @click="applyFilters">筛选</BaseButton>
|
||||
<button type="button" class="flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border transition-colors" :class="actionClass" aria-label="重置筛选" title="重置筛选" @click="resetFilters">
|
||||
<RotateCcwIcon class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="theme-2026-card overflow-hidden rounded-[24px] border shadow-md sm:rounded-[30px]" :class="panelClass">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3 border-b px-4 py-3 sm:px-6 sm:py-4" :class="dividerClass">
|
||||
<div>
|
||||
<h3 class="text-base font-semibold" :class="primaryTextClass">审计事件</h3>
|
||||
<p class="mt-0.5 text-xs" :class="mutedTextClass">筛选结果 {{ total }} 条 · 已保存 {{ storedTotal }} 条</p>
|
||||
</div>
|
||||
<span class="inline-flex items-center rounded-full px-3 py-1 text-xs font-medium" :class="isDarkMode ? 'bg-[#263941] text-[#b8d6de]' : 'bg-[#e5f0f1] text-[#365a66]'">
|
||||
<ShieldCheckIcon class="mr-1.5 h-3.5 w-3.5" /> 审计留痕
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div v-if="isLoading" class="flex min-h-64 items-center justify-center text-sm" :class="mutedTextClass"><RefreshCwIcon class="mr-2 h-4 w-4 animate-spin" />正在加载操作记录…</div>
|
||||
<div v-else-if="errorText" class="px-4 py-12 text-center sm:px-6"><p class="text-sm font-medium text-red-600">{{ errorText }}</p><BaseButton class="mt-3" variant="secondary" @click="loadActivities">重新加载</BaseButton></div>
|
||||
<div v-else-if="activities.length === 0" class="px-4 py-14 text-center sm:px-6"><ClipboardListIcon class="mx-auto h-9 w-9" :class="mutedTextClass" /><p class="mt-3 text-sm" :class="mutedTextClass">没有匹配的操作记录</p></div>
|
||||
|
||||
<div v-else class="divide-y" :class="dividerClass">
|
||||
<article
|
||||
v-for="activity in activities"
|
||||
:key="activity.id"
|
||||
class="fcb-interactive-row group grid gap-3 px-4 py-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-start sm:px-6"
|
||||
:class="isDarkMode ? 'hover:bg-[#253941]/60' : 'hover:bg-[#f2f8f8]'"
|
||||
>
|
||||
<div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl" :class="activityToneClass(activity.action)">
|
||||
<component :is="activityIcon(activity.action)" class="h-5 w-5" aria-hidden="true" />
|
||||
</div>
|
||||
<div class="min-w-0">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<p class="break-words text-sm font-semibold" :class="primaryTextClass">{{ actionLabel(activity.action) }}</p>
|
||||
<span class="rounded-full border px-2 py-0.5 text-[11px] font-medium" :class="badgeClass">{{ targetTypeLabel(activity.targetType) }}</span>
|
||||
</div>
|
||||
<p class="mt-1 break-all text-sm" :class="mutedTextClass">{{ activity.targetName || '系统对象' }}<span v-if="activity.targetId !== null && activity.targetId !== undefined" class="ml-1.5 text-xs">#{{ activity.targetId }}</span></p>
|
||||
<div v-if="metaSummary(activity.meta)" class="mt-2 inline-flex max-w-full rounded-lg px-2 py-1 text-xs" :class="isDarkMode ? 'bg-[#17262c] text-[#abc0c6]' : 'bg-[#edf4f5] text-[#557078]'">{{ metaSummary(activity.meta) }}</div>
|
||||
</div>
|
||||
<time class="text-xs tabular-nums sm:pt-1 sm:text-right" :class="mutedTextClass">{{ formatTimestamp(activity.createdAt) }}</time>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<DataPagination v-if="total > 0" :current-page="filters.page" :page-size="filters.size" :total="total" @page-change="changePage" @page-size-change="changePageSize" />
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import type { Component } from 'vue'
|
||||
import { ActivityIcon, ClipboardListIcon, CogIcon, FilePenLineIcon, RefreshCwIcon, RotateCcwIcon, SearchIcon, ShieldCheckIcon, Trash2Icon, UploadIcon } from 'lucide-vue-next'
|
||||
import BaseButton from '@/components/common/BaseButton.vue'
|
||||
import DataPagination from '@/components/common/DataPagination.vue'
|
||||
import { useAdminActivities, useInjectedDarkMode } from '@/composables'
|
||||
import type { AdminActivityEvent, AdminActivityOption } from '@/types'
|
||||
import { formatTimestamp } from '@/utils/common'
|
||||
|
||||
const isDarkMode = useInjectedDarkMode()
|
||||
const { fetchAdminActivities } = useAdminActivities()
|
||||
const activities = ref<AdminActivityEvent[]>([])
|
||||
const actionOptions = ref<AdminActivityOption[]>([])
|
||||
const targetTypeOptions = ref<AdminActivityOption[]>([])
|
||||
const total = ref(0)
|
||||
const storedTotal = ref(0)
|
||||
const isLoading = ref(false)
|
||||
const errorText = ref('')
|
||||
const filters = ref({ page: 1, size: 20, keyword: '', action: '', targetType: '' })
|
||||
|
||||
const primaryTextClass = computed(() => isDarkMode.value ? 'text-white' : 'text-[#1f3c45]')
|
||||
const mutedTextClass = computed(() => isDarkMode.value ? 'text-[#a9bdc2]' : 'text-[#617980]')
|
||||
const panelClass = computed(() => isDarkMode.value ? 'border-[#40545c] bg-[#202f36]/90' : 'border-[#d7e3e5] bg-[#f8fbfb]')
|
||||
const fieldClass = computed(() => isDarkMode.value ? 'border-[#50666f] bg-[#253941] text-white placeholder:text-[#9fb2b7]' : 'border-[#c8d8dc] bg-white text-[#263f48] placeholder:text-[#84969a]')
|
||||
const dividerClass = computed(() => isDarkMode.value ? 'divide-[#40545c] border-[#40545c]' : 'divide-[#d7e3e5] border-[#d7e3e5]')
|
||||
const actionClass = computed(() => isDarkMode.value ? 'border-[#50666f] bg-[#263941] text-[#d8e3e5] hover:bg-[#2d4751]' : 'border-[#c8d8dc] bg-[#edf4f5] text-[#415d66] hover:bg-[#e2ecee]')
|
||||
const badgeClass = computed(() => isDarkMode.value ? 'border-[#50666f] text-[#b8d6de]' : 'border-[#c8d8dc] text-[#4e6c75]')
|
||||
|
||||
const actionLabel = (action: string) => ({
|
||||
'file.delete': '移入回收站', 'files.batch_delete': '批量移入回收站', 'trash.restore': '从回收站恢复', 'trash.purge': '永久清理文件本体', 'file.update': '更新文件信息', 'files.batch_update': '批量更新文件', 'file.metadata_update': '更新文件备注', 'file.policy_action': '调整文件策略', 'files.batch_policy_action': '批量调整策略', 'config.update': '更新系统设置', 'local_file.delete': '删除本地文件', 'local_file.share': '分享本地文件'
|
||||
}[action] || action)
|
||||
const targetTypeLabel = (targetType: string) => ({ file: '文件', config: '系统配置', local_file: '本地文件', view_preset: '视图预设', system: '系统' }[targetType] || targetType || '系统')
|
||||
const activityIcon = (action: string): Component => action.includes('trash') || action.includes('delete') ? Trash2Icon : action.includes('config') ? CogIcon : action.includes('update') || action.includes('policy') ? FilePenLineIcon : action.includes('share') ? UploadIcon : ActivityIcon
|
||||
const activityToneClass = (action: string) => {
|
||||
if (action === 'trash.purge') return isDarkMode.value ? 'bg-red-950/50 text-red-300' : 'bg-red-50 text-red-600'
|
||||
if (action.includes('trash') || action.includes('delete')) return isDarkMode.value ? 'bg-amber-950/45 text-amber-300' : 'bg-amber-50 text-amber-700'
|
||||
if (action.includes('restore') || action.includes('share')) return isDarkMode.value ? 'bg-emerald-950/45 text-emerald-300' : 'bg-emerald-50 text-emerald-700'
|
||||
return isDarkMode.value ? 'bg-[#263f48] text-[#b8d6de]' : 'bg-[#e5f0f1] text-[#397084]'
|
||||
}
|
||||
const metaSummary = (meta: Record<string, unknown>) => Object.entries(meta || {}).slice(0, 3).map(([key, value]) => `${key}: ${Array.isArray(value) ? value.length + ' 项' : String(value)}`).join(' · ')
|
||||
|
||||
const loadActivities = async () => {
|
||||
isLoading.value = true
|
||||
errorText.value = ''
|
||||
try {
|
||||
const detail = await fetchAdminActivities(filters.value)
|
||||
activities.value = detail?.activities || detail?.items || []
|
||||
total.value = Number(detail?.total || 0)
|
||||
storedTotal.value = Number(detail?.storedTotal ?? detail?.stored_total ?? total.value)
|
||||
actionOptions.value = detail?.actionOptions || detail?.action_options || []
|
||||
targetTypeOptions.value = detail?.targetTypeOptions || detail?.target_type_options || []
|
||||
} catch (error: unknown) {
|
||||
errorText.value = (error as { response?: { data?: { detail?: string } } })?.response?.data?.detail || '操作记录加载失败,请稍后重试。'
|
||||
} finally { isLoading.value = false }
|
||||
}
|
||||
const applyFilters = () => { filters.value.page = 1; void loadActivities() }
|
||||
const resetFilters = () => { filters.value = { page: 1, size: filters.value.size, keyword: '', action: '', targetType: '' }; void loadActivities() }
|
||||
const changePage = (page: number) => { filters.value.page = page; void loadActivities() }
|
||||
const changePageSize = (size: number) => { filters.value.size = size; filters.value.page = 1; void loadActivities() }
|
||||
void loadActivities()
|
||||
</script>
|
||||
@@ -385,14 +385,13 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<Transition name="fcb-expand-120">
|
||||
<aside
|
||||
v-if="hasSelectedFiles"
|
||||
class="fixed inset-x-0 bottom-0 z-40 border-t px-3 pt-3 shadow-2xl backdrop-blur-xl md:hidden"
|
||||
:class="isDarkMode ? 'border-[#40545c] bg-[#17252b]/95' : 'border-[#c8d7da] bg-[#f2f6f5]/95'"
|
||||
:style="{ paddingBottom: 'max(0.75rem, env(safe-area-inset-bottom))' }"
|
||||
:aria-label="t('fileManage.mobileBatchActions')"
|
||||
>
|
||||
<aside
|
||||
v-if="hasSelectedFiles"
|
||||
class="pointer-events-auto fixed inset-x-0 bottom-0 z-[60] border-t px-3 pt-3 shadow-2xl backdrop-blur-xl md:hidden"
|
||||
:class="isDarkMode ? 'border-[#40545c] bg-[#17252b]/95' : 'border-[#c8d7da] bg-[#f2f6f5]/95'"
|
||||
:style="{ paddingBottom: 'max(0.75rem, env(safe-area-inset-bottom))', touchAction: 'manipulation' }"
|
||||
:aria-label="t('fileManage.mobileBatchActions')"
|
||||
>
|
||||
<div class="mx-auto max-w-lg space-y-2">
|
||||
<div
|
||||
v-if="showMobilePolicyActions"
|
||||
@@ -453,7 +452,7 @@
|
||||
<button
|
||||
type="button"
|
||||
class="flex min-h-12 items-center justify-center rounded-xl bg-red-600 px-2 text-sm font-medium text-white shadow-sm disabled:opacity-50"
|
||||
:disabled="isBatchUpdating || isBatchPolicyActionRunning"
|
||||
:disabled="isBatchUpdating || isBatchPolicyActionRunning || isBatchDeleting"
|
||||
@click="deleteSelectedFilesAndRefreshHistory"
|
||||
>
|
||||
<TrashIcon class="mr-1.5 h-4 w-4" aria-hidden="true" />
|
||||
@@ -461,8 +460,7 @@
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
</Transition>
|
||||
</aside>
|
||||
|
||||
<div v-if="!isMobileViewport" class="hidden md:block">
|
||||
<DataTable :title="t('fileManage.allFiles')" :headers="fileTableHeaders" table-class="min-w-[1120px]">
|
||||
@@ -1206,7 +1204,7 @@
|
||||
{{ t('fileManage.lifecycle') }}
|
||||
</h4>
|
||||
<button
|
||||
v-if="selectedFileDetail.detailTimeline.length > 3"
|
||||
v-if="retrievalTimelineCount > 3"
|
||||
type="button"
|
||||
class="inline-flex min-h-11 items-center self-start rounded-lg border px-3 py-2 text-sm font-medium transition-colors sm:min-h-0 sm:self-auto"
|
||||
:class="detailActionClass"
|
||||
@@ -1216,7 +1214,7 @@
|
||||
isLifecycleExpanded
|
||||
? t('fileManage.collapseLifecycle')
|
||||
: t('fileManage.expandLifecycle', {
|
||||
count: selectedFileDetail.detailTimeline.length
|
||||
count: retrievalTimelineCount
|
||||
})
|
||||
}}
|
||||
</button>
|
||||
@@ -1225,12 +1223,12 @@
|
||||
class="rounded-[30px] border px-4 py-4 shadow-md"
|
||||
:class="[isDarkMode ? 'border-gray-700 bg-gray-700/30' : 'border-gray-200 bg-white']"
|
||||
>
|
||||
<TransitionGroup name="fcb-expand-120" tag="div">
|
||||
<div
|
||||
v-for="(item, index) in visibleDetailTimeline"
|
||||
:key="`${item.key}-${index}`"
|
||||
class="fcb-expand-content grid grid-cols-[auto_minmax(0,1fr)] gap-3"
|
||||
>
|
||||
<TransitionGroup name="fcb-expand-120" tag="div" class="fcb-lifecycle-list">
|
||||
<template v-for="(item, index) in visibleDetailTimeline" :key="`${item.key}-${index}`">
|
||||
<div
|
||||
v-if="item.key !== 'retrieved_event' || isLifecycleExpanded || retrievalVisibleIndex(item) < 3"
|
||||
class="fcb-lifecycle-row grid grid-cols-[auto_minmax(0,1fr)] gap-3"
|
||||
>
|
||||
<div class="flex flex-col items-center">
|
||||
<span
|
||||
class="mt-1 h-3 w-3 rounded-full"
|
||||
@@ -1243,7 +1241,7 @@
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="theme-2026-card-hover mb-3 rounded-[30px] border px-3 py-2 shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:shadow-md last:mb-0"
|
||||
class="fcb-lifecycle-card theme-2026-card-hover mb-3 rounded-[18px] border px-3 py-2 shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:shadow-md last:mb-0 sm:rounded-[22px]"
|
||||
:class="[
|
||||
isDarkMode ? 'border-gray-700 bg-gray-800/60' : 'border-gray-100 bg-gray-50'
|
||||
]"
|
||||
@@ -1259,8 +1257,9 @@
|
||||
<p class="mt-1 text-sm" :class="[mutedTextClass]">
|
||||
{{ item.displayDescription }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</TransitionGroup>
|
||||
</div>
|
||||
</section>
|
||||
@@ -1817,10 +1816,14 @@ const syncMobileViewport = (event: MediaQueryListEvent) => {
|
||||
isMobileViewport.value = event.matches
|
||||
}
|
||||
const isLifecycleExpanded = ref(false)
|
||||
const visibleDetailTimeline = computed(() => {
|
||||
const rows = selectedFileDetail.value?.detailTimeline || []
|
||||
return isLifecycleExpanded.value ? rows : rows.slice(0, 3)
|
||||
})
|
||||
const retrievalTimelineCount = computed(
|
||||
() => (selectedFileDetail.value?.detailTimeline || []).filter((item) => item.key === 'retrieved_event').length
|
||||
)
|
||||
const retrievalVisibleIndex = (timelineItem: { key: string }) =>
|
||||
(selectedFileDetail.value?.detailTimeline || [])
|
||||
.filter((item) => item.key === 'retrieved_event')
|
||||
.findIndex((item) => item === timelineItem)
|
||||
const visibleDetailTimeline = computed(() => selectedFileDetail.value?.detailTimeline || [])
|
||||
const filterBodyVisible = computed(() => isFilterPanelOpen.value || hasActiveFilters.value)
|
||||
|
||||
watch(hasSelectedFiles, (selected) => {
|
||||
@@ -2340,6 +2343,22 @@ onUnmounted(() => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fcb-lifecycle-list {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.fcb-lifecycle-row {
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
will-change: opacity, transform;
|
||||
}
|
||||
|
||||
.fcb-lifecycle-card {
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
border-top-width: 1px;
|
||||
}
|
||||
|
||||
.fcb-expand-content {
|
||||
overflow: clip;
|
||||
will-change: grid-template-rows, opacity, transform;
|
||||
|
||||
@@ -748,6 +748,17 @@ onMounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<SettingNumberInput
|
||||
v-model="config.trashRetentionDays"
|
||||
:label="t('manage.settings.trashRetentionDays')"
|
||||
:suffix="t('common.day')"
|
||||
/>
|
||||
<p class="text-xs leading-5" :class="isDarkMode ? 'text-gray-400' : 'text-gray-600'">
|
||||
{{ t('manage.settings.trashRetentionDaysNote') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<SettingSwitch
|
||||
:label="t('manage.settings.guestUpload')"
|
||||
:model-value="config.openUpload"
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
<template>
|
||||
<div class="p-4 sm:p-6">
|
||||
<header class="mb-5 flex flex-col gap-3 sm:mb-6 sm:flex-row sm:items-end sm:justify-between">
|
||||
<div>
|
||||
<p class="text-xs font-medium tracking-[0.16em]" :class="mutedTextClass">RECYCLE BIN</p>
|
||||
<h2 class="mt-1 text-2xl font-bold" :class="primaryTextClass">回收站</h2>
|
||||
<p class="mt-1 text-sm" :class="mutedTextClass">删除文件会先保留在这里;恢复后将生成新的 8 位取件码。</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<BaseButton variant="secondary" @click="openRetentionSettings">
|
||||
<template #icon><Settings2Icon class="mr-2 h-4 w-4" /></template>
|
||||
配置默认清理时间
|
||||
</BaseButton>
|
||||
<BaseButton variant="secondary" :loading="isLoading" @click="loadTrash">
|
||||
<template #icon><RefreshCwIcon class="mr-2 h-4 w-4" /></template>
|
||||
刷新回收站
|
||||
</BaseButton>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="mb-5 grid gap-3 sm:mb-6 sm:grid-cols-3">
|
||||
<div class="theme-2026-card rounded-[20px] border p-3.5 shadow-sm sm:rounded-[24px] sm:p-4" :class="panelClass">
|
||||
<p class="text-xs" :class="mutedTextClass">回收站记录</p><strong class="mt-1 block text-2xl" :class="primaryTextClass">{{ total }}</strong>
|
||||
</div>
|
||||
<div class="theme-2026-card rounded-[20px] border p-3.5 shadow-sm sm:rounded-[24px] sm:p-4" :class="panelClass">
|
||||
<p class="text-xs" :class="mutedTextClass">可恢复</p><strong class="mt-1 block text-2xl" :class="primaryTextClass">{{ recoverableCount }}</strong>
|
||||
</div>
|
||||
<div class="theme-2026-card rounded-[20px] border p-3.5 shadow-sm sm:rounded-[24px] sm:p-4" :class="panelClass">
|
||||
<p class="text-xs" :class="mutedTextClass">仅审计记录</p><strong class="mt-1 block text-2xl" :class="primaryTextClass">{{ purgedCount }}</strong>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="theme-2026-card overflow-hidden rounded-[24px] border shadow-md sm:rounded-[30px]" :class="panelClass">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3 border-b px-4 py-3 sm:px-6 sm:py-4" :class="dividerClass">
|
||||
<div><h3 class="text-base font-semibold" :class="primaryTextClass">已删除文件</h3><p class="mt-0.5 text-xs" :class="mutedTextClass">物理清理只释放文件本体,文件记录和取件历史会持续保留。</p></div>
|
||||
<span class="inline-flex items-center rounded-full px-3 py-1 text-xs font-medium" :class="isDarkMode ? 'bg-[#263941] text-[#b8d6de]' : 'bg-[#e5f0f1] text-[#365a66]'"><ShieldCheckIcon class="mr-1.5 h-3.5 w-3.5" />审计保留</span>
|
||||
</div>
|
||||
|
||||
<div v-if="isLoading" class="flex min-h-64 items-center justify-center text-sm" :class="mutedTextClass"><RefreshCwIcon class="mr-2 h-4 w-4 animate-spin" />正在加载回收站…</div>
|
||||
<div v-else-if="errorText" class="px-4 py-12 text-center sm:px-6"><p class="text-sm font-medium text-red-600">{{ errorText }}</p><BaseButton class="mt-3" variant="secondary" @click="loadTrash">重新加载</BaseButton></div>
|
||||
<div v-else-if="items.length === 0" class="px-4 py-14 text-center sm:px-6"><Trash2Icon class="mx-auto h-9 w-9" :class="mutedTextClass" /><p class="mt-3 text-sm" :class="mutedTextClass">回收站目前为空</p></div>
|
||||
|
||||
<div v-else class="divide-y" :class="dividerClass">
|
||||
<article
|
||||
v-for="item in items"
|
||||
:key="item.id"
|
||||
class="fcb-interactive-row group grid gap-3 px-4 py-4 sm:grid-cols-[auto_minmax(0,1fr)_auto] sm:items-center sm:px-6"
|
||||
:class="isDarkMode ? 'hover:bg-[#253941]/60' : 'hover:bg-[#f2f8f8]'"
|
||||
>
|
||||
<div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl" :class="item.isTrashPurged ? (isDarkMode ? 'bg-[#30383c] text-[#aab7ba]' : 'bg-[#edf0f1] text-[#61747a]') : (isDarkMode ? 'bg-amber-950/45 text-amber-300' : 'bg-amber-50 text-amber-700')"><FileX2Icon class="h-5 w-5" /></div>
|
||||
<div class="min-w-0">
|
||||
<div class="flex flex-wrap items-center gap-2"><p class="break-all text-sm font-semibold" :class="primaryTextClass">{{ fileName(item) }}</p><span class="rounded-full border px-2 py-0.5 text-[11px] font-medium" :class="badgeClass">{{ stateLabel(item) }}</span></div>
|
||||
<div class="mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs" :class="mutedTextClass"><span>旧取件码 {{ item.code }}</span><span>{{ formatFileSize(Number(item.size || 0), 1) }}</span><span>移入 {{ formatTimestamp(item.trashedAt || '') }}</span></div>
|
||||
<p class="mt-1 text-xs" :class="mutedTextClass">{{ expiryLabel(item) }}</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2 sm:justify-end">
|
||||
<BaseButton v-if="!item.isTrashPurged" size="sm" variant="success" :loading="busyId === item.id && busyAction === 'restore'" @click="restore(item)"><template #icon><RotateCcwIcon class="mr-2 h-4 w-4" /></template>恢复</BaseButton>
|
||||
<BaseButton v-if="!item.isTrashPurged" size="sm" variant="outline" :loading="busyId === item.id && busyAction === 'retention'" @click="makePermanent(item)"><template #icon><InfinityIcon class="mr-2 h-4 w-4" /></template>永久保留</BaseButton>
|
||||
<BaseButton v-if="!item.isTrashPurged" size="sm" variant="danger" :loading="busyId === item.id && busyAction === 'purge'" @click="purge(item)"><template #icon><EraserIcon class="mr-2 h-4 w-4" /></template>物理清理</BaseButton>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<DataPagination v-if="total > 0" :current-page="page" :page-size="size" :total="total" @page-change="changePage" @page-size-change="changePageSize" />
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { EraserIcon, FileX2Icon, InfinityIcon, RefreshCwIcon, RotateCcwIcon, Settings2Icon, ShieldCheckIcon, Trash2Icon } from 'lucide-vue-next'
|
||||
import BaseButton from '@/components/common/BaseButton.vue'
|
||||
import DataPagination from '@/components/common/DataPagination.vue'
|
||||
import { useAdminTrash, useInjectedDarkMode } from '@/composables'
|
||||
import type { TrashFileItem } from '@/types'
|
||||
import { formatFileSize, formatTimestamp } from '@/utils/common'
|
||||
|
||||
const isDarkMode = useInjectedDarkMode()
|
||||
const router = useRouter()
|
||||
const { fetchTrash, purgeTrashItem, restoreTrashItem, updateTrashRetention } = useAdminTrash()
|
||||
const items = ref<TrashFileItem[]>([])
|
||||
const page = ref(1)
|
||||
const size = ref(20)
|
||||
const total = ref(0)
|
||||
const isLoading = ref(false)
|
||||
const errorText = ref('')
|
||||
const busyId = ref<number | null>(null)
|
||||
const busyAction = ref('')
|
||||
const primaryTextClass = computed(() => isDarkMode.value ? 'text-white' : 'text-[#1f3c45]')
|
||||
const mutedTextClass = computed(() => isDarkMode.value ? 'text-[#a9bdc2]' : 'text-[#617980]')
|
||||
const panelClass = computed(() => isDarkMode.value ? 'border-[#40545c] bg-[#202f36]/90' : 'border-[#d7e3e5] bg-[#f8fbfb]')
|
||||
const dividerClass = computed(() => isDarkMode.value ? 'divide-[#40545c] border-[#40545c]' : 'divide-[#d7e3e5] border-[#d7e3e5]')
|
||||
const badgeClass = computed(() => isDarkMode.value ? 'border-[#50666f] text-[#b8d6de]' : 'border-[#c8d8dc] text-[#4e6c75]')
|
||||
const recoverableCount = computed(() => items.value.filter(item => !item.isTrashPurged).length)
|
||||
const purgedCount = computed(() => items.value.filter(item => item.isTrashPurged).length)
|
||||
const fileName = (item: TrashFileItem) => item.name || `${item.prefix || ''}${item.suffix || ''}` || '未命名文件'
|
||||
const stateLabel = (item: TrashFileItem) => item.isTrashPurged ? '仅审计记录' : item.isTrashPermanent ? '永久保留' : '可恢复'
|
||||
const expiryLabel = (item: TrashFileItem) => item.isTrashPurged ? `文件本体已于 ${formatTimestamp(item.trashPurgedAt || '')} 清理` : item.isTrashPermanent ? '不会自动清理文件本体' : `预计清理:${formatTimestamp(item.trashExpiresAt || '')}`
|
||||
const openRetentionSettings = () => { void router.push({ path: '/admin/settings', hash: '#settings-upload' }) }
|
||||
|
||||
const loadTrash = async () => { isLoading.value = true; errorText.value = ''; try { const detail = await fetchTrash({ page: page.value, size: size.value }); items.value = detail?.data || []; total.value = Number(detail?.total || 0) } catch (error: unknown) { errorText.value = (error as { response?: { data?: { detail?: string } } })?.response?.data?.detail || '回收站加载失败,请稍后重试。' } finally { isLoading.value = false } }
|
||||
const run = async (item: TrashFileItem, action: string, operation: () => Promise<unknown>) => { busyId.value = item.id; busyAction.value = action; try { await operation(); await loadTrash() } catch (error: unknown) { errorText.value = (error as { response?: { data?: { detail?: string } } })?.response?.data?.detail || '操作未完成,请稍后重试。' } finally { busyId.value = null; busyAction.value = '' } }
|
||||
const restore = (item: TrashFileItem) => run(item, 'restore', () => restoreTrashItem(item.id))
|
||||
const makePermanent = (item: TrashFileItem) => run(item, 'retention', () => updateTrashRetention(item.id, 0))
|
||||
const purge = (item: TrashFileItem) => { if (!window.confirm(`确定物理清理“${fileName(item)}”吗?文件本体不可恢复,但审计记录会永久保留。`)) return; void run(item, 'purge', () => purgeTrashItem(item.id)) }
|
||||
const changePage = (nextPage: number) => { page.value = nextPage; void loadTrash() }
|
||||
const changePageSize = (nextSize: number) => { size.value = nextSize; page.value = 1; void loadTrash() }
|
||||
void loadTrash()
|
||||
</script>
|
||||
Reference in new issue
Block a user