feat: complete reporting and filing workflows
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { adminApi, type AuditRecord } from '@/api/adminApi';
|
||||
import { formatDateTime } from '@/utils/dateTime';
|
||||
|
||||
const automaticReviewActions = new Set(['admin_create_approved', 'admin_update_approved']);
|
||||
const reviewActions = new Set(['approve', 'reject', ...automaticReviewActions]);
|
||||
|
||||
export function AuditReviewInfo({ targetId, targetType }: { targetId: string; targetType: string }) {
|
||||
const [records, setRecords] = useState<AuditRecord[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
setLoading(true);
|
||||
adminApi.listAuditRecords({ targetType, targetId })
|
||||
.then((items) => {
|
||||
if (active) setRecords(items);
|
||||
})
|
||||
.catch(() => {
|
||||
if (active) setRecords([]);
|
||||
})
|
||||
.finally(() => {
|
||||
if (active) setLoading(false);
|
||||
});
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, [targetId, targetType]);
|
||||
|
||||
const review = useMemo(() => records.find((record) => reviewActions.has(record.action)), [records]);
|
||||
return <>
|
||||
<div><span>审核时间</span><strong>{loading ? '加载中…' : formatDateTime(review?.createdAt)}</strong></div>
|
||||
<div>
|
||||
<span>审核人员(用户名)</span>
|
||||
<strong>
|
||||
{loading
|
||||
? '加载中…'
|
||||
: review?.reviewer?.username ?? (review && automaticReviewActions.has(review.action) ? '系统自动' : '-')}
|
||||
</strong>
|
||||
</div>
|
||||
</>;
|
||||
}
|
||||
@@ -7,6 +7,7 @@ export { DetailInfoGrid, DetailProgressStats, DetailSection, DetailTitle, getRat
|
||||
export { FileActions } from './FileActions';
|
||||
export { SystemLogExport } from './SystemLogExport';
|
||||
export { RiskAction } from './RiskAction';
|
||||
export { AuditReviewInfo } from './AuditReviewInfo';
|
||||
export { DeleteRiskAction } from './DeleteRiskAction';
|
||||
export { ManualRechargeDialog } from './ManualRechargeDialog';
|
||||
export type { ManualRechargeTarget } from './ManualRechargeDialog';
|
||||
|
||||
Reference in New Issue
Block a user