refactor: 更新管理端页面元数据,统一国际化支持,移除冗余代码
This commit is contained in:
@@ -26,6 +26,8 @@ import { LotteryApiBizError } from "@/types/api/errors";
|
||||
import type { AdminDrawFinanceSummaryData } from "@/types/api/admin-draw-finance";
|
||||
import { toast } from "sonner";
|
||||
|
||||
import { useExportLabels } from "@/hooks/use-export-labels";
|
||||
|
||||
import { PRD_PAYOUT_MANAGE, PRD_PAYOUT_REVIEW } from "./draw-prd";
|
||||
|
||||
function drawStatusText(status: string, t: (key: string) => string): string {
|
||||
@@ -43,6 +45,7 @@ export function DrawFinanceConsole({ drawId }: { drawId: string }): React.ReactE
|
||||
PRD_PAYOUT_REVIEW,
|
||||
]);
|
||||
const [data, setData] = useState<AdminDrawFinanceSummaryData | null>(null);
|
||||
const exportLabels = useExportLabels("drawFinance", { drawNo: data?.draw_no ?? drawId });
|
||||
const [err, setErr] = useState<string | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [settling, setSettling] = useState(false);
|
||||
@@ -170,8 +173,8 @@ export function DrawFinanceConsole({ drawId }: { drawId: string }): React.ReactE
|
||||
<div className="admin-table-toolbar">
|
||||
<AdminTableExportButton
|
||||
tableId={`draw-finance-table-${drawId}`}
|
||||
filename={`期号收支-${data.draw_no}`}
|
||||
sheetName="期号收支"
|
||||
filename={exportLabels.filename}
|
||||
sheetName={exportLabels.sheetName}
|
||||
/>
|
||||
</div>
|
||||
<Table id={`draw-finance-table-${drawId}`}>
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import { useAdminDateTimeFormatter } from "@/hooks/use-admin-datetime-formatter";
|
||||
import { useExportLabels } from "@/hooks/use-export-labels";
|
||||
import { adminHasAnyPermission } from "@/lib/admin-permissions";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { useAdminProfile } from "@/stores/admin-session";
|
||||
@@ -65,6 +66,7 @@ function drawAdminStatusSelectLabel(raw: unknown, t: (key: string) => string): s
|
||||
|
||||
export function DrawsIndexConsole() {
|
||||
const { t } = useTranslation(["draws", "common"]);
|
||||
const exportLabels = useExportLabels("drawsList");
|
||||
const formatDt = useAdminDateTimeFormatter();
|
||||
const profile = useAdminProfile();
|
||||
const canManageDraw = adminHasAnyPermission(profile?.permissions, [PRD_DRAW_RESULT_MANAGE]);
|
||||
@@ -198,8 +200,8 @@ export function DrawsIndexConsole() {
|
||||
<div className="admin-list-actions">
|
||||
<AdminTableExportButton
|
||||
tableId="draws-index-table"
|
||||
filename="期号列表"
|
||||
sheetName="期号列表"
|
||||
filename={exportLabels.filename}
|
||||
sheetName={exportLabels.sheetName}
|
||||
/>
|
||||
<Button
|
||||
type="button"
|
||||
|
||||
Reference in New Issue
Block a user