fix(bugcollect): 修复趋势图不显示 — API 响应结构为 {issueId, points[]} 而非数组
trend API 返回 { issueId, points: [...] },前端误以为是数组直接调用 .map()
导致 TypeError 被 catch 静默吞掉,图表从不渲染。
修复:正确读取 res.data.data.points,并更新类型定义。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
父节点
563a8d8af6
当前提交
e2b85c76a4
@ -162,7 +162,7 @@ export const bugCollectApi = {
|
||||
},
|
||||
|
||||
issueTrend(id: string | number, params?: { from?: string; to?: string }) {
|
||||
return client.get<{ data: { date: string; count: number; affectedUsers: number }[] }>(
|
||||
return client.get<{ data: { issueId: number; points: { date: string; count: number; affectedUsers: number }[] } }>(
|
||||
`/bugcollect/v1/issues/${id}/trend`,
|
||||
{ params },
|
||||
)
|
||||
|
||||
@ -241,7 +241,7 @@ async function loadTrend() {
|
||||
if (!id || !trendChartRef.value) return
|
||||
try {
|
||||
const res = await bugCollectApi.issueTrend(id)
|
||||
const trend = res.data.data
|
||||
const trend = res.data.data?.points
|
||||
if (!trend || !trendChartRef.value) return
|
||||
|
||||
if (!trendChart) trendChart = echarts.init(trendChartRef.value)
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户