|
@@ -1,11 +1,11 @@
|
|
|
import request from '@/utils/request';
|
|
import request from '@/utils/request';
|
|
|
-import {download } from '@/utils/file';
|
|
|
|
|
|
|
+import { download } from '@/utils/file';
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 上传文件
|
|
* 上传文件
|
|
|
* @param file 文件
|
|
* @param file 文件
|
|
|
*/
|
|
*/
|
|
|
-export async function uploadFile (data) {
|
|
|
|
|
|
|
+export async function uploadFile(data) {
|
|
|
const formData = new FormData();
|
|
const formData = new FormData();
|
|
|
formData.append('multiPartFile', data.multiPartFile);
|
|
formData.append('multiPartFile', data.multiPartFile);
|
|
|
formData.append('module', data.module);
|
|
formData.append('module', data.module);
|
|
@@ -19,7 +19,7 @@ export async function uploadFile (data) {
|
|
|
* 上传文件 批量
|
|
* 上传文件 批量
|
|
|
* @param file 文件
|
|
* @param file 文件
|
|
|
*/
|
|
*/
|
|
|
-export async function uploadBatch (data) {
|
|
|
|
|
|
|
+export async function uploadBatch(data) {
|
|
|
const formData = new FormData();
|
|
const formData = new FormData();
|
|
|
data.multiPartFiles.forEach((item, index) => {
|
|
data.multiPartFiles.forEach((item, index) => {
|
|
|
formData.append(`multiPartFiles`, item);
|
|
formData.append(`multiPartFiles`, item);
|
|
@@ -37,7 +37,7 @@ export async function uploadBatch (data) {
|
|
|
/**
|
|
/**
|
|
|
* 获取文件路径
|
|
* 获取文件路径
|
|
|
*/
|
|
*/
|
|
|
-export async function getPathAddress () {
|
|
|
|
|
|
|
+export async function getPathAddress() {
|
|
|
const res = await request.post('/main/file/getPathAddress');
|
|
const res = await request.post('/main/file/getPathAddress');
|
|
|
if (res.data.code === '0') {
|
|
if (res.data.code === '0') {
|
|
|
return res.data.data;
|
|
return res.data.data;
|
|
@@ -47,7 +47,7 @@ export async function getPathAddress () {
|
|
|
/**
|
|
/**
|
|
|
* 获取文件
|
|
* 获取文件
|
|
|
*/
|
|
*/
|
|
|
-export async function getFile (params, fileName) {
|
|
|
|
|
|
|
+export async function getFile(params, fileName) {
|
|
|
const res = await request.get('/main/file/getFile', {
|
|
const res = await request.get('/main/file/getFile', {
|
|
|
params,
|
|
params,
|
|
|
responseType: 'blob'
|
|
responseType: 'blob'
|
|
@@ -62,7 +62,7 @@ export async function getFile (params, fileName) {
|
|
|
/**
|
|
/**
|
|
|
* 删除文件
|
|
* 删除文件
|
|
|
*/
|
|
*/
|
|
|
-export async function removeFile (data) {
|
|
|
|
|
|
|
+export async function removeFile(data) {
|
|
|
const res = await request.post(
|
|
const res = await request.post(
|
|
|
`/main/file/delete?fileId=${data.fileId}`,
|
|
`/main/file/delete?fileId=${data.fileId}`,
|
|
|
data
|
|
data
|
|
@@ -75,7 +75,7 @@ export async function removeFile (data) {
|
|
|
/**
|
|
/**
|
|
|
* 文件列表
|
|
* 文件列表
|
|
|
*/
|
|
*/
|
|
|
-export async function getFileList (data) {
|
|
|
|
|
|
|
+export async function getFileList(data) {
|
|
|
const res = await request.post(`/main/file/list`, data);
|
|
const res = await request.post(`/main/file/list`, data);
|
|
|
if (res.data.code === '0') {
|
|
if (res.data.code === '0') {
|
|
|
return res.data.data;
|
|
return res.data.data;
|
|
@@ -83,7 +83,6 @@ export async function getFileList (data) {
|
|
|
return Promise.reject(new Error(res.data.message));
|
|
return Promise.reject(new Error(res.data.message));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 导入文件 批量
|
|
* 导入文件 批量
|
|
|
* @param file 文件
|
|
* @param file 文件
|
|
@@ -93,13 +92,24 @@ export async function importBatch(data) {
|
|
|
data.multiPartFiles.forEach((item, index) => {
|
|
data.multiPartFiles.forEach((item, index) => {
|
|
|
formData.append(`file`, item);
|
|
formData.append(`file`, item);
|
|
|
});
|
|
});
|
|
|
- const res = await request.post(
|
|
|
|
|
- `/eom/saleorder/importFile`,
|
|
|
|
|
- formData
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ const res = await request.post(`/eom/saleorder/importFile`, formData);
|
|
|
if (res.data.code === '0') {
|
|
if (res.data.code === '0') {
|
|
|
return res.data;
|
|
return res.data;
|
|
|
}
|
|
}
|
|
|
return Promise.reject(new Error(res.data.message));
|
|
return Promise.reject(new Error(res.data.message));
|
|
|
}
|
|
}
|
|
|
|
|
+/**
|
|
|
|
|
+ * 下载模板
|
|
|
|
|
+ */
|
|
|
|
|
+export async function downLoadTemplate() {
|
|
|
|
|
+ const res = await request.post(
|
|
|
|
|
+ '/main/user/downLoadTemplate',
|
|
|
|
|
+ {},
|
|
|
|
|
+ {
|
|
|
|
|
+ responseType: 'blob'
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
|
|
+ console.log(res.data, '***********');
|
|
|
|
|
+ download(res.data, '员工档案导入模板.xlsx');
|
|
|
|
|
|
|
|
|
|
+}
|