| | |
| | | action="/mes/exception/upload" |
| | | :headers="headers" |
| | | :before-upload="submitUpload" |
| | | :on-preview="handlePreview" |
| | | :on-remove="handleRemove" |
| | | :on-preview="handlePreview" |
| | | :on-success="uploadSuccess" |
| | | :data="paramData" |
| | | :file-list="fileList" |
| | |
| | | > |
| | | <el-button size="small" type="primary">点击上传</el-button> |
| | | <div slot="tip" class="el-upload__tip"> |
| | | 只能上传jpg图片,且不超过2MB |
| | | 只能上传jpg/png图片,且不超过5MB |
| | | </div> |
| | | </el-upload> |
| | | </el-col> |
| | |
| | | }) |
| | | } |
| | | }, |
| | | submitUpload() { |
| | | submitUpload(file) { |
| | | console.info(this.currentRow && this.currentRow.id) |
| | | console.log(file); |
| | | if (this.currentRow && this.currentRow.id) { |
| | | const maxSize = 5 * 1024 *1024 |
| | | let jpgType = 'image/jpeg' |
| | | let pngType = 'image/png' |
| | | if(file.type != jpgType && file.type != pngType){ |
| | | this.$message.error('只能上传.jpg/.png类型的图片') |
| | | return false |
| | | } |
| | | if(file.szie > maxSize){ |
| | | this.$message.error('图片大小不能超过5MB') |
| | | } |
| | | this.paramData.exceptionId = this.currentRow.id |
| | | |
| | | } else { |
| | | this.$message.error('请先选择生产异常记录') |
| | | return false |