9.4上午提交
This commit is contained in:
@@ -87,7 +87,7 @@
|
||||
|
||||
<view class="listbox">
|
||||
<!-- 使用 up-index-list 索引组件,数据动态渲染 -->
|
||||
<up-index-list :index-list="indexList" custom-nav-height="140rpx">
|
||||
<up-index-list :index-list="indexList" custom-nav-height="140rpx" v-if="patientList.length > 0">
|
||||
<template v-for="group in patientGroups" :key="group.letter">
|
||||
<up-index-item >
|
||||
<up-index-anchor :text="group.letter" />
|
||||
@@ -117,18 +117,49 @@
|
||||
</up-index-item>
|
||||
</template>
|
||||
</up-index-list>
|
||||
<empty v-else></empty>
|
||||
</view>
|
||||
</view>
|
||||
<view class="plan" v-if="activeTab === 'plan'">
|
||||
|
||||
<view class="apply-list" v-if="applyList.length > 0">
|
||||
<view class="apply-item" v-for="item in applyList" :key="item.id">
|
||||
<view class="apply-content">
|
||||
<text class="apply-text">{{ item.messagePreview }}</text>
|
||||
<scroll-view
|
||||
class="plan-scroll"
|
||||
scroll-y="true"
|
||||
refresher-enabled="true"
|
||||
:refresher-triggered="followUpRefreshing"
|
||||
@refresherrefresh="onFollowUpRefresh"
|
||||
@scrolltolower="onFollowUpLoadMore"
|
||||
:lower-threshold="100"
|
||||
>
|
||||
<view class="plan-list" v-if="groupedFollowUpList.length > 0">
|
||||
<view class="plan-group" v-for="group in groupedFollowUpList" :key="group.yearMonth">
|
||||
<view class="group-header">{{ group.yearMonth }}</view>
|
||||
<view class="plan-card" v-for="item in group.items" :key="item.uuid" @click="goFollowDetail(item)">
|
||||
<view class="left-rail">
|
||||
<text class="day">{{ formatDay(item.datetime) }}</text>
|
||||
</view>
|
||||
<view class="linebox">
|
||||
<up-image :src="lineImg" width="14rpx" height="140rpx" ></up-image>
|
||||
</view>
|
||||
<view class="right-content">
|
||||
<view class="note">{{ item.note }}</view>
|
||||
<uni-icons type="forward" size="20" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 加载更多状态 -->
|
||||
<view class="load-more" v-if="followUpLoading">
|
||||
<uni-icons type="spinner-cycle" size="20" color="#999"></uni-icons>
|
||||
<text class="load-text">加载中...</text>
|
||||
</view>
|
||||
|
||||
<!-- 没有更多数据 -->
|
||||
<view class="no-more" v-if="!followUpHasMore && followUpList.length > 0">
|
||||
<text class="no-more-text">没有更多数据了</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<empty v-else></empty>
|
||||
<empty v-else></empty>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 悬浮添加按钮 -->
|
||||
<view class="floating-add-btn" @click="showAddMenu">
|
||||
@@ -175,7 +206,7 @@
|
||||
|
||||
|
||||
<script setup>
|
||||
import { ref, getCurrentInstance } from 'vue';
|
||||
import { ref, getCurrentInstance, computed } from 'vue';
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
import dayImg from "@/static/visit_data11.png"
|
||||
import planImg from "@/static/visitplan.png"
|
||||
@@ -185,6 +216,8 @@
|
||||
const patientList = ref([]);
|
||||
import pinyin from 'pinyin';
|
||||
import dayjs from 'dayjs'
|
||||
import lineImg from "@/static/item_visitplan_fg.png"
|
||||
|
||||
const goPatientDetail = (uuid) => {
|
||||
navTo({
|
||||
url: `/pages_app/patientDetail/patientDetail?uuid=${uuid}`
|
||||
@@ -202,6 +235,18 @@
|
||||
const d = dayjs(input);
|
||||
return d.isValid() ? d.format('YYYY-MM-DD') : '';
|
||||
}
|
||||
|
||||
const formatYearMonth = (input) => {
|
||||
if (!input) return '';
|
||||
const d = dayjs(input);
|
||||
return d.isValid() ? d.format('YYYY年MM月') : '';
|
||||
}
|
||||
// 格式化显示日(如:03)
|
||||
const formatDay = (input) => {
|
||||
if (!input) return '';
|
||||
const d = dayjs(input);
|
||||
return d.isValid() ? d.format('DD日') : '';
|
||||
}
|
||||
// 申请列表数据
|
||||
const messageList = ref([
|
||||
{
|
||||
@@ -283,7 +328,51 @@
|
||||
|
||||
// 刷新状态
|
||||
const isRefreshing = ref(false);
|
||||
|
||||
const getFollowUpList = async (isRefresh = false) => {
|
||||
if (followUpLoading.value) return;
|
||||
|
||||
followUpLoading.value = true;
|
||||
|
||||
try {
|
||||
const currentPage = isRefresh ? 1 : page.value;
|
||||
const res = await api.followUpList({
|
||||
page: currentPage,
|
||||
pageSize: followUpPageSize.value
|
||||
});
|
||||
|
||||
if(res.code === 200) {
|
||||
const newData = res.data.list || [];
|
||||
|
||||
if (isRefresh) {
|
||||
// 下拉刷新:替换数据
|
||||
followUpList.value = newData;
|
||||
page.value = 1;
|
||||
} else {
|
||||
// 上拉加载:追加数据
|
||||
followUpList.value = [...followUpList.value, ...newData];
|
||||
}
|
||||
|
||||
// 判断是否还有更多数据
|
||||
followUpHasMore.value = newData.length >= followUpPageSize.value;
|
||||
|
||||
if (!isRefresh) {
|
||||
page.value++;
|
||||
}
|
||||
|
||||
console.log('随访计划数据:', followUpList.value);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取随访计划失败:', error);
|
||||
uni.showToast({
|
||||
title: '获取数据失败',
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
});
|
||||
} finally {
|
||||
followUpLoading.value = false;
|
||||
followUpRefreshing.value = false;
|
||||
}
|
||||
};
|
||||
const getApplyList = async () => { // 申请列表
|
||||
|
||||
try {
|
||||
@@ -321,17 +410,36 @@
|
||||
|
||||
};
|
||||
const page=ref(1)
|
||||
const followUpList = async () => {
|
||||
let userInfo=uni.getStorageSync('userInfo')
|
||||
const res = await api.followUpList({
|
||||
page:page.value,
|
||||
pageSize:10
|
||||
});
|
||||
if(res.code === '1'){
|
||||
followUpList.value = res.data;
|
||||
const followUpList = ref([]);
|
||||
|
||||
// 随访计划相关状态
|
||||
const followUpLoading = ref(false);
|
||||
const followUpRefreshing = ref(false);
|
||||
const followUpHasMore = ref(true);
|
||||
const followUpPageSize = ref(10);
|
||||
|
||||
// 按年月分组的随访计划数据
|
||||
const groupedFollowUpList = computed(() => {
|
||||
if (!followUpList.value || followUpList.value.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
};
|
||||
const groups = new Map();
|
||||
|
||||
followUpList.value.forEach(item => {
|
||||
const yearMonth = formatYearMonth(item.datetime);
|
||||
if (!groups.has(yearMonth)) {
|
||||
groups.set(yearMonth, []);
|
||||
}
|
||||
groups.get(yearMonth).push(item);
|
||||
});
|
||||
|
||||
// 转换为数组格式,按时间正序排列
|
||||
return Array.from(groups.entries()).map(([yearMonth, items]) => ({
|
||||
yearMonth,
|
||||
items: items.sort((a, b) => new Date(a.datetime) - new Date(b.datetime))
|
||||
})).sort((a, b) => new Date(a.items[0].datetime) - new Date(b.items[0].datetime));
|
||||
});
|
||||
|
||||
// 下拉刷新
|
||||
const onRefresh = async () => {
|
||||
@@ -356,6 +464,23 @@
|
||||
}
|
||||
};
|
||||
|
||||
// 随访计划下拉刷新
|
||||
const onFollowUpRefresh = async () => {
|
||||
followUpRefreshing.value = true;
|
||||
await getFollowUpList(true);
|
||||
uni.showToast({
|
||||
title: '刷新成功',
|
||||
icon: 'success',
|
||||
duration: 1500
|
||||
});
|
||||
};
|
||||
|
||||
// 随访计划上拉加载
|
||||
const onFollowUpLoadMore = async () => {
|
||||
if (!followUpHasMore.value || followUpLoading.value) return;
|
||||
await getFollowUpList(false);
|
||||
};
|
||||
|
||||
// 搜索患者
|
||||
const searchPatients = () => {
|
||||
uni.showToast({
|
||||
@@ -397,11 +522,10 @@
|
||||
// 显示患者列表
|
||||
break;
|
||||
case 'plan':
|
||||
// 跳转到随访计划页面
|
||||
uni.showToast({
|
||||
title: '随访计划',
|
||||
icon: 'none'
|
||||
});
|
||||
// 随访计划页面 - 加载随访计划数据
|
||||
if (followUpList.value.length === 0) {
|
||||
getFollowUpList(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
@@ -432,12 +556,13 @@
|
||||
const addFollowUpPlan = () => {
|
||||
showAddMenuFlag.value = false;
|
||||
uni.navigateTo({
|
||||
url: '/pages_app/visit/visit'
|
||||
url: '/pages_app/visit/visit?from=patientMsg'
|
||||
});
|
||||
};
|
||||
|
||||
// 添加日程
|
||||
const addSchedule = () => {
|
||||
showAddMenuFlag.value = false;
|
||||
uni.navigateTo({
|
||||
url: '/pages_app/schedule/schedule'
|
||||
});
|
||||
@@ -457,17 +582,25 @@
|
||||
|
||||
// 页面显示时加载数据
|
||||
onShow(() => {
|
||||
activeTab.value='message';
|
||||
loadMessageList();
|
||||
computeListHeight();
|
||||
getApplyList();
|
||||
patientListByGBK();
|
||||
followUpList();
|
||||
getFollowUpList();
|
||||
});
|
||||
|
||||
// 加载消息列表
|
||||
const loadMessageList = () => {
|
||||
// 这里可以调用API获取消息列表
|
||||
};
|
||||
|
||||
const goFollowDetail = (raw) => {
|
||||
if(!raw) return;
|
||||
navTo({
|
||||
url: `/pages_app/followDetail/followDetail?followUpUuid=${encodeURIComponent(raw.uuid || '')}&patient_name=${encodeURIComponent(raw.patient_name || '')}`
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -476,7 +609,9 @@
|
||||
min-height: 100vh;
|
||||
|
||||
}
|
||||
|
||||
.linebox{
|
||||
margin:0 20rpx;
|
||||
}
|
||||
// 导航栏右侧按钮样式
|
||||
.nav-right {
|
||||
display: flex;
|
||||
@@ -878,5 +1013,99 @@
|
||||
background-color: #f0f0f0;
|
||||
margin: 0 40rpx;
|
||||
}
|
||||
|
||||
/* 随访计划样式 */
|
||||
.plan{
|
||||
position: fixed;
|
||||
top: 140rpx;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom:110rpx;
|
||||
}
|
||||
|
||||
.plan-scroll {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.plan-list{
|
||||
margin-top: 20rpx;
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.plan-group{
|
||||
background:#f5f5f5;
|
||||
}
|
||||
|
||||
.group-header{
|
||||
text-align: center;
|
||||
background:#eee;
|
||||
color:#333;
|
||||
font-size: 30rpx;
|
||||
padding: 20rpx 30rpx;
|
||||
}
|
||||
|
||||
.plan-card{
|
||||
display:flex;
|
||||
align-items:center;
|
||||
background:#fff;
|
||||
padding: 26rpx 30rpx;
|
||||
border-bottom:1rpx solid #f0f0f0;
|
||||
}
|
||||
|
||||
.left-rail{
|
||||
display:flex;
|
||||
align-items:center;
|
||||
color:#8B2316;
|
||||
}
|
||||
|
||||
.left-rail .day{
|
||||
font-size: 36rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.left-rail .rail-dot{
|
||||
width: 4rpx;
|
||||
height: 60rpx;
|
||||
background:#8B2316;
|
||||
border-radius: 2rpx;
|
||||
}
|
||||
|
||||
.right-content{
|
||||
flex:1;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:space-between;
|
||||
}
|
||||
|
||||
.right-content .note{
|
||||
font-size: 30rpx;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
/* 加载状态样式 */
|
||||
.load-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 30rpx;
|
||||
color: #999;
|
||||
|
||||
.load-text {
|
||||
margin-left: 10rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.no-more {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 30rpx;
|
||||
|
||||
.no-more-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user