feat: wire admin workflows to real APIs

This commit is contained in:
hectorzhao
2026-07-02 13:50:09 +08:00
parent f8c9b78c21
commit ab421cf8a7
42 changed files with 2596 additions and 250 deletions
+25 -3
View File
@@ -86,6 +86,27 @@ const channelNames: Record<string, string> = {
'67': '联通-行政-上海甲医院-34',
};
const channelCopyStorageKey = 'cmpp-channel-copies';
type ChannelCopyMeta = {
sourceId: string;
name: string;
};
function readChannelCopyMeta(): Record<string, ChannelCopyMeta> {
try {
const raw = window.localStorage.getItem(channelCopyStorageKey);
return raw ? JSON.parse(raw) as Record<string, ChannelCopyMeta> : {};
} catch {
return {};
}
}
function getChannelName(channelId: string) {
const copyMeta = readChannelCopyMeta()[channelId];
return copyMeta?.name ?? channelNames[channelId] ?? `短信通道 ${channelId}`;
}
const statusOptions = [
{ label: '全部状态', value: 'all' },
{ label: '报备成功', value: 'success' },
@@ -426,11 +447,12 @@ function ReceiptImportModal({ onClose, onSubmit }: { onClose: () => void; onSubm
export function AdminChannelReportPage() {
const navigate = useNavigate();
const { channelId = '88827' } = useParams();
const channelName = getChannelName(channelId);
const [reports, setReports] = useState(initialReports);
const [keyword, setKeyword] = useState('');
const [status, setStatus] = useState('all');
const [dateRange, setDateRange] = useState<DateRangeValue>({});
const [expanded, setExpanded] = useState<Set<string>>(() => new Set(['sig-1']));
const [expanded, setExpanded] = useState<Set<string>>(() => new Set());
const [selectedIds, setSelectedIds] = useState<Set<string>>(() => new Set());
const [statusTarget, setStatusTarget] = useState<{ signatureId: string; drainageId?: string } | null>(null);
const [nextStatus, setNextStatus] = useState<ReportStatus>('success');
@@ -493,10 +515,10 @@ export function AdminChannelReportPage() {
return (
<section className="page-stack channel-report-page">
<div className="surface channel-report-hero">
<Breadcrumb items={[channelNames[channelId] ?? `短信通道 ${channelId}`]} />
<Breadcrumb items={[channelName]} />
<div className="channel-report-heading">
<Button icon={<ChevronLeft size={16} />} onClick={() => navigate('/admin/channels')} variant="ghost"></Button>
<h1>{channelNames[channelId] ?? `短信通道 ${channelId}`}</h1>
<h1>{channelName}</h1>
<Button icon={<ChevronRight size={16} />} variant="ghost"></Button>
<div className="channel-report-config-actions">
<Button icon={<FileUp size={16} />} onClick={() => setReceiptOpen(true)} variant="secondary"></Button>