diff --git a/.vscode/settings.json b/.vscode/settings.json index 947c6ee..29677da 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -39,5 +39,10 @@ "jsonc", "yaml" ], - "vue3snippets.enable-compile-vue-file-on-did-save-code": true + "vue3snippets.enable-compile-vue-file-on-did-save-code": true, + "editor.defaultFormatter": "rvest.vs-code-prettier-eslint", + "[vue]": { + "editor.defaultFormatter": "rvest.vs-code-prettier-eslint" + }, + "editor.formatOnSaveMode": "modifications" } diff --git a/components.d.ts b/components.d.ts index bf396cc..298dbe9 100644 --- a/components.d.ts +++ b/components.d.ts @@ -23,7 +23,6 @@ declare module 'vue' { NDropdown: typeof import('naive-ui')['NDropdown'] NForm: typeof import('naive-ui')['NForm'] NFormItem: typeof import('naive-ui')['NFormItem'] - NGi: typeof import('naive-ui')['NGi'] NGrid: typeof import('naive-ui')['NGrid'] NGridItem: typeof import('naive-ui')['NGridItem'] NImage: typeof import('naive-ui')['NImage'] @@ -34,6 +33,7 @@ declare module 'vue' { NotPassed: typeof import('./src/components/NotPassed.vue')['default'] NPopover: typeof import('naive-ui')['NPopover'] NPopselect: typeof import('naive-ui')['NPopselect'] + NProgress: typeof import('naive-ui')['NProgress'] NScrollbar: typeof import('naive-ui')['NScrollbar'] NSelect: typeof import('naive-ui')['NSelect'] NSlider: typeof import('naive-ui')['NSlider'] diff --git a/src/assets/images/bg-loading.png b/src/assets/images/bg-loading.png new file mode 100644 index 0000000..839713f Binary files /dev/null and b/src/assets/images/bg-loading.png differ diff --git a/src/layout/components/Header/RecycleModal.vue b/src/layout/components/Header/RecycleModal.vue index 7122402..cd0f085 100644 --- a/src/layout/components/Header/RecycleModal.vue +++ b/src/layout/components/Header/RecycleModal.vue @@ -13,12 +13,14 @@ import { viewOptions } from '@/config/home' import NotPassed from '@/components/Approval/NotPassed.vue' import { formatToDateHMS } from '@/utils/dateUtil' import { off, on } from '@/utils/domUtils' +import bgLoading from '@/assets/images/bg-loading.png' const cardStyle = { '--n-padding-bottom': '40px', '--n-padding-left': '120px', } +const bgLoadingImg = ref(bgLoading) let startTime = 0 let endTime = 0 let startCalTime = false @@ -732,6 +734,7 @@ watch(() => pagination.pageNo, (newVal, oldVal) => { ref="imageRef" :src="item.imgUrl" :preview-src="item.imgUrl" + :fallback-src="bgLoadingImg" class="img " :class="{ 'img-fit': viewMode === 'horizontalVersion', diff --git a/src/views/home/content/Content.vue b/src/views/home/content/Content.vue index 387d47d..7ec3a35 100644 --- a/src/views/home/content/Content.vue +++ b/src/views/home/content/Content.vue @@ -1,31 +1,14 @@ @@ -915,6 +930,14 @@ defineExpose({ position: relative; transition: 0.5s; + .tag-status { + width: 46px; + height: 22px; + position: absolute; + left: -1px; + top: 10px; + } + .glass { position: absolute; display: none !important; diff --git a/src/views/task/content/Content.vue b/src/views/task/content/Content.vue index 3644816..503fcb1 100644 --- a/src/views/task/content/Content.vue +++ b/src/views/task/content/Content.vue @@ -8,207 +8,216 @@ import { ref, unref, watch, -} from "vue"; -import { chunk, clone } from "lodash-es"; -import { useDialog, useMessage } from "naive-ui"; -import { useRoute, useRouter } from "vue-router"; -import { useInfiniteScroll } from "@vueuse/core"; -import BatchModal from "../modal/BatchModal.vue"; -import CustomSettingModal from "../modal/CustomSettingModal.vue"; -import PictureTable from "./PictureTable.vue"; -import TaskTable from "./TaskTable.vue"; -import History from "./History.vue"; -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"; +} from 'vue' +import { chunk, clone } from 'lodash-es' +import { useDialog, useMessage } from 'naive-ui' +import { useRoute, useRouter } from 'vue-router' +import { useInfiniteScroll } from '@vueuse/core' +import BatchModal from '../modal/BatchModal.vue' +import CustomSettingModal from '../modal/CustomSettingModal.vue' +import PictureTable from './PictureTable.vue' +import TaskTable from './TaskTable.vue' +import History from './History.vue' +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 { audit, dubiousfileyd, getSimilarityList, getTaskDetailInfo, -} from "@/api/task/task"; -import { useTask } from "@/store/modules/task"; -import { useUser } from "@/store/modules/user"; -import { isEmpty } from "@/utils"; -import { formatToDateHMS } from "@/utils/dateUtil"; -import { hideDownload } from "@/utils/image"; - -const emit = defineEmits(["setAsideItemName"]); - -const router = useRouter(); -const loading = ref(false); -const batch = ref(false); -const batchtwo = ref(false); -const selectItems = ref([]); -const message = useMessage(); -const dialog = useDialog(); -const notPassModalRef = ref(null); -const batchModalRef: any = ref(null); -const totalCount = ref(0); -const taskId: any = ref(""); // 任务id -const packageId: any = ref(""); // 包id -const CustomSettingModalRef = ref(null); -const taskTableData = ref([]); -const route = useRoute(); -const isDetail = ref(false); // 是否是详情 -const finalStore = useFinal(); -const imgbigshow = ref(true); +} from '@/api/task/task' +import { useTask } from '@/store/modules/task' +import { useUser } from '@/store/modules/user' +import { isEmpty } from '@/utils' +import { formatToDateHMS } from '@/utils/dateUtil' +import { hideDownload } from '@/utils/image' +import bgLoading from '@/assets/images/bg-loading.png' + +const emit = defineEmits(['setAsideItemName']) + +const router = useRouter() +const loading = ref(false) +const batch = ref(false) +const batchtwo = ref(false) +const selectItems = ref([]) +const message = useMessage() +const dialog = useDialog() +const notPassModalRef = ref(null) +const batchModalRef: any = ref(null) +const totalCount = ref(0) +const taskId: any = ref('') // 任务id +const packageId: any = ref('') // 包id +const CustomSettingModalRef = ref(null) +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); + orderType: 'desc', + orderName: 'similarityScore', +} +const el = ref(null) +const bgLoadingImg = ref(bgLoading) + const pagination = reactive({ pageNo: 0, pageSize: 30, -}); +}) function onCheckChange(checked: any, item: any) { - const index = selectItems.value.indexOf(item); - item.checked = checked; + const index = selectItems.value.indexOf(item) + item.checked = checked - if (index === -1 && checked) selectItems.value.push(item); - else selectItems.value.splice(index, 1); + if (index === -1 && checked) + selectItems.value.push(item) + else selectItems.value.splice(index, 1) } const showActions = computed(() => { - return selectItems.value.length > 0 && batch; -}); + return selectItems.value.length > 0 && batch +}) const taskpagination = reactive({ pageNo: 1, pageSize: 30, -}); -const taskStore = useTask(); -const overTask = ref(null); -const overTasktwo = ref(null); -const taskDetailInfo = ref({}); -const taskDetailPictureList = ref([]); -const userStore = useUser(); -const imageRef = ref(); -let processItems: any[] = []; -const isFullScreen = ref(false); +}) +const taskStore = useTask() +const overTask = ref(null) +const overTasktwo = ref(null) +const taskDetailInfo = ref({}) +const taskDetailPictureList = ref([]) +const userStore = useUser() +const imageRef = ref() +let processItems: any[] = [] +const isFullScreen = ref(false) const fullscreenStyles = computed(() => ({ - width: isFullScreen.value ? "100vw" : "", - height: isFullScreen.value ? "100vh" : "", - position: isFullScreen.value ? "fixed" : "", - top: isFullScreen.value ? "0" : "", - left: isFullScreen.value ? "0" : "", - zIndex: isFullScreen.value ? "100" : "", -})); + width: isFullScreen.value ? '100vw' : '', + height: isFullScreen.value ? '100vh' : '', + position: isFullScreen.value ? 'fixed' : '', + top: isFullScreen.value ? '0' : '', + left: isFullScreen.value ? '0' : '', + zIndex: isFullScreen.value ? '100' : '', +})) const fullscreenStylestwo = computed(() => ({ - width: isFullScreen.value ? "100vw" : "", - height: isFullScreen.value ? "100vh" : "", - position: isFullScreen.value ? "fixed" : "", - top: isFullScreen.value ? "0" : "", - left: isFullScreen.value ? "0" : "", - zIndex: isFullScreen.value ? "160" : "", -})); + width: isFullScreen.value ? '100vw' : '', + height: isFullScreen.value ? '100vh' : '', + position: isFullScreen.value ? 'fixed' : '', + top: isFullScreen.value ? '0' : '', + left: isFullScreen.value ? '0' : '', + zIndex: isFullScreen.value ? '160' : '', +})) onMounted(() => { - window.addEventListener("keydown", handleKeydown); + window.addEventListener('keydown', handleKeydown) if (route.query.id) { - taskId.value = route.query.id; - packageId.value = route.query.packageid; - isDetail.value = true; - getDetail(); + taskId.value = route.query.id + packageId.value = route.query.packageid + isDetail.value = true + getDetail() } -}); +}) -let lastKeyPressTime = 0; -let keyPressTimer = null; +let lastKeyPressTime = 0 +let keyPressTimer = null function changeimgbigshow() { - imgbigshow.value = !imgbigshow.value; + imgbigshow.value = !imgbigshow.value } -const doubleClickInterval = 300; // 可以自定义间隔时间,单位是毫秒 +const doubleClickInterval = 300 // 可以自定义间隔时间,单位是毫秒 // 键盘左右箭头快捷切换 function handleKeydown(event) { - if (event.key === "ArrowLeft") { - backHandler(); + if (event.key === 'ArrowLeft') { + backHandler() } // 在这里执行左箭头的逻辑 - else if (event.key === "ArrowRight") { - forwardHandler(); + else if (event.key === 'ArrowRight') { + forwardHandler() } // 在这里执行右箭头的逻辑 else if (event.keyCode === 67) { - isFullScreen.value = false; + isFullScreen.value = false // batchModalRef.value.closeModal() - } else if (event.keyCode === 27) { - overTask.value = null; - overTasktwo.value = null; - } else if (event.key === "p" || event.key === "P") { + } + else if (event.keyCode === 27) { + overTask.value = null + overTasktwo.value = null + } + else if (event.key === 'p' || event.key === 'P') { // 获取当前时间 - const now = Date.now(); + const now = Date.now() // 如果两次按键时间间隔小于我们设定的双击间隔,则认为是双击 if (now - lastKeyPressTime < doubleClickInterval) { // 清除已经设置的定时器(如果有的话) - clearTimeout(keyPressTimer); - const item = taskDetailInfo.value; + clearTimeout(keyPressTimer) + const item = taskDetailInfo.value if ( - item?.userapprove?.statshis === 2 || - item?.userapprove?.statshis == 3 + item?.userapprove?.statshis === 2 + || item?.userapprove?.statshis == 3 ) { - overTask.value = null; - return; + overTask.value = null + return } if (validate([item]) == null && batch.value === false) - overTask.value = item; + overTask.value = item // 执行想要的操作 - approvalHandler(); + approvalHandler() // 重置上次按键时间 - lastKeyPressTime = 0; - } else { + lastKeyPressTime = 0 + } + else { // 如果不是双击,则更新上次按键时间,并开始一个新的计时器 - lastKeyPressTime = now; + lastKeyPressTime = now // 通过定时器重置上次按键时间 // 这可以防止如果用户只按了一次键,也会触发双击的情况 - clearTimeout(keyPressTimer); + clearTimeout(keyPressTimer) keyPressTimer = setTimeout(() => { - lastKeyPressTime = 0; - }, doubleClickInterval); + lastKeyPressTime = 0 + }, doubleClickInterval) } - } else if (event.key === "x" || event.key === "X") { + } + else if (event.key === 'x' || event.key === 'X') { // 获取当前时间 - const now = Date.now(); + const now = Date.now() // 如果两次按键时间间隔小于我们设定的双击间隔,则认为是双击 if (now - lastKeyPressTime < doubleClickInterval) { // 清除已经设置的定时器(如果有的话) - clearTimeout(keyPressTimer); - const item = taskDetailInfo.value; + clearTimeout(keyPressTimer) + const item = taskDetailInfo.value if ( - item?.userapprove?.statshis === 2 || - item?.userapprove?.statshis == 3 + item?.userapprove?.statshis === 2 + || item?.userapprove?.statshis == 3 ) { - overTask.value = null; - return; + overTask.value = null + return } if (validate([item]) == null && batch.value === false) - overTask.value = item; + overTask.value = item // 执行想要的操作 - const modal = unref(notPassModalRef)! as any; - modal.showModal([taskDetailInfo.value]); + const modal = unref(notPassModalRef)! as any + modal.showModal([taskDetailInfo.value]) // 重置上次按键时间 - lastKeyPressTime = 0; - } else { + lastKeyPressTime = 0 + } + else { // 如果不是双击,则更新上次按键时间,并开始一个新的计时器 - lastKeyPressTime = now; + lastKeyPressTime = now // 通过定时器重置上次按键时间 // 这可以防止如果用户只按了一次键,也会触发双击的情况 - clearTimeout(keyPressTimer); + clearTimeout(keyPressTimer) keyPressTimer = setTimeout(() => { - lastKeyPressTime = 0; - }, doubleClickInterval); + lastKeyPressTime = 0 + }, doubleClickInterval) } } } @@ -217,26 +226,27 @@ function setBatch(value: boolean) { // if (totalCount.value === 0) // return - batch.value = value; + batch.value = value if (value === false) { - taskDetailInfo.value.checked = false; - selectItems.value = []; + taskDetailInfo.value.checked = false + selectItems.value = [] taskDetailPictureList.value.forEach((item) => { - item.checked = false; - }); + item.checked = false + }) } } // 从store里面获取任务id function currentTaskId() { - const index = taskStore.getCurrentIndex; - return taskStore.getApprovalList[index]?.id || ""; + const index = taskStore.getCurrentIndex + return taskStore.getApprovalList[index]?.id || '' } // states:1未提交,2待审批,3通过,4不通过 function validate(items: any[]) { - if (items.length === 0) return "至少选中一个任务"; + if (items.length === 0) + return '至少选中一个任务' // const useInfo = userStore.getUserInfo // const username = useInfo.loginname @@ -253,180 +263,181 @@ function validate(items: any[]) { // return '审批人不一致' // } - return null; + return null } function approvalHandler(items?: any) { - let cloneItem: any; + let cloneItem: any if (batch.value) { - processItems = selectItems.value; - } else if (overTask.value) { - cloneItem = clone(overTask.value); - processItems = [cloneItem]; + processItems = selectItems.value + } + else if (overTask.value) { + cloneItem = clone(overTask.value) + processItems = [cloneItem] } if (items !== undefined && !(items instanceof PointerEvent)) - processItems = items; + processItems = items - const msg = validate(processItems); + const msg = validate(processItems) if (msg !== null) { - message.error(msg); - return; + message.error(msg) + return } - console.log(processItems); + console.log(processItems) - const list: any = []; + const list: any = [] processItems.forEach((item) => { list.push({ formId: item.id, taskId: item.taskId, taskName: item.fromTaskName, - }); - }); + }) + }) const param = { result: true, - comment: "", - disposeType: "", - disposeTypeId: "", - failCauseId: "", - failCauseName: "", + comment: '', + disposeType: '', + disposeTypeId: '', + failCauseId: '', + failCauseName: '', flowTaskInfoList: list, - }; + } dialog.info({ - title: "确认提示", - content: "确认给该任务审批为【通过】吗?", - positiveText: "确定", - negativeText: "取消", + title: '确认提示', + content: '确认给该任务审批为【通过】吗?', + positiveText: '确定', + negativeText: '取消', onPositiveClick: () => { - doAudit(param); - overTask.value = null; + doAudit(param) + overTask.value = null }, onNegativeClick: () => { - overTask.value = null; + overTask.value = null }, - }); + }) } function approvalHandlerx(item?: any) { - console.log(item); - alert(1); + console.log(item) } function singleRejectHandlex(item?: any) { - console.log(item); - const modal = unref(notPassModalRef)! as any; + console.log(item) + const modal = unref(notPassModalRef)! as any - modal.showModal([item]); + modal.showModal([item]) } function rejectHandler(items?: any) { - console.log(items); - const modal = unref(notPassModalRef)! as any; - modal.showModal(items); + console.log(items) + const modal = unref(notPassModalRef)! as any + modal.showModal(items) } function singleRejectHandler() { - const modal = unref(notPassModalRef)! as any; - modal.showModal([taskDetailInfo.value]); + const modal = unref(notPassModalRef)! as any + modal.showModal([taskDetailInfo.value]) } function doAudit(param: any) { audit(param).then((res) => { - const { code } = res; - if (code === "OK") { - message.success(res.message); - setBatch(false); - reloadList(param, "通过"); - batchModalRef.value.reload(); + const { code } = res + if (code === 'OK') { + message.success(res.message) + setBatch(false) + reloadList(param, '通过') + batchModalRef.value.reload() } - }); + }) } function showModal(modalRef: any) { - const modal = unref(modalRef)! as any; - modal.showModal(taskId.value); + const modal = unref(modalRef)! as any + modal.showModal(taskId.value) } function forwardHandler() { - taskStore.forward(); + taskStore.forward() } function backHandler() { - taskStore.back(); + taskStore.back() } async function handleDragEnd(event, item) { - console.log(event, item); + console.log(event, item) // 可以在这里添加拖拽结束后的逻辑 - const flag = taskStore.getInFile; + const flag = taskStore.getInFile if (flag) { - const res = await dubiousfileyd({ pictureid: item.pictureId }); - if (res.code === "OK") { - message.success("加入成功"); - setBatch(false); - getTableData(); - getImgList(); + const res = await dubiousfileyd({ pictureid: item.pictureId }) + if (res.code === 'OK') { + message.success('加入成功') + setBatch(false) + getTableData() + getImgList() } - taskStore.setInFile(false); - taskStore.setInFile(item.pictureId); + taskStore.setInFile(false) + taskStore.setInFile(item.pictureId) } } async function addSuspicious() { - taskStore.setInFileId(taskDetailInfo.value.ocrPicture); - console.log(taskDetailInfo.value.ocrPicture); + taskStore.setInFileId(taskDetailInfo.value.ocrPicture) + console.log(taskDetailInfo.value.ocrPicture) if (taskDetailInfo.value.ocrPicture.pictureid) { const res = await dubiousfileyd({ pictureid: taskDetailInfo.value.ocrPicture.id, - }); - - if (res.code === "OK") { - message.success("加入成功"); - setBatch(false); - getTableData(); - getImgList(); - } else { - message.error(res.message); + }) + + if (res.code === 'OK') { + message.success('加入成功') + setBatch(false) + getTableData() + getImgList() } - taskStore.setInFile(false); + else { + message.error(res.message) + } + taskStore.setInFile(false) } } async function getTableData() { - const useInfo = userStore.getUserInfo; - const listData = []; - const reviewType = 3; // 类型 - let res = await getAllfieldList(reviewType); - const fieldList = (res as any)?.data; - res = await getfieldList(reviewType, useInfo.id); - const userFieldList = (res as any)?.data.userFieldFixed; + const useInfo = userStore.getUserInfo + const listData = [] + const reviewType = 3 // 类型 + let res = await getAllfieldList(reviewType) + const fieldList = (res as any)?.data + res = await getfieldList(reviewType, useInfo.id) + const userFieldList = (res as any)?.data.userFieldFixed const blueList = [ - "拜访终端名称", - "定位信息", - "拜访日期", - "定位距离", - "拜访小结", - "拜访项目类别", - ]; - - fieldList.map((v) => { + '拜访终端名称', + '定位信息', + '拜访日期', + '定位距离', + '拜访小结', + '拜访项目类别', + ] + + fieldList.forEach((v) => { if (userFieldList.includes(v.name)) { - let locationobj = { address: "" }; - if (v.name == "location") - locationobj = JSON.parse(taskDetailInfo.value.ocrPicture[v.name]); + let locationobj = { address: '' } + if (v.name == 'location') + locationobj = JSON.parse(taskDetailInfo.value.ocrPicture[v.name]) const item = { label: v.fieldDesc, value: - v.name == "location" + v.name == 'location' ? locationobj.address : taskDetailInfo.value.ocrPicture[v.name], key: v.name, blue: blueList.includes(v.fieldDesc), - }; - listData.push(item); + } + listData.push(item) } - }); - taskTableData.value = chunk(listData, 2); + }) + taskTableData.value = chunk(listData, 2) } async function getImgList() { @@ -435,218 +446,226 @@ async function getImgList() { ...taskpagination, ...sortBy, pictureId: taskDetailInfo.value.ocrPicture.id, - }); - taskDetailPictureList.value = data; - totalCount.value = total; - } else { - taskDetailPictureList.value.length = 0; - totalCount.value = 0; + }) + taskDetailPictureList.value = data + totalCount.value = total + } + else { + taskDetailPictureList.value.length = 0 + totalCount.value = 0 } } function overTaskHandle() { - const item = taskDetailInfo.value; + const item = taskDetailInfo.value if (item?.userapprove?.statshis === 2 || item?.userapprove?.statshis == 3) { - overTask.value = null; - return; + overTask.value = null + return } - if (validate([item]) == null && batch.value === false) overTask.value = item; + if (validate([item]) == null && batch.value === false) + overTask.value = item } function leaveTaskHandler() { - overTask.value = null; - overTasktwo.value = null; + overTask.value = null + overTasktwo.value = null } function showActionsModal() { - const modal = unref(CustomSettingModalRef)! as any; - modal.showModal(); + const modal = unref(CustomSettingModalRef)! as any + modal.showModal() } onUnmounted(() => { - taskStore.reset(); - window.removeEventListener("keydown", handleKeydown); -}); + taskStore.reset() + window.removeEventListener('keydown', handleKeydown) +}) function immersionHandler() { - imgbigshow.value = true; + imgbigshow.value = true // taskStore.updateImmersion() - toggleFullScreen(); + toggleFullScreen() } // 切换全屏状态 function toggleFullScreen() { - isFullScreen.value = !isFullScreen.value; + isFullScreen.value = !isFullScreen.value if (isFullScreen.value) { - fetchData(); - window.addEventListener("scroll", checkBottom); - } else { - window.removeEventListener("scroll", checkBottom); + fetchData() + window.addEventListener('scroll', checkBottom) + } + else { + window.removeEventListener('scroll', checkBottom) } } function previewHandler(event: MouseEvent) { - event.stopImmediatePropagation(); - event.stopPropagation(); + event.stopImmediatePropagation() + event.stopPropagation() if (imageRef.value && (imageRef.value as any).src) - (imageRef.value as any).mergedOnClick(); + (imageRef.value as any).mergedOnClick() } watch( () => [taskStore.activeId], () => { if (!isEmpty(taskStore.getActiveId)) { - packageId.value = taskStore.getPackageid; - taskId.value = taskStore.getActiveId; - getDetail(); + packageId.value = taskStore.getPackageid + taskId.value = taskStore.getActiveId + getDetail() } - } -); + }, +) // 获取数据 async function getDetail() { - taskDetailInfo.value = await getTaskDetailInfo(taskId.value, packageId.value); - setBatch(false); - getTableData(); - getImgList(); + taskDetailInfo.value = await getTaskDetailInfo(taskId.value, packageId.value) + setBatch(false) + getTableData() + getImgList() } function notPassSuccess(param) { - batchModalRef.value.reload(); - reloadList(param, "不通过"); - overTask.value = null; + batchModalRef.value.reload() + reloadList(param, '不通过') + overTask.value = null } function reloadList(param, text) { // 修改左侧状态 - const id = currentTaskId(); + const id = currentTaskId() const hasCurrentId = param.flowTaskInfoList.find( - (item) => item.formId === id - ); - finalStore.setListKey(); - if (hasCurrentId) emit("setAsideItemName", text); + item => item.formId === id, + ) + finalStore.setListKey() + if (hasCurrentId) + emit('setAsideItemName', text) - getDetail(); + getDetail() } function goBack() { - router.back(); + router.back() } function switchBatch() { - setBatch(!batch.value); + setBatch(!batch.value) } function getrowValue(e) { - if (e.key == "location") { - const locationobj = JSON.parse(taskDetailInfo.value.ocrPicture.location); - const lat = locationobj.lat.$numberDecimal; - const lng = locationobj.lng.$numberDecimal; - const name = e.value; - const protocol = window.location.protocol; - const hostname = window.location.hostname; - const port = window.location.port; - const hostWithPort = `${protocol}//${hostname}:${port}/`; - window.open(`${hostWithPort}map` + `?name=${name}&lat=${lat}&lng=${lng}`); + if (e.key == 'location') { + const locationobj = JSON.parse(taskDetailInfo.value.ocrPicture.location) + const lat = locationobj.lat.$numberDecimal + const lng = locationobj.lng.$numberDecimal + const name = e.value + const protocol = window.location.protocol + const hostname = window.location.hostname + const port = window.location.port + const hostWithPort = `${protocol}//${hostname}:${port}/` + window.open(`${hostWithPort}map` + `?name=${name}&lat=${lat}&lng=${lng}`) } } function overTaskHandelr(item: any) { if (item?.historyStates === 2 || item?.historyStates == 3) { - overTasktwo.value = null; - return; + overTasktwo.value = null + return } if (validate([item]) == null && batchtwo.value === false) - overTasktwo.value = item; + overTasktwo.value = item } function closePassno() { - console.log(notPassModalRef.value); - overTask.value = null; + console.log(notPassModalRef.value) + overTask.value = null } // const loadingx = ref(false); -const items = ref([]); -const scrollContainer = ref(null); -let debounceTimer; +const items = ref([]) +const scrollContainer = ref(null) +let debounceTimer async function fetchData() { - if (loading.value) return; // 如果已经在加载中,则不重复加载 + if (loading.value) + return // 如果已经在加载中,则不重复加载 - loading.value = true; + loading.value = true try { - loadMore(); - } finally { - loading.value = false; + loadMore() + } + finally { + loading.value = false } } // const throttledCheckScroll = throttle(checkBottom, 200); -let num = 1; +let num = 1 // 检查是否滚动到底部 function checkBottom() { - const container = scrollContainer.value; + const container = scrollContainer.value // console.log(1) - if (!container) return; + if (!container) + return // const { scrollTop, clientHeight, scrollHeight } = container; - const scrollTop = window.pageYOffset || document.documentElement.scrollTop; + const scrollTop = window.pageYOffset || document.documentElement.scrollTop // 获取视口的内部高度 - const clientHeight = - window.innerHeight || document.documentElement.clientHeight; + const clientHeight + = window.innerHeight || document.documentElement.clientHeight // 获取整个文档的高度 - const scrollHeight = document.documentElement.scrollHeight; + const scrollHeight = document.documentElement.scrollHeight - clearTimeout(debounceTimer); + clearTimeout(debounceTimer) debounceTimer = setTimeout(() => { if (scrollTop + clientHeight >= scrollHeight - 10) { - num = num + 1; - console.log(num); - fetchData(); // 接近底部时加载更多数据 + num = num + 1 + console.log(num) + fetchData() // 接近底部时加载更多数据 } - }, 500); + }, 500) } async function loadMore() { - console.log(loading.value); + console.log(loading.value) if (loading.value) { - const more = await fetchList(); - taskDetailPictureList.value.push(...more); - console.log(taskDetailPictureList); + const more = await fetchList() + taskDetailPictureList.value.push(...more) + console.log(taskDetailPictureList) } } -let canloadMore = true; +let canloadMore = true async function fetchList() { try { - pagination.pageNo += 1; + 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 []; + }) + canloadMore = pageCount >= pagination.pageNo && pageCount > 0 + totalCount.value = total + return data + } + catch (error) { + canloadMore = false + return [] } } async function reset() { - pagination.pageNo = 0; - pagination.pageSize = 30; - taskDetailPictureList.value.length = 0; - loading.value = false; - canloadMore = true; + pagination.pageNo = 0 + pagination.pageSize = 30 + taskDetailPictureList.value.length = 0 + loading.value = false + canloadMore = true // layout() } async function refreshHandler() { - getImgList(); + getImgList() } -function sortHandler(orderby: "similarityScore" | "createdate") { - sortBy.orderName = orderby; - sortBy.orderType = sortBy.orderType === "asc" ? "desc" : "asc"; - refreshHandler(); +function sortHandler(orderby: 'similarityScore' | 'createdate') { + sortBy.orderName = orderby + sortBy.orderType = sortBy.orderType === 'asc' ? 'desc' : 'asc' + refreshHandler() } @@ -735,14 +754,14 @@ function sortHandler(orderby: "similarityScore" | "createdate") { src="@/assets/images/task/btn-not-pass.png" alt="" @click.stop="rejectHandler(selectItems)" - /> + > + >
@@ -759,8 +778,8 @@ function sortHandler(orderby: "similarityScore" | "createdate") { :style=" isFullScreen ? { - height: '596px', - } + height: '596px', + } : {} " > @@ -800,21 +819,24 @@ function sortHandler(orderby: "similarityScore" | "createdate") { isFullScreen ? imgbigshow ? { - position: 'relative', - //width: '70vw', - flex: 1, - // flex: 0.75, - 'background-image': `url(${taskDetailInfo?.ocrPicture?.imgurl})`, - } + position: 'relative', + //width: '70vw', + flex: 1, + // flex: 0.75, + // 'background-image': `url(${taskDetailInfo?.ocrPicture?.imgurl})`, + background: `url(${taskDetailInfo?.ocrPicture?.imgurl}), url(${bgLoadingImg})`, + } : { - height: '92vh', - flex: 1, + height: '92vh', + flex: 1, - 'background-image': `url(${taskDetailInfo?.ocrPicture?.imgurl})`, - } - : { - 'background-image': `url(${taskDetailInfo?.ocrPicture?.imgurl})`, + // 'background-image': `url(${taskDetailInfo?.ocrPicture?.imgurl})`, + background: `url(${taskDetailInfo?.ocrPicture?.imgurl}), url(${bgLoadingImg})`, } + : { + // 'background-image': `url(${taskDetailInfo?.ocrPicture?.imgurl})`, + background: `url(${taskDetailInfo?.ocrPicture?.imgurl}), url(${bgLoadingImg})`, + } " @mouseover="overTaskHandle" @mouseleave="leaveTaskHandler" @@ -855,14 +877,14 @@ function sortHandler(orderby: "similarityScore" | "createdate") { class="img-status" src="@/assets/images/task/pass.png" alt="" - /> + > + >
+ > @@ -912,12 +934,11 @@ function sortHandler(orderby: "similarityScore" | "createdate") { class="icon-status" src="@/assets/images/task/similarity.png" alt="" - /> + > - {{ totalCount }} + {{ totalCount }} 相似匹配 @@ -947,8 +968,8 @@ function sortHandler(orderby: "similarityScore" | "createdate") { {{ taskDetailInfo?.ocrPicture?.submitDateTimestamp ? formatToDateHMS( - Number(taskDetailInfo.ocrPicture.submitDateTimestamp) - ) + Number(taskDetailInfo.ocrPicture.submitDateTimestamp), + ) : "-" }}
@@ -968,14 +989,14 @@ function sortHandler(orderby: "similarityScore" | "createdate") { :style=" isFullScreen ? { - flex: 0.3, - // flex: 0, - //width: '30vw', - borderLeft: '2px solid #507AFD', - position: 'relative', - borderRadius: 0, - height: '596px', - } + flex: 0.3, + // flex: 0, + //width: '30vw', + borderLeft: '2px solid #507AFD', + position: 'relative', + borderRadius: 0, + height: '596px', + } : { flex: 0.5 } " > @@ -1022,7 +1043,8 @@ function sortHandler(orderby: "similarityScore" | "createdate") {
@@ -1040,13 +1062,13 @@ function sortHandler(orderby: "similarityScore" | "createdate") { class="tag-status" src="@/assets/images/task/tag-pass.png" alt="" - /> + > + >
- {{ taskDetailInfo.fromtaskname }} + + {{ taskDetailInfo.fromtaskname }} +
@@ -1223,8 +1247,7 @@ function sortHandler(orderby: "similarityScore" | "createdate") { color: #333333; font-family: PingFang SC, PingFang SC-Medium; " - >相似图片({{ totalCount }}) + >相似图片({{ totalCount }})
+ > + >
{ show.value && addListeners() - window.addEventListener("keydown", handleKeydown); + window.addEventListener('keydown', handleKeydown) }) - // 键盘左右箭头快捷切换 function handleKeydown(event) { - // 在这里执行右箭头的逻辑 - if (event.keyCode === 67) { -show.value=false - // batchModalRef.value.closeModal() - } + if (event.keyCode === 67) + show.value = false + // batchModalRef.value.closeModal() } function showModal(value) { taskId.value = value @@ -408,7 +405,8 @@ const gridHeight = computed(() => { defineExpose({ showModal, - reload,closeModal + reload, + closeModal, }) @@ -544,40 +542,39 @@ defineExpose({ :style="{ height: gridHeight }" class="grid-item" > - -
-
-
- - {{ formatToDateHMS(Number(item.photoDateTimestamp) || 0) }} -
-
- - {{ formatToDateHMS(Number(item.submitDateTimestamp) || 0) }} -
+ :src="item.serverThumbnailUrl ? item.serverThumbnailUrl : item.imgUrl" + /> +
+
+
+ + {{ formatToDateHMS(Number(item.photoDateTimestamp) || 0) }}
- - -
- +
+ + {{ formatToDateHMS(Number(item.submitDateTimestamp) || 0) }}
-
- {{ item.similarityScore }}% -
+
+ + +
+ +
+
+ {{ item.similarityScore }}% +
diff --git a/src/views/worksheet/components/pictureCard.vue b/src/views/worksheet/components/pictureCard.vue index 310c6b2..f3b37a2 100644 --- a/src/views/worksheet/components/pictureCard.vue +++ b/src/views/worksheet/components/pictureCard.vue @@ -1,5 +1,6 @@