Merge branch 'jie' into main

pull/1/head
lizijiee 1 year ago
commit e54b709692

@ -1,9 +1,9 @@
import { pickBy } from 'lodash-es'
import { http } from '@/utils/http/axios'
import type { CheckParam, PageParam, QueryPictureParam, UploadParam } from '/#/api'
import { ContentTypeEnum } from '@/enums/httpEnum'
import { notEmpty } from '@/utils'
import { formatToDate2 } from '@/utils/dateUtil'
import { http } from '@/utils/http/axios'
import { pickBy } from 'lodash-es'
import type { CheckParam, PageParam, QueryPictureParam, UploadParam } from '/#/api'
/**
*
@ -103,6 +103,104 @@ export async function oneClickCheck(params: Partial<CheckParam> = { search_histo
})
}
/**
*
* @param note
* @returns
*/
export async function oneClickCheckTaskPackage(params: Partial<CheckParam> = { search_history: '0' }) {
const notEmptyParams = pickBy(params, notEmpty)
Object.keys(notEmptyParams).forEach((key) => {
const val = notEmptyParams[key]
if (Array.isArray(val))
notEmptyParams[key] = val.join(',')
})
return http.request({
url: `/ocr/checkDuplicate/openCheckDuplicate`,
method: 'get',
params: notEmptyParams,
headers: { 'Content-Type': ContentTypeEnum.FORM_DATA },
})
}
/**
*
* @param note
* @returns
*/
export async function getLastCheckNo() {
return http.request({
url: `/ocr/checkDuplicate/getLastCheckNo`,
method: 'get',
headers: { 'Content-Type': ContentTypeEnum.FORM_DATA },
})
}
/**
*
* @param note
* @returns
*/
export async function getCheckDuplicateStatus(checkDuplicateNo) {
return http.request({
url: `/ocr/checkDuplicate/getCheckDuplicateStatus`,
method: 'get',
params: { checkDuplicateNo },
headers: { 'Content-Type': ContentTypeEnum.FORM_DATA },
})
}
/**
*
* @param
* @returns
*/
export async function createPackage(params) {
return http.request({
url: `/ocr/ocrTaskPackage/createPackage`,
method: 'post',
params
})
}
/**
*
* @param
* @returns
*/
export async function queryPageListByCheckNo(params: any): Promise<any> {
const notEmptyParams = pickBy(params, notEmpty)
Object.keys(notEmptyParams).forEach((key) => {
const val = notEmptyParams[key]
if (key === 'izyear') {
const start = formatToDate2(val[0])
const end = formatToDate2(val[1])
notEmptyParams[key] = `${start}-${end}`
}
if (Array.isArray(notEmptyParams[key]))
notEmptyParams[key] = val.join(',')
})
const res = await http.request({
url: `/ocr/checkDuplicate/queryPageListByCheckNo`,
method: 'get',
params: notEmptyParams,
headers: { 'Content-Type': ContentTypeEnum.FORM_DATA },
})
const { data: { records, pages, total } } = res
return {
pageCount: pages,
data: records,
total,
}
}
/**
*
* @param params

@ -1,5 +1,5 @@
<script lang="ts" setup>
import { getPictureList, oneClickCheck } from '@/api/home/main'
import { createPackage, getCheckDuplicateStatus, getLastCheckNo, getPictureList, oneClickCheckTaskPackage, queryPageListByCheckNo } from '@/api/home/main'
import avatar from '@/assets/images/avatar.jpg'
import { timeOptions, viewOptions } from '@/config/home'
import { useWindowSizeFn } from '@/hooks/event/useWindowSizeFn'
@ -9,8 +9,9 @@ import { hideDownload } from '@/utils/image'
import emitter from '@/utils/mitt'
import { getImgUrl } from '@/utils/urlUtils'
import { useInfiniteScroll } from '@vueuse/core'
import dayjs from 'dayjs'
import imagesloaded from 'imagesloaded'
import { debounce } from 'lodash-es'
import { cloneDeep, debounce } from 'lodash-es'
import Masonry from 'masonry-layout'
import { useMessage } from 'naive-ui'
import { computed, nextTick, onMounted, onUnmounted, onUpdated, reactive, ref, unref, watch } from 'vue'
@ -41,6 +42,10 @@ const sortBy: PictureSortParam = {
orderbyvalue: "pictureResult",
};
const imageRef = ref<ComponentElRef | null>()
const checkDuplicateNo = ref('')
const checkTaskStatus = ref(null) // 1. 2. 3.
const isRefresh = ref(true) //
let canloadMore = true
let filterId = null
@ -132,7 +137,16 @@ async function featchList() {
const asideParams = unref(configStore.getAsideValue)
const params = filterId ? { userSearchId: filterId } : asideParams
const result = await getPictureList({ ...pagination, ...contentParams, ...params, ...sortBy })
let result = {
pageCount: 0,
data: [],
total: 0,
}
if (checkTaskStatus.value === 2 && isRefresh) {
result = await queryPageListByCheckNo({ ...pagination, ...contentParams, ...params, ...sortBy, checkDuplicateNo: checkDuplicateNo.value })
} else {
result = await getPictureList({ ...pagination, ...contentParams, ...params, ...sortBy })
}
const { data, pageCount, total } = result
totalCount.value = total
canloadMore = pageCount >= pagination.pageNo && pageCount > 0
@ -180,8 +194,38 @@ const gridHeight = computed(() => {
})
async function oneCheck() {
const modal = packageModalRef.value as any
modal.showModal()
const asideVal = cloneDeep(configStore.getAsideValue)
asideVal.izyear = dayjs(asideVal.izyear[0]).format("YYYY/MM/DD") + '-' + dayjs(asideVal.izyear[1]).format("YYYY/MM/DD")
delete asideVal.izsimilarity
if (checkDuplicateNo.value) {
getCheckDuplicateStatus(checkDuplicateNo.value).then((res) => {
if (res.code === "OK") {
checkTaskStatus.value = res.data.status // 1. 2.
if (isRefresh.value === false) {
const modal = packageModalRef.value as any
modal.showModal()
return
}
if (checkTaskStatus.value === 2 && isRefresh) {
isRefresh.value = false
message.success('任务执行完毕,正在刷新数据...');
reset()
loadMore()
} else if (checkTaskStatus.value === 1) {
return
}
}
})
return
}
oneClickCheckTaskPackage(asideVal).then((res) => {
if (res.code === "OK") {
checkDuplicateNo.value = res.data.checkDuplicateNo
} else {
message.error(res.message || '查重失败')
}
})
}
async function showLoginSuccessModal() {
@ -190,28 +234,42 @@ async function showLoginSuccessModal() {
}
async function commitHandler(settingParam) {
const contentParams = {
search_month: timeRange.value,
// comparehistory: false
// mark: false //
// packagename: "22222"
const params = {
name: settingParam.packagename,
checkDuplicateNo: checkDuplicateNo.value,
// mark: settingParam.mark
}
createPackage(params).then((res) => {
if (res.code === "OK") {
message.success(res.data);
}
})
// const asideVal = configStore.getAsideValue
// const finalParam = { ...contentParams, ...asideVal }
// finalParam.buessinessno = settingParam.packagename
// finalParam.search_history = settingParam.comparehistory ? 1 : 0
const asideVal = configStore.getAsideValue
const finalParam = { ...contentParams, ...asideVal }
finalParam.buessinessno = settingParam.packagename
finalParam.search_history = settingParam.comparehistory ? 1 : 0
const modal = generateModalRef.value as any
modal.showModal()
// const modal = generateModalRef.value as any
// modal.showModal()
oneClickCheck(finalParam).then(() => {
modal.closeModal()
}, () => {
modal.closeModal()
})
// oneClickCheck(finalParam).then(() => {
// modal.closeModal()
// }, () => {
// modal.closeModal()
// })
}
onMounted(() => {
emitter.on('filter', refreshHandler)
//
getLastCheckNo().then((res) => {
if (res.code === "OK") {
checkDuplicateNo.value = res.data
}
})
nextTick(() => {
computeListHeight()
//
@ -310,7 +368,7 @@ async function downloadImage(item) {
}
}
function previewHandler(index: number,event: MouseEvent) {
function previewHandler(index: number, event: MouseEvent) {
event.stopImmediatePropagation();
event.stopPropagation();
if (imageRef.value?.[index] && (imageRef.value[index] as any).src)
@ -325,7 +383,11 @@ function previewHandler(index: number,event: MouseEvent) {
<SvgIcon size="32" name="magnifying" />
<span class="font">AI一键查重</span>
</div>
<SvgIcon style="cursor: pointer;" size="105" name="yijianchachong" @click="oneCheck" />
<SvgIcon v-show="checkTaskStatus !== 2" style="cursor: pointer;" size="105" name="yijianchachong"
@click="oneCheck" />
<div v-show="checkTaskStatus === 2" style="cursor: pointer;" size="105" name="magnifying" @click="oneCheck">
生成任务包
</div>
</div>
<div class="wrapper-content">
<div style="display: flex;justify-content: space-between;">
@ -352,7 +414,8 @@ function previewHandler(index: number,event: MouseEvent) {
<SvgIcon style="margin-left: 8px;" name="sort" size="12" />
</div>
</div>
<span style="font-size: 16px;color:#494949"> <span style="color:#7899fd;font-weight: 500;">{{ totalCount }}</span> </span>
<span style="font-size: 16px;color:#494949"> <span style="color:#7899fd;font-weight: 500;">{{ totalCount
}}</span> </span>
</div>
<n-spin :show="loading">
<div ref="el" class="scroll" :style="listStyle">
@ -508,7 +571,7 @@ function previewHandler(index: number,event: MouseEvent) {
flex-direction: row;
align-items: center;
margin-right: 24px;
color:#323233;
color: #323233;
.gap {
margin-left: 5px;
@ -546,6 +609,7 @@ function previewHandler(index: number,event: MouseEvent) {
padding: 0 10px;
background: rgba(0, 0, 0, .35);
border-radius: 7px;
.img-name {
width: 70%;
color: #FFF;

@ -1,7 +1,7 @@
<script lang="ts" setup>
import type { FormInst, FormRules } from 'naive-ui'
import { ref } from 'vue'
import { useMessage } from 'naive-ui'
import type { FormInst, FormRules } from 'naive-ui';
import { useMessage } from 'naive-ui';
import { ref } from 'vue';
const emit = defineEmits<{
(e: 'commit', value: any)
@ -42,7 +42,7 @@ const rules: FormRules = {
const model = ref({
packagename: '',
comparehistory: false,
// comparehistory: false,
mark: false,
})
@ -66,7 +66,6 @@ const formItemStyle = {
function afterLeave() {
model.value.packagename = ''
model.value.comparehistory = false
model.value.mark = false
}
</script>
@ -85,11 +84,6 @@ function afterLeave() {
<n-form-item path="packagename" label="任务包名称">
<n-input v-model:value="model.packagename" max="12" @keydown.enter.prevent />
</n-form-item>
<n-form-item path="comparehistory" :style="formItemStyle">
<n-checkbox v-model:checked="model.comparehistory">
是否对比历史数据
</n-checkbox>
</n-form-item>
<n-form-item path="mark" :style="formItemStyle">
<n-checkbox v-model:checked="model.mark">
是否给重复图片添加重复标识

Loading…
Cancel
Save