mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
设备编号校验,只能为字母和数字
This commit is contained in:
@@ -230,7 +230,7 @@
|
||||
</div>
|
||||
<div style="display:table;">
|
||||
<div style="width:70px;font-weight: bold;display:table-cell;">赞助用户:</div>
|
||||
<div style="display:table-cell;line-height:22px;"><b style="color:#F56C6C">可用于商业用途,并提供移动端源码,包含一年的更新。</b>但是不能低价或批量转售源码,不能随意分发源码。目前赞助费为3000元,项目不断完善后会对应增加费用。</div>
|
||||
<div style="display:table-cell;line-height:22px;"><b style="color:#F56C6C">可用于商业用途,并提供移动端源码,包含一年的更新。</b>但是不能低价或批量转售源码,不能随意分发源码。目前赞助费为3500元,项目不断完善后会对应增加费用。</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card shadow="hover" style="padding:20px 0;margin-bottom:40px;font-size:14px;">
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<template slot="label">
|
||||
<span style="color:red;">* </span>设备编号
|
||||
</template>
|
||||
<el-input v-model="form.serialNumber" placeholder="请输入设备编号" :disabled="form.status!=1">
|
||||
<el-input v-model="form.serialNumber" placeholder="请输入设备编号" :disabled="form.status!=1" maxlength="32">
|
||||
<el-button slot="append" @click="generateNum" :loading="genDisabled" :disabled="form.status!=1">生成</el-button>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
@@ -152,7 +152,7 @@
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<div style="border:1px solid #ccc;width:200px;text-align: center;margin-left:20px;margin-top:-10px;">
|
||||
<vue-qr :text="qrText" :size="200" ></vue-qr>
|
||||
<vue-qr :text="qrText" :size="200"></vue-qr>
|
||||
<div style="padding-bottom:10px;">设备二维码</div>
|
||||
</div>
|
||||
</el-col>
|
||||
@@ -232,7 +232,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
// 二维码内容
|
||||
qrText:'wumei-smart',
|
||||
qrText: 'wumei-smart',
|
||||
// 打开设备配置对话框
|
||||
openSummary: false,
|
||||
// 是否加载完成
|
||||
@@ -271,6 +271,11 @@ export default {
|
||||
required: true,
|
||||
message: "设备名称不能为空",
|
||||
trigger: "blur"
|
||||
}, {
|
||||
min: 2,
|
||||
max: 5,
|
||||
message: '设备名称长度在 2 到 5 个字符',
|
||||
trigger: 'blur'
|
||||
}],
|
||||
firmwareVersion: [{
|
||||
required: true,
|
||||
@@ -429,6 +434,20 @@ export default {
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
if (this.form.serialNumber == null || this.form.serialNumber == 0) {
|
||||
this.$modal.alertError("设备编号不能为空");
|
||||
return;
|
||||
}
|
||||
let reg = /^[0-9a-zA-Z]+$/;
|
||||
if (!reg.test(this.form.serialNumber)) {
|
||||
this.$modal.alertError("设备编号只能是字母和数字");
|
||||
return;
|
||||
}
|
||||
if (this.form.productId == null || this.form.productId == 0) {
|
||||
this.$modal.alertError("所属产品不能为空");
|
||||
return;
|
||||
}
|
||||
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.deviceId != 0) {
|
||||
@@ -476,13 +495,13 @@ export default {
|
||||
},
|
||||
/**关闭物模型 */
|
||||
openSummaryDialog() {
|
||||
let json={
|
||||
type:1,// 1=扫码关联设备
|
||||
deviceNumber:this.form.serialNumber,
|
||||
productId:this.form.productId,
|
||||
productName:this.form.productName,
|
||||
let json = {
|
||||
type: 1, // 1=扫码关联设备
|
||||
deviceNumber: this.form.serialNumber,
|
||||
productId: this.form.productId,
|
||||
productName: this.form.productName,
|
||||
};
|
||||
this.qrText=JSON.stringify(json);
|
||||
this.qrText = JSON.stringify(json);
|
||||
this.openSummary = true;
|
||||
},
|
||||
/**关闭物模型 */
|
||||
|
||||
Reference in New Issue
Block a user