打包项目
This commit is contained in:
@@ -1,96 +0,0 @@
|
||||
import { requestDeleteJson, requestGetJson, requestPostJson, requestPutJson } from '@/shared/api/http'
|
||||
|
||||
export interface AdminUserItem {
|
||||
id: number
|
||||
username?: string
|
||||
role?: 'super_admin' | 'admin' | 'normal' | string
|
||||
creator_username?: string
|
||||
created_at?: string
|
||||
}
|
||||
|
||||
export interface AdminSimpleUser {
|
||||
id: number
|
||||
username: string
|
||||
}
|
||||
|
||||
export interface AdminUsersResponse {
|
||||
success: boolean
|
||||
current_user_role?: 'super_admin' | 'admin' | 'normal' | string
|
||||
admins?: AdminSimpleUser[]
|
||||
items?: AdminUserItem[]
|
||||
total?: number
|
||||
page?: number
|
||||
page_size?: number
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface AdminMutationResponse {
|
||||
success: boolean
|
||||
msg?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface AdminHistoryItem {
|
||||
id: number
|
||||
username?: string
|
||||
panel_type?: string
|
||||
created_at?: string
|
||||
long_image_url?: string | null
|
||||
result_urls?: string[]
|
||||
}
|
||||
|
||||
export interface AdminHistoryResponse {
|
||||
success: boolean
|
||||
items?: AdminHistoryItem[]
|
||||
total?: number
|
||||
page?: number
|
||||
page_size?: number
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface AdminColumnPermissionItem {
|
||||
column_key?: string
|
||||
}
|
||||
|
||||
export interface AdminColumnPermissionResponse {
|
||||
success: boolean
|
||||
items?: AdminColumnPermissionItem[]
|
||||
error?: string
|
||||
}
|
||||
|
||||
export function getAdminUsers(query = '') {
|
||||
const suffix = query ? `?${query}` : ''
|
||||
return requestGetJson<AdminUsersResponse>(`/api/admin/users${suffix}`)
|
||||
}
|
||||
|
||||
export function createAdminUser(payload: {
|
||||
username: string
|
||||
password: string
|
||||
role: string
|
||||
created_by_id?: number
|
||||
}) {
|
||||
return requestPostJson<AdminMutationResponse>('/api/admin/user', payload)
|
||||
}
|
||||
|
||||
export function updateAdminUser(
|
||||
userId: number | string,
|
||||
payload: {
|
||||
password?: string
|
||||
role?: string
|
||||
},
|
||||
) {
|
||||
return requestPutJson<AdminMutationResponse>(`/api/admin/user/${userId}`, payload)
|
||||
}
|
||||
|
||||
export function deleteAdminUser(userId: number | string) {
|
||||
return requestDeleteJson<AdminMutationResponse>(`/api/admin/user/${userId}`)
|
||||
}
|
||||
|
||||
export function getAdminHistory(query = '') {
|
||||
const suffix = query ? `?${query}` : ''
|
||||
return requestGetJson<AdminHistoryResponse>(`/api/admin/history${suffix}`)
|
||||
}
|
||||
|
||||
export function getUserColumnPermissions(userId: string | number) {
|
||||
return requestGetJson<AdminColumnPermissionResponse>(`/api/admin/user/${userId}/column-permissions`)
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
import { requestGetJson, requestPostJson } from '@/shared/api/http'
|
||||
|
||||
export interface LoginResponse {
|
||||
success: boolean
|
||||
redirect?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface AuthCheckResponse {
|
||||
logged_in: boolean
|
||||
redirect?: string
|
||||
}
|
||||
|
||||
export async function checkAuth() {
|
||||
return requestGetJson<AuthCheckResponse>('/api/auth/check')
|
||||
}
|
||||
|
||||
export async function login(username: string, password: string) {
|
||||
const formData = new FormData()
|
||||
formData.set('username', username)
|
||||
formData.set('password', password)
|
||||
|
||||
return requestPostJson<LoginResponse>('/login', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export async function logout() {
|
||||
try {
|
||||
await requestGetJson('/logout', {
|
||||
validateStatus: () => true,
|
||||
})
|
||||
} catch {
|
||||
// logout should still continue on the client even if backend responds abnormally
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
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,
|
||||
})
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
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')
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import { requestGetJson, requestPostJson } from '@/shared/api/http'
|
||||
|
||||
export interface VersionResponse {
|
||||
version?: string
|
||||
has_update?: boolean
|
||||
latest_version?: string
|
||||
desc?: string
|
||||
file_url?: string
|
||||
}
|
||||
|
||||
export interface UpdateStartResponse {
|
||||
success: boolean
|
||||
error?: string
|
||||
}
|
||||
|
||||
export function fetchVersion() {
|
||||
return requestGetJson<VersionResponse>('/api/version')
|
||||
}
|
||||
|
||||
export function startUpdate(fileUrl: string) {
|
||||
return requestPostJson<UpdateStartResponse>('/api/update/do', { file_url: fileUrl })
|
||||
}
|
||||
@@ -4,7 +4,7 @@ export interface SplitExcelPayload {
|
||||
split_mode: 'rows_per_file' | 'parts'
|
||||
rows_per_file?: number
|
||||
parts?: number
|
||||
output_dir: string
|
||||
output_dir?: string
|
||||
}
|
||||
|
||||
export interface SplitExcelResultItem {
|
||||
@@ -37,6 +37,14 @@ export interface ExcelInfoResponse {
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface CleanExcelPayload {
|
||||
paths: string[]
|
||||
selected_columns: string[]
|
||||
keep_integer_ids?: boolean
|
||||
keep_underscore_ids?: boolean
|
||||
output_dir?: string
|
||||
}
|
||||
|
||||
export interface CleanExcelResultItem {
|
||||
result_id?: number
|
||||
source_path: string
|
||||
@@ -47,7 +55,7 @@ export interface CleanExcelResultItem {
|
||||
|
||||
export interface ConvertTxtPayload {
|
||||
paths: string[]
|
||||
output_dir: string
|
||||
output_dir?: string
|
||||
template_id: string
|
||||
}
|
||||
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
import { ref } from 'vue'
|
||||
import { fetchVersion, startUpdate } from '@/shared/api/update'
|
||||
|
||||
export function useUpdateCheck() {
|
||||
const loading = ref(false)
|
||||
const version = ref('1.0.0')
|
||||
const hint = ref('')
|
||||
const downloadVisible = ref(false)
|
||||
const downloadLoading = ref(false)
|
||||
const fileUrl = ref('')
|
||||
|
||||
const check = async () => {
|
||||
loading.value = true
|
||||
hint.value = '正在检测更新...'
|
||||
downloadVisible.value = false
|
||||
|
||||
try {
|
||||
const result = await fetchVersion()
|
||||
version.value = (result.version || version.value).replace(/^v/i, '')
|
||||
|
||||
if (result.has_update && result.latest_version) {
|
||||
hint.value = `发现新版本 v${result.latest_version}${result.desc ? `:${result.desc}` : ''}`
|
||||
fileUrl.value = result.file_url || ''
|
||||
downloadVisible.value = true
|
||||
return
|
||||
}
|
||||
|
||||
hint.value = '已是最新版本'
|
||||
} catch (error) {
|
||||
hint.value = error instanceof Error ? error.message : '检测更新失败'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const runUpdate = async () => {
|
||||
if (!fileUrl.value) {
|
||||
hint.value = '暂无下载地址,请关注官方渠道。'
|
||||
return false
|
||||
}
|
||||
|
||||
downloadLoading.value = true
|
||||
hint.value = '正在下载并准备更新,程序将自动退出...'
|
||||
|
||||
try {
|
||||
const result = await startUpdate(fileUrl.value)
|
||||
if (result.success) {
|
||||
hint.value = '更新已启动,程序即将退出...'
|
||||
return true
|
||||
}
|
||||
|
||||
hint.value = result.error || '更新启动失败'
|
||||
return false
|
||||
} catch (error) {
|
||||
hint.value = error instanceof Error ? error.message : '请求更新失败,请重试'
|
||||
return false
|
||||
} finally {
|
||||
downloadLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
loading,
|
||||
version,
|
||||
hint,
|
||||
downloadVisible,
|
||||
downloadLoading,
|
||||
check,
|
||||
runUpdate,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user