3.11提交

This commit is contained in:
zoujiandong
2026-03-11 13:13:10 +08:00
parent 40f5ddf4a5
commit 08e3ba22c5
22 changed files with 2845 additions and 185 deletions
+57 -11
View File
@@ -2,20 +2,21 @@
<view class="patient-group-page">
<!-- 头部 -->
<uni-nav-bar
<view class="navbox">
<view class="status_bar"></view>
<uni-nav-bar
left-icon="left"
title="患者分组"
@clickLeft="goBack"
fixed
color="#8B2316"
height="180rpx"
:border="false"
@clickLeft="goBack"
color="#8B2316"
:border="false"
backgroundColor="#eeeeee"
>
<template #right>
<view class="save-text" @click="confirmGroup">确定({{ totalSelectedCount }})</view>
</template>
</uni-nav-bar>
</view>
<!-- 筛选排序栏 -->
<!-- <view class="filter-sort-bar">
<view class="sort-section" @click="toggleGroupSort">
@@ -82,9 +83,16 @@
<view class="patient-list" v-if="openGroups[gi]">
<view class="patient-item" v-for="(patient, index) in (group.patientList || [])" :key="patient.uuid || index">
<view class="patient-avatar">
<up-image :src="docUrl + patient.photo" width="80rpx" height="80rpx" mode="aspectFill"></up-image>
<view class="namebox">
<view class="patient-avatar">
<up-image :src="patient._avatarLoadError ? defaultImg : getPatientAvatar(patient)" width="80rpx" height="80rpx" mode="aspectFill" @error="handlePatientAvatarError(patient)"></up-image>
</view>
<view class="name">
<view class="real">{{ patient.realName}}</view>
<view class="nick" v-if="patient.nickname">{{ patient.nickname}}</view>
</view>
</view>
<view class="patient-checkbox" @click.stop="togglePatientSelection(gi, patient, index)">
<view class="checkbox" :class="{ 'checked': isPatientSelected(gi, patient, index) }">
<uni-icons v-if="isPatientSelected(gi, patient, index)" type="checkmarkempty" color="#8B2316" size="16"></uni-icons>
@@ -103,12 +111,13 @@
</template>
<script setup>
import { ref, computed, onMounted } from 'vue';
import { ref, computed, onMounted,nextTick} from 'vue';
import { onShow,onLoad } from "@dcloudio/uni-app";
import upImg from "@/static/triangle_green_theme.png"
import downImg from "@/static/triangle_normal.png"
import groupRightImg from "@/static/groupright_big.png"
import groupDownImg from "@/static/groupup_big.png"
import defaultImg from "@/static/default.png"
import api from '@/api/api.js';
import docUrl from '@/utils/docUrl'
import dayjs from 'dayjs'
@@ -161,7 +170,11 @@ const selectedPatientCount = computed(() => {
// 合计数量:只计算去重后的患者数量
const totalSelectedCount = computed(() => selectedPatientCount.value);
onShow(() => {
onLoad(() => {
uni.showLoading({
title: '加载中...',
mask: true
});
fetchGroupList();
});
@@ -183,6 +196,9 @@ const fetchGroupList = async () => {
// 若组选中但患者为空,则保持组选中;否则按患者是否全选同步组选中状态
updateGroupSelectionByPatients(idx);
});
nextTick(() => {
uni.hideLoading();
});
}
};
@@ -268,6 +284,10 @@ const chooseGroupSort = (type) => {
};
const confirmGroup = () => {
// 收集已选患者,并做去重
if(totalSelectedCount.value > 200){
uni.showToast({ title: '选择人数不能超过200', icon: 'none' });
return;
}
const idSet = new Set();
const dedupPatients = [];
groups.value.forEach((group, gi) => {
@@ -341,9 +361,35 @@ const clearSelection = () => {
selectedPatients.value = {};
};
const getPatientAvatar = (patient) => {
if (!patient) return defaultImg;
return patient.photo ? (docUrl + patient.photo) : defaultImg;
};
const handlePatientAvatarError = (patient) => {
if (!patient) return;
patient._avatarLoadError = true;
};
</script>
<style lang="scss" scoped>
.namebox{
display: flex;
align-items: center;
.name{
margin-left: 16rpx;
}
.real{
color: #333;
font-size: 28rpx;
}
.nick{
color:#666;
font-size: 26rpx;
margin-top: 2rpx;
}
}
.patient-group-page {
min-height: 100vh;
background-color: #f5f5f5;
@@ -578,7 +624,7 @@ const clearSelection = () => {
}
.patient-list-section {
top: 180rpx;
top:calc(var(--status-bar-height) + 44px);
width:100%;
bottom:120rpx; // 预留底部操作栏高度
position: fixed;