You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
266 lines
5.8 KiB
266 lines
5.8 KiB
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'
|
|
|
|
/**
|
|
* 获取查重列表
|
|
* @param params
|
|
* @returns
|
|
*/
|
|
export async function getDeduplicationList(params: PageParam & QueryPictureParam): Promise<any> {
|
|
const res = await http.request({
|
|
url: `/ocr/ocrPicture/list`,
|
|
method: 'get',
|
|
params,
|
|
})
|
|
|
|
const { data: { records } } = res
|
|
return {
|
|
data: records,
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 上传图片
|
|
* @param params
|
|
* @returns
|
|
*/
|
|
export async function upload(params: UploadParam): Promise<{ data: string }> {
|
|
return http.request({
|
|
url: `/ocr/ocrPackagetask/upload`,
|
|
method: 'post',
|
|
params,
|
|
headers: { 'Content-Type': ContentTypeEnum.FORM_DATA },
|
|
})
|
|
|
|
// return new Promise((r, e) => {
|
|
// r({ url: 'https://picx.zhimg.com/70/v2-615f0ca70562a95edff5b10b393c18e4_1440w.avis?source=172ae18b&biz_tag=Post' })
|
|
// })
|
|
}
|
|
|
|
/**
|
|
* 查询个人笔记
|
|
* @returns
|
|
*/
|
|
export async function queryNote() {
|
|
return http.request({
|
|
url: `/ocr/ocrBooknote/query`,
|
|
method: 'get',
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 保存个人笔记
|
|
* @param note
|
|
* @returns
|
|
*/
|
|
export async function saveNote(note: string) {
|
|
return http.request({
|
|
url: `/ocr/ocrBooknote/add`,
|
|
method: 'post',
|
|
params: { notecontent: note },
|
|
headers: { 'Content-Type': ContentTypeEnum.FORM_DATA },
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 获取统计信息
|
|
* @returns
|
|
*/
|
|
export async function getToolsCount() {
|
|
return http.request({
|
|
url: `/ocr/aitools/toolsCount`,
|
|
method: 'get',
|
|
params: { },
|
|
// headers: { 'Content-Type': ContentTypeEnum.FORM_DATA },
|
|
})
|
|
}
|
|
|
|
|
|
/**
|
|
* 一键查重
|
|
* @param note
|
|
* @returns
|
|
*/
|
|
export async function oneClickCheck(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/ocrPicture/createorder`,
|
|
method: 'get',
|
|
params: notEmptyParams,
|
|
headers: { 'Content-Type': ContentTypeEnum.FORM_DATA },
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 增加生成任务包逻辑—一键查重
|
|
* @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 note
|
|
* @returns
|
|
*/
|
|
export async function removeCheckDuplicate(checkDuplicateNo) {
|
|
|
|
return http.request({
|
|
url: `/ocr/checkDuplicate/removeCheckDuplicate`,
|
|
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 deletePackage(params) {
|
|
|
|
return http.request({
|
|
url: `/ocr/ocrTaskPackage/deletePackage`,
|
|
method: 'get',
|
|
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
|
|
* @returns
|
|
*/
|
|
export async function getPictureList(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/ocrPicture/list`,
|
|
method: 'get',
|
|
params: notEmptyParams,
|
|
headers: { 'Content-Type': ContentTypeEnum.FORM_DATA },
|
|
})
|
|
|
|
const { data: { records, pages, total } } = res
|
|
return {
|
|
pageCount: pages,
|
|
data: records,
|
|
total,
|
|
}
|
|
}
|