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">
<scroll-view scroll-x class="tabs-scroll" :show-scrollbar="false">
<view class="tabs-container">
<view
v-for="tab in tabs"
:key="tab.key"
class="tab-item"
:class="{ active: currentTabKey === tab.key }"
@click="onTabClick(tab)"
>
<view v-for="tab in tabs" :key="tab.key" class="tab-item" :class="{ active: currentTabKey === tab.key }"
@click="onTabClick(tab)">
{{ tab.label }}
</view>
</view>
@ -47,32 +42,24 @@
<!-- Main Content -->
<view class="content-body">
<!-- Patient List -->
<scroll-view
scroll-y
class="patient-list"
:scroll-into-view="scrollIntoId"
:scroll-with-animation="true"
lower-threshold="80"
@scrolltolower="loadMore"
>
<scroll-view scroll-y 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 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 -->
<view v-if="isBatchMode" class="checkbox-area">
<uni-icons
:type="selectedItems.includes(getSelectId(patient)) ? 'checkbox-filled' : 'checkbox'"
size="24"
:color="selectedItems.includes(getSelectId(patient)) ? '#007aff' : '#ccc'"
></uni-icons>
<uni-icons :type="selectedItems.includes(getSelectId(patient)) ? 'checkbox-filled' : 'checkbox'" size="24"
:color="selectedItems.includes(getSelectId(patient)) ? '#007aff' : '#ccc'"></uni-icons>
</view>
<view class="card-content">
<!-- Row 1 -->
<view class="card-row-top">
<view class="patient-info">
<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 class="patient-tags">
<view v-for="(tag, tIndex) in resolveGroupTags(patient)" :key="tIndex" class="tag">
@ -81,11 +68,20 @@
</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">
<template v-if="currentTabKey === 'new'"> <!-- New Patient Tab -->
<text class="record-text">
{{ patient.createTime || '-' }} / {{ resolveCreatorName(patient) || '-' }}
{{ patient.createTime || '-' }} {{ resolveCreatorName(patient) ? resolveCreatorName(patient) +
'创建' : '-' }}
</text>
</template>
<template v-else>
@ -104,12 +100,7 @@
<!-- Sidebar Index -->
<view v-if="!isBatchMode" class="sidebar-index">
<view
v-for="letter in indexList"
:key="letter"
class="index-item"
@click="scrollToLetter(letter)"
>
<view v-for="letter in indexList" :key="letter" class="index-item" @click="scrollToLetter(letter)">
{{ letter }}
</view>
</view>
@ -120,9 +111,7 @@
<view class="left-action" @click="handleSelectAll">
<uni-icons
:type="selectedItems.length > 0 && selectedItems.length === patientList.flatMap(g => g.data).length ? 'checkbox-filled' : 'checkbox'"
size="24"
color="#666"
></uni-icons>
size="24" color="#666"></uni-icons>
<text class="footer-text">全选 ({{ selectedItems.length }})</text>
</view>
<view class="right-actions">
@ -202,7 +191,7 @@ const accountStore = useAccountStore();
const { account, doctorInfo } = storeToRefs(accountStore);
const { getDoctorInfo } = accountStore;
const teamDisplay = computed(() => `${currentTeam.value?.name || ''}(${managedArchiveCountAllTeams.value})`);
const teamDisplay = computed(() => `${currentTeam.value?.name || ''}`);
function asArray(value) {
return Array.isArray(value) ? value : [];
@ -246,10 +235,10 @@ async function loadTeamMembers() {
const members = Array.isArray(t.memberList) ? t.memberList : [];
// Update map
members.forEach(m => {
const uid = String(m?.userid || '');
if (uid) {
userNameMap.value[uid] = String(m?.anotherName || m?.name || m?.userid || '') || uid;
}
const uid = String(m?.userid || '');
if (uid) {
userNameMap.value[uid] = String(m?.anotherName || m?.name || m?.userid || '') || uid;
}
});
} catch (e) {
console.error('获取团队成员失败', e);
@ -535,11 +524,11 @@ async function reload(reset = true) {
managedArchiveCountAllTeams.value =
Number(
payload.totalAllTeams ||
payload.totalAllTeam ||
payload.totalAllTeamsCount ||
managedArchiveCountAllTeams.value ||
totalFromApi.value ||
0
payload.totalAllTeam ||
payload.totalAllTeamsCount ||
managedArchiveCountAllTeams.value ||
totalFromApi.value ||
0
) || (totalFromApi.value || 0);
}
@ -579,7 +568,7 @@ const patientList = computed(() => {
.filter((p) => Number(p?.createTimeTs || 0) >= sevenDaysAgo)
.slice()
.sort((a, b) => Number(b?.createTimeTs || 0) - Number(a?.createTimeTs || 0));
return [{ letter: '最近新增', data: flatList }];
return [{ letter: '最近7天新增', data: flatList }];
}
return groupByLetter(all);
@ -587,7 +576,8 @@ const patientList = computed(() => {
const indexList = computed(() => {
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(() => {
@ -953,7 +943,7 @@ onShow(async () => {
color: #666;
white-space: nowrap;
flex-shrink: 0;
min-width: 100rpx;
min-width: 70rpx;
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 {
font-size: 28rpx;
@ -1067,12 +1078,13 @@ onShow(async () => {
align-items: center;
justify-content: space-between;
padding: 0 30rpx;
box-shadow: 0 -4rpx 20rpx rgba(0,0,0,0.05);
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.05);
z-index: 99;
.left-action {
display: flex;
align-items: center;
.footer-text {
margin-left: 10rpx;
font-size: 28rpx;