Files
akmon/pages/ec/doctor/health-reports.uvue
2026-01-20 08:04:15 +08:00

107 lines
2.1 KiB
Plaintext

<template>
<view class="health-reports-page">
<view class="header">
<text class="title">健康报告</text>
</view>
<view class="content">
<view v-if="reports.length === 0" class="empty-state">
<text class="empty-text">暂无健康报告</text>
</view>
<view v-for="report in reports" :key="report.id" class="report-item">
<text class="report-title">{{ report.title }}</text>
<text class="report-date">{{ formatDate(report.created_at) }}</text>
<text class="report-summary">{{ report.summary }}</text>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { ref, onMounted } from 'vue'
import supa from '@/components/supadb/aksupainstance.uts'
import { formatDate } from '../types_new.uts'
type HealthReport = {
id: string
elder_id: string
elder_name: string
title: string
summary: string
created_at: string
}
const reports = ref<Array<HealthReport>>([])
onMounted(() => {
loadReports()
})
const loadReports = async () => {
try {
const result = await supa
.from('ec_health_reports')
.select('*')
.order('created_at', { ascending: false })
.limit(20)
.executeAs<HealthReport[]>()
if (result.error == null && result.data != null) {
reports.value = result.data
}
} catch (error) {
console.error('加载健康报告失败:', error)
}
}
</script>
<style scoped>
.health-reports-page {
padding: 20px;
background: #f5f5f5;
min-height: 100vh;
}
.header {
margin-bottom: 20px;
}
.title {
font-size: 22px;
font-weight: bold;
color: #333;
}
.content {
background: #fff;
border-radius: 10px;
padding: 16px;
}
.report-item {
border-bottom: 1px solid #f0f0f0;
padding: 12px 0;
}
.report-item:last-child {
border-bottom: none;
}
.report-title {
font-size: 16px;
font-weight: 600;
color: #222;
}
.report-date {
font-size: 12px;
color: #888;
margin-left: 10px;
}
.report-summary {
font-size: 13px;
color: #555;
margin-top: 6px;
display: block;
}
.empty-state {
text-align: center;
padding: 40px 0;
}
.empty-text {
color: #aaa;
font-size: 14px;
}
</style>