bug修复

This commit is contained in:
zhanchao 2026-09-09 10:35:40 +08:00
parent 6dcfee76d7
commit 31ac208134

View File

@ -91,7 +91,7 @@
</view>
</template>
<scroll-view v-if="list.length" scroll-y="true" class="h-full">
<scroll-view v-if="list.length" scroll-y class="todo-scroll h-full" :lower-threshold="80" @scrolltolower="getMore">
<view v-for="i in list" :key="i._id" class="mb-10 shadow-lg bg-white" @click="toTodoDetail(i)">
<view class="flex items-center justify-between px-15 py-10 border-b">
<view class="text-base text-dark">计划执行: {{ i.planDate }}</view>
@ -140,7 +140,7 @@
</template>
<script setup>
import { computed, ref } from 'vue';
import { computed, nextTick, ref } from 'vue';
import { storeToRefs } from "pinia";
import { statusNames, ToDoEventType, statusClassNames } from '@/baseData';
import useGuard from "@/hooks/useGuard.js";
@ -176,7 +176,7 @@ const filtered = ref(false);
const filterVisible = ref(false);
const filterData = ref({ eventStatus: 'processing' });
const followUpType = ref('person') // person team
const { total, list, page, pages, pageSize, changePage } = usePageList(getList)
const { total, list, loading, page, pages, pageSize, changePage } = usePageList(getList)
const certStatus = computed(() => doctorInfo.value?.verifyStatus ? certConfig[doctorInfo.value.verifyStatus] : null)
@ -212,6 +212,28 @@ function changeStatus(val) {
changePage(1);
}
function getMore() {
const totalPages = Number(pages.value) || Math.ceil((Number(total.value) || 0) / Number(pageSize.value || 1));
if (totalPages > page.value && !loading.value) {
changePage(page.value + 1);
}
}
function loadWhenNotScrollable() {
nextTick(() => {
const query = uni.createSelectorQuery();
query.select('.todo-scroll').boundingClientRect();
query.select('.todo-scroll').scrollOffset();
query.exec((result) => {
const rect = result?.[0];
const offset = result?.[1];
if (rect && offset && offset.scrollHeight <= rect.height && !loading.value) {
getMore();
}
});
});
}
function editProfile() {
uni.navigateTo({
url: "/pages/work/profile",
@ -240,40 +262,48 @@ async function getList() {
list.value = []
return
}
const data = {
corpId: account.value.corpId,
startDate: filterData.value.startDate,
endDate: filterData.value.endDate,
page: page.value,
pageSize: pageSize.value
}
if (followUpType.value === 'person') {
data.executorUserId = doctorInfo.value.userid;
} else {
data.teamIds = chargeTeams.value.map(i => i.teamId);
}
if (filterData.value.eventStatus !== 'all') {
data.statusList = [filterData.value.eventStatus]
}
if (filterData.value.eventType) {
data.eventType = filterData.value.eventType;
}
const res = await api('getTeamTodos', data);
const arr = res && Array.isArray(res.data) ? res.data.map(i => ({
...i,
eventTypeLabel: ToDoEventType[i.eventType],
planDate: i.plannedExecutionTime && dayjs(i.plannedExecutionTime).isValid() ? dayjs(i.plannedExecutionTime).format("YYYY-MM-DD") : "",
endTime: i.endTime && dayjs(i.endTime).isValid() ? dayjs(i.endTime).format("YYYY-MM-DD HH:mm") : "",
createTime: i.createTime && dayjs(i.createTime).isValid() ? dayjs(i.createTime).format("YYYY-MM-DD HH:mm") : "",
eventStatusLabel: statusNames[i.eventStatus],
fileList: Array.isArray(i.fileList) ? i.fileList.filter(i => i && i.file && i.file.name) : [],
ownTeam: followUpType.value === 'team'
})) : [];
list.value = page.value === 1 ? arr : [...list.value, ...arr];
total.value = res && res.total > 0 ? res.total : 0;
pages.value = res && res.pages > 0 ? res.pages : 0;
if (!res && !res.success) {
toast(res?.message || '查询待办失败')
loading.value = true;
try {
const data = {
corpId: account.value.corpId,
startDate: filterData.value.startDate,
endDate: filterData.value.endDate,
page: page.value,
pageSize: 4
}
if (followUpType.value === 'person') {
data.executorUserId = doctorInfo.value.userid;
} else {
data.teamIds = chargeTeams.value.map(i => i.teamId);
}
if (filterData.value.eventStatus !== 'all') {
data.statusList = [filterData.value.eventStatus]
}
if (filterData.value.eventType) {
data.eventType = filterData.value.eventType;
}
const res = await api('getTeamTodos', data);
const arr = res && Array.isArray(res.data) ? res.data.map(i => ({
...i,
eventTypeLabel: ToDoEventType[i.eventType],
planDate: i.plannedExecutionTime && dayjs(i.plannedExecutionTime).isValid() ? dayjs(i.plannedExecutionTime).format("YYYY-MM-DD") : "",
endTime: i.endTime && dayjs(i.endTime).isValid() ? dayjs(i.endTime).format("YYYY-MM-DD HH:mm") : "",
createTime: i.createTime && dayjs(i.createTime).isValid() ? dayjs(i.createTime).format("YYYY-MM-DD HH:mm") : "",
eventStatusLabel: statusNames[i.eventStatus],
fileList: Array.isArray(i.fileList) ? i.fileList.filter(i => i && i.file && i.file.name) : [],
ownTeam: followUpType.value === 'team'
})) : [];
list.value = page.value === 1 ? arr : [...list.value, ...arr];
total.value = res && res.total > 0 ? res.total : 0;
pages.value = res && res.pages > 0 ? res.pages : 0;
if (!res || !res.success) {
toast(res?.message || '查询待办失败')
}
if (res?.success && arr.length) {
loadWhenNotScrollable();
}
} finally {
loading.value = false;
}
}
@ -417,4 +447,4 @@ useShow(async () => {
width: 24rpx;
height: 24rpx;
}
</style>
</style>