diff --git a/src/views/accident/event/components/addOrEdit.vue b/src/views/accident/event/components/addOrEdit.vue index c971ec2..0caef1d 100644 --- a/src/views/accident/event/components/addOrEdit.vue +++ b/src/views/accident/event/components/addOrEdit.vue @@ -1,7 +1,7 @@ @@ -82,12 +83,12 @@ - {{ form.FFILE.name }} 上传 @@ -115,7 +116,7 @@ :on-change="handleChangePDF2" :before-upload = "beforeFileUpload2" :auto-upload="false" - accept=".pdf" + accept=".pdf, .doc, .xls, .jpg, .png, .jpeg" class="upload-demo" action="#"> 选取文件 @@ -162,7 +163,16 @@ class="video-player vjs-custom-skin"/> - + + +
+ +
+
+
@@ -180,11 +190,14 @@ export default { directives: { waves }, data() { return { + config: config, txtPre: '', + imgUrl: '', dialogFormUpload: false, dialogForm: false, listLoading: true, treeLoading: false, + dialogViewImg: false, dialogBatchUpload: false, add: false, del: false, @@ -259,7 +272,10 @@ export default { this.urlToBlob() }, methods: { - + goViewImg(filePath) { + this.imgUrl = this.config.fileUrl + filePath + this.dialogViewImg = true + }, urlToBlob() {}, // 上一页 prePage() { @@ -321,20 +337,18 @@ export default { console.log(file) }, handleChangePDF(file, fileList) { - const types = ['application/pdf'] - const isImage = types.includes(file.raw.type) - if (!isImage) { - this.$message.error('上传文件只能是 PDF 格式!') + const types = ['pdf', 'doc', 'xls', 'jpg', 'png', 'jpeg'] + if (!types.includes(file.name.substring(file.name.lastIndexOf('.') + 1))) { + this.$message.error('上传文件只支持【' + types + '】格式!') fileList.pop() } else { this.form.FFILE = file.raw } }, handleChangePDF2(file, fileList) { - const types = ['application/pdf'] - const isImage = types.includes(file.raw.type) - if (!isImage) { - this.$message.error('上传文件只能是 PDF 格式!') + const types = ['pdf', 'doc', 'xls', 'jpg', 'png', 'jpeg'] + if (!types.includes(file.name.substring(file.name.lastIndexOf('.') + 1))) { + this.$message.error('上传文件只支持【' + types + '】格式!') fileList.pop() } }, @@ -355,23 +369,21 @@ export default { // return false // }, beforeFileUpload2(file) { - var testmsg = file.name.substring(file.name.lastIndexOf('.') + 1) - const extension = testmsg === 'pdf' - if (!extension) { - this.$confirm(`上传文件只能是pdf格式!`) - } else { + const types = ['pdf', 'doc', 'xls', 'jpg', 'png', 'jpeg'] + if (types.includes(file.name.substring(file.name.lastIndexOf('.') + 1))) { this.fileList.push(file) + } else { + this.$confirm('上传文件只支持【' + types + '】格式!') } this.$forceUpdate() return false }, beforeFileUpload(file) { - var testmsg = file.name.substring(file.name.lastIndexOf('.') + 1) - const extension = testmsg === 'pdf' - if (!extension) { - this.$confirm(`上传文件只能是pdf格式!`) - } else { + const types = ['pdf', 'doc', 'xls', 'jpg', 'png', 'jpeg'] + if (types.includes(file.name.substring(file.name.lastIndexOf('.') + 1))) { this.form.FFILE = file + } else { + this.$confirm('上传文件只支持【' + types + '】格式!') } this.$forceUpdate() return false