refactor: 获取任务包列表错误逻辑处理

bak
elseif 1 year ago
parent 26bb511100
commit ff018504a4

35
components.d.ts vendored

@ -9,6 +9,41 @@ declare module 'vue' {
export interface GlobalComponents {
Application: typeof import('./src/components/Application/Application.vue')['default']
BasicModal: typeof import('./src/components/Modal/BasicModal.vue')['default']
NAvatar: typeof import('naive-ui')['NAvatar']
NButton: typeof import('naive-ui')['NButton']
NCard: typeof import('naive-ui')['NCard']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NCollapse: typeof import('naive-ui')['NCollapse']
NCollapseItem: typeof import('naive-ui')['NCollapseItem']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDatePicker: typeof import('naive-ui')['NDatePicker']
NDialogProvider: typeof import('naive-ui')['NDialogProvider']
NDivider: typeof import('naive-ui')['NDivider']
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']
NInput: typeof import('naive-ui')['NInput']
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
NModal: typeof import('naive-ui')['NModal']
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
NPopover: typeof import('naive-ui')['NPopover']
NPopselect: typeof import('naive-ui')['NPopselect']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSelect: typeof import('naive-ui')['NSelect']
NSlider: typeof import('naive-ui')['NSlider']
NSpace: typeof import('naive-ui')['NSpace']
NSpin: typeof import('naive-ui')['NSpin']
NSwitch: typeof import('naive-ui')['NSwitch']
NTabPane: typeof import('naive-ui')['NTabPane']
NTabs: typeof import('naive-ui')['NTabs']
NTag: typeof import('naive-ui')['NTag']
NTooltip: typeof import('naive-ui')['NTooltip']
NUpload: typeof import('naive-ui')['NUpload']
NUploadDragger: typeof import('naive-ui')['NUploadDragger']
Quill: typeof import('./src/components/RichEditor/Quill.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']

@ -1,16 +1,17 @@
import { http } from '@/utils/http/axios'
import type { PageParam, PictureSortParam, SetTFParam } from '/#/api'
import { ContentTypeEnum } from '@/enums/httpEnum'
/**
*
* @returns
*/
export async function getPackageList(params: PageParam) {
export async function getPackageList(params: PageParam, packagename: string) {
const res = await http.request({
url: `/ocr/ocrPackagetask/list`,
method: 'get',
params,
params: { ...params, packagename },
})
const { data: { records, pages } } = res

@ -43,9 +43,9 @@ export const useWorkOrderStore = defineStore({
this.setActive(--this.currentIndex)
},
async fetchOrderList(pagination) {
const res = await getPackageList(pagination)
async fetchOrderList(pagination, keyword) {
const res = await getPackageList(pagination, keyword)
if (res.data.length > 0) {
this.setOrderList(res.data)
this.setActive(0)

@ -1,4 +1,13 @@
<script lang="ts" setup>
import { useInfiniteScroll } from '@vueuse/core'
import imagesloaded from 'imagesloaded'
import { debounce } from 'lodash-es'
import Masonry from 'masonry-layout'
import { useMessage } from 'naive-ui'
import { computed, nextTick, onBeforeMount, onMounted, onUnmounted, onUpdated, reactive, ref, unref, watch } from 'vue'
import GeneratePackageModal from './modal/GeneratePackageModal.vue'
import PackageSettingsModal from './modal/PackageSettingsModal.vue'
import LoginSuccessModal from './modal/LoginSuccessModal.vue'
import { getPictureList, oneClickCheck } from '@/api/home/main'
import img1 from '@/assets/images/1.jpg'
import img2 from '@/assets/images/2.jpg'
@ -13,14 +22,6 @@ import { hideDownload } from '@/utils/image'
import { randomInt } from '@/utils/index'
import emitter from '@/utils/mitt'
import { getImgUrl } from '@/utils/urlUtils'
import { useInfiniteScroll } from '@vueuse/core'
import imagesloaded from 'imagesloaded'
import { debounce } from 'lodash-es'
import Masonry from 'masonry-layout'
import { useMessage } from 'naive-ui'
import { computed, nextTick, onBeforeMount, onMounted, onUnmounted, onUpdated, reactive, ref, unref, watch } from 'vue'
import GeneratePackageModal from './modal/GeneratePackageModal.vue'
import PackageSettingsModal from './modal/PackageSettingsModal.vue'
const deviceHeight = ref(600)
let _masonry: null | Masonry = null
@ -29,7 +30,7 @@ const masonryRef = ref<ComponentRef>(null)
const el = ref<HTMLDivElement | null>(null)
const viewMode = ref('masonry')
const pagination = reactive({
pageNo: 1,
pageNo: 0,
pageSize: 30,
})
const configStore = useConfig()
@ -153,13 +154,13 @@ async function featchList() {
search_history: 0,
}
pagination.pageNo += 1
const result = await getPictureList({ ...pagination, ...contentParams })
// TODO
// result.data = Array.from({ length: 30 })
// result.pageCount = 1
const { data, pageCount } = result
pagination.pageNo += 1
canloadMore = pageCount >= pagination.pageNo
canloadMore = pageCount >= pagination.pageNo && pageCount > 0
const list = data.map((item) => {
return {
@ -173,6 +174,7 @@ async function featchList() {
return list
}
catch (error) {
canloadMore = false
return []
}
}
@ -185,10 +187,10 @@ async function loadMore() {
listData.value.push(...more)
}
onBeforeMount(async () => {
const list = await featchList()
listData.value = list
})
// onBeforeMount(async () => {
// const list = await featchList()
// listData.value = list
// })
const gridHeight = computed(() => {
return viewMode.value !== 'masonry' ? '145px' : ''
@ -199,9 +201,9 @@ async function oneCheck() {
modal.showModal()
}
async function showLoginSuccessModal(){
async function showLoginSuccessModal() {
const modal = LoginSuccessModalRef.value as any
modal.showModal()
// modal.showModal()
}
async function commitHandler(settingParam) {

@ -6,9 +6,7 @@ import { computed, onBeforeMount, onMounted, onUnmounted, reactive, ref, unref,
import TaskList from './TaskList.vue'
import type { TaskListItem } from '/#/task'
const CustomFieldModalRef = ref(null);
const CustomFieldModalRef = ref(null)
const collapse = ref(false)
const taskStore = useTaskStore()
const userStore = useUser()
@ -73,9 +71,10 @@ async function refreshHandler() {
watch(() => taskStore.immersion, () => {
collapse.value = true
})
const showFilterModal = ()=>{
const modal = unref(CustomFieldModalRef)! as any;
modal.showModal();
function showFilterModal() {
const modal = unref(CustomFieldModalRef)! as any
modal.showModal()
}
</script>
@ -93,7 +92,7 @@ const showFilterModal = ()=>{
</div>
<div class="aside-header-right">
<SvgIcon size="18" name="magnifying-1" />
<SvgIcon style="margin-left: 10px;cursor: pointer;" size="18" name="filter" @click="showFilterModal"/>
<SvgIcon style="margin-left: 10px;cursor: pointer;" size="18" name="filter" @click="showFilterModal" />
</div>
</div>
<TaskList style="height: calc(100vh - 146px);" class="work-sheet-list" :data="data" :active-id="taskStore.getActiveId!" />

@ -22,33 +22,33 @@ const dialog = useDialog()
const confrimModalRef = ref(null)
const batchModalRef = ref(null)
const totalCount = ref(0)
const CustomSettingModalRef = ref(null);
const CustomSettingModalRef = ref(null)
const sortBy: PictureSortParam = {
orderbyname: "asc",
orderbyvalue: "fromuptime",
};
orderbyname: 'asc',
orderbyvalue: 'fromuptime',
}
function setBatch(value: boolean) {
batch.value = value;
batch.value = value
if (value === false) {
selectItems.value.forEach((item) => (item.checked = false));
selectItems.value.length = 0;
selectItems.value.forEach(item => (item.checked = false))
selectItems.value.length = 0
}
}
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,
@ -180,16 +180,16 @@ function reject(idOrDesc: string, backId: string, isOther: boolean) {
}
function showModal(modalRef: any) {
const modal = unref(modalRef)! as any;
modal.showModal();
const modal = unref(modalRef)! as any
modal.showModal()
}
function forwardHandler() {
taskStore.forward();
taskStore.forward()
}
function backHandler() {
taskStore.back();
taskStore.back()
}
watch(() => [taskStore.activeId, taskStore.refresh], async (newValue, oldValue) => {
@ -207,9 +207,9 @@ watch(() => [taskStore.activeId, taskStore.refresh], async (newValue, oldValue)
})
const currentTaskId = computed(() => {
const index = taskStore.getCurrentIndex;
return taskStore.getApprovalList[index]?.formid || "";
});
const index = taskStore.getCurrentIndex
return taskStore.getApprovalList[index]?.formid || ''
})
function overTaskHandle() {
const item = taskDetailInfo.value
@ -219,12 +219,12 @@ function overTaskHandle() {
}
function leaveTaskHandler() {
overTask.value = null;
overTask.value = null
}
function showActionsModal(){
const modal = unref(CustomSettingModalRef)! as any;
modal.showModal();
function showActionsModal() {
const modal = unref(CustomSettingModalRef)! as any
modal.showModal()
}
onUnmounted(() => {
@ -359,7 +359,9 @@ function previewHandler(event: MouseEvent) {
@update:checked="onCheckChange($event, item)"
/>
</div>
<div class="percent">96%</div>
<div class="percent">
96%
</div>
</div>
</div>
</n-scrollbar>
@ -368,7 +370,9 @@ function previewHandler(event: MouseEvent) {
<div class="info-header">
<div class="left_box">
<div class="title">填报信息</div>
<div class="title">
填报信息
</div>
<SvgIcon size="12" name="collapse" />
</div>
<div class="right_box" @click="showActionsModal">
@ -444,13 +448,8 @@ function previewHandler(event: MouseEvent) {
display: flex;
align-items: center;
justify-content: center;
<<<<<<< HEAD
color: #FFF;
margin-right: 10px;
=======
color: #fff;
margin-right: 6px;
>>>>>>> al
cursor: pointer;
}

@ -2,7 +2,7 @@
import type { PackageListItem } from '/#/workorder'
import ListItem from './ListItem.vue'
import { useWorkOrder } from '@/store/modules/workOrder'
import { onUnmounted, reactive, ref, watch } from 'vue'
import { reactive, ref, watch } from 'vue'
import { useInfiniteScroll } from '@vueuse/core'
const workStore = useWorkOrder()
@ -27,7 +27,7 @@ const { isLoading } = useInfiniteScroll(
loadMore()
},
{ distance: 10, interval: 300, canLoadMore: () => {
console.log('canloadmore excuted!')
// console.log('canloadmore excuted!')
return canloadMore.value
} },
)
@ -44,12 +44,13 @@ async function loadMore() {
async function fetchList() {
try {
pagination.pageNo += 1
const result = await workStore.fetchOrderList(pagination)
const result = await workStore.fetchOrderList(pagination, keyword.value)
const { data, pageCount } = result
canloadMore.value = pageCount >= pagination.pageNo
return data
canloadMore.value = pageCount >= pagination.pageNo && pageCount !== 0
return data || []
}
catch (error) {
canloadMore.value = false
return []
}
}

@ -286,6 +286,8 @@ function previewHandler(event: MouseEvent) {
if (imageRef.value)
(imageRef.value as any).mergedOnClick()
}
const count = computed(() => taskDetailPictureList.value.length)
</script>
<template>
@ -388,7 +390,7 @@ function previewHandler(event: MouseEvent) {
</div>
</div>
<div style="display: flex;justify-content: space-between;padding: 12px 0px;">
<div><span style="font-size: 21px;font-weight: bold;">相似图片</span><span>(16)</span></div>
<div><span style="font-size: 21px;font-weight: bold;">相似图片</span><span>({{ count }})</span></div>
<div style="display: flex;align-items: center;" @click="sortHandler('fromuptime')">
<div style="cursor: pointer;">
<span>按时间排序</span>

Loading…
Cancel
Save