fix: resolve all admin typecheck errors (typed api wrapper, unused imports, missing hooks, PermissionButton children)

This commit is contained in:
2026-07-06 01:02:26 +08:00
parent 4a48a65a48
commit 6b0a21d266
22 changed files with 4051 additions and 273 deletions

View File

@@ -1,7 +1,6 @@
import React, { useEffect, useState, useMemo } from 'react';
import {
Table,
Button,
Modal,
Form,
Select,
@@ -40,6 +39,15 @@ const installmentStatusMap: Record<string, { text: string; color: string }> = {
paid: { text: '已缴', color: 'green' },
};
interface PendingRefund {
id: number;
student?: { name?: string };
amount?: number;
paidDate?: string;
refundStatus?: string;
refundRequestedAt?: string;
}
const DepositsPage: React.FC = () => {
const [data, setData] = useState<any[]>([]);
const [students, setStudents] = useState<any[]>([]);
@@ -48,7 +56,7 @@ const DepositsPage: React.FC = () => {
const [refundModal, setRefundModal] = useState<any>(null);
const [detailModal, setDetailModal] = useState<any>(null);
const [installmentModal, setInstallmentModal] = useState<number | null>(null);
const [pendingRefunds, setPendingRefunds] = useState<any[]>([]);
const [pendingRefunds, setPendingRefunds] = useState<PendingRefund[]>([]);
const [pendingLoading, setPendingLoading] = useState(false);
const [createForm] = Form.useForm();
const [refundForm] = Form.useForm();
@@ -72,7 +80,7 @@ const DepositsPage: React.FC = () => {
const fetchPendingRefunds = async () => {
setPendingLoading(true);
try {
const res = await api.get('/deposits/pending-refunds');
const res = await api.get<PendingRefund[]>('/deposits/pending-refunds');
setPendingRefunds(res || []);
} catch (e) {
console.error(e);
@@ -273,7 +281,9 @@ const DepositsPage: React.FC = () => {
size="small"
danger
icon={<DeleteOutlined />}
/>
>
</PermissionButton>
</Popconfirm>
</Space>
),
@@ -536,7 +546,9 @@ const DepositsPage: React.FC = () => {
title="确定删除?"
onConfirm={() => handleDeleteInstallment(item.id)}
>
<PermissionButton key="del" permission="deposit:delete" size="small" danger icon={<DeleteOutlined />} />
<PermissionButton key="del" permission="deposit:delete" size="small" danger icon={<DeleteOutlined />}>
</PermissionButton>
</Popconfirm>
].filter(Boolean)}
>