fix: 健康指标接口字段名修复
This commit is contained in:
@@ -80,10 +80,13 @@ class CareController extends Controller
|
|||||||
->where('care_profile_id', $profile->id);
|
->where('care_profile_id', $profile->id);
|
||||||
|
|
||||||
if ($request->filled('metric_type')) {
|
if ($request->filled('metric_type')) {
|
||||||
$query->where('metric_type', $request->input('metric_type'));
|
$query->where('metric_type', (string) $request->input('metric_type'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = $query->orderByDesc('measured_at')->limit(30)->get();
|
$limit = (int) $request->input('limit', 30);
|
||||||
|
$limit = max(1, min($limit, 50));
|
||||||
|
|
||||||
|
$list = $query->orderByDesc('recorded_at')->limit($limit)->get();
|
||||||
|
|
||||||
return $this->success($list);
|
return $this->success($list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ onMounted(async () => {
|
|||||||
</div>
|
</div>
|
||||||
<div class="metric-body">
|
<div class="metric-body">
|
||||||
<span class="metric-type">{{ metricTypeLabel[m.metric_type] || '指标' }}</span>
|
<span class="metric-type">{{ metricTypeLabel[m.metric_type] || '指标' }}</span>
|
||||||
<span class="metric-time">{{ m.measured_at?.slice(0, 16) }}</span>
|
<span class="metric-time">{{ m.recorded_at?.slice(0, 16) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<span class="metric-val" :style="{ color: typeColor[m.metric_type] }">
|
<span class="metric-val" :style="{ color: typeColor[m.metric_type] }">
|
||||||
{{ m.value }} {{ metricUnit[m.metric_type] || '' }}
|
{{ m.value }} {{ metricUnit[m.metric_type] || '' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user