From d2a5c4d125c2849bdf3a2f4091ca223b161a360f Mon Sep 17 00:00:00 2001 From: lihui_ocr Date: Thu, 11 Apr 2024 17:33:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=B2=89=E6=B5=B8=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E5=9B=BE=E7=89=87=E5=88=97=E8=A1=A8=E6=BB=9A=E5=8A=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E8=B0=83=E6=95=B4=E4=B8=BB=E5=9B=BE=E6=94=BE?= =?UTF-8?q?=E5=A4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/task/content/Content.vue | 701 +++++++++++++++++------------ 1 file changed, 421 insertions(+), 280 deletions(-) diff --git a/src/views/task/content/Content.vue b/src/views/task/content/Content.vue index a03961b..f212255 100644 --- a/src/views/task/content/Content.vue +++ b/src/views/task/content/Content.vue @@ -7,6 +7,7 @@ import { ref, unref, watch, + nextTick, } from "vue"; import { chunk, clone } from "lodash-es"; import { useDialog, useMessage } from "naive-ui"; @@ -20,7 +21,7 @@ import NotPassed from "@/components/Approval/NotPassed.vue"; import { getAllfieldList, getfieldList } from "@/api/home/filter"; import { TASK_STATUS_OBJ } from "@/enums/index"; import { useFinal } from "@/store/modules/final"; - +import { useInfiniteScroll } from "@vueuse/core"; import { audit, dubiousfileyd, @@ -52,11 +53,16 @@ const taskTableData = ref([]); const route = useRoute(); const isDetail = ref(false); // 是否是详情 const finalStore = useFinal(); +const imgbigshow = ref(true); const sortBy: any = { orderType: "desc", orderName: "similarityScore", }; - +const el = ref(null); +const pagination = reactive({ + pageNo: 0, + pageSize: 30, +}); function onCheckChange(checked: any, item: any) { const index = selectItems.value.indexOf(item); item.checked = checked; @@ -105,6 +111,9 @@ onMounted(() => { let lastKeyPressTime = 0; let keyPressTimer = null; +function changeimgbigshow() { + imgbigshow.value = !imgbigshow.value; +} const doubleClickInterval = 300; // 可以自定义间隔时间,单位是毫秒 // 键盘左右箭头快捷切换 function handleKeydown(event) { @@ -157,7 +166,7 @@ function handleKeydown(event) { // 如果两次按键时间间隔小于我们设定的双击间隔,则认为是双击 if (now - lastKeyPressTime < doubleClickInterval) { - const item = taskDetailInfo.value; + const item = taskDetailInfo.value; if ( item?.userapprove?.statshis === 2 || item?.userapprove?.statshis == 3 @@ -278,24 +287,25 @@ function approvalHandler(items?: any) { negativeText: "取消", onPositiveClick: () => { doAudit(param); - overTask.value = null; + overTask.value = null; + }, + onNegativeClick: () => { + overTask.value = null; }, - onNegativeClick: () => {overTask.value = null;}, }); } -function approvalHandlerx(item?:any){ - - console.log(item) - alert(1) +function approvalHandlerx(item?: any) { + console.log(item); + alert(1); } -function singleRejectHandlex(item?:any){ - console.log(item) - const modal = unref(notPassModalRef)! as any; +function singleRejectHandlex(item?: any) { + console.log(item); + const modal = unref(notPassModalRef)! as any; - modal.showModal([item]); + modal.showModal([item]); } function rejectHandler(items?: any) { - console.log(items) + console.log(items); const modal = unref(notPassModalRef)! as any; modal.showModal(items); } @@ -348,14 +358,13 @@ async function handleDragEnd(event, item) { } } async function addSuspicious() { - - console.log(taskDetailInfo.value.ocrPicture) - if (taskDetailInfo.value.ocrPicture.pictureid) { + console.log(taskDetailInfo.value.ocrPicture); + if (taskDetailInfo.value.ocrPicture.pictureid) { const res = await dubiousfileyd({ pictureid: taskDetailInfo.value.ocrPicture.id, }); - if (res.code === "OK") { + if (res.code === "OK") { message.success("加入成功"); setBatch(false); getTableData(); @@ -364,8 +373,8 @@ async function addSuspicious() { message.error(res.message); } taskStore.setInFile(false); - -}} + } +} async function getTableData() { const useInfo = userStore.getUserInfo; const listData = []; @@ -431,7 +440,7 @@ function overTaskHandle() { function leaveTaskHandler() { overTask.value = null; - overTasktwo.value = null; + overTasktwo.value = null; } function showActionsModal() { @@ -451,6 +460,12 @@ function immersionHandler() { // 切换全屏状态 function toggleFullScreen() { isFullScreen.value = !isFullScreen.value; + if (isFullScreen.value) { + fetchData(); + window.addEventListener("scroll", checkBottom); + } else { + window.removeEventListener("scroll", checkBottom); + } } function previewHandler(event: MouseEvent) { event.stopImmediatePropagation(); @@ -482,7 +497,7 @@ async function getDetail() { function notPassSuccess(param) { batchModalRef.value.reload(); reloadList(param, "不通过"); - overTask.value=null + overTask.value = null; } function reloadList(param, text) { @@ -529,13 +544,96 @@ function overTaskHandelr(item: any) { if (validate([item]) == null && batchtwo.value === false) overTasktwo.value = item; } -function closePassno(){ - overTask.value=null +function closePassno() { + overTask.value = null; +} +//const loadingx = ref(false); +const items = ref([]); +const scrollContainer = ref(null); +let debounceTimer; +async function fetchData() { + if (loading.value) { + return; // 如果已经在加载中,则不重复加载 + } + loading.value = true; + try { + loadMore(); + } finally { + loading.value = false; + } +} +//const throttledCheckScroll = throttle(checkBottom, 200); + +let num = 1; + +// 检查是否滚动到底部 +function checkBottom() { + const container = scrollContainer.value; + // console.log(1) + if (!container) { + return; + } + //const { scrollTop, clientHeight, scrollHeight } = container; + const scrollTop = window.pageYOffset || document.documentElement.scrollTop; + + // 获取视口的内部高度 + const clientHeight = + window.innerHeight || document.documentElement.clientHeight; + + // 获取整个文档的高度 + const scrollHeight = document.documentElement.scrollHeight; + + clearTimeout(debounceTimer); + debounceTimer = setTimeout(() => { + if (scrollTop + clientHeight >= scrollHeight - 10) { + num = num + 1; + console.log(num); + fetchData(); // 接近底部时加载更多数据 + } + }, 500); +} +function reset() { + taskpagination.pageNo = 0; + taskpagination.pageSize = 20; + taskDetailPictureList.value.length = 0; + loading.value = false; + canloadMore = true; +} + +async function loadMore() { + console.log(loading.value); + if (loading.value) { + const more = await fetchList(); + taskDetailPictureList.value.push(...more); + console.log(taskDetailPictureList); + } +} +let canloadMore = true; +async function fetchList() { + try { + pagination.pageNo += 1; + const { data, pageCount, total } = await getSimilarityList({ + ...pagination, + ...sortBy, + pictureId: taskDetailInfo.value.ocrPicture.id, + }); + canloadMore = pageCount >= pagination.pageNo && pageCount > 0; + totalCount.value = total; + return data; + } catch (error) { + canloadMore = false; + return []; + } }