fix:优化病历列表显示

This commit is contained in:
Jafeng 2026-02-06 14:12:56 +08:00
parent ea51cee22a
commit de468c1acb

View File

@ -30,13 +30,8 @@
<view class="tabs-area"> <view class="tabs-area">
<scroll-view scroll-x class="tabs-scroll" :show-scrollbar="false"> <scroll-view scroll-x class="tabs-scroll" :show-scrollbar="false">
<view class="tabs-container"> <view class="tabs-container">
<view <view v-for="tab in tabs" :key="tab.key" class="tab-item" :class="{ active: currentTabKey === tab.key }"
v-for="tab in tabs" @click="onTabClick(tab)">
:key="tab.key"
class="tab-item"
:class="{ active: currentTabKey === tab.key }"
@click="onTabClick(tab)"
>
{{ tab.label }} {{ tab.label }}
</view> </view>
</view> </view>
@ -47,32 +42,24 @@
<!-- Main Content --> <!-- Main Content -->
<view class="content-body"> <view class="content-body">
<!-- Patient List --> <!-- Patient List -->
<scroll-view <scroll-view scroll-y class="patient-list" :scroll-into-view="scrollIntoId" :scroll-with-animation="true"
scroll-y lower-threshold="80" @scrolltolower="loadMore">
class="patient-list"
:scroll-into-view="scrollIntoId"
:scroll-with-animation="true"
lower-threshold="80"
@scrolltolower="loadMore"
>
<view v-for="group in patientList" :key="group.letter" :id="letterToDomId(group.letter)"> <view v-for="group in patientList" :key="group.letter" :id="letterToDomId(group.letter)">
<view class="group-title">{{ group.letter }}</view> <view class="group-title">{{ group.letter }}</view>
<view v-for="(patient, pIndex) in group.data" :key="pIndex" class="patient-card" @click="handlePatientClick(patient)"> <view v-for="(patient, pIndex) in group.data" :key="pIndex" class="patient-card"
@click="handlePatientClick(patient)">
<!-- Checkbox for Batch Mode --> <!-- Checkbox for Batch Mode -->
<view v-if="isBatchMode" class="checkbox-area"> <view v-if="isBatchMode" class="checkbox-area">
<uni-icons <uni-icons :type="selectedItems.includes(getSelectId(patient)) ? 'checkbox-filled' : 'checkbox'" size="24"
:type="selectedItems.includes(getSelectId(patient)) ? 'checkbox-filled' : 'checkbox'" :color="selectedItems.includes(getSelectId(patient)) ? '#007aff' : '#ccc'"></uni-icons>
size="24"
:color="selectedItems.includes(getSelectId(patient)) ? '#007aff' : '#ccc'"
></uni-icons>
</view> </view>
<view class="card-content"> <view class="card-content">
<!-- Row 1 --> <!-- Row 1 -->
<view class="card-row-top"> <view class="card-row-top">
<view class="patient-info"> <view class="patient-info">
<text class="patient-name">{{ patient.name }}</text> <text class="patient-name">{{ patient.name }}</text>
<text class="patient-meta">{{ patient.gender }}/{{ patient.age }}</text> <text class="patient-meta">{{ patient.gender }}{{ patient.age ? '/' + patient.age + '岁' : '' }}</text>
</view> </view>
<view class="patient-tags"> <view class="patient-tags">
<view v-for="(tag, tIndex) in resolveGroupTags(patient)" :key="tIndex" class="tag"> <view v-for="(tag, tIndex) in resolveGroupTags(patient)" :key="tIndex" class="tag">
@ -81,11 +68,20 @@
</view> </view>
</view> </view>
<!-- Row 2 / 3 --> <!-- Row 2 -->
<view v-if="currentTabKey === 'new'" class="card-row-middle">
<text v-if="patient.record" class="record-text record-ellipsis">
{{ patient.record.type }} / {{ patient.record.date }} / {{ patient.record.diagnosis }}
</text>
<text v-else class="no-record">暂无病历记录</text>
</view>
<!-- Row 3 -->
<view class="card-row-bottom"> <view class="card-row-bottom">
<template v-if="currentTabKey === 'new'"> <!-- New Patient Tab --> <template v-if="currentTabKey === 'new'"> <!-- New Patient Tab -->
<text class="record-text"> <text class="record-text">
{{ patient.createTime || '-' }} / {{ resolveCreatorName(patient) || '-' }} {{ patient.createTime || '-' }} {{ resolveCreatorName(patient) ? resolveCreatorName(patient) +
'创建' : '-' }}
</text> </text>
</template> </template>
<template v-else> <template v-else>
@ -104,12 +100,7 @@
<!-- Sidebar Index --> <!-- Sidebar Index -->
<view v-if="!isBatchMode" class="sidebar-index"> <view v-if="!isBatchMode" class="sidebar-index">
<view <view v-for="letter in indexList" :key="letter" class="index-item" @click="scrollToLetter(letter)">
v-for="letter in indexList"
:key="letter"
class="index-item"
@click="scrollToLetter(letter)"
>
{{ letter }} {{ letter }}
</view> </view>
</view> </view>
@ -120,9 +111,7 @@
<view class="left-action" @click="handleSelectAll"> <view class="left-action" @click="handleSelectAll">
<uni-icons <uni-icons
:type="selectedItems.length > 0 && selectedItems.length === patientList.flatMap(g => g.data).length ? 'checkbox-filled' : 'checkbox'" :type="selectedItems.length > 0 && selectedItems.length === patientList.flatMap(g => g.data).length ? 'checkbox-filled' : 'checkbox'"
size="24" size="24" color="#666"></uni-icons>
color="#666"
></uni-icons>
<text class="footer-text">全选 ({{ selectedItems.length }})</text> <text class="footer-text">全选 ({{ selectedItems.length }})</text>
</view> </view>
<view class="right-actions"> <view class="right-actions">
@ -202,7 +191,7 @@ const accountStore = useAccountStore();
const { account, doctorInfo } = storeToRefs(accountStore); const { account, doctorInfo } = storeToRefs(accountStore);
const { getDoctorInfo } = accountStore; const { getDoctorInfo } = accountStore;
const teamDisplay = computed(() => `${currentTeam.value?.name || ''}(${managedArchiveCountAllTeams.value})`); const teamDisplay = computed(() => `${currentTeam.value?.name || ''}`);
function asArray(value) { function asArray(value) {
return Array.isArray(value) ? value : []; return Array.isArray(value) ? value : [];
@ -579,7 +568,7 @@ const patientList = computed(() => {
.filter((p) => Number(p?.createTimeTs || 0) >= sevenDaysAgo) .filter((p) => Number(p?.createTimeTs || 0) >= sevenDaysAgo)
.slice() .slice()
.sort((a, b) => Number(b?.createTimeTs || 0) - Number(a?.createTimeTs || 0)); .sort((a, b) => Number(b?.createTimeTs || 0) - Number(a?.createTimeTs || 0));
return [{ letter: '最近新增', data: flatList }]; return [{ letter: '最近7天新增', data: flatList }];
} }
return groupByLetter(all); return groupByLetter(all);
@ -587,7 +576,8 @@ const patientList = computed(() => {
const indexList = computed(() => { const indexList = computed(() => {
if (currentTab.value.kind === 'new') return []; // No index bar for new patient if (currentTab.value.kind === 'new') return []; // No index bar for new patient
return 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('').filter(l => patientList.value.some(g => g.letter === l)); const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ#'.split('').filter(l => patientList.value.some(g => g.letter === l));
return letters;
}); });
const totalPatients = computed(() => { const totalPatients = computed(() => {
@ -953,7 +943,7 @@ onShow(async () => {
color: #666; color: #666;
white-space: nowrap; white-space: nowrap;
flex-shrink: 0; flex-shrink: 0;
min-width: 100rpx; min-width: 70rpx;
text-align: right; text-align: right;
} }
} }
@ -1035,6 +1025,27 @@ onShow(async () => {
} }
} }
.card-row-middle {
font-size: 28rpx;
margin-bottom: 12rpx;
.record-text {
color: #666;
}
.record-ellipsis {
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 100%;
}
.no-record {
color: #bdc3c7;
}
}
.card-row-bottom { .card-row-bottom {
font-size: 28rpx; font-size: 28rpx;
@ -1073,6 +1084,7 @@ onShow(async () => {
.left-action { .left-action {
display: flex; display: flex;
align-items: center; align-items: center;
.footer-text { .footer-text {
margin-left: 10rpx; margin-left: 10rpx;
font-size: 28rpx; font-size: 28rpx;