diff --git a/src/api/work/work.ts b/src/api/work/work.ts index 20accd0..c75ffef 100644 --- a/src/api/work/work.ts +++ b/src/api/work/work.ts @@ -69,7 +69,7 @@ export async function getTaskDetailPictureList(packageid: string, taskchildpictu params, }) - const { data: { records, pages } } = res + const { data: { records, pages, total } } = res // 精简一下数据 const list = records.map((item) => { @@ -85,6 +85,7 @@ export async function getTaskDetailPictureList(packageid: string, taskchildpictu return { pageCount: pages, data: list, + total, } } diff --git a/src/views/home/content/Content.vue b/src/views/home/content/Content.vue index 47d1a80..0028e4c 100644 --- a/src/views/home/content/Content.vue +++ b/src/views/home/content/Content.vue @@ -2,8 +2,9 @@ import { computed, nextTick, onBeforeMount, onMounted, onUnmounted, onUpdated, reactive, ref, unref, watch } from 'vue' import Masonry from 'masonry-layout' import { useInfiniteScroll } from '@vueuse/core' -import { debounce, pickBy } from 'lodash-es' +import { debounce } from 'lodash-es' import imagesloaded from 'imagesloaded' +import { useMessage } from 'naive-ui' import PackageSettingsModal from './modal/PackageSettingsModal.vue' import { timeOptions, viewOptions } from '@/config/home' import { useWindowSizeFn } from '@/hooks/event/useWindowSizeFn' @@ -21,6 +22,7 @@ import { getImgUrl } from '@/utils/urlUtils' const deviceHeight = ref(600) let _masonry: null | Masonry = null +let _imagesload: any const masonryRef = ref(null) const el = ref(null) const viewMode = ref('masonry') @@ -31,6 +33,7 @@ const pagination = reactive({ const configStore = useConfig() const packageModalRef = ref(null) const loading = ref(false) +const message = useMessage() async function computeListHeight() { const headEl = document.querySelector('.wrapper-content')! @@ -62,7 +65,13 @@ const layout = debounce(() => { stagger: 10, }) - imagesloaded('.grid-item', () => { + _imagesload = imagesloaded('.grid-item') + + _imagesload.on('always', (instance) => { + console.log('always') + }) + + _imagesload.on('done', (instance) => { (_masonry as any).layout() const scrollHeight = el.value!.scrollHeight const clientHeight = el.value!.clientHeight @@ -70,6 +79,20 @@ const layout = debounce(() => { el.value!.scrollTo({ top, behavior: 'instant' }) loading.value = false }) + + _imagesload.on('fail', (instance) => { + message.error('图片错误') + loading.value = false + }) + + // imagesloaded('.grid-item', () => { + // (_masonry as any).layout() + // const scrollHeight = el.value!.scrollHeight + // const clientHeight = el.value!.clientHeight + // const top = scrollHeight - clientHeight - 20 + // el.value!.scrollTo({ top, behavior: 'instant' }) + // loading.value = false + // }) }, 300) let canloadMore = true @@ -139,6 +162,7 @@ async function featchList() { imgUrl: item.imgurl, upname: item.upname, ocrPictureclass: item.ocrPictureclass, + uphead: item.uphead, } }) @@ -225,6 +249,9 @@ async function refreshHandler() { const list = data.map((item) => { return { imgUrl: item.imgurl, + upname: item.upname, + ocrPictureclass: item.ocrPictureclass, + uphead: item.uphead, } }) diff --git a/src/views/worksheet/content/Content.vue b/src/views/worksheet/content/Content.vue index a0ce67f..cdec594 100644 --- a/src/views/worksheet/content/Content.vue +++ b/src/views/worksheet/content/Content.vue @@ -12,6 +12,7 @@ const batch = ref(false) const selectItems = ref([]) const message = useMessage() const dialog = useDialog() +const totalCount = ref(0) function setBatch(value: boolean) { batch.value = value @@ -199,8 +200,9 @@ async function handleSelect(item: any) { const taskId = item.id taskDetailInfo.value = await getTaskDetailInfo(taskId, workStore.activeId) - const res = await getTaskDetailPictureList(workStore.activeId, taskId, { ...taskpagination, ...sortBy }) - taskDetailPictureList.value = res.data + const { data, total } = await getTaskDetailPictureList(workStore.activeId, taskId, { ...taskpagination, ...sortBy }) + taskDetailPictureList.value = data + totalCount.value = total } async function sortHandler(orderby: 'pictureResult' | 'fromuptime') { @@ -266,6 +268,10 @@ function getPercent(pictureid: string) { const val = Number.parseFloat(percent) return `${val}%` } + +const mark = computed(() => { + return taskDetailInfo.value.iztrueorfalse === null ? '未标记' : '已标记' +})