完成6075J蓝牙对接

This commit is contained in:
liub
2026-03-30 13:17:47 +08:00
parent 4e518e7340
commit 37f5047a46
32 changed files with 472 additions and 281 deletions

View File

@ -16,7 +16,7 @@
</view>
<view>
<view class="battery-v1">
<image src="/static/images/common/dl.png" class="dlIMG"></image>
<image src="/static/images/common/battry.png" class="dlIMG"></image>
<view>
<view class="battery-v2"
:style="{ color: deviceInfo.batteryPercentage < 20 ? '#FF0000' : '' }">
@ -29,7 +29,7 @@
</view>
</view>
<view class="battery-v1">
<image src="/static/images/common/nz.png" class="dlIMG" mode="aspectFit"></image>
<image src="/static/images/common/time.png" class="dlIMG" mode="aspectFit"></image>
<view>
<view class="battery-v2">{{ deviceInfo.batteryRemainingTime || '0' }}分钟</view>
<view class="battery-v3">续航时间</view>
@ -54,7 +54,7 @@
</view>
<view class="info-row" v-if="itemInfo.deviceMac" @click="bleStatuToggle">
<text class="info-label">蓝牙状态</text>
<text class="info-value status-running" >
<text class="info-value status-running" :class="formData.bleStatu?'green':'red'" >
{{getbleStatu}}
</text>
</view>
@ -115,6 +115,17 @@
</view>
</view>
</view>
<view class="mode-v1" :class="{'active':itemInfo.alarmStatus===1 || itemInfo.alarmStatus==='1'}" >
<view class="mode-v2" @click="warnToggle">
<image v-show="itemInfo.alarmStatus!=1" src="/static/images/common/sg.png" class="setIMG" mode="aspectFit"></image>
<image v-show="itemInfo.alarmStatus==1" src="/static/images/common/sgActive.png" class="setIMG" mode="aspectFit"></image>
<view>
<view class="battery-v2">{{itemInfo.alarmStatus==1?'解除报警':'强制报警'}}</view>
</view>
</view>
</view>
<view class="mode-v1" v-if="hasPermission('3')">
<view class="mode-v2" @click="uploadStartup">
<image src="/static/images/common/path7.png" class="setIMG" mode="aspectFit"></image>
@ -273,9 +284,16 @@
<!-- 解除报警 -->
<CustomPopup v-if="popupType === 'cancel'" :show="showPopupFlag"
popupBorder="1rpx solid rgba(224, 52, 52, 0.3)" :message="popupMessage"
icon="/static/images/6170/svg.png" :confirm-text="popupConfirmText" :show-cancel="false"
icon="/static/images/6170/svg.png" :confirm-text="popupConfirmText" :show-cancel="true"
@confirm="onPopupConfirmPolice" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" />
<!-- 强制报警 -->
<CustomPopup v-if="popupType === 'openWarn'" :show="showPopupFlag"
popupBorder="1rpx solid rgba(224, 52, 52, 0.3)" :message="popupMessage"
icon="/static/images/6170/svg.png" :confirm-text="popupConfirmText" :show-cancel="true"
@confirm="OpenWarn(1)" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" />
<MsgBox ref="msgPop" />
<global-loading ref="loading" />
</view>
@ -405,7 +423,7 @@
Status: {
pageHide: null
},
inteval: 120
inteval: 1000
}
},
computed: {
@ -461,8 +479,7 @@
},
getDevice: function() {
if (ble) {
console.log("LinkedList=", ble.data.LinkedList);
console.log("this.device=", this.itemInfo);
let f = ble.data.LinkedList.find((v) => {
if (v.macAddress == this.itemInfo.deviceMac) {
if (!this.formData.deviceId) {
@ -926,6 +943,7 @@
},
// 激光确认框提交
handleBtn() {
@ -1561,16 +1579,69 @@
// 强制报警()
handlePolice() {
this.popupType = 'cancel';
this.popupMessage = '确认解除所选设备的报警状态';
this.popupMessage = '确认解除报警状态';
this.showPopupFlag = true;
// this.popupConfirmText="";
},
OpenWarn(val){//开启/解除强制报警
const topic = `B/${this.itemInfo.deviceImei}`;
let message={"instruct":[7,val,0,0,0,0]};
message=JSON.stringify(message);
let flag=this.mqttClient.publish(topic, message, {
qos: 1
});
if(flag){
this.itemInfo.alarmStatus=val;
}
this.showPopupFlag = false;
},
warnToggle(){
if(this.itemInfo.alarmStatus==1){
this.popupType = 'cancel';
this.popupMessage = '确认解除报警状态';
}else{
this.popupType = 'openWarn';
this.popupMessage = '确认开启报警状态';
}
this.showPopupFlag = true;
// this.popupConfirmText="开启";
// let val=1;
// let msg="确认开启强制报警?";
// if(this.itemInfo.alarmStatus==1){
// val=0;
// msg="确认解除强制报警?";
// }
// let mqSend=()=>{
// const topic = `B/${this.itemInfo.deviceImei}`;
// let message={"instruct":[7,val,0,0,0,0]};
// message=JSON.stringify(message);
// let flag=this.mqttClient.publish(topic, message, {
// qos: 1
// });
// if(flag){
// this.itemInfo.alarmStatus=val;
// }
// }
},
// 解除报警逻辑
async onPopupConfirmPolice() {
if (this.deviceInfo.onlineStatus !== 1) {
uni.showToast({
title: '设备已离线',
icon: 'none'
});
// uni.showToast({
// title: '设备已离线',
// icon: 'none'
// });
this.OpenWarn(0);//走mq直发
return;
}
this.isPolling = true; // 标记开始轮询
@ -1595,8 +1666,10 @@
title: registerRes.msg,
icon: 'none'
})
return
}
this.itemInfo.alarmStatus=0;
// 4. 获取设备状态FunctionAccessBatchStatusRule 批量
let deviceImei = this.itemInfo.deviceImei
let typeName = this.itemInfo.typeName
@ -2210,6 +2283,11 @@
width: 47%;
display: flex;
text-align: center;
box-sizing: border-box;
border: 1rpx solid #00000000;
}
.mode-v1.active{
border:1rpx solid #bbe600 !important;
}
.mode-v2 {