This commit is contained in:
oneao committed 2026-03-28 17:22:49 +08:00
1 parent ce466130c0
commit 9c026f00ad
36 files changed
+2230 -1036

No files matched your search

@@ -1,4 +1,6 @@
import { httpPost } from ".";
import { httpPost, httpUpload } from ".";
// 登录
export function loginApi(orgid, userid, password) {
@@ -112,6 +112,41 @@ export function httpPost(url, data, config) {
.then((res) => res.data);
}
/**
* 通用文件上传
* @param {string} url - 上传接口地址
* @param {File | File[]} file - 单个或多个文件
* @param {Object} extraData - 额外参数(可选)
* @param {Object} config - axios 配置(可选)
* @returns {Promise<any>}
*/
export function httpUpload(url, file, extraData = {}, config = {}) {
const formData = new FormData();
// 兼容单文件 & 多文件
if (Array.isArray(file)) {
file.forEach((f) => {
formData.append("file", f);
});
} else {
formData.append("file", file);
}
// 追加额外参数
Object.keys(extraData).forEach((key) => {
formData.append(key, extraData[key]);
});
return axiosInstance
.post(url, formData, {
headers: {
"Content-Type": "multipart/form-data",
},
...config,
})
.then((res) => res.data);
}
export function reset401Flag() {
hasShown401 = false;
}
@@ -94,6 +94,9 @@ async function loadTableColumns() {
}
}
/**
* 上传到临时文件夹
*/
async function loadTableDatas() {
loading.table = true;