|
|
|
@ -1,7 +1,9 @@
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
import { computed, onUnmounted, reactive, ref, unref, watch } from 'vue'
|
|
|
|
|
import { computed, onMounted, onUnmounted, onUpdated, reactive, ref, unref, watch } from 'vue'
|
|
|
|
|
import { useDialog, useMessage } from 'naive-ui'
|
|
|
|
|
import { clone, pickBy } from 'lodash-es'
|
|
|
|
|
import { clone, debounce, pickBy } from 'lodash-es'
|
|
|
|
|
import { useInfiniteScroll } from '@vueuse/core'
|
|
|
|
|
import imagesloaded from 'imagesloaded'
|
|
|
|
|
import ConfrimModal from '../modal/ConfrimModal.vue'
|
|
|
|
|
import type { PictureSortParam, SetTFParam } from '/#/api'
|
|
|
|
|
import { useWorkOrder } from '@/store/modules/workOrder'
|
|
|
|
@ -15,6 +17,7 @@ const selectItems = ref<any[]>([])
|
|
|
|
|
const message = useMessage()
|
|
|
|
|
const dialog = useDialog()
|
|
|
|
|
const totalCount = ref(0)
|
|
|
|
|
let _imagesload: any
|
|
|
|
|
|
|
|
|
|
function setBatch(value: boolean) {
|
|
|
|
|
batch.value = value
|
|
|
|
@ -59,6 +62,11 @@ const taskDetailInfo = ref<any>({})
|
|
|
|
|
const taskDetailPictureList = ref<any[]>([])
|
|
|
|
|
const confrimModalRef = ref(null)
|
|
|
|
|
const imageRef = ref<ComponentElRef | null>()
|
|
|
|
|
const listData = ref<any[]>([])
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
const el = ref<HTMLDivElement | null>(null)
|
|
|
|
|
|
|
|
|
|
let canloadMore = true
|
|
|
|
|
|
|
|
|
|
let processItems: any[] = []
|
|
|
|
|
|
|
|
|
@ -184,16 +192,86 @@ function backHandler() {
|
|
|
|
|
workStore.back()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function reset() {
|
|
|
|
|
taskpagination.pageNo = 0
|
|
|
|
|
taskpagination.pageSize = 20
|
|
|
|
|
listData.value.length = 0
|
|
|
|
|
loading.value = false
|
|
|
|
|
canloadMore = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function refreshHandler() {
|
|
|
|
|
reset()
|
|
|
|
|
|
|
|
|
|
useInfiniteScroll(
|
|
|
|
|
el as any,
|
|
|
|
|
() => {
|
|
|
|
|
loadMore()
|
|
|
|
|
},
|
|
|
|
|
{ distance: 10, canLoadMore: () => canloadMore },
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function loadMore() {
|
|
|
|
|
if (loading.value || el.value == null)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
const more = await featchList()
|
|
|
|
|
listData.value.push(...more)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function featchList() {
|
|
|
|
|
loading.value = true
|
|
|
|
|
try {
|
|
|
|
|
taskpagination.pageNo += 1
|
|
|
|
|
const taskId = selectTask.value.id
|
|
|
|
|
const { data, total, pageCount } = await getTaskDetailPictureList(workStore.activeId, taskId, { ...taskpagination, ...sortBy })
|
|
|
|
|
totalCount.value = total
|
|
|
|
|
canloadMore = pageCount >= taskpagination.pageNo && pageCount > 0
|
|
|
|
|
|
|
|
|
|
return data
|
|
|
|
|
}
|
|
|
|
|
catch (error) {
|
|
|
|
|
canloadMore = false
|
|
|
|
|
return []
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const layout = debounce(() => {
|
|
|
|
|
if (el.value == null)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
_imagesload = imagesloaded('.grid-item')
|
|
|
|
|
|
|
|
|
|
_imagesload.on('done', (instance) => {
|
|
|
|
|
if (!el.value)
|
|
|
|
|
return
|
|
|
|
|
const scrollHeight = el.value!.scrollHeight
|
|
|
|
|
const clientHeight = el.value!.clientHeight
|
|
|
|
|
const top = scrollHeight - clientHeight - 100
|
|
|
|
|
el.value!.scrollTo({ top, behavior: 'instant' })
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
_imagesload.on('fail', (instance) => {
|
|
|
|
|
message.error('图片错误')
|
|
|
|
|
loading.value = false
|
|
|
|
|
})
|
|
|
|
|
}, 300)
|
|
|
|
|
|
|
|
|
|
onUpdated(() => {
|
|
|
|
|
layout()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
watch(() => workStore.activeId, async (newValue, oldValue) => {
|
|
|
|
|
const taskId = workStore.getActiveId
|
|
|
|
|
const packageid = workStore.getActiveId
|
|
|
|
|
|
|
|
|
|
if (isEmpty(taskId))
|
|
|
|
|
if (isEmpty(packageid))
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
const res = await getPackageTaskList(newValue, packagepagination)
|
|
|
|
|
const { data } = res
|
|
|
|
|
taskList.value = data
|
|
|
|
|
|
|
|
|
|
if (taskList.value.length > 0)
|
|
|
|
|
handleSelect(taskList.value[0])
|
|
|
|
|
})
|
|
|
|
@ -208,9 +286,15 @@ async function handleSelect(item: any) {
|
|
|
|
|
const taskId = item.id
|
|
|
|
|
taskDetailInfo.value = await getTaskDetailInfo(taskId, workStore.activeId)
|
|
|
|
|
|
|
|
|
|
const { data, total } = await getTaskDetailPictureList(workStore.activeId, taskId, { ...taskpagination, ...sortBy })
|
|
|
|
|
taskDetailPictureList.value = data
|
|
|
|
|
totalCount.value = total
|
|
|
|
|
const packageid = workStore.getActiveId
|
|
|
|
|
|
|
|
|
|
if (isEmpty(packageid))
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
// const { data, total } = await getTaskDetailPictureList(workStore.activeId, taskId, { ...taskpagination, ...sortBy })
|
|
|
|
|
// taskDetailPictureList.value = data
|
|
|
|
|
// totalCount.value = total
|
|
|
|
|
refreshHandler()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function sortHandler(orderby: 'pictureResult' | 'fromuptime') {
|
|
|
|
@ -292,8 +376,6 @@ function previewHandler(event: MouseEvent) {
|
|
|
|
|
if (imageRef.value)
|
|
|
|
|
(imageRef.value as any).mergedOnClick()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const count = computed(() => taskDetailPictureList.value.length)
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
@ -334,6 +416,8 @@ const count = computed(() => taskDetailPictureList.value.length)
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<n-spin :show="loading">
|
|
|
|
|
<div ref="el" class="scroll">
|
|
|
|
|
<div class="wrapper-detail">
|
|
|
|
|
<div
|
|
|
|
|
class="left" :style="{ 'background-image': `url(${taskDetailInfo?.ocrPicture?.imgurl})` }"
|
|
|
|
@ -396,7 +480,7 @@ const count = computed(() => taskDetailPictureList.value.length)
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="display: flex;justify-content: space-between;padding: 12px 0px;">
|
|
|
|
|
<div><span style="font-size: 21px;font-weight: bold;">相似图片</span><span>({{ count }})</span></div>
|
|
|
|
|
<div><span style="font-size: 21px;font-weight: bold;">相似图片</span><span>({{ totalCount }})</span></div>
|
|
|
|
|
<div style="display: flex;align-items: center;" @click="sortHandler('fromuptime')">
|
|
|
|
|
<div style="cursor: pointer;">
|
|
|
|
|
<span>按时间排序</span>
|
|
|
|
@ -410,10 +494,11 @@ const count = computed(() => taskDetailPictureList.value.length)
|
|
|
|
|
</div>
|
|
|
|
|
<div class="wrapper-list">
|
|
|
|
|
<div
|
|
|
|
|
v-for="(item, index) in taskDetailPictureList" :key="index" :class="{ 'item-selected': item === selectTask }"
|
|
|
|
|
class="item" @click="handleSelect(item)" @mouseover="overTaskHandelr(item)" @mouseleave="leaveTaskHandler"
|
|
|
|
|
v-for="(item, index) in listData" :key="index" :class="{ 'item-selected': item === selectTask }"
|
|
|
|
|
class="grid-item" @click="handleSelect(item)" @mouseover="overTaskHandelr(item)"
|
|
|
|
|
@mouseleave="leaveTaskHandler"
|
|
|
|
|
>
|
|
|
|
|
<div class="img-wrapper" :style="{ 'background-image': `url(${item.imgurl})` }" />
|
|
|
|
|
<div class="img-wrapper" :style="{ 'background-image': `url(${item.thumburl})` }" />
|
|
|
|
|
<div class="check">
|
|
|
|
|
<n-checkbox
|
|
|
|
|
v-show="batch" v-model:checked="item.checked" @click.stop
|
|
|
|
@ -438,6 +523,8 @@ const count = computed(() => taskDetailPictureList.value.length)
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</n-spin>
|
|
|
|
|
<ConfrimModal ref="confrimModalRef" @commit="setFalse" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
@ -453,8 +540,11 @@ const count = computed(() => taskDetailPictureList.value.length)
|
|
|
|
|
background: #FFF;
|
|
|
|
|
border-radius: 3px;
|
|
|
|
|
border: 1px solid rgb(239, 239, 245);
|
|
|
|
|
height: calc(100vh - 88px);
|
|
|
|
|
|
|
|
|
|
.scroll {
|
|
|
|
|
height: calc(100vh - 88px - 72px);
|
|
|
|
|
overflow-y: scroll;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&-header {
|
|
|
|
|
display: flex;
|
|
|
|
@ -635,7 +725,7 @@ const count = computed(() => taskDetailPictureList.value.length)
|
|
|
|
|
background-color: #FFF;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.item {
|
|
|
|
|
.grid-item {
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
padding: 9px 10px;
|
|
|
|
|