修复首页蓝牙连接断开时更新状态,修复670 SOS报警时红色提示
This commit is contained in:
@ -90,10 +90,10 @@
|
||||
<view :class="getWarnStyle(5)" class="net netfive"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="warnnig" :class="(formData.qzwarn && Status.staticWarn.time)?'':'displayNone'"
|
||||
<view class="warnnig" :class="formData.qzwarn ?'':'displayNone'"
|
||||
@click="CloseWarn(true)">
|
||||
<view>设备强制报警中!</view>
|
||||
<view class="netContent">
|
||||
<view class="netContent" :class="{'displayNone':!Status.staticWarn.time}">
|
||||
{{Status.staticWarn.time}}s
|
||||
</view>
|
||||
</view>
|
||||
@ -890,7 +890,7 @@
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.log("无法解析此消息", error);
|
||||
console.error("无法解析此消息", payload);
|
||||
}
|
||||
});
|
||||
resolve();
|
||||
@ -973,6 +973,9 @@
|
||||
if ("sta_SOSGrade" in json) {
|
||||
let sosText = json.sta_SOSGrade === 2 ? 'rb' : json.sta_SOSGrade === 1 ? "sg" : "close";
|
||||
receiveData.SOS = sosText;
|
||||
|
||||
receiveData.qzwarn=sosText==='sg';
|
||||
|
||||
}
|
||||
|
||||
if ("sta_ShakeBit" in json) {
|
||||
@ -1056,9 +1059,16 @@
|
||||
if (this.formData.imei) {
|
||||
this.initMQ();
|
||||
}
|
||||
let msgs=[];
|
||||
if(this.formData.qzwarn){
|
||||
msgs.push("设备强制报警中");
|
||||
}
|
||||
if (this.formData.staticWarn) { //有静止报警
|
||||
msgs.push("设备静止报警中");
|
||||
}
|
||||
if(msgs.length>0){
|
||||
this.showPop({
|
||||
message: "设备静止报警中",
|
||||
message: msgs.join(";"),
|
||||
iconUrl: "/static/images/6155/DeviceDetail/warnning.png",
|
||||
borderColor: "#e034344d",
|
||||
buttonBgColor: "#E03434",
|
||||
@ -1067,6 +1077,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
this.setBleFormData();
|
||||
},
|
||||
getDevice: function() {
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
<view class="device-callpolice"
|
||||
v-if="item.communicationMode==0 && item.onlineStatus==1 && item.alarmStatus==1">
|
||||
报警中</view>
|
||||
<view v-if="item.communicationMode==1">
|
||||
<view v-if="item.communicationMode==1 || item.communicationMode==2">
|
||||
<view class="device-status" :class="item.bleStatu?'online':'unline'">
|
||||
{{item.bleStatu?'已连接':'未连接'}}
|
||||
</view>
|
||||
@ -69,7 +69,7 @@
|
||||
</uni-swipe-action>
|
||||
|
||||
</view>
|
||||
<!-- <view v-else class="noDATA">
|
||||
<!-- <view v-else class="noDATA">
|
||||
<view> <uni-icons type="image-filled" size="120" color="rgba(255, 255, 255, 0.9)"></uni-icons>
|
||||
</view>
|
||||
暂无数据
|
||||
@ -143,7 +143,7 @@
|
||||
deviceUnbind, //删除设备
|
||||
deviceReName
|
||||
} from '@/api/common/index.js'
|
||||
import BleHelper from '@/utils/BleHelper.js';
|
||||
import bleTool from '@/utils/BleHelper.js';
|
||||
import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue'
|
||||
|
||||
|
||||
@ -267,14 +267,17 @@
|
||||
|
||||
this.getData();
|
||||
},
|
||||
|
||||
bleStateBreak(){
|
||||
console.error("蓝牙适配器不可用");
|
||||
this.updateBleStatu();
|
||||
},
|
||||
bleStateRecovery() {
|
||||
console.log("蓝牙适配器恢复可用,重连断开的设备");
|
||||
ble.linkAllDevices();
|
||||
|
||||
},
|
||||
bleBreak(res) {
|
||||
console.log("蓝牙断开连接", res);
|
||||
console.error("蓝牙断开连接", res);
|
||||
if (res.deviceId) {
|
||||
this.updateBleStatu(res.deviceId);
|
||||
}
|
||||
@ -392,6 +395,11 @@
|
||||
isAsc:'desc',
|
||||
orderByColumn:'bindingTime'
|
||||
}
|
||||
if(!data.pageNum){
|
||||
this.mescroll.endSuccess(0, false);
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
deviceInfo(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
|
||||
@ -401,33 +409,36 @@
|
||||
}));
|
||||
|
||||
// 如果是第一页或切换分类,替换数据
|
||||
this.deviceList = data.pageNum === 1 ? newDevices :this.deviceList.concat(newDevices);
|
||||
if(data.pageNum === 1){
|
||||
this.deviceList =newDevices
|
||||
}else{
|
||||
//防止后端返回的数据包含已有数据
|
||||
for (var i = 0; i < newDevices.length; i++) {
|
||||
let device=newDevices[i];
|
||||
let f=this.deviceList.find(v=>{
|
||||
return v.id===device.id;
|
||||
});
|
||||
if(!f){
|
||||
this.deviceList.push(device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.updateBleStatu();
|
||||
|
||||
this.total = res.total;
|
||||
// 判断是否加载完成
|
||||
let hasNext = true;
|
||||
if (res.rows.length < this.size || this.deviceList.length >= this
|
||||
.total) {
|
||||
|
||||
if (res.rows.length < this.size || this.deviceList.length >= this.total) {
|
||||
hasNext = false;
|
||||
} else {
|
||||
|
||||
hasNext = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
this.mescroll.endSuccess(res.rows.length, hasNext);
|
||||
|
||||
|
||||
}else{
|
||||
this.mescroll.endSuccess(0, false);
|
||||
}
|
||||
}).finally(() => {
|
||||
|
||||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
@ -713,25 +724,32 @@
|
||||
console.log('列表收到消息了么');
|
||||
this.downCallback();
|
||||
});
|
||||
ble = BleHelper.getBleTool();
|
||||
ble = bleTool.getBleTool();
|
||||
|
||||
//蓝牙连接成功的回调
|
||||
ble.addRecoveryCallback((res) => {
|
||||
console.log("11111");
|
||||
console.log("蓝牙连接成功的回调");
|
||||
this.bleRecovery(res);
|
||||
}, pagePath);
|
||||
|
||||
//蓝牙断开连接的回调
|
||||
ble.addDisposeCallback((res) => {
|
||||
console.log("2222222");
|
||||
console.log("蓝牙断开连接的回调");
|
||||
this.bleBreak(res);
|
||||
}, pagePath);
|
||||
|
||||
//蓝牙适配器恢复可用的回调,一般是重连设备
|
||||
ble.addStateRecoveryCallback(res => {
|
||||
console.log("蓝牙适配器恢复可用的回调");
|
||||
this.bleStateRecovery();
|
||||
}, pagePath);
|
||||
|
||||
//蓝牙适配器不可用的回调
|
||||
ble.addStateBreakCallback(res=>{
|
||||
console.error("蓝牙适配器不可用的回调");
|
||||
this.bleStateBreak();
|
||||
},pagePath);
|
||||
|
||||
this.getSystemInfoSyncH();
|
||||
},
|
||||
|
||||
|
||||
@ -258,7 +258,7 @@ class BleReceive {
|
||||
Receive_670(receive, f, path, recArr) {
|
||||
// console.log("pagh=", path);
|
||||
var todo = (bytes) => {
|
||||
// console.log("todo",receive);
|
||||
console.log("todo",receive);
|
||||
let receiveData = {};
|
||||
if (bytes[0] == 0x55) {
|
||||
try {
|
||||
@ -319,7 +319,7 @@ class BleReceive {
|
||||
receiveData.staticWarn = staticWarn;
|
||||
receiveData.fourGStrenth = fourGStrenth;
|
||||
receiveData.SOS = sosTxt;
|
||||
|
||||
receiveData.qzwarn = sosTxt==='sg';
|
||||
this.setBleFormData(receiveData, f);
|
||||
console.log("recArr=", recArr);
|
||||
let recCnt = recArr.find(v => {
|
||||
@ -327,16 +327,25 @@ class BleReceive {
|
||||
.replace(/\//g, "").toLowerCase();
|
||||
});
|
||||
if (!recCnt) {
|
||||
if (this.formData.staticWarn) { //有静止报警
|
||||
let msgs=[];
|
||||
if(receiveData.qzwarn){
|
||||
msgs.push("声光报警中");
|
||||
}
|
||||
if (staticWarn) { //有静止报警
|
||||
msgs.push("静止报警中");
|
||||
}
|
||||
if(msgs.length>0){
|
||||
msgs="设备'"+f.device.deviceName+msgs.join(";");
|
||||
uni.showModal({
|
||||
title: "警告",
|
||||
content: "设备'"+f.device.deviceName+"'静止报警中",
|
||||
content:msgs,
|
||||
showCancel: false
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('数据解析错误:', error);
|
||||
console.error('数据解析错误:', error);
|
||||
}
|
||||
// console.log("todo");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user