完成100

This commit is contained in:
liub
2025-11-07 11:57:35 +08:00
parent c39cbcb34d
commit 2493bb7113
16 changed files with 1278 additions and 527 deletions

View File

@ -6,19 +6,19 @@
</image>
</view>
<view class="deviceName">
蓝牙名:{{device.name}}
蓝牙名:{{serverDevice?serverDevice['bluetoothName']: device.name}}
</view>
<view class="deviceName">
状态:{{deviceStatu}}
</view>
<view class="deviceName">
设备名:{{device.deviceName}}
设备名:{{serverDevice?serverDevice['deviceName']:device.deviceName}}
</view>
<view class="deviceId">
设备Mac:{{device.macAddress}}
设备Mac:{{serverDevice?serverDevice['deviceMac']:device.macAddress}}
</view>
<view class="deviceId">
设备IMEI:{{device.imei}}
设备IMEI:{{serverDevice?serverDevice['deviceImei']:device.imei}}
</view>
<view class="bound" :class="boundStatu">
{{Statu.boundRemark}}
@ -84,17 +84,18 @@
}
},
deviceStatu: function() {
if (!this.device.name) {
debugger;
if (!this.device.name && !this.device.macAddress) {
return "";
}
if (!this.device.linkStatu) {
if (!this.device.linkStatu && !this.device.macAddress) {
return "蓝牙未连接";
}
if (!this.device.macAddress) {
return '等待设备上报Mac地址';
}
if (!this.device.deviceName) {
if (!this.device.deviceName && !(this.serverDevice && this.serverDevice.deviceName)) {
if (this.Statu.isSearch) {
return "无效设备";
} else {
@ -105,7 +106,10 @@
}
}
} else {
return "找到有效设备"
return "找到有效设备"
}
return "";
@ -192,30 +196,39 @@
}
}, pagePath);
eventChannel = this.getOpenerEventChannel();
eventChannel.on('LinkItem', function(data) {
console.log("data=", data);
let f = ble.data.LinkedList.find((v) => {
return v.deviceId == data.deviceId;
});
if (f) {
let keys = Object.keys(f);
keys.forEach((v, index) => {
these.device[v] = f[v];
})
// console.log("LinkedList=", ble.data.LinkedList)
// console.log("f=", f);
// console.log("获取到设备", these.device);
if (f.macAddress) {
these.device.macAddress = f.macAddress;
these.initDevice();
if(option.mac){
this.device.macAddress=option.mac;
these.initDevice();
}
else{
eventChannel.on('LinkItem', function(data) {
console.log("data=", data);
let f = ble.data.LinkedList.find((v) => {
return v.deviceId == data.deviceId;
});
if (f) {
let keys = Object.keys(f);
keys.forEach((v, index) => {
these.device[v] = f[v];
})
// console.log("LinkedList=", ble.data.LinkedList)
// console.log("f=", f);
// console.log("获取到设备", these.device);
if (f.macAddress) {
these.device.macAddress = f.macAddress;
these.initDevice();
}
} else {
console.log("未获取到设备");
}
} else {
console.log("未获取到设备");
}
})
let inteval = setInterval(this.initDevice, 10000);
})
let inteval = setInterval(this.initDevice, 10000);
}
},
methods: {
reLinkdevice() {
@ -281,6 +294,7 @@
deviceInvalid();
}
} else {
this.serverDevice =null;
deviceInvalid();
}
@ -297,21 +311,21 @@
},
Link() {
// 调用绑定设备接口
let f = ble.data.LinkedList.find((v) => {
return v.deviceId == these.device.deviceId;
});
if (!f) {
// let f = ble.data.LinkedList.find((v) => {
// return v.deviceId == these.device.deviceId;
// });
// if (!f) {
// these.Statu.bound = false;
// these.Statu.boundRemark = "蓝牙连接不成功";
// return;
// }
if (!this.device.macAddress) {
these.Statu.bound = false;
these.Statu.boundRemark = "蓝牙连接不成功";
these.Statu.boundRemark = "获取设备Mac地址异常";
return;
}
if (!f.macAddress) {
these.Statu.bound = false;
these.Statu.boundRemark = "设备上报Mac地址异常";
return;
}
if (!this.device.deviceName) {
if (!this.serverDevice) {
these.Statu.bound = false;
these.Statu.boundRemark = "设备未入库";
return;