feat: P3阶段完成 - 全部模块迁移完成 🎉

## P3.1: 争议仲裁模块(disputes)
- API: disputes.ts
- 模块导出

## P3.2: 卖家中心模块(seller)
- Views: 4个页面
- Composables: usePublishForm, usePublishDraft
- 模块导出

## P3.3: 管理后台模块(admin)
- API: 8个文件(adminAuth, adminDashboard, adminUsers等)
- Views: 15个管理页面
- Composables: useAdminTable, useAdminPaginatedTable
- Components: 管理端组件
- 模块导出

---

## 🎉 Features 架构迁移全部完成!

### 最终统计
-  P0: shared(基础设施)- 22个文件
-  P1: wallet, chats, orders - 24个文件
-  P2: listings, auth - 35个文件
-  P3: seller, disputes, admin - 47个文件

**总计:** 9个模块,128个文件完成迁移

### 新架构
```
frontend/src/
├── features/          # 9个业务模块 
│   ├── wallet/       
│   ├── chats/        
│   ├── orders/        (已重构)
│   ├── listings/     
│   ├── auth/         
│   ├── seller/       
│   ├── disputes/     
│   └── admin/        
└── shared/           
```

下一步:清理旧文件、更新路由配置

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
yml2213
2026-06-04 09:05:34 +08:00
co-authored by Claude Opus 4.7
parent 3534cffce1
commit c9397635e2
47 changed files with 9406 additions and 0 deletions
@@ -0,0 +1,170 @@
<script setup lang="ts">
import { Search } from '@element-plus/icons-vue'
import { computed, onMounted, reactive, ref } from 'vue'
import { fetchAdminAuditLogs, type AdminAuditLog } from '@/api/adminAudit'
import { formatDateTime } from '@/utils/time'
const loading = ref(false)
const logs = ref<AdminAuditLog[]>([])
const activeLog = ref<AdminAuditLog | null>(null)
const currentPage = ref(1)
const currentPageSize = ref(20)
const total = ref(0)
const filters = reactive({
actor_id: '',
action: '',
biz_type: '',
})
const highRiskCount = computed(() => logs.value.filter((item) => item.action.includes('freeze') || item.action.includes('update')).length)
onMounted(loadLogs)
async function loadLogs() {
loading.value = true
try {
const query = {
...filters,
page: currentPage.value,
page_size: currentPageSize.value,
}
const result = await fetchAdminAuditLogs(query)
logs.value = result.items
total.value = result.total
} finally {
loading.value = false
}
}
function resetFilters() {
filters.actor_id = ''
filters.action = ''
filters.biz_type = ''
currentPage.value = 1
void loadLogs()
}
function handleSizeChange() {
currentPage.value = 1
loadLogs()
}
function actorName(row: AdminAuditLog) {
return row.actor_nickname || row.actor_username || `${row.actor_type} ${row.actor_id}`
}
function detailText(row: AdminAuditLog | null) {
if (!row?.detail) return '{}'
return JSON.stringify(row.detail, null, 2)
}
function actionType(action: string) {
if (action.includes('freeze')) return 'danger'
if (action.includes('update') || action.includes('create')) return 'warning'
return 'info'
}
</script>
<template>
<section class="page">
<div class="page-header-row">
<div class="page-header">
<p class="eyebrow">Audit Logs</p>
<h1>审计日志</h1>
<p>查看后台管理员操作业务对象和操作明细用于追踪冻结配置修改等高风险动作</p>
</div>
<div class="toolbar-actions">
<el-button @click="resetFilters">重置</el-button>
<el-button type="primary" :icon="Search" :loading="loading" @click="loadLogs">查询</el-button>
</div>
</div>
<div class="metric-grid">
<div class="metric-card">
<span>总条数</span>
<strong>{{ total }} </strong>
</div>
<div class="metric-card">
<span>高风险动作</span>
<strong>{{ highRiskCount }} </strong>
</div>
</div>
<el-form class="filter-panel" label-position="top">
<el-form-item label="管理员 ID">
<el-input v-model="filters.actor_id" clearable placeholder="按管理员筛选" />
</el-form-item>
<el-form-item label="动作">
<el-select v-model="filters.action" clearable filterable placeholder="全部动作" class="full-control">
<el-option label="冻结用户" value="admin_user.freeze" />
<el-option label="解冻用户" value="admin_user.unfreeze" />
<el-option label="后台下架商品" value="listing.admin_offline" />
<el-option label="商品标记异常" value="listing.mark_abnormal" />
<el-option label="客服关闭订单" value="order.admin_close" />
<el-option label="订单标记异常" value="order.mark_abnormal" />
<el-option label="申诉仲裁" value="dispute.arbitrate" />
<el-option label="更新系统配置" value="system_config.update" />
</el-select>
</el-form-item>
<el-form-item label="业务类型">
<el-select v-model="filters.biz_type" clearable placeholder="全部业务" class="full-control">
<el-option label="用户" value="user" />
<el-option label="商品" value="listing" />
<el-option label="订单" value="order" />
<el-option label="申诉" value="dispute" />
<el-option label="系统配置" value="system_config" />
</el-select>
</el-form-item>
</el-form>
<el-table v-loading="loading" class="table-panel" :data="logs">
<el-table-column label="操作人" min-width="160">
<template #default="{ row }">
<strong>{{ actorName(row) }}</strong>
</template>
</el-table-column>
<el-table-column label="动作" min-width="180">
<template #default="{ row }">
<el-tag :type="actionType(row.action)">{{ row.action }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="biz_type" label="业务类型" width="130" />
<el-table-column prop="biz_id" label="业务 ID" width="100" />
<el-table-column label="时间" min-width="180">
<template #default="{ row }">{{ formatDateTime(row.created_at) }}</template>
</el-table-column>
<el-table-column label="操作" width="100">
<template #default="{ row }">
<el-button size="small" @click="activeLog = row">明细</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination-wrap" v-if="total > 0">
<el-pagination
v-model:current-page="currentPage"
v-model:page-size="currentPageSize"
:total="total"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next"
@current-change="loadLogs"
@size-change="handleSizeChange"
/>
</div>
<el-dialog :model-value="!!activeLog" title="审计明细" width="720px" @update:model-value="activeLog = null">
<div v-if="activeLog" class="dialog-body">
<p><strong>{{ activeLog.action }}</strong> · {{ activeLog.biz_type }} #{{ activeLog.biz_id || '-' }}</p>
<p>操作人{{ actorName(activeLog) }} · IP{{ activeLog.ip }}</p>
<p>User-Agent{{ activeLog.user_agent }}</p>
<div class="code-panel">
<pre>{{ detailText(activeLog) }}</pre>
</div>
</div>
<template #footer>
<el-button type="primary" @click="activeLog = null">关闭</el-button>
</template>
</el-dialog>
</section>
</template>