🔨 查询上传任务.

This commit is contained in:
lijiahang
2024-05-10 13:21:08 +08:00
parent cd312ef5c8
commit 564e40a31d
10 changed files with 210 additions and 60 deletions

View File

@@ -1,4 +1,5 @@
import type { DataGrid, Pagination } from '@/types/global';
import type { HostQueryResponse } from '@/api/asset/host';
import type { TableData } from '@arco-design/web-vue/es/table/interface';
import axios from 'axios';
import qs from 'query-string';
@@ -28,6 +29,7 @@ export interface UploadTaskFileCreateRequest {
export interface UploadTaskCreateResponse {
id: number;
token: string;
hosts: Array<HostQueryResponse>;
}
/**
@@ -110,6 +112,18 @@ export function getUploadTaskPage(request: UploadTaskQueryRequest) {
return axios.post<DataGrid<UploadTaskQueryResponse>>('/asset/upload-task/query', request);
}
/**
* 查询上传任务状态
*/
export function getUploadTaskStatus(idList: Array<number>, queryFiles: boolean) {
return axios.get<Array<UploadTaskQueryResponse>>('/asset/upload-task/status', {
params: { idList, queryFiles },
paramsSerializer: params => {
return qs.stringify(params, { arrayFormat: 'comma' });
}
});
}
/**
* 删除上传任务
*/

View File

@@ -74,7 +74,7 @@
import type { FileItem } from '@arco-design/web-vue';
import type { UploadTaskFileCreateRequest } from '@/api/exec/upload-task';
import type { IFileUploader } from '@/components/system/uploader/const';
import { ref } from 'vue';
import { onUnmounted, ref } from 'vue';
import { getFileSize } from '@/utils/file';
import FileUploader from '@/components/system/uploader/file-uploader';
@@ -127,6 +127,11 @@
defineExpose({ getFiles, startUpload, close });
// 卸载时关闭
onUnmounted(() => {
uploader.value?.close();
});
</script>
<style lang="less" scoped>

View File

@@ -58,8 +58,9 @@
const filesRef = ref();
const hostModal = ref<any>();
// TODO pullstatus
// TODO 测试 error 情况
// TODO pullstatus 按钮显示就可以去掉了吧
// host tab
// status tab
// 设置选中主机
const setSelectedHost = (hosts: Array<number>) => {
@@ -147,6 +148,7 @@
const clear = () => {
status.value = UploadTaskStatus.WAITING;
formModel.value = { ...defaultForm() };
filesRef.value?.close();
};
</script>