| | |
| | | <el-dialog |
| | | v-dialogDrag |
| | | :close-on-click-modal="false" |
| | | :destroy-on-close="true" |
| | | :visible.sync="visible" |
| | | :width="width" |
| | | append-to-body |
| | |
| | | style="margin-top: -20vh !important;" |
| | | > |
| | | <Divider left="30px" text="导入提示"></Divider> |
| | | <ul> |
| | | <li> |
| | | <ul style="color: #e73a3a"> |
| | | <li v-if="!paramVOS.tipList"> |
| | | 请点击浏览文件进行上传 |
| | | </li> |
| | | <li v-if="paramVOS.tipList && paramVOS.tipList.length >=1 " v-for="(item,index) in paramVOS.tipList" :key="index"> {{index+1}} : {{item}}。</li> |
| | | </ul> |
| | | <Divider left="30px" text="选择文件后会自动上传"></Divider> |
| | | <el-upload |
| | |
| | | return { |
| | | ownbizOid: this.sourceData.oid, |
| | | ownBtmName: this.sourceData.btmname, |
| | | secretGrade: -1, |
| | | fileDocClassify: '', |
| | | updateFileFlag: true, |
| | | secretGrade: this.paramVOS.secretGrade || -1, |
| | | fileDocClassify: this.paramVOS.fileDocClassify || "", |
| | | updateFileFlag: this.paramVOS.updateFileFlag || true, |
| | | } |
| | | }, |
| | | width() { |
| | |
| | | async beforeUpload(file) { |
| | | // 获取文件扩展名 |
| | | const fileExtension = file.name.split(".").pop().toLowerCase(); // 转换为小写以避免大小写不匹配的问题 |
| | | const allowedExtensions = this.paramVOS.fileType || ['css', 'csv', 'doc', 'gif', 'html', 'jpe', 'jpg', 'jpeg', 'png', 'js', 'json', |
| | | 'mp3', 'mp4', 'xlsx', 'xml', 'zip', 'xhtml', 'wps', 'ppt', 'xls', 'word', 'pdf', 'txt']; |
| | | |
| | | // 检查文件扩展名是否在允许的文件扩展名数组中 |
| | | if (!allowedExtensions.includes(fileExtension)) { |
| | | // 上传格式不符合要求,提示错误信息并取消上传 |
| | | this.$message.error(`只允许上传${allowedExtensions.toString()}格式的文件`); |
| | | return Promise.reject(false); |
| | | if(this.paramVOS.fileType){ |
| | | if (!this.paramVOS.fileType.includes(fileExtension)) { |
| | | // 上传格式不符合要求,提示错误信息并取消上传 |
| | | this.$message.error(`只允许上传${this.paramVOS.fileType.toString()}格式的文件`); |
| | | return Promise.reject(false); |
| | | } |
| | | } |
| | | |
| | | this.pageLoading = this.$loading({ |
| | |
| | | onSuccess(resbonse) { |
| | | if (resbonse.code === 200) { |
| | | this.$message.success("上传成功!"); |
| | | this.dialogVisible = false; |
| | | this.visible = false; |
| | | }else { |
| | | this.$message.error(resbonse.msg); |
| | | } |
| | |
| | | if (file.status === "success" || file.status === "error") { |
| | | this.pageLoading.close(); |
| | | } |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | </script> |