fix(growth-quality): period select reads periods array from object response
ci/woodpecker/push/main Pipeline failed

Backend GET /growth-quality/periods returns {entity_id,periods[],coverage{}}; axios interceptor already unwraps response.data so the old r.data||r||[] put the whole object into el-select and Vue rendered JSON.

Also default to periods[0]: backend returns periods in DESC order, so old code picked the OLDEST period. Only frontend/src/views/GrowthQuality.vue changed.
This commit is contained in:
Hermes CI Fix
2026-09-23 15:29:44 +08:00
parent bd4f58aae1
commit c88e1ad6c9
+6 -2
View File
@@ -130,9 +130,13 @@ async function loadPeriods() {
loadingPeriods.value = true
try {
const r: any = await api.get('/growth-quality/periods')
periods.value = r.data || r || []
// 后端返回 {entity_id, periods[], coverage{}};axios 拦截器已 unwrap(response.data),
// 故 r 即响应体本体、r.data 恒为 undefined(本页曾因此把整个对象塞进 el-select → 渲染成 JSON)
const raw = r?.periods ?? r?.data?.periods
const list = Array.isArray(raw) ? raw : (Array.isArray(r) ? r : [])
periods.value = list.filter((p: any) => typeof p === 'string')
if (periods.value.length && !periods.value.includes(period.value)) {
period.value = periods.value[periods.value.length - 1]
period.value = periods.value[0] // 后端按期间倒序返回 → 首元素即最新有数据的期间
}
} catch (_) {}
loadingPeriods.value = false