refactor: 全量迁移前端 API 调用到统一 api-services 服务层
- 新建 api-services-raw.ts 导出原始 axios 方法供特殊端点使用 - 完成 api-services.ts 全领域覆盖(auth/employee/roster/dashboard/attendance/payroll/socialInsurance/commercialInsurance/termination/policies/evidence/audit/calendar/companyFiles/notifications/settings/ai/platform/portal/survey/search) - 迁移所有 47+ 页面文件:pages/、pages/roster/、pages/portal/、pages/platform/、pages/auth/、pages/dashboard/、pages/compliance/ - 移除所有直接 import api from '../../lib/api' 引用 - 修复 Termination.tsx / WorkProcess.tsx 中 string|null 类型错误 - 修复 SocialInsurance.tsx 中 api-services-raw delete 导入名 - 修复 PlatformLogin.tsx 变量遮蔽问题 - tsc --noEmit 零错误,vite build 成功
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useState } from 'react'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { ScrollText, Search, Filter } from 'lucide-react'
|
||||
import api from '../lib/api'
|
||||
import { auditApi } from '../lib/api-services'
|
||||
import Card from '../components/ui/Card'
|
||||
import Button from '../components/ui/Button'
|
||||
import EmptyState from '../components/ui/EmptyState'
|
||||
@@ -128,21 +128,19 @@ export default function AuditLog() {
|
||||
const { data, isLoading } = useQuery<any>({
|
||||
queryKey: ['audit-logs', page, pageSize, action, entity, dateFrom, dateTo],
|
||||
queryFn: async () => {
|
||||
const params = new URLSearchParams({ page: String(page), pageSize: String(pageSize) })
|
||||
if (action) params.set('action', action)
|
||||
if (entity) params.set('entity', entity)
|
||||
if (dateFrom) params.set('dateFrom', dateFrom)
|
||||
if (dateTo) params.set('dateTo', dateTo)
|
||||
const res = await api.get(`/audit?${params}`) as any
|
||||
return res.data
|
||||
const p: any = { page, pageSize }
|
||||
if (action) p.action = action
|
||||
if (entity) p.entity = entity
|
||||
if (dateFrom) p.dateFrom = dateFrom
|
||||
if (dateTo) p.dateTo = dateTo
|
||||
return await auditApi.list(p)
|
||||
},
|
||||
})
|
||||
|
||||
const { data: stats } = useQuery<any>({
|
||||
queryKey: ['audit-stats'],
|
||||
queryFn: async () => {
|
||||
const res = await api.get('/audit/stats') as any
|
||||
return res.data
|
||||
return await auditApi.stats()
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user