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> </view>
</template> </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 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="flex items-center justify-between px-15 py-10 border-b">
<view class="text-base text-dark">计划执行: {{ i.planDate }}</view> <view class="text-base text-dark">计划执行: {{ i.planDate }}</view>
@ -140,7 +140,7 @@
</template> </template>
<script setup> <script setup>
import { computed, ref } from 'vue'; import { computed, nextTick, ref } from 'vue';
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { statusNames, ToDoEventType, statusClassNames } from '@/baseData'; import { statusNames, ToDoEventType, statusClassNames } from '@/baseData';
import useGuard from "@/hooks/useGuard.js"; import useGuard from "@/hooks/useGuard.js";
@ -176,7 +176,7 @@ const filtered = ref(false);
const filterVisible = ref(false); const filterVisible = ref(false);
const filterData = ref({ eventStatus: 'processing' }); const filterData = ref({ eventStatus: 'processing' });
const followUpType = ref('person') // person team 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) const certStatus = computed(() => doctorInfo.value?.verifyStatus ? certConfig[doctorInfo.value.verifyStatus] : null)
@ -212,6 +212,28 @@ function changeStatus(val) {
changePage(1); 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() { function editProfile() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/work/profile", url: "/pages/work/profile",
@ -240,12 +262,14 @@ async function getList() {
list.value = [] list.value = []
return return
} }
loading.value = true;
try {
const data = { const data = {
corpId: account.value.corpId, corpId: account.value.corpId,
startDate: filterData.value.startDate, startDate: filterData.value.startDate,
endDate: filterData.value.endDate, endDate: filterData.value.endDate,
page: page.value, page: page.value,
pageSize: pageSize.value pageSize: 4
} }
if (followUpType.value === 'person') { if (followUpType.value === 'person') {
data.executorUserId = doctorInfo.value.userid; data.executorUserId = doctorInfo.value.userid;
@ -272,9 +296,15 @@ async function getList() {
list.value = page.value === 1 ? arr : [...list.value, ...arr]; list.value = page.value === 1 ? arr : [...list.value, ...arr];
total.value = res && res.total > 0 ? res.total : 0; total.value = res && res.total > 0 ? res.total : 0;
pages.value = res && res.pages > 0 ? res.pages : 0; pages.value = res && res.pages > 0 ? res.pages : 0;
if (!res && !res.success) { if (!res || !res.success) {
toast(res?.message || '查询待办失败') toast(res?.message || '查询待办失败')
} }
if (res?.success && arr.length) {
loadWhenNotScrollable();
}
} finally {
loading.value = false;
}
} }