diff --git a/src/views/dataCenter/dataSet/child/dataSetDetails.vue b/src/views/dataCenter/dataSet/child/dataSetDetails.vue index b430d61f..3620dff2 100644 --- a/src/views/dataCenter/dataSet/child/dataSetDetails.vue +++ b/src/views/dataCenter/dataSet/child/dataSetDetails.vue @@ -24,7 +24,8 @@ size="mini" @click="handleAdd" v-hasPermi="['dataCenter:dataSet:import']" - >导入 + >导入 + 删除 + >删除 + 关闭 + >关闭 + - - - - - + + + + + @@ -70,7 +75,7 @@ {{ parseTime(scope.row.createTime) }} - + @@ -92,20 +98,23 @@ /> - + @@ -207,10 +230,12 @@ export default { .demo-table-expand { font-size: 0; } + .demo-table-expand label { width: 90px; color: #99a9bf; } + .demo-table-expand .el-form-item { margin-right: 0; margin-bottom: 0; diff --git a/src/views/dataCenter/dataSet/components/dataSet.vue b/src/views/dataCenter/dataSet/components/dataSet.vue index 28d09d89..5cd9c24e 100644 --- a/src/views/dataCenter/dataSet/components/dataSet.vue +++ b/src/views/dataCenter/dataSet/components/dataSet.vue @@ -48,8 +48,8 @@ @@ -183,7 +183,6 @@ export default { }, methods: { indexMethod(index){ - console.log(index); return (this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1; }, updateTableHeight() { diff --git a/src/views/dataCenter/library/child/uploadFiles.vue b/src/views/dataCenter/library/child/uploadFiles.vue index 46ef60fb..e69fc095 100644 --- a/src/views/dataCenter/library/child/uploadFiles.vue +++ b/src/views/dataCenter/library/child/uploadFiles.vue @@ -75,7 +75,8 @@ export default { uploadFailed: {}, // 存储上传失败的文件 queue: [], // 文件上传队列 maxConcurrentUploads: 5, // 最大并发上传数 - uploadsNum:{} + uploadsNum:{}, + isUploading: true, // 是否正在上传 }; }, beforeMount() { @@ -86,14 +87,17 @@ export default { }, methods: { handleClose(done) { - this.$modal.confirm('您确认要关闭吗?关闭后,未完成上传的文件将停止上传。').then(function() { - return done(); - }).then(() => { - this.resetComponent() - //this.getList() - this.getList() - }).catch(function() { - }) + this.$modal + .confirm('您确认要关闭吗?关闭后,未完成上传的文件将停止上传。') + .then(() => { + this.queue = []; // 清空队列 + done(); + }) + .then(() => { + this.resetComponent(); + this.getList && this.getList(); // 重新加载文件列表 + }) + .catch(() => {}); }, // 重置组件状态 resetComponent() { @@ -102,6 +106,7 @@ export default { this.uploadFailed = {}; this.queue = []; this.uploadsNum = {}; + this.isUploading = true; // 允许重新上传 }, // 自定义上传请求 customUpload(uploadFile) { @@ -124,40 +129,44 @@ export default { // 分片上传 uploadChunks(file) { - this.$set(this.uploadsNum, file.name, 0); // 更新文件上传进度 - const totalChunks = Math.ceil(file.size / this.chunkSize); // 计算分片总数 - let currentChunk = 0; // 当前分片索引 + if (!this.drawer) return; // 检查是否需要继续上传 + this.$set(this.uploadsNum, file.name, 0); + const totalChunks = Math.ceil(file.size / this.chunkSize); + let currentChunk = 0; const uploadNextChunk = () => { + console.log(this.queue.length) + if (!this.drawer) return; // 检查是否需要继续上传 const start = currentChunk * this.chunkSize; const end = Math.min(file.size, start + this.chunkSize); const chunk = file.slice(start, end); const formData = new FormData(); - formData.append("file", chunk); - formData.append("filename", file.name); - formData.append("chunk", currentChunk + 1); // 当前分片编号 - formData.append("totalChunks", totalChunks); // 总分片数 - formData.append("parentId", this.parentId); - formData.append("fileUrl", this.fileUrl); - // 使用 fetch 上传分片 + formData.append('file', chunk); + formData.append('filename', file.name); + formData.append('chunk', currentChunk + 1); + formData.append('totalChunks', totalChunks); + formData.append('parentId', this.parentId); + formData.append('fileUrl', this.fileUrl); + uploadFiles(formData) .then(() => { currentChunk++; const progress = Math.floor((currentChunk / totalChunks) * 100); - this.$set(this.uploadsNum, file.name, progress); // 更新文件上传进度 - this.$set(this.uploadProgress, file.name, progress); // 更新文件上传进度 + this.$set(this.uploadsNum, file.name, progress); + this.$set(this.uploadProgress, file.name, progress); if (currentChunk < totalChunks) { - uploadNextChunk(); // 上传下一个分片 + uploadNextChunk(); } else { - this.startNextUpload(); // 上传下一个文件 - this.checkAllUploadsComplete(); // 检查是否所有文件上传完成 + this.startNextUpload(); + this.checkAllUploadsComplete(); } }) - .catch((error) => { + .catch(() => { this.$set(this.uploadFailed, file.name, true); - this.startNextUpload(); // 上传下一个文件 + this.startNextUpload(); }); }; - uploadNextChunk(); // 开始上传第一个分片 + + uploadNextChunk(); }, checkAllUploadsComplete() { const allComplete = Object.values(this.uploadProgress).every(progress => progress === 100); @@ -165,20 +174,24 @@ export default { this.$message.success("所有文件上传完成!"); this.drawer = false; // 自动关闭弹窗 this.getList && this.getList(); // 重新加载列表 + this.resetComponent(); } }, // 启动队列中的下一个文件上传(控制并发) startNextUpload() { - Object.keys(this.uploadsNum).forEach(fileName => { + if (!this.isUploading) return; // 如果停止上传,则不启动新任务 + + Object.keys(this.uploadsNum).forEach((fileName) => { if (this.uploadsNum[fileName] === 100) { - delete this.uploadsNum[fileName]; // Remove completed files from the progress list + delete this.uploadsNum[fileName]; } }); + if (this.queue.length === 0 || Object.values(this.uploadsNum).length >= this.maxConcurrentUploads) { - return; // 如果队列为空或并发数已满,则不启动新任务 + return; } - const nextFile = this.queue.shift(); // 获取下一个文件 - this.uploadChunks(nextFile); // 开始上传该文件 + const nextFile = this.queue.shift(); + this.uploadChunks(nextFile); }, beforeUpload(file) { const maxSize = 2 * 1024 * 1024*1024; // 限制文件最大为 5MB @@ -186,6 +199,10 @@ export default { this.$message.error('文件大小不能超过 2GB'); return false; // 阻止上传 } + if ( file.size < 0) { + this.$message.error('文件大小错误'); + return false; // 阻止上传 + } return true; // 允许上传 }, // 处理超出文件数限制的情况 diff --git a/src/views/dataCenter/teamMember/index.vue b/src/views/dataCenter/teamMember/index.vue index 93bd2c88..7d2bcde1 100644 --- a/src/views/dataCenter/teamMember/index.vue +++ b/src/views/dataCenter/teamMember/index.vue @@ -114,7 +114,7 @@ /> - + @@ -128,6 +128,8 @@ { this.$modal.msgSuccess("新增成功"); this.addOpen = false; + this.transferKey += 1; // 更新 key 强制刷新 el-transfer this.getList(); }); }