制作非车渗透的上传报表。
This commit is contained in:
76
code/web/task_schedule/src/utils/BIReport.ts
Normal file
76
code/web/task_schedule/src/utils/BIReport.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2023-10-17 11:18:19
|
||||
* @LastEditors: Kane
|
||||
* @FilePath: /task_schedule/src/utils/api/BIReport.ts
|
||||
* @Description: BI报表相关的代码
|
||||
*
|
||||
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
||||
*/
|
||||
import { service as instance } from "./api/request.js";
|
||||
import { API_URL } from "./api/config.js";
|
||||
import { type AxiosResponse } from "axios";
|
||||
interface BIReportType
|
||||
{
|
||||
reportTypeCode: number;
|
||||
reportTypeName: string;
|
||||
}
|
||||
|
||||
interface ImportBIReportRequest
|
||||
{
|
||||
filePath: string,
|
||||
reportType: number,
|
||||
hasCaption: boolean,
|
||||
sheetIndex: number,
|
||||
}
|
||||
|
||||
interface ImportBIReportResponse
|
||||
{
|
||||
success: boolean,
|
||||
message: string,
|
||||
importedCount: number,
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param request 请求参数
|
||||
* @param handler 调用者提供的请求结果处理函数
|
||||
*/
|
||||
function importBIReport( request: ImportBIReportRequest, handler: any ): void
|
||||
{
|
||||
const importResponse: ImportBIReportResponse = {
|
||||
success: false,
|
||||
message: "",
|
||||
importedCount: 0,
|
||||
};
|
||||
|
||||
instance.request({
|
||||
url: API_URL.URL_IMPORT_REPORT,
|
||||
method: "post",
|
||||
data: request,
|
||||
})
|
||||
.then(( response: AxiosResponse<any, any> ): any =>
|
||||
{
|
||||
const data: ImportBIReportResponse = response.data;
|
||||
|
||||
importResponse.success = data.success ?? false;
|
||||
importResponse.message = data.message ?? "";
|
||||
importResponse.importedCount = data.importedCount ?? 0;
|
||||
|
||||
handler( importResponse, null );
|
||||
})
|
||||
.catch(( error: any ): any =>
|
||||
{
|
||||
importResponse.message = "请求导入报表错误,请查看控制台!";
|
||||
console.log( error );
|
||||
|
||||
handler( importResponse, error );
|
||||
});
|
||||
}
|
||||
|
||||
export {
|
||||
type BIReportType,
|
||||
type ImportBIReportRequest,
|
||||
type ImportBIReportResponse,
|
||||
importBIReport
|
||||
};
|
@@ -44,7 +44,12 @@ const API_URL = {
|
||||
// 删除获奖人员
|
||||
URL_DEL_REWARD_TELSALER: "http://10.39.0.41:8081/desktop_archievement_backend/rewards/delete_telsaler_reward.do",
|
||||
// URL_ADD_REWARD_TELSALER: "http://222.76.244.118:11101/desktop_archievement_backend/rewards/delete_telsaler_reward.do",
|
||||
|
||||
// 上传文件
|
||||
URL_UPLOAD_FILE: "http://10.39.0.41:8081/desktop_archievement_backend/file/file-upload.do",
|
||||
// URL_UPLOAD_FILE: "http://222.76.244.118:11101/desktop_archievement_backend/file/file-upload.do",
|
||||
// 导入报表
|
||||
URL_IMPORT_REPORT: "http://10.39.0.41:8081/desktop_archievement_backend/import_bi_data/excel.do",
|
||||
// URL_IMPORT_REPORT: "http://222.76.244.118:11101/desktop_archievement_backend/import_bi_data/excel.do",
|
||||
};
|
||||
|
||||
export { API_URL };
|
||||
|
@@ -14,3 +14,7 @@ interface FileUploadResponse
|
||||
message: string;
|
||||
fileList: string[];
|
||||
}
|
||||
|
||||
export {
|
||||
type FileUploadResponse
|
||||
};
|
||||
|
Reference in New Issue
Block a user