feat: 修改bug

pull/150/head
raofuzi 1 year ago
parent d602ede9e9
commit 2ce03ead8f

@ -111,11 +111,17 @@ watch(viewMode, () => {
layout() layout()
}) })
onBeforeMount(async () => {
})
let canloadMore = true let canloadMore = true
useInfiniteScroll( useInfiniteScroll(
el as any, el as any,
() => { () => {
loading = false
console.log("加载了000000000000000---------------------------");
loadMore() loadMore()
}, },
{ distance: 10, canLoadMore: () => canloadMore }, { distance: 10, canLoadMore: () => canloadMore },
@ -125,13 +131,15 @@ async function featchList() {
loading = true loading = true
try { try {
// const result = await dubiousfilelist({ ...pagination, orderbyname: timeRange.value }) // const result = await dubiousfilelist({ ...pagination, orderbyname: timeRange.value })
console.log("pagination.pageNo------------", pagination.pageNo);
const result = await dubiousfilelist({ ...pagination, ...sortObj }) const result = await dubiousfilelist({ ...pagination, ...sortObj })
// TODO // TODO
// result.data = Array.from({ length: 30 }) // result.data = Array.from({ length: 30 })
const { data, pageCount } = result const { data, pageCount } = result
pagination.pageNo += 1
// canloadMore = pageCount >= pagination.pageNo && pageCount > 0; // canloadMore = pageCount >= pagination.pageNo && pageCount > 0;
canloadMore = data.pages >= pagination.pageNo && data.pages > 0; canloadMore = data.pages >= pagination.pageNo && data.pages > 0;
console.log("canloadMore------------", canloadMore);
return result.data.records return result.data.records
// const list = data.map((item) => { // const list = data.map((item) => {
// return { // return {
@ -147,12 +155,15 @@ async function featchList() {
} }
async function loadMore() { async function loadMore() {
console.log("执行l------------------------", loading, el.value);
console.log("执行l------------------------", loading, el.value, pagination.pageNo);
if (loading || el.value == null) if (loading || el.value == null)
return return
// loading = true // loading = true
pagination.pageNo = pagination.pageNo + 1;
const more = await featchList() const more = await featchList()
console.log("more------------------------", more);
listData.value.push(...more) listData.value.push(...more)
layout() layout()
} }
@ -172,11 +183,6 @@ onUpdated(() => {
layout() layout()
}) })
onBeforeMount(async () => {
// const list = await featchList()
// listData.value = list
})
let start: { x: number, y: number } | null = null let start: { x: number, y: number } | null = null
let selectionBox: HTMLDivElement | null let selectionBox: HTMLDivElement | null
const selectIds = ref<string[]>([]) const selectIds = ref<string[]>([])
@ -310,7 +316,7 @@ function upHandler(event: MouseEvent) {
listData.value.map(item => { listData.value.map(item => {
item.checked = false; item.checked = false;
}); });
batch.value = false; // batch.value = false;
} }
} }
@ -353,7 +359,7 @@ function afterLeave() {
removeListeners() removeListeners()
} }
onMounted(() => { onMounted(async() => {
show.value && addListeners() show.value && addListeners()
removeDom() removeDom()
}) })
@ -491,13 +497,13 @@ function validate(items: any[]) {
return null; return null;
} }
function approvalHandler(items?: any) { function approvalHandler(items?: any) {
if (batch.value) { // if (batch.value) {
processItems = selectedApproveItems.value processItems = selectedApproveItems.value
} // }
// => => / // => => /
if (items !== undefined && !(items instanceof PointerEvent)) if (items !== undefined && !(items instanceof PointerEvent))
processItems = [items] processItems = [items]
console.log("batch-------------",batch.value,selectedApproveItems.value,processItems);
const msg = validate(processItems) const msg = validate(processItems)
if (msg !== null) { if (msg !== null) {
@ -555,6 +561,7 @@ function reloadList() {
async function refreshHandler(filtersearchId?: any) { async function refreshHandler(filtersearchId?: any) {
// rao start // rao start
reset() reset()
pagination.pageNo = 1;
const list = await featchList() const list = await featchList()
listData.value = list listData.value = list
layout() layout()
@ -570,6 +577,7 @@ async function refreshHandler(filtersearchId?: any) {
useInfiniteScroll( useInfiniteScroll(
el as any, el as any,
() => { () => {
console.log("加载了333333333333333333333333---------------------------");
loadMore(); loadMore();
}, },
{ distance: 10, canLoadMore: () => canloadMore } { distance: 10, canLoadMore: () => canloadMore }
@ -578,6 +586,33 @@ async function refreshHandler(filtersearchId?: any) {
}); });
} }
watch(() => show.value,
async(newVal) => {
if(show.value) {
pagination.pageNo = 1;
const list = await featchList()
listData.value = list
console.log("加载了1111111111111---------------------------", listData.value);
layout()
}
},
)
watch(() => pagination.pageNo,
(newVal) => {
if((newVal == 1 || newVal == 2) && canloadMore) {
setTimeout(() => {
nextTick(() => {
console.log("加载了22222222222222222---------------------------", newVal);
loading = false
loadMore();
})
}, 500)
}
},
);
</script> </script>
<template> <template>

Loading…
Cancel
Save