From cc7e9715c4a4882998ff75087d3ad4733e27aa59 Mon Sep 17 00:00:00 2001 From: elseif Date: Mon, 18 Mar 2024 13:40:52 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E8=B0=83=E6=95=B4=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E8=BF=87=E6=BB=A4=E6=97=B6=E5=88=B7=E6=96=B0=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/workorder.ts | 5 +- src/views/final/aside/Aside.vue | 3 +- src/views/final/content/Content.vue | 50 +++++++++++-------- src/views/home/aside/comp/AdvanceFilter.vue | 4 +- src/views/home/content/Content.vue | 55 ++++++++------------- src/views/task/content/Content.vue | 13 ++++- types/home.d.ts | 1 + 7 files changed, 69 insertions(+), 62 deletions(-) diff --git a/src/config/workorder.ts b/src/config/workorder.ts index 9b62b62..1583c0f 100644 --- a/src/config/workorder.ts +++ b/src/config/workorder.ts @@ -157,16 +157,17 @@ export const fieldMap = { field2: '拜访客户类型', field3: '拜访客户名称', field4: '任务来源', - field5: '厂商1', + field5: '厂商', field6: '拜访客户级别', field7: '科室名称', field8: '拜访小结', field9: '产品名称', field10: '定位信息', - field11: 2002, + field11: '拜访日期', field12: '定位距离', field13: '病历号', field14: '是否重复', field15: '任务类型', field16: '任务状态', + field17: '项目类别', } diff --git a/src/views/final/aside/Aside.vue b/src/views/final/aside/Aside.vue index ac2c2b8..9e3ed29 100644 --- a/src/views/final/aside/Aside.vue +++ b/src/views/final/aside/Aside.vue @@ -10,6 +10,7 @@ import type { Filter } from '/#/home' import type { AsideEntity } from '@/config/aside' import { asideMap } from '@/config/final' import type { AsideConfig } from '/#/api' +import emitter from '@/utils/mitt' const finalStore = useFinal() @@ -142,7 +143,7 @@ function filterHandler(filterList: Filter[]) { filerMap[key] = value } - // TODO: 这里不需要赋值,直接以过滤条件为参数调用终审列表接口 + emitter.emit('filter-final', filerMap) } function editFilter(filter: any) { diff --git a/src/views/final/content/Content.vue b/src/views/final/content/Content.vue index 6a6c607..c6326fd 100644 --- a/src/views/final/content/Content.vue +++ b/src/views/final/content/Content.vue @@ -1,4 +1,8 @@ diff --git a/src/views/home/aside/comp/AdvanceFilter.vue b/src/views/home/aside/comp/AdvanceFilter.vue index 09cc477..df6193c 100644 --- a/src/views/home/aside/comp/AdvanceFilter.vue +++ b/src/views/home/aside/comp/AdvanceFilter.vue @@ -21,7 +21,7 @@ const emit = defineEmits<{ (e: 'show-filter'): void (e: 'show-custom'): void (e: 'update:search'): void - (e: 'select', filterList: Filter[]) + (e: 'select', id: string) }>() const data = ref([]) @@ -132,7 +132,7 @@ function generateFilterEntityList(data) { function selectHandler(item: FilterEntity) { (popover.value as any).setShow(false) - emit('select', item.filterList) + emit('select', item.id) } const inputHandler = debounce((word) => { diff --git a/src/views/home/content/Content.vue b/src/views/home/content/Content.vue index 0da34f7..ada822f 100644 --- a/src/views/home/content/Content.vue +++ b/src/views/home/content/Content.vue @@ -34,6 +34,8 @@ const generateModalRef = ref(null) const LoginSuccessModalRef = ref(null) const loading = ref(false) const message = useMessage() +let canloadMore = true +let filterId = null async function computeListHeight() { const headEl = document.querySelector('.wrapper-content')! @@ -82,19 +84,8 @@ const layout = debounce(() => { 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 - useInfiniteScroll( el as any, () => { @@ -136,8 +127,9 @@ async function featchList() { pagination.pageNo += 1 - const filterParams = unref(configStore.getAsideValue) - const result = await getPictureList({ ...pagination, ...contentParams, ...filterParams }) + const asideParams = unref(configStore.getAsideValue) + const params = filterId ? { userSearchId: filterId } : asideParams + const result = await getPictureList({ ...pagination, ...contentParams, ...params }) const { data, pageCount } = result canloadMore = pageCount >= pagination.pageNo && pageCount > 0 @@ -190,8 +182,6 @@ async function commitHandler(settingParam) { finalParam.buessinessno = settingParam.packagename finalParam.search_history = settingParam.comparehistory ? 1 : 0 - // TODO:添加重复标识参数 - const modal = generateModalRef.value as any modal.showModal() @@ -224,33 +214,28 @@ watch(() => configStore.asideValue, (newVal, oldVal) => { refreshHandler() }, { deep: true }) -async function refreshHandler() { +function reset() { pagination.pageNo = 0 pagination.pageSize = 50 listData.value.length = 0 - loading.value = true + loading.value = false canloadMore = true + filterId = null +} - const contentParams = { - search_month: timeRange.value, - search_history: 0, - } +async function refreshHandler(filtersearchId?: any) { + reset() - const filterParams = unref(configStore.getAsideValue) - const result = await getPictureList({ ...pagination, ...contentParams, ...filterParams }) - const { data, pageCount } = result - pagination.pageNo += 1 - canloadMore = pageCount >= pagination.pageNo - const list = data.map((item) => { - return { - imgUrl: item.imgurl, - upname: item.upname, - ocrPictureclass: item.ocrPictureclass, - uphead: item.uphead, - } - }) + if (filtersearchId) + filterId = filtersearchId - listData.value = list + useInfiniteScroll( + el as any, + () => { + loadMore() + }, + { distance: 10, canLoadMore: () => canloadMore }, + ) } function getAvatar(url: string): string { diff --git a/src/views/task/content/Content.vue b/src/views/task/content/Content.vue index f2a7cf1..f0e6a58 100644 --- a/src/views/task/content/Content.vue +++ b/src/views/task/content/Content.vue @@ -256,6 +256,15 @@ function previewHandler(event: MouseEvent) { if (imageRef.value) (imageRef.value as any).mergedOnClick() } + +function getPercent(pictureid: string) { + const { ocpictureid, pictureresult } = taskDetailInfo.value + const index = ocpictureid.split(',').indexOf(String(pictureid)) + const results = pictureresult.split(',') + const percent = results[index] || '0' + const val = Number.parseFloat(percent) + return `${val}%` +}