fix(factor): 排行榜详情「查看tears报告」跳分析提交页的断点改一键直达 [nas]
用户08-30验收:对比页已见,但点tears仍跳原因子分析页(旧桥接=带预填跳/factor/new手动提交,方案A上线后成了断点)。改:按钮「生成tears报告」直接submitFactor(30只跨行业样本×2024-01~2026-06,分钟级)→progress→完成即新版ECharts tears页;原桥接降级为「自选样本分析」次按钮。npm run build绿
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, watch, nextTick, computed } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { getEvalDetail, type EvalDetail } from '@/api/factor'
|
||||
import { getEvalDetail, submitFactor, type EvalDetail } from '@/api/factor'
|
||||
import { useChart } from '@/composables/useChart'
|
||||
import { darkTitle, darkTooltip, darkGrid, darkAxis, BRAND } from '@/utils/echartsDark'
|
||||
import { useFactorCompareStore } from '@/stores/factorCompare'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import type { EChartsCoreOption } from 'echarts'
|
||||
|
||||
const route = useRoute()
|
||||
@@ -47,6 +48,38 @@ function toggleCompare() {
|
||||
compareStore.toggle(detail.value.factor, route.query.run ? String(route.query.run) : undefined)
|
||||
}
|
||||
|
||||
// —— 一键生成 tears(方案A):排行榜数据没有分层序列,tears 要跑一次 alphalens 分析
|
||||
// (固定 30 只跨行业样本 × 近 2.5 年,分钟级),跑完结果页即新版 ECharts tears。
|
||||
|
||||
const TEARS_SAMPLE_SYMBOLS = [
|
||||
'600519', '000858', '600036', '601318', '000001', '600000', '300750', '002594',
|
||||
'600276', '000538', '600887', '000651', '000333', '600690', '000725', '002415',
|
||||
'600030', '601166', '600028', '601857', '600585', '000625', '601633', '002352',
|
||||
'600104', '601398', '600941', '300059', '002230', '601888',
|
||||
]
|
||||
const TEARS_SAMPLE_SPAN = { start: '2024-01-01', end: '2026-06-30' }
|
||||
|
||||
const tearsSubmitting = ref(false)
|
||||
|
||||
async function generateTears() {
|
||||
if (!detail.value || tearsSubmitting.value) return
|
||||
tearsSubmitting.value = true
|
||||
try {
|
||||
const tid = await submitFactor({
|
||||
symbols: TEARS_SAMPLE_SYMBOLS,
|
||||
factor_names: [detail.value.factor],
|
||||
start: TEARS_SAMPLE_SPAN.start,
|
||||
end: TEARS_SAMPLE_SPAN.end,
|
||||
})
|
||||
ElMessage.success('tears 分析已发起(30 只样本 · 约 1~3 分钟)')
|
||||
router.push(`/factor/progress/${tid}`)
|
||||
} catch {
|
||||
ElMessage.error('tears 分析提交失败')
|
||||
} finally {
|
||||
tearsSubmitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const currentMetrics = computed(() => {
|
||||
if (!detail.value?.metrics) return null
|
||||
const metrics = detail.value.metrics as Record<string, unknown>
|
||||
@@ -314,7 +347,10 @@ function pct(val: number | null | undefined): string {
|
||||
|
||||
<!-- Actions -->
|
||||
<div class="actions">
|
||||
<button class="btn primary" @click="goToNewFactor">查看完整 tears 报告</button>
|
||||
<button class="btn primary" :disabled="tearsSubmitting" @click="generateTears">
|
||||
{{ tearsSubmitting ? '发起中…' : '生成 tears 报告' }}
|
||||
</button>
|
||||
<button class="btn" @click="goToNewFactor">自选样本分析</button>
|
||||
<button class="btn" :class="{ chosen: inCompare }" @click="toggleCompare">
|
||||
{{ inCompare ? '✓ 已加入对比' : '加入对比' }}
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user