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