概念/行业分析移除数据获取功能

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-06 14:26:06 +08:00
parent a415762a77
commit efdfe29ccc
2 changed files with 6 additions and 64 deletions
+3 -32
View File
@@ -1,5 +1,5 @@
import { useMemo, useState, type ReactNode } from 'react' import { useMemo, useState, type ReactNode } from 'react'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query' import { useQuery } from '@tanstack/react-query'
import { AnimatePresence } from 'framer-motion' import { AnimatePresence } from 'framer-motion'
import { import {
Activity, Activity,
@@ -14,7 +14,7 @@ import {
} from 'lucide-react' } from 'lucide-react'
import { PageHeader } from '@/components/PageHeader' import { PageHeader } from '@/components/PageHeader'
import { EmptyState } from '@/components/EmptyState' import { EmptyState } from '@/components/EmptyState'
import { AnalysisConfigDialog, PresetFetchState, type AnalysisFieldConfig } from '@/components/analysis-shared' import { AnalysisConfigDialog, type AnalysisFieldConfig } from '@/components/analysis-shared'
import { StockPreviewDialog } from '@/components/StockPreviewDialog' import { StockPreviewDialog } from '@/components/StockPreviewDialog'
import { RpsRotationDialog } from '@/components/RpsRotationDialog' import { RpsRotationDialog } from '@/components/RpsRotationDialog'
import { api, type MarketSnapshotRow } from '@/lib/api' import { api, type MarketSnapshotRow } from '@/lib/api'
@@ -258,21 +258,6 @@ export function ConceptAnalysis() {
enabled: !!activeConfigId, enabled: !!activeConfigId,
}) })
// 内置概念预设 (ext_gn_ths) 手动获取数据
const PRESET_CONCEPT_ID = 'ext_gn_ths'
const queryClient = useQueryClient()
const fetchMutation = useMutation({
mutationFn: () => api.extDataPresetFetch(PRESET_CONCEPT_ID),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: QK.extData })
queryClient.invalidateQueries({ queryKey: QK.extDataRows(PRESET_CONCEPT_ID, undefined, PAGE_LIMIT) })
},
})
// 是否处于「内置概念预设存在但无数据」状态 → 显示获取按钮
const needsConceptFetch =
!!activeConfig && activeConfig.id === PRESET_CONCEPT_ID &&
!rowsQuery.isLoading && (rowsQuery.data?.total ?? 0) === 0
const marketQuery = useQuery({ const marketQuery = useQuery({
queryKey: QK.marketSnapshot, queryKey: QK.marketSnapshot,
queryFn: api.marketSnapshot, queryFn: api.marketSnapshot,
@@ -339,13 +324,7 @@ export function ConceptAnalysis() {
</button> </button>
} }
/> />
<PresetFetchState <EmptyState icon={Layers3} title="暂无概念数据" hint="请通过 local→serve 同步概念数据" />
title="暂无概念数据"
hint="从同花顺获取概念分类数据后即可使用概念分析"
isLoading={fetchMutation.isPending}
error={fetchMutation.error}
onFetch={() => fetchMutation.mutate()}
/>
</div> </div>
<AnimatePresence> <AnimatePresence>
{showConfig && <AnalysisConfigDialog currentConfig={fieldConfig} onSave={handleSaveConfig} onClose={() => setShowConfig(false)} />} {showConfig && <AnalysisConfigDialog currentConfig={fieldConfig} onSave={handleSaveConfig} onClose={() => setShowConfig(false)} />}
@@ -411,14 +390,6 @@ export function ConceptAnalysis() {
</div> </div>
) : rowsQuery.isLoading ? ( ) : rowsQuery.isLoading ? (
<div className="rounded-2xl border border-border bg-surface px-6 py-16 text-center text-sm text-muted">...</div> <div className="rounded-2xl border border-border bg-surface px-6 py-16 text-center text-sm text-muted">...</div>
) : needsConceptFetch ? (
<PresetFetchState
title="未获取概念数据"
hint="内置概念数据源已就绪,点击下方按钮从同花顺获取概念分类数据"
isLoading={fetchMutation.isPending}
error={fetchMutation.error}
onFetch={() => fetchMutation.mutate()}
/>
) : ( ) : (
<EmptyState icon={Layers3} title="未匹配到概念数据" hint={resolved.hint || '请检查扩展数据是否包含概念/题材相关字段'} /> <EmptyState icon={Layers3} title="未匹配到概念数据" hint={resolved.hint || '请检查扩展数据是否包含概念/题材相关字段'} />
)} )}
+3 -32
View File
@@ -1,5 +1,5 @@
import { useMemo, useState, type ReactNode } from 'react' import { useMemo, useState, type ReactNode } from 'react'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query' import { useQuery } from '@tanstack/react-query'
import { AnimatePresence } from 'framer-motion' import { AnimatePresence } from 'framer-motion'
import { import {
Activity, Activity,
@@ -13,7 +13,7 @@ import {
} from 'lucide-react' } from 'lucide-react'
import { PageHeader } from '@/components/PageHeader' import { PageHeader } from '@/components/PageHeader'
import { EmptyState } from '@/components/EmptyState' import { EmptyState } from '@/components/EmptyState'
import { AnalysisConfigDialog, DimensionHeatmap, PresetFetchState, type AnalysisFieldConfig } from '@/components/analysis-shared' import { AnalysisConfigDialog, DimensionHeatmap, type AnalysisFieldConfig } from '@/components/analysis-shared'
import { StockPreviewDialog } from '@/components/StockPreviewDialog' import { StockPreviewDialog } from '@/components/StockPreviewDialog'
import { api, type MarketSnapshotRow } from '@/lib/api' import { api, type MarketSnapshotRow } from '@/lib/api'
import { QK } from '@/lib/queryKeys' import { QK } from '@/lib/queryKeys'
@@ -290,21 +290,6 @@ export function IndustryAnalysis() {
enabled: !!activeConfigId, enabled: !!activeConfigId,
}) })
// 内置行业预设 (ext_hy_ths) 手动获取数据
const PRESET_INDUSTRY_ID = 'ext_hy_ths'
const queryClient = useQueryClient()
const fetchMutation = useMutation({
mutationFn: () => api.extDataPresetFetch(PRESET_INDUSTRY_ID),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: QK.extData })
queryClient.invalidateQueries({ queryKey: QK.extDataRows(PRESET_INDUSTRY_ID, undefined, PAGE_LIMIT) })
},
})
// 是否处于「内置行业预设存在但无数据」状态 → 显示获取按钮
const needsIndustryFetch =
!!activeConfig && activeConfig.id === PRESET_INDUSTRY_ID &&
!rowsQuery.isLoading && (rowsQuery.data?.total ?? 0) === 0
const marketQuery = useQuery({ const marketQuery = useQuery({
queryKey: QK.marketSnapshot, queryKey: QK.marketSnapshot,
queryFn: api.marketSnapshot, queryFn: api.marketSnapshot,
@@ -387,13 +372,7 @@ export function IndustryAnalysis() {
</button> </button>
} }
/> />
<PresetFetchState <EmptyState icon={Layers3} title="暂无行业数据" hint="请通过 local→serve 同步行业数据" />
title="暂无行业数据"
hint="从同花顺获取行业分类数据后即可使用行业分析"
isLoading={fetchMutation.isPending}
error={fetchMutation.error}
onFetch={() => fetchMutation.mutate()}
/>
</div> </div>
<AnimatePresence> <AnimatePresence>
{showConfig && <AnalysisConfigDialog currentConfig={fieldConfig} onSave={handleSaveConfig} onClose={() => setShowConfig(false)} showHierarchyLevel />} {showConfig && <AnalysisConfigDialog currentConfig={fieldConfig} onSave={handleSaveConfig} onClose={() => setShowConfig(false)} showHierarchyLevel />}
@@ -464,14 +443,6 @@ export function IndustryAnalysis() {
</div> </div>
) : rowsQuery.isLoading ? ( ) : rowsQuery.isLoading ? (
<div className="rounded-2xl border border-border bg-surface px-6 py-16 text-center text-sm text-muted">...</div> <div className="rounded-2xl border border-border bg-surface px-6 py-16 text-center text-sm text-muted">...</div>
) : needsIndustryFetch ? (
<PresetFetchState
title="未获取行业数据"
hint="内置行业数据源已就绪,点击下方按钮从同花顺获取行业分类数据"
isLoading={fetchMutation.isPending}
error={fetchMutation.error}
onFetch={() => fetchMutation.mutate()}
/>
) : ( ) : (
<EmptyState icon={Layers3} title="未匹配到行业数据" hint={resolved.hint || '请检查扩展数据是否包含行业/板块相关字段'} /> <EmptyState icon={Layers3} title="未匹配到行业数据" hint={resolved.hint || '请检查扩展数据是否包含行业/板块相关字段'} />
)} )}