[fix]:[FL-198][地闪密度页面进入时不应该调用GET /api/v1/lightning-currents,去掉这个调用动作]

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
chengkai3
2026-06-27 22:33:38 +08:00
parent cf68e6104b
commit dc023b1f3e
@@ -129,6 +129,7 @@ export default function AdminLightningDistributionPage() {
const [isLoadingMore, setIsLoadingMore] = useState(false);
const [tableScrollY, setTableScrollY] = useState(LIGHTNING_TABLE_MIN_SCROLL_Y);
const [pagination, setPagination] = useState({ current: 1, pageSize: 20 });
const [shouldLoadData, setShouldLoadData] = useState(false);
const canRead = hasPermission("lightning.read") || hasPermission("lightning.manage");
const canManage = hasPermission("lightning.manage");
@@ -145,7 +146,7 @@ export default function AdminLightningDistributionPage() {
const importBatchesQuery = useQuery({
queryKey: [importBatchesPath],
enabled: !!user && canRead,
enabled: !!user && canRead && shouldLoadData,
queryFn: async () => {
const response = await fetchWithAuth(importBatchesPath);
if (!response.ok) {
@@ -260,9 +261,17 @@ export default function AdminLightningDistributionPage() {
setSearchKeyword(value);
setCardViewPage(1);
setAllLoadedBatches([]);
if (shouldLoadData) {
setShouldLoadData(false);
setTimeout(() => setShouldLoadData(true), 0);
}
}, 500);
};
const handleSearch = () => {
setShouldLoadData(true);
};
const updateTableScrollY = useCallback(() => {
if (typeof window === "undefined") {
return;
@@ -587,7 +596,7 @@ export default function AdminLightningDistributionPage() {
onChange={(event) => handleKeywordChange(event.target.value)}
/>
</Form.Item>
<Form.Item label="Region ID" style={{ marginBottom: 0 }}>
<Form.Item label="Region ID" style={{ marginBottom: 12 }}>
<Input
allowClear
placeholder="按 Region ID 筛选"
@@ -596,9 +605,18 @@ export default function AdminLightningDistributionPage() {
setRegionFilter(event.target.value);
setCardViewPage(1);
setAllLoadedBatches([]);
if (shouldLoadData) {
setShouldLoadData(false);
setTimeout(() => setShouldLoadData(true), 0);
}
}}
/>
</Form.Item>
<Form.Item style={{ marginBottom: 0 }}>
<Button type="primary" onClick={handleSearch}>
</Button>
</Form.Item>
</Form>
) : (
<Form layout="inline" style={{ rowGap: 12 }}>
@@ -620,9 +638,18 @@ export default function AdminLightningDistributionPage() {
setCardViewPage(1);
setAllLoadedBatches([]);
setPagination((prev) => ({ ...prev, current: 1 }));
if (shouldLoadData) {
setShouldLoadData(false);
setTimeout(() => setShouldLoadData(true), 0);
}
}}
/>
</Form.Item>
<Form.Item>
<Button type="primary" onClick={handleSearch}>
</Button>
</Form.Item>
</Form>
)}