完成新需求
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')
|
||||
}
|
||||
@@ -8,6 +8,7 @@ export interface SplitExcelPayload {
|
||||
}
|
||||
|
||||
export interface SplitExcelResultItem {
|
||||
result_id?: number
|
||||
source_path: string
|
||||
output_path?: string
|
||||
success: boolean
|
||||
@@ -37,6 +38,7 @@ export interface ExcelInfoResponse {
|
||||
}
|
||||
|
||||
export interface CleanExcelResultItem {
|
||||
result_id?: number
|
||||
source_path: string
|
||||
output_path?: string
|
||||
success: boolean
|
||||
@@ -58,6 +60,7 @@ export interface ConvertTxtTemplateItem {
|
||||
}
|
||||
|
||||
export interface ConvertTxtResultItem {
|
||||
result_id?: number
|
||||
source_path: string
|
||||
output_path?: string
|
||||
success: boolean
|
||||
@@ -92,6 +95,24 @@ export interface CleanExcelResponse {
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface ConvertTxtHistoryResponse {
|
||||
success: boolean
|
||||
items?: ConvertTxtResultItem[]
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface SplitExcelHistoryResponse {
|
||||
success: boolean
|
||||
items?: SplitExcelResultItem[]
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface CleanExcelHistoryResponse {
|
||||
success: boolean
|
||||
items?: CleanExcelResultItem[]
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface PywebviewApi {
|
||||
select_brand_xlsx_files?: () => Promise<string[]>
|
||||
select_clean_xlsx_files?: () => Promise<string[]>
|
||||
@@ -99,12 +120,17 @@ export interface PywebviewApi {
|
||||
select_clean_folder?: () => Promise<string | null>
|
||||
select_folder?: () => Promise<string | null>
|
||||
get_excel_headers?: (filePath: string) => Promise<{ success: boolean; headers?: string[]; error?: string }>
|
||||
get_dedupe_history?: () => Promise<CleanExcelHistoryResponse>
|
||||
get_convert_history?: () => Promise<ConvertTxtHistoryResponse>
|
||||
get_split_history?: () => Promise<SplitExcelHistoryResponse>
|
||||
delete_history_item?: (moduleType: string, resultId: number) => Promise<{ success: boolean; error?: string }>
|
||||
get_excel_info?: (filePath: string) => Promise<ExcelInfoResponse>
|
||||
clean_excel_files?: (payload: CleanExcelPayload) => Promise<CleanExcelResponse>
|
||||
split_excel_files?: (payload: SplitExcelPayload) => Promise<SplitExcelResponse>
|
||||
list_txt_templates?: () => Promise<ConvertTxtTemplateItem[]>
|
||||
import_txt_template?: (name?: string) => Promise<{ success: boolean; template?: ConvertTxtTemplateItem; error?: string }>
|
||||
set_default_txt_template?: (templateId: string) => Promise<{ success: boolean; error?: string }>
|
||||
delete_txt_template?: (templateId: string) => Promise<{ success: boolean; error?: string }>
|
||||
convert_excel_to_uk_txt?: (payload: ConvertTxtPayload) => Promise<ConvertTxtResponse>
|
||||
open_path?: (path: string) => Promise<{ success: boolean; error?: string }>
|
||||
save_template_xlsx?: () => Promise<{ success: boolean; path?: string; error?: string }>
|
||||
|
||||
Reference in New Issue
Block a user