feat: 完成登录与栅格下载桌面端
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import { api } from "../../shared/http";
|
||||
|
||||
export interface GroupOption {
|
||||
id: string;
|
||||
label: string;
|
||||
columns: string[];
|
||||
}
|
||||
|
||||
export interface Meta {
|
||||
networks: { value: string; label: string }[];
|
||||
cities: { name: string; code: string }[];
|
||||
groups: Record<string, GroupOption[]>;
|
||||
fixed: { grid: string[]; cell: Record<string, string[]> };
|
||||
}
|
||||
|
||||
export interface DownloadJob {
|
||||
id: string;
|
||||
name: string;
|
||||
status: string;
|
||||
message: string;
|
||||
network: string;
|
||||
cityName: string;
|
||||
month: string;
|
||||
total: number;
|
||||
completed: number;
|
||||
failed: number;
|
||||
writtenRows: number;
|
||||
csvPath: string;
|
||||
failures: { id: string; message: string }[];
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export function loadMeta() {
|
||||
return api<Meta>("/api/download/meta");
|
||||
}
|
||||
|
||||
export function loadJobs() {
|
||||
return api<{ jobs: DownloadJob[] }>("/api/download/jobs");
|
||||
}
|
||||
|
||||
export function createJob(form: FormData) {
|
||||
return api<DownloadJob>("/api/download/jobs", { method: "POST", body: form });
|
||||
}
|
||||
|
||||
export function cancelJob(id: string) {
|
||||
return api<DownloadJob>(`/api/download/jobs/${id}/cancel`, { method: "POST" });
|
||||
}
|
||||
|
||||
export function resumeJob(id: string) {
|
||||
return api<DownloadJob>(`/api/download/jobs/${id}/resume`, { method: "POST" });
|
||||
}
|
||||
Reference in New Issue
Block a user