fix: 修复固件版本管理固件版本格式验证

This commit is contained in:
聂黎 2023-09-18 10:01:25 +08:00
parent e958c81025
commit dd2e64efd7
3 changed files with 23 additions and 3 deletions

View File

@ -28,7 +28,6 @@ export default {
}, },
methods: { methods: {
close() { close() {
console.log('close0--')
this.$emit('close') this.$emit('close')
} }
}, },

View File

@ -429,7 +429,11 @@ export default {
}, },
], ],
otaVersion: [ otaVersion: [
{ required: true, message: "版本不能为空", trigger: "blur" }, {
required: true,
validator: this.chenking_otaVersion,
trigger: ["change",'blur'],
},
], ],
otaUrl: [ otaUrl: [
{ required: false, message: " 升级地址不能为空", trigger: "blur" }, { required: false, message: " 升级地址不能为空", trigger: "blur" },
@ -444,6 +448,16 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
chenking_otaVersion(rule, value, callback){
const regex = /^\d+(\.\d+)*$/;
if (!this.form.otaVersion) {
callback(new Error('版本不能为空'))
} else if(!regex.test(this.form.otaVersion)) {
callback(new Error('版本格式不正确: x.x.x.x (如1.0.05.121)'))
} else {
callback();
}
},
beforeAvatarUpload(file) { beforeAvatarUpload(file) {
console.log('oat-upload-file--', file, file.type === 'application/octet-stream'); console.log('oat-upload-file--', file, file.type === 'application/octet-stream');
const isBin = file.type === 'application/octet-stream'; const isBin = file.type === 'application/octet-stream';

View File

@ -44,12 +44,19 @@
:stroke-width="24" :stroke-width="24"
:percentage="scope.row.upgradeProgress" :percentage="scope.row.upgradeProgress"
:status="upgradeStatusType(scope.row, 'upgradeStatus')"></el-progress> :status="upgradeStatusType(scope.row, 'upgradeStatus')"></el-progress>
<el-tag :type="upgradeStatusTagType(scope.row, 'upgradeStatus')">{{upgradeStatusTagTiltle(scope.row, 'upgradeStatus')}}</el-tag> <el-tag :type="upgradeStatusTagType(scope.row, 'upgradeStatus')">{{upgradeStatusTagTiltle(scope.row, 'upgradeStatus')}}</el-tag>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="升级信息" align="left" prop="upgradeInfo" /> <el-table-column label="升级信息" align="left" prop="upgradeInfo" >
<template slot-scope="scope">
<span class="lay-table-textarea" :title="scope.row.upgradeInfo">
{{ scope.row.upgradeInfo }}
</span>
</template>
</el-table-column>
<el-table-column <el-table-column
label="创建时间" label="创建时间"