| | |
| | | }) |
| | | }, |
| | | beforeAvatarUpload(file) { |
| | | const isJPGorPNG = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/gif'; |
| | | const isLt2MB = file.size / 1024 / 1024 < 2; |
| | | if (!isJPGorPNG) { |
| | | this.$message.error('上传图片只能是 JPG/PNG 格式!'); |
| | | return false; |
| | | let flag = true |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | this.$message.error('上传文件不超过10M'); |
| | | this.$refs.upload.clearFiles() |
| | | flag = false |
| | | } |
| | | // if (!isLt2MB) { |
| | | // this.$message.error('上传图片大小不能超过 2MB!'); |
| | | // } |
| | | // 校验通过才返回 true,允许文件上传 |
| | | return isJPGorPNG && isLt2MB; |
| | | if (!flag) { |
| | | return Promise.reject(flag); //正确的终止 |
| | | } |
| | | }, |
| | | downloadFile(fileName) { |
| | | this.$download.saveAs(fileName, fileName) |
| | |
| | | }, |
| | | // 取人员分类的字典 |
| | | getComparisonList() { |
| | | tthis.personnelClassification = this.dict.type.personnl_type; |
| | | this.checkList = this.form.personnelClassification.split(',') |
| | | // 文件状态 |
| | | this.getDicts("personnl_type").then((response) => { |
| | | this.personnelClassification = this.dictToValue(response.data); |
| | | this.checkList = this.form.personnelClassification ? this.form.personnelClassification.split(',') : [] |
| | | }); |
| | | }, |
| | | clickPersonnelClassificationSure() { |
| | | this.dialogVisible = false |