feat: harden platform workflows and UI governance

This commit is contained in:
hectorzhao
2026-07-22 14:14:55 +08:00
parent ef957f7daa
commit 0f223f7f91
80 changed files with 4958 additions and 764 deletions
+7 -17
View File
@@ -1,6 +1,6 @@
import { useEffect, useMemo, useState } from 'react';
import { Check, Search, X } from 'lucide-react';
import { Breadcrumb, Button, Input, Select, Table, Tag, type TableColumn } from '@/components/ui';
import { Search, X } from 'lucide-react';
import { Breadcrumb, Button, Input, RiskAction, Select, Table, Tag, type TableColumn } from '@/components/ui';
import { adminApi, type SmsTemplateAudit } from '@/api/adminApi';
import { formatDateTime } from '@/utils/dateTime';
@@ -29,10 +29,8 @@ export function AdminTemplateAuditPage() {
.catch(() => setAudits([]));
}, [keyword, status]);
async function reviewTemplate(id: string, nextStatus: 'approved' | 'rejected') {
const updated = nextStatus === 'approved'
? await adminApi.approveTemplate(id)
: await adminApi.rejectTemplate(id);
async function rejectTemplate(id: string) {
const updated = await adminApi.rejectTemplate(id);
setAudits((items) => items.map((item) => (item.id === id ? updated : item)));
}
@@ -58,19 +56,11 @@ export function AdminTemplateAuditPage() {
align: 'right',
render: (record) => (
<div className="table-actions">
<Button
disabled={record.auditStatus !== 'pending'}
icon={<Check size={15} />}
onClick={() => void reviewTemplate(record.id, 'approved')}
size="sm"
variant="success"
>
</Button>
<RiskAction disabled={record.auditStatus !== 'pending'} onCompleted={() => adminApi.listTemplateAudits({ keyword, status }).then(setAudits)} targetId={record.id} targetType="template" />
<Button
disabled={record.auditStatus !== 'pending'}
icon={<X size={15} />}
onClick={() => void reviewTemplate(record.id, 'rejected')}
onClick={() => void rejectTemplate(record.id)}
size="sm"
variant="danger"
>
@@ -80,7 +70,7 @@ export function AdminTemplateAuditPage() {
),
},
],
[],
[keyword, status],
);
const templateAudits = audits;