切换筛选条件时可能继续显示旧数据。
This commit is contained in:
parent
31ac208134
commit
22b2881141
@ -177,6 +177,7 @@ 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, loading, page, pages, pageSize, changePage } = usePageList(getList)
|
const { total, list, loading, page, pages, pageSize, changePage } = usePageList(getList)
|
||||||
|
let queryVersion = 0;
|
||||||
|
|
||||||
const certStatus = computed(() => doctorInfo.value?.verifyStatus ? certConfig[doctorInfo.value.verifyStatus] : null)
|
const certStatus = computed(() => doctorInfo.value?.verifyStatus ? certConfig[doctorInfo.value.verifyStatus] : null)
|
||||||
|
|
||||||
@ -197,19 +198,27 @@ function changeFilterData(data) {
|
|||||||
const case1 = Object.keys(data).filter(i => i != 'eventStatus').length > 0;
|
const case1 = Object.keys(data).filter(i => i != 'eventStatus').length > 0;
|
||||||
const case2 = statusList.some(i => i.value === data.eventStatus);
|
const case2 = statusList.some(i => i.value === data.eventStatus);
|
||||||
filtered.value = case1 || !case2;
|
filtered.value = case1 || !case2;
|
||||||
changePage(1);
|
refreshList();
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeFollowType(type) {
|
function changeFollowType(type) {
|
||||||
if (followUpType.value === type) return;
|
if (followUpType.value === type) return;
|
||||||
followUpType.value = type;
|
followUpType.value = type;
|
||||||
changePage(1);
|
refreshList();
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeStatus(val) {
|
function changeStatus(val) {
|
||||||
if (filterData.value.eventStatus === val) return;
|
if (filterData.value.eventStatus === val) return;
|
||||||
filterData.value.eventStatus = val;
|
filterData.value.eventStatus = val;
|
||||||
changePage(1);
|
refreshList();
|
||||||
|
}
|
||||||
|
|
||||||
|
function refreshList() {
|
||||||
|
queryVersion += 1;
|
||||||
|
page.value = 1;
|
||||||
|
pages.value = 0;
|
||||||
|
list.value = [];
|
||||||
|
getList(queryVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMore() {
|
function getMore() {
|
||||||
@ -262,6 +271,8 @@ async function getList() {
|
|||||||
list.value = []
|
list.value = []
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const currentVersion = queryVersion;
|
||||||
|
const requestPage = page.value;
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
const data = {
|
const data = {
|
||||||
@ -283,6 +294,7 @@ async function getList() {
|
|||||||
data.eventType = filterData.value.eventType;
|
data.eventType = filterData.value.eventType;
|
||||||
}
|
}
|
||||||
const res = await api('getTeamTodos', data);
|
const res = await api('getTeamTodos', data);
|
||||||
|
if (currentVersion !== queryVersion) return;
|
||||||
const arr = res && Array.isArray(res.data) ? res.data.map(i => ({
|
const arr = res && Array.isArray(res.data) ? res.data.map(i => ({
|
||||||
...i,
|
...i,
|
||||||
eventTypeLabel: ToDoEventType[i.eventType],
|
eventTypeLabel: ToDoEventType[i.eventType],
|
||||||
@ -293,7 +305,7 @@ async function getList() {
|
|||||||
fileList: Array.isArray(i.fileList) ? i.fileList.filter(i => i && i.file && i.file.name) : [],
|
fileList: Array.isArray(i.fileList) ? i.fileList.filter(i => i && i.file && i.file.name) : [],
|
||||||
ownTeam: followUpType.value === 'team'
|
ownTeam: followUpType.value === 'team'
|
||||||
})) : [];
|
})) : [];
|
||||||
list.value = page.value === 1 ? arr : [...list.value, ...arr];
|
list.value = requestPage === 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) {
|
||||||
@ -303,9 +315,11 @@ async function getList() {
|
|||||||
loadWhenNotScrollable();
|
loadWhenNotScrollable();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
if (currentVersion === queryVersion) {
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
useShow(async () => {
|
useShow(async () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user