Commit 1ab544da authored by zhuangzhuang's avatar zhuangzhuang

网关正则修改

网关绑定的功能
parent c7928dec
......@@ -278,37 +278,46 @@ export class GatewayComponent implements OnInit {
save(v) {
this.isLoading = true;
console.log('im here');
if (!this.ck.formCheck(this[v], this.try)) {
this.isLoading = false;
return;
}
console.log('im here 2');
// 单个新增
if (!this.isMulti && this.isAddConV && !this.isUpdate) {
console.log('add');
this.api.device.addGateway([this.req, this.next]);
// 单个编辑
} else if (!this.isMulti && this.isAddConV && this.isUpdate) {
console.log('updateGateway');
this.api.device.updateGateway([this.req, this.next]);
// 单个分配
} else if (!this.isMulti && this.isDivideConV) {
console.log('updateCompany');
this.api.device.updateCompany([this.req4, this.next]);
// 单个绑定
} else if (!this.isMulti && this.isBindConV) {
this.req3.device = null;
console.log('gatewayBindGateway');
// this.req3.device = null;
this.req3.pDeviceNo = this.req3.device.deviceNo;
this.req3.influxdbDatabaseNo = this.req3.device.influxdbDatabaseNo ? this.req3.device.influxdbDatabaseNo : 'ITN78344312655581185';
this.api.device.gatewayBindGateway([this.req3, this.next]);
// 批量新增
} else if (this.isMulti && this.isMultiAddConV) {
console.log('batchAddGateway');
this.api.device.batchAddGateway([this.req, this.next]);
// 批量绑定
} else if (this.isMulti && this.isBindConV) {
console.log('multiply');
this.req3.bindDeviceAddressVos = [];
this.req3.pDeviceNo = this.req3.device.deviceNo;
this.req3.influxdbDatabaseNo = this.req3.device.influxdbDatabaseNo ? this.req3.device.influxdbDatabaseNo : 'ITN78344312655581185';
this.req3.device = null;
this.data.map((one) => {
if (one.checked) {
this.req3.bindDeviceAddressVos.push({deviceNo: one.deviceNo, address: Number(this.req3.address) + one.cI});
this.req3.bindDeviceAddressVos.push({deviceNo: one.deviceNo, address: this.req3.address + one.cI});
}
});
this.api.device.batchBindDevice([this.req3, this.next]);
......
......@@ -143,7 +143,7 @@ export class CheckService {
if ((data[num] === '' || isUndefined(data[num]) || data[num] === null) && fieldStr.indexOf('-' + num + '-') <= -1) {
return true;
}
const reg = new RegExp('^[0-9]*$');
const reg = new RegExp('^[0-9.]*$');
if (reg.test(data[num])) {
return true;
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment