提交:
-- 固件版本管理 功能 文件上传 文件类型判定 application/octet-stream (.bin)文件
This commit is contained in:
parent
06e26dabb5
commit
e4b1b2553f
|
@ -247,6 +247,7 @@
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="upload"
|
ref="upload"
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
|
:before-upload="beforeAvatarUpload"
|
||||||
:http-request="uploud"
|
:http-request="uploud"
|
||||||
action
|
action
|
||||||
drag
|
drag
|
||||||
|
@ -443,6 +444,14 @@ export default {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
beforeAvatarUpload(file) {
|
||||||
|
console.log('oat-upload-file--', file, file.type === 'application/octet-stream');
|
||||||
|
const isBin = file.type === 'application/octet-stream';
|
||||||
|
if (!isBin) {
|
||||||
|
this.$message.error('上传文件类型错误,只能上传.bin文件!');
|
||||||
|
}
|
||||||
|
return isBin;
|
||||||
|
},
|
||||||
copyOnClick(val) {
|
copyOnClick(val) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this.$copyText(val).then(
|
this.$copyText(val).then(
|
||||||
|
@ -490,18 +499,6 @@ export default {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
beforeAvatarUpload(file) {
|
|
||||||
const isJPG = this.fileType.indexOf(file.type) >= 0;
|
|
||||||
const isLt2M = file.size < this.fileSize;
|
|
||||||
|
|
||||||
if (!isJPG) {
|
|
||||||
this.$message.error("上传头像图片只能是 JPG 格式!");
|
|
||||||
}
|
|
||||||
if (!isLt2M) {
|
|
||||||
this.$message.error("上传头像图片大小不能超过 2MB!");
|
|
||||||
}
|
|
||||||
return isLt2M;
|
|
||||||
},
|
|
||||||
// 打开厂商选择窗口 ——表格
|
// 打开厂商选择窗口 ——表格
|
||||||
openModelTableSelectDialog() {
|
openModelTableSelectDialog() {
|
||||||
this.selectResult = {};
|
this.selectResult = {};
|
||||||
|
|
Loading…
Reference in New Issue