bug修复
This commit is contained in:
parent
6dcfee76d7
commit
31ac208134
@ -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,40 +262,48 @@ async function getList() {
|
|||||||
list.value = []
|
list.value = []
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const data = {
|
loading.value = true;
|
||||||
corpId: account.value.corpId,
|
try {
|
||||||
startDate: filterData.value.startDate,
|
const data = {
|
||||||
endDate: filterData.value.endDate,
|
corpId: account.value.corpId,
|
||||||
page: page.value,
|
startDate: filterData.value.startDate,
|
||||||
pageSize: pageSize.value
|
endDate: filterData.value.endDate,
|
||||||
}
|
page: page.value,
|
||||||
if (followUpType.value === 'person') {
|
pageSize: 4
|
||||||
data.executorUserId = doctorInfo.value.userid;
|
}
|
||||||
} else {
|
if (followUpType.value === 'person') {
|
||||||
data.teamIds = chargeTeams.value.map(i => i.teamId);
|
data.executorUserId = doctorInfo.value.userid;
|
||||||
}
|
} else {
|
||||||
if (filterData.value.eventStatus !== 'all') {
|
data.teamIds = chargeTeams.value.map(i => i.teamId);
|
||||||
data.statusList = [filterData.value.eventStatus]
|
}
|
||||||
}
|
if (filterData.value.eventStatus !== 'all') {
|
||||||
if (filterData.value.eventType) {
|
data.statusList = [filterData.value.eventStatus]
|
||||||
data.eventType = filterData.value.eventType;
|
}
|
||||||
}
|
if (filterData.value.eventType) {
|
||||||
const res = await api('getTeamTodos', data);
|
data.eventType = filterData.value.eventType;
|
||||||
const arr = res && Array.isArray(res.data) ? res.data.map(i => ({
|
}
|
||||||
...i,
|
const res = await api('getTeamTodos', data);
|
||||||
eventTypeLabel: ToDoEventType[i.eventType],
|
const arr = res && Array.isArray(res.data) ? res.data.map(i => ({
|
||||||
planDate: i.plannedExecutionTime && dayjs(i.plannedExecutionTime).isValid() ? dayjs(i.plannedExecutionTime).format("YYYY-MM-DD") : "",
|
...i,
|
||||||
endTime: i.endTime && dayjs(i.endTime).isValid() ? dayjs(i.endTime).format("YYYY-MM-DD HH:mm") : "",
|
eventTypeLabel: ToDoEventType[i.eventType],
|
||||||
createTime: i.createTime && dayjs(i.createTime).isValid() ? dayjs(i.createTime).format("YYYY-MM-DD HH:mm") : "",
|
planDate: i.plannedExecutionTime && dayjs(i.plannedExecutionTime).isValid() ? dayjs(i.plannedExecutionTime).format("YYYY-MM-DD") : "",
|
||||||
eventStatusLabel: statusNames[i.eventStatus],
|
endTime: i.endTime && dayjs(i.endTime).isValid() ? dayjs(i.endTime).format("YYYY-MM-DD HH:mm") : "",
|
||||||
fileList: Array.isArray(i.fileList) ? i.fileList.filter(i => i && i.file && i.file.name) : [],
|
createTime: i.createTime && dayjs(i.createTime).isValid() ? dayjs(i.createTime).format("YYYY-MM-DD HH:mm") : "",
|
||||||
ownTeam: followUpType.value === 'team'
|
eventStatusLabel: statusNames[i.eventStatus],
|
||||||
})) : [];
|
fileList: Array.isArray(i.fileList) ? i.fileList.filter(i => i && i.file && i.file.name) : [],
|
||||||
list.value = page.value === 1 ? arr : [...list.value, ...arr];
|
ownTeam: followUpType.value === 'team'
|
||||||
total.value = res && res.total > 0 ? res.total : 0;
|
})) : [];
|
||||||
pages.value = res && res.pages > 0 ? res.pages : 0;
|
list.value = page.value === 1 ? arr : [...list.value, ...arr];
|
||||||
if (!res && !res.success) {
|
total.value = res && res.total > 0 ? res.total : 0;
|
||||||
toast(res?.message || '查询待办失败')
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user