提交优化55,60

This commit is contained in:
RenCheng 2025-05-10 13:45:28 +08:00
parent 36adff7ab2
commit 3a358e7ac3
3 changed files with 17 additions and 3 deletions

View File

@ -75,7 +75,7 @@ export default {
maxFile: Number, maxFile: Number,
accept: { accept: {
type: String, type: String,
default: '.jpg,.png,.doc,.docx,.pdf,.txt,.jpeg' default: '.txt,.csv'
}, },
autoUpload: { // autoUpload: { //
type: Boolean, type: Boolean,
@ -200,6 +200,13 @@ export default {
this.$message.warning("请先选择上传的模式"); this.$message.warning("请先选择上传的模式");
return 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) const currentRow = this.tableDate.find((row) => row.uid === file.uid)
if (currentRow) { if (currentRow) {

View File

@ -75,7 +75,7 @@ export default {
maxFile: Number, maxFile: Number,
accept: { accept: {
type: String, 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: { // autoUpload: { //
type: Boolean, type: Boolean,
@ -209,10 +209,18 @@ export default {
this.$message.error('文件目录选择异常请刷新页面') this.$message.error('文件目录选择异常请刷新页面')
return; return;
} }
// if(this.taskId.length <= 0){ // if(this.taskId.length <= 0){
// this.$message.error('') // this.$message.error('')
// return; // 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) const currentRow = this.tableDate.find((row) => row.uid === file.uid)
if (currentRow) { if (currentRow) {
// 0 // 0

View File

@ -226,7 +226,6 @@ import { taskCreate,
} }
}).finally(() => { }).finally(() => {
that.confirmLoading = false; that.confirmLoading = false;
that.close();
}) })
} }
} }