完成新需求
This commit is contained in:
63
frontend-vue/src/shared/api/convert.ts
Normal file
63
frontend-vue/src/shared/api/convert.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { requestGetJson, requestPostJson } from '@/shared/api/http'
|
||||
|
||||
export interface UploadFileVo {
|
||||
fileKey: string
|
||||
originalFilename?: string
|
||||
localPath?: string
|
||||
size?: number
|
||||
}
|
||||
|
||||
export interface ConvertTemplateVo {
|
||||
id: number
|
||||
templateCode: string
|
||||
templateName: string
|
||||
outputFilename: string
|
||||
isDefault?: boolean
|
||||
builtIn?: boolean
|
||||
}
|
||||
|
||||
export interface UploadedSourceFileDto {
|
||||
fileKey: string
|
||||
originalFilename?: string
|
||||
}
|
||||
|
||||
export interface ConvertResultItemVo {
|
||||
resultId?: number
|
||||
sourceFilename?: string
|
||||
outputFilename?: string
|
||||
success: boolean
|
||||
error?: string
|
||||
downloadUrl?: string
|
||||
}
|
||||
|
||||
export interface ConvertRunVo {
|
||||
total: number
|
||||
successCount: number
|
||||
failedCount: number
|
||||
items: ConvertResultItemVo[]
|
||||
}
|
||||
|
||||
export interface StandardApiResponse<T> {
|
||||
success: boolean
|
||||
message?: string
|
||||
data?: T
|
||||
}
|
||||
|
||||
export function getConvertTemplates() {
|
||||
return requestGetJson<StandardApiResponse<ConvertTemplateVo[]>>('/api/convert/templates')
|
||||
}
|
||||
|
||||
export function uploadTempFile(file: File) {
|
||||
const formData = new FormData()
|
||||
formData.append('file', file)
|
||||
return requestPostJson<StandardApiResponse<UploadFileVo>, FormData>('/api/files/upload', formData, {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
})
|
||||
}
|
||||
|
||||
export function runConvert(files: UploadedSourceFileDto[], templateId: number) {
|
||||
return requestPostJson<StandardApiResponse<ConvertRunVo>>('/api/convert/run', {
|
||||
files,
|
||||
templateId,
|
||||
})
|
||||
}
|
||||
22
frontend-vue/src/shared/api/dedupe.ts
Normal file
22
frontend-vue/src/shared/api/dedupe.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { requestGetJson } from '@/shared/api/http'
|
||||
|
||||
export interface DedupeHistoryItem {
|
||||
sourceFilename?: string
|
||||
outputFilename?: string
|
||||
downloadUrl?: string
|
||||
success: boolean
|
||||
}
|
||||
|
||||
export interface DedupeHistoryVo {
|
||||
items: DedupeHistoryItem[]
|
||||
}
|
||||
|
||||
export interface StandardApiResponse<T> {
|
||||
success: boolean
|
||||
message?: string
|
||||
data?: T
|
||||
}
|
||||
|
||||
export function getDedupeHistory() {
|
||||
return requestGetJson<StandardApiResponse<DedupeHistoryVo>>('/api/dedupe/history')
|
||||
}
|
||||
Reference in New Issue
Block a user