feat: 重构管理端列表与风控/结算导航,新增表格导出和结算审核确认

This commit is contained in:
2026-05-19 17:06:56 +08:00
parent a1fb163f1b
commit 37b13278ef
47 changed files with 1255 additions and 524 deletions

View File

@@ -6,6 +6,7 @@ import { useTranslation } from "react-i18next";
import { getAdminDraws } from "@/api/admin-draws";
import { AdminListPaginationFooter } from "@/components/admin/admin-list-pagination-footer";
import { AdminTableExportButton } from "@/components/admin/admin-table-export-button";
import { Button, buttonVariants } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
@@ -101,17 +102,21 @@ export function RiskIndexConsole() {
const lastPage = Math.max(1, data?.meta.last_page ?? 1);
return (
<Card>
<CardHeader className="flex flex-row flex-wrap items-end justify-between gap-4">
<CardTitle className="text-lg">{t("center")}</CardTitle>
<div className="flex w-full max-w-4xl flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-end">
<div className="grid flex-1 gap-2 sm:min-w-[12rem]">
<Label htmlFor="risk-index-draw-no" className="text-xs text-muted-foreground">
<Card className="admin-list-card">
<CardHeader className="admin-list-header flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
<CardTitle className="admin-list-title">{t("center")}</CardTitle>
<div className="admin-list-toolbar lg:w-auto">
<div className="admin-list-field lg:min-w-0">
<Label
htmlFor="risk-index-draw-no"
className="text-xs text-muted-foreground sm:w-10 sm:shrink-0"
>
{t("drawNo")}
</Label>
<Input
id="risk-index-draw-no"
placeholder={t("fuzzyDrawNo")}
className="w-full sm:w-[18rem] lg:w-[24rem]"
value={drawNoInput}
onChange={(e) => setDrawNoInput(e.target.value)}
onKeyDown={(e) => {
@@ -121,8 +126,11 @@ export function RiskIndexConsole() {
}}
/>
</div>
<div className="grid gap-2 sm:w-44">
<Label htmlFor="risk-index-status" className="text-xs text-muted-foreground">
<div className="admin-list-field">
<Label
htmlFor="risk-index-status"
className="text-xs text-muted-foreground sm:w-10 sm:shrink-0"
>
{t("status")}
</Label>
<Select
@@ -134,7 +142,7 @@ export function RiskIndexConsole() {
setPage(1);
}}
>
<SelectTrigger id="risk-index-status" size="sm" className="w-full">
<SelectTrigger id="risk-index-status" size="sm" className="w-full sm:w-40">
<SelectValue>{riskStatusTriggerLabel}</SelectValue>
</SelectTrigger>
<SelectContent align="start">
@@ -147,7 +155,12 @@ export function RiskIndexConsole() {
</SelectContent>
</Select>
</div>
<div className="flex gap-2">
<div className="admin-list-actions">
<AdminTableExportButton
tableId="risk-index-table"
filename="风控中心期号列表"
sheetName="风控中心"
/>
<Button type="button" size="sm" onClick={() => applySearch()}>
{t("search")}
</Button>
@@ -157,13 +170,13 @@ export function RiskIndexConsole() {
</div>
</div>
</CardHeader>
<CardContent className="space-y-4">
<CardContent className="admin-list-content">
{error ? <p className="text-sm text-destructive">{error}</p> : null}
{loading && (data?.items.length ?? 0) === 0 ? (
<p className="text-sm text-muted-foreground">{t("states.loading", { ns: "common" })}</p>
) : (
<div className="overflow-x-auto rounded-md border">
<Table>
<div className="admin-table-shell">
<Table id="risk-index-table">
<TableHeader>
<TableRow>
<TableHead>{t("drawNo")}</TableHead>
@@ -191,7 +204,7 @@ export function RiskIndexConsole() {
</TableCell>
<TableCell className="text-right">
<Link
href={`/admin/risk/draws/${row.id}/occupancy`}
href={`/admin/draws/${row.id}/risk/occupancy`}
className={cn(buttonVariants({ variant: "secondary", size: "sm" }))}
>
{t("enterRisk")}