diff --git a/src/views/datalink/modules/SliceUpload.vue b/src/views/datalink/modules/SliceUpload.vue index 7c7feab..9a5f2b7 100644 --- a/src/views/datalink/modules/SliceUpload.vue +++ b/src/views/datalink/modules/SliceUpload.vue @@ -75,7 +75,7 @@ export default { maxFile: Number, accept: { type: String, - default: '.jpg,.png,.doc,.docx,.pdf,.txt,.jpeg' + default: '.txt,.csv' }, autoUpload: { // 自动上传 type: Boolean, @@ -200,6 +200,13 @@ export default { this.$message.warning("请先选择上传的模式"); return } + const isValidExtension = this.accept.split(',').some(ext => + file.name.toLowerCase().endsWith(ext) + ); + if (!isValidExtension) { + this.$message.error(file.name+'文件类型错误阻止上传!'); + return false; + } // 开始执行上传逻辑 const currentRow = this.tableDate.find((row) => row.uid === file.uid) if (currentRow) { diff --git a/src/views/fileManage/modules/SliceUpload.vue b/src/views/fileManage/modules/SliceUpload.vue index 61fff0e..63daef3 100644 --- a/src/views/fileManage/modules/SliceUpload.vue +++ b/src/views/fileManage/modules/SliceUpload.vue @@ -75,7 +75,7 @@ export default { maxFile: Number, accept: { type: String, - default: '.jpg,.png,.doc,.docx,.pdf,.txt,.jpeg' + default: '.jpg,.png,.doc,.docx,.pdf,.txt,.jpeg,.bmp,.mp4,.avi,.wmv,.mkv,.flv,.mp3,.sql,.db,.dmp,.xls,.xlsx,.wps,.et,.csv,.xml,.json,.other' }, autoUpload: { // 自动上传 type: Boolean, @@ -209,10 +209,18 @@ export default { this.$message.error('文件目录选择异常请刷新页面') return; } + // if(this.taskId.length <= 0){ // this.$message.error('请选择任务') // return; // } + const isValidExtension = this.accept.split(',').some(ext => + file.name.toLowerCase().endsWith(ext) + ); + if (!isValidExtension) { + this.$message.error(file.name+'文件类型错误阻止上传!'); + return false; + } const currentRow = this.tableDate.find((row) => row.uid === file.uid) if (currentRow) { // 当前上传进度归0 diff --git a/src/views/task/modules/taskModal.vue b/src/views/task/modules/taskModal.vue index b3e6a3f..cd77517 100644 --- a/src/views/task/modules/taskModal.vue +++ b/src/views/task/modules/taskModal.vue @@ -226,7 +226,6 @@ import { taskCreate, } }).finally(() => { that.confirmLoading = false; - that.close(); }) } }