From cb44810c6b55e7381b3b865e043a235f55c11d82 Mon Sep 17 00:00:00 2001 From: liub Date: Thu, 18 Sep 2025 17:31:40 +0800 Subject: [PATCH] =?UTF-8?q?670=E5=8A=A0=E5=85=A5=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E3=80=81=E8=AE=BE=E5=A4=87=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=8A=A0=E6=8E=A5=E5=8F=A3=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/670/HBY670.js | 10 +- pages/6155/deviceDetail.vue | 21 +- pages/650/HBY650.vue | 32 ++- pages/670/HBY670.vue | 237 ++++++++++++++---- pages/7305/BJQ7305.vue | 109 ++++---- pages/BlueTooth/ModeSetting/HBY670V1.vue | 69 +++-- pages/BlueTooth/ModeSetting/VideoSend.vue | 14 +- pages/BlueTooth/ModeSetting/VideoSend_670.vue | 12 +- utils/BleHelper.js | 5 +- utils/update.js | 166 ++++++------ 10 files changed, 454 insertions(+), 221 deletions(-) diff --git a/api/670/HBY670.js b/api/670/HBY670.js index 21bfd7a..ce050d4 100644 --- a/api/670/HBY670.js +++ b/api/670/HBY670.js @@ -83,10 +83,18 @@ function sendPic(data){ }); } +//设备详情 +function getDetail(id){ + return request({ + url: '/api/xinghan/device/'+id, + method: 'get', + }) +} export default{ sendUsr:sendUsr, warnMsg:warnMsg, - sendPic:sendPic + sendPic:sendPic, + getDetail:getDetail } diff --git a/pages/6155/deviceDetail.vue b/pages/6155/deviceDetail.vue index 228eff6..4716c31 100644 --- a/pages/6155/deviceDetail.vue +++ b/pages/6155/deviceDetail.vue @@ -328,7 +328,7 @@ }); if (!f) { - + these.getDetail(); these.showBleUnConnect(); return; } @@ -347,7 +347,7 @@ these.formData.deviceId = f.deviceId; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId); these.setBleFormData(); - + these.getDetail(); }); @@ -875,7 +875,7 @@ setMode(mode, type) { let dataValue = 0; - + switch (mode) { case 0: @@ -1203,7 +1203,22 @@ setTimeout(task, 0); }, + getDetail() { + var that = this; + usrApi.getDetail(this.device.id).then(res => { + if (res && res.code == 200) { + res = res.data; + let personnelInfo = res.personnelInfo; + if (personnelInfo) { + these.formData.textLines[2] = personnelInfo.unitName; + these.formData.textLines[1] = personnelInfo.name; + these.formData.textLines[0] = personnelInfo.position; + + } + } + }); + }, ack: function() { diff --git a/pages/650/HBY650.vue b/pages/650/HBY650.vue index b754697..91eafda 100644 --- a/pages/650/HBY650.vue +++ b/pages/650/HBY650.vue @@ -255,10 +255,10 @@ cMode: false, modeCurr: 'low', - company: '黄石消防支队', - name: '菜英俊', - job: '小队长', - id: 'HSXF01061', + company: '', + name: '', + job: '', + id: '', iswarn: false }, rgb565Data: [], @@ -314,6 +314,7 @@ these.showBleUnConnect(); + these.getDetail(); return; } let form = f.formData; @@ -331,7 +332,7 @@ these.formData.deviceId = f.deviceId; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId); these.setBleFormData(); - + these.getDetail(); }); @@ -457,6 +458,23 @@ return f; }, + getDetail() { + var that = this; + usrApi.getDetail(this.device.id).then(res => { + + if (res && res.code == 200) { + res = res.data; + let personnelInfo = res.personnelInfo; + if (personnelInfo) { + that.formData.company = personnelInfo.unitName; + that.formData.name = personnelInfo.name; + that.formData.job = personnelInfo.position; + that.formData.id = personnelInfo.code + } + } + }); + }, + setBleFormData() { ble.data.LinkedList.find((v) => { if (v.deviceId == these.formData.deviceId) { @@ -959,8 +977,8 @@ } uni.uploadFile({ - // url: 'http://114.55.111.217/video/upload', - url: baseURL+"app/video/upload", + url: 'http://114.55.111.217/video/upload', + // url: baseURL+"app/video/upload", filePath: videoPath, name: 'file', header: { diff --git a/pages/670/HBY670.vue b/pages/670/HBY670.vue index a478e20..16d43c5 100644 --- a/pages/670/HBY670.vue +++ b/pages/670/HBY670.vue @@ -33,13 +33,30 @@ 设备名称 {{device.deviceName}} + + 设备状态 + {{formData.sta_system}} + 定位信息 - - {{formData.lon}}  {{formData.lat}} - {{formData.address}} + + + {{formData.Lon}} + + + + + {{formData.Lat}} + + + + + {{formData.address}} + + + @@ -358,7 +375,8 @@ warnLevel: "", //报警级别 staticWarn: false, //静止报警 fourGStrenth: 0, //4G信号强度 - deviceId: "" + deviceId: "", + sta_system: "" //设备状态,0关机,1仅充电,2开机未充电,3,开机且充电 }, device: { id: "", @@ -413,6 +431,7 @@ var device = data.data; these.Status.apiType = data.apiType; these.device = device; + if (these.device.deviceImei) { these.initMQ(); } @@ -425,6 +444,7 @@ return false; }); if (!f) { + these.getDetail(); return; } let form = f.formData; @@ -440,6 +460,7 @@ } else if (these.device.deviceImei) { these.formData['imei'] = these.device.deviceImei; } + these.getDetail(); ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId); }); @@ -454,6 +475,74 @@ }, methods: { + getDetail() { + var that = this; + api.getDetail(this.device.id).then(res => { + + if (res && res.code == 200) { + res = res.data; + let json=res; + console.log("res=",res); + that.formData.Lon = res.longitude; + that.formData.Lat = res.latitude; + that.formData.address = res.address; + let personnelInfo = res.personnelInfo; + if (personnelInfo) { + that.formData.company = personnelInfo.unitName; + that.formData.usrname = personnelInfo.name; + that.formData.job = personnelInfo.position; + that.formData.usrid = personnelInfo.code + } + + let dic = { + "3": "hight", + "2": "center", + "1": "low", + "0": "close", + + }; + let staticLevelText = dic[json.staDetectGrade]; + that.formData.modeCurr = staticLevelText; + + dic = { + "0": "none", + "1": "ruo", + "2": "center", + "3": "hight", + "4": "veryhight", + }; + let warn = dic[json.staDetectResult]; + that.formData.warnLevel = warn; + + let lightingLevelText = json.staLightGrade === 1 ? 'hight' : json.staLightGrade === 2 ? 'low' : + 'close'; + that.formData.lightCurr = lightingLevelText; + + that.formData.battary = json.staPowerPercent + + + let hours = Math.floor(json.staPowerTime / 60); + let remainingMinutes = json.staPowerTime % 60; + let xuhang = '0分'; + // 处理不同情况的显示 + if (hours === 0) { + xuhang = `${remainingMinutes}分`; + } else if (remainingMinutes === 0) { + xuhang = `${hours}小时`; + } else { + xuhang = `${hours}小时${remainingMinutes}分`; + } + + that.formData.xuhang = xuhang; + + let sosText = json.staSOSGrade === 2 ? 'rb' : json.staSOSGrade === 1 ? "sg" : "close"; + that.formData.SOS = sosText; + + + } + }); + }, + getWarnStyle(index) { let className = ""; @@ -540,6 +629,7 @@ console.log("收到设备上报的数据", payload); this.parseDataMQ(json); } + //以下操作已改到后端 // else if (keys.indexOf('sta_PicTrans') > -1) { //发送开机画面 // console.log("收到开机画面答复", payload); // // this.SendImgMQ(json); @@ -598,56 +688,80 @@ }, parseDataMQ(json) { let receiveData = {}; - let staticLevelText = ""; - let dic = { - "3": "hight", - "2": "center", - "1": "low", - "0": "close", - }; - staticLevelText = dic[json.sta_DetectGrade]; + let dic = {}; + if ("sta_DetectGrade" in json) { + dic = { + "3": "hight", + "2": "center", + "1": "low", + "0": "close", - let lightingLevelText = json.sta_LightGrade === - 1 ? 'hight' : - json.sta_LightGrade === - 2 ? - 'low' : - 'close'; - let warn = ""; - dic = { - "0": "none", - "1": "ruo", - "2": "center", - "3": "hight", - "4": "veryhight", - }; - warn = dic[json.sta_DetectResult]; + }; + let staticLevelText = dic[json.sta_DetectGrade]; + receiveData.modeCurr = staticLevelText; + } + if ("sta_LightGrade" in json) { - let sosText = null; - if (json.sta_SOSGrade !== undefined) { + let lightingLevelText = json.sta_LightGrade === 1 ? 'hight' : json.sta_LightGrade === 2 ? 'low' : + 'close'; + receiveData.lightCurr = lightingLevelText; + } + if ("sta_DetectResult" in json) { - sosText = json.sta_SOSGrade === 2 ? 'rb' : - json.sta_SOSGrade === 1 ? "sg" : "close" + dic = { + "0": "none", + "1": "ruo", + "2": "center", + "3": "hight", + "4": "veryhight", + }; + let warn = dic[json.sta_DetectResult]; + receiveData.warnLevel = warn; + } + if ("sta_SOSGrade" in json) { + let sosText = json.sta_SOSGrade === 2 ? 'rb' : json.sta_SOSGrade === 1 ? "sg" : "close"; receiveData.SOS = sosText; } - let staticWarn = json.sta_ShakeBit === 1; - receiveData.modeCurr = staticLevelText; - receiveData.lightCurr = lightingLevelText; - receiveData.xuhang = json.sta_PowerTime + "分钟"; - receiveData.battary = json.sta_PowerPercent; + if ("sta_ShakeBit" in json) { + let staticWarn = json.sta_ShakeBit === 1; + receiveData.staticWarn = staticWarn; + } - receiveData.warnLevel = warn; - receiveData.staticWarn = staticWarn; - receiveData.fourGStrenth = json.sta_4gSinal; - receiveData.imei = json.sta_imei; - receiveData.Lon = json.sta_longitude; - receiveData.Lat = json.sta_latitude; + if ("sta_PowerTime" in json) { + let hours = Math.floor(json.sta_PowerTime / 60); + let remainingMinutes = json.sta_PowerTime % 60; + let xuhang = '0分'; + // 处理不同情况的显示 + if (hours === 0) { + xuhang = `${remainingMinutes}分`; + } else if (remainingMinutes === 0) { + xuhang = `${hours}小时`; + } else { + xuhang = `${hours}小时${remainingMinutes}分`; + } + receiveData.xuhang = xuhang; + } + + ("sta_PowerPercent" in json) && (receiveData.battary = json.sta_PowerPercent); + ("sta_4gSinal" in json) && (receiveData.fourGStrenth = json.sta_4gSinal); + ("sta_imei" in json) && (receiveData.imei = json.sta_imei); + ("sta_longitude" in json) && (receiveData.Lon = json.sta_longitude); + ("sta_latitude" in json) && (receiveData.Lat = json.sta_latitude); + if ("sta_system" in json) { + dic = { + "0": "关机", + "1": "仅充电", + "2": "开机未充电", + "3": "开机且充电" + } + receiveData.sta_system = dic[json.sta_system]; + } this.refreshFormData(receiveData, 'auto'); return receiveData; }, @@ -686,14 +800,14 @@ for (var i = 0; i < keys.length; i++) { let key = keys[i]; if (key in these.formData) { - these.formData[key] = data[key]; + this.formData[key] = data[key]; } } if (this.formData.imei) { this.initMQ(); } if (this.formData.staticWarn) { //有静止报警 - these.showPop({ + this.showPop({ message: "设备静止报警中", iconUrl: "/static/images/6155/DeviceDetail/warnning.png", borderColor: "#e034344d", @@ -701,8 +815,6 @@ buttonText: "确定", clickEvt: "staticWarn" }); - - } this.setBleFormData(); @@ -1576,8 +1688,8 @@ } console.log("baseURL=", baseURL); uni.uploadFile({ - // url: 'http://114.55.111.217/video/upload', - url: baseURL + "/app/video/upload", + url: 'http://114.55.111.217/video/upload', + // url: baseURL + "/app/video/upload", filePath: videoPath, name: 'file', header: { @@ -1617,7 +1729,7 @@ } else { - console.log("服务器未返回正确的数据"); + console.log("服务器未返回正确的数据", arr); these.showPop({ @@ -1996,7 +2108,7 @@ text: "请稍候..." }); this.setBleFormData(); - + let data = { "sendMsg": this.formData.msgTxt, @@ -2187,7 +2299,8 @@ .eqinfo .item { width: 100%; - height: 60rpx; + min-height: 60rpx; + height: auto; line-height: 60rpx; padding: 0rpx 28rpx; box-sizing: border-box; @@ -2204,7 +2317,7 @@ font-family: PingFang SC; font-size: 28rpx; font-weight: 400; - + width: 140rpx; letter-spacing: 0.07px; text-align: left; } @@ -2219,6 +2332,26 @@ text-align: left; } + .eqinfo .multiValue { + display: flex; + flex-direction: column; + flex-wrap: wrap; + align-content: flex-end; + align-items: flex-end; + justify-content: flex-start; + width: calc(100% - 140rpx) + } + + .eqinfo .valueItem { + height: auto; + line-height: 40rpx; + color: rgba(255, 255, 255, 0.6); + font-family: PingFang SC; + font-size: 14px; + font-weight: 400; + letter-spacing: 0.07px; + } + .lamp { margin-top: 24rpx; } diff --git a/pages/7305/BJQ7305.vue b/pages/7305/BJQ7305.vue index 443555f..d99ccf6 100644 --- a/pages/7305/BJQ7305.vue +++ b/pages/7305/BJQ7305.vue @@ -158,7 +158,7 @@ var these = null; var BrighInteval = null; var recei = null; - + export default { components: { TextToHexV1 @@ -317,7 +317,7 @@ let device = data.data; these.device = device; - + let f = ble.data.LinkedList.find((v) => { if (v.macAddress == device.deviceMac) { console.log("找到设备了", v); @@ -328,7 +328,7 @@ }); if (!f) { - + these.getDetail(); these.showBleUnConnect(); return; } @@ -347,7 +347,7 @@ these.formData.deviceId = f.deviceId; ble.LinkBlue(f.deviceId, f.writeServiceId, f.wirteCharactId, f.notifyCharactId); these.setBleFormData(); - + these.getDetail(); }); @@ -385,15 +385,15 @@ } switch (this.formData.mode) { case 0: - - + + txt = "强光模式"; - + break; case 1: txt = "弱光模式"; break; - + case 2: txt = "爆闪模式"; break; @@ -403,7 +403,7 @@ default: txt = "关闭"; break; - + } return txt; } @@ -419,9 +419,9 @@ return f; }, bleValueNotify: function(receive, device, path) { - + let str = recei.ReceiveData(receive, device, path); - + console.log("处理接收到的数据:" + str); return; let data = recei.ReceiveData(receive, device, path); @@ -529,29 +529,31 @@ } }); }, - showBleUnConnect(){ + showBleUnConnect() { this.showPop({ message: "蓝牙未连接过该设备,请使用蓝牙重新添加该设备", iconUrl: "/static/images/6155/DeviceDetail/uploadErr.png", borderColor: "#e034344d", buttonBgColor: "#E03434", - buttonText:'去连接', - okCallback:function(){ + buttonText: '去连接', + okCallback: function() { console.log("1111"); uni.navigateTo({ - url:"/pages/common/addBLE/addEquip", - events: { - BindOver: function(data) { - console.log(data) - } - }, - success: function(res) { - // 通过eventChannel向被打开页面传送数据 - res.eventChannel.emit('detailData', { data: these.device }) - }, - fail(ex){ - console.log("跳转失败",ex); - } + url: "/pages/common/addBLE/addEquip", + events: { + BindOver: function(data) { + console.log(data) + } + }, + success: function(res) { + // 通过eventChannel向被打开页面传送数据 + res.eventChannel.emit('detailData', { + data: these.device + }) + }, + fail(ex) { + console.log("跳转失败", ex); + } }) } }); @@ -642,8 +644,8 @@ these.showPop({ message: "上传成功", iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png", - borderColor : '#BBE600', - buttonBgColor : '#BBE600' + borderColor: '#BBE600', + buttonBgColor: '#BBE600' }); resolve(); @@ -889,9 +891,9 @@ case 1: dataValue = 0x02; break; - // case 2: - // dataValue = 0x02; - // break; + // case 2: + // dataValue = 0x02; + // break; case 2: dataValue = 0x03; break; @@ -974,7 +976,7 @@ if (this.Status.Pop.clickEvt == 'SendUsr') { } - if(this.Status.Pop.okCallback){ + if (this.Status.Pop.okCallback) { this.Status.Pop.okCallback(); } this.Status.Pop.showPop = false; @@ -992,11 +994,11 @@ okCallback: null, cancelCallback: null, popType: 'custom', - buttonText:'确定', + buttonText: '确定', clickEvt: '' }; if (!option) { - + } let keys = Object.keys(option); for (var i = 0; i < keys.length; i++) { @@ -1011,7 +1013,7 @@ } this.Status.Pop[key] = defaultCfg[key]; } - + this.Status.Pop.showPop = true; }, sendUsr() { @@ -1171,18 +1173,18 @@ console.log("发送成功"); this.showPop({ message: "发送成功", - iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png", - borderColor : '#BBE600', - buttonBgColor : '#BBE600' + iconUrl: "/static/images/6155/DeviceDetail/uploadSuccess.png", + borderColor: '#BBE600', + buttonBgColor: '#BBE600' }); - - - - + + + + let json = { - deviceId: these.device.id, - name: these.formData.textLines[1], - position: these.formData.textLines[0], + deviceId: these.device.id, + name: these.formData.textLines[1], + position: these.formData.textLines[0], unitName: these.formData.textLines[2], code: "" }; @@ -1199,7 +1201,22 @@ setTimeout(task, 0); }, + getDetail() { + var that = this; + usrApi.getDetail(this.device.id).then(res => { + if (res && res.code == 200) { + res = res.data; + let personnelInfo = res.personnelInfo; + if (personnelInfo) { + these.formData.textLines[2] = personnelInfo.unitName; + these.formData.textLines[1] = personnelInfo.name; + these.formData.textLines[0] = personnelInfo.position; + + } + } + }); + }, ack: function() { diff --git a/pages/BlueTooth/ModeSetting/HBY670V1.vue b/pages/BlueTooth/ModeSetting/HBY670V1.vue index 3cdedd5..c1fe054 100644 --- a/pages/BlueTooth/ModeSetting/HBY670V1.vue +++ b/pages/BlueTooth/ModeSetting/HBY670V1.vue @@ -56,6 +56,7 @@ 静止报警状态:{{receiveData.staticWarn}} 4G信号强度:{{receiveData.fourGStrenth}} SOS模式:{{receiveData.SOS}} + 设备状态:{{receiveData.sta_system}} 重发包序号:{{reSendNumber}} @@ -226,7 +227,7 @@