From 3b5aae87f4e95c92aed89b6ea1e988107873f206 Mon Sep 17 00:00:00 2001 From: liub Date: Tue, 10 Mar 2026 17:27:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=8A=A5=E8=AD=A6=E3=80=81?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=8F=91=E9=80=81=E6=B6=88=E6=81=AF=EF=BC=8C?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E4=BE=9B=E5=BA=94=E5=95=86=E7=9A=84=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E4=BD=9C=E5=8C=BA=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/common/callPolice/index.vue | 155 ++++++++--- pages/common/send/index.vue | 416 ++++++++++++++++++++++-------- 2 files changed, 429 insertions(+), 142 deletions(-) diff --git a/pages/common/callPolice/index.vue b/pages/common/callPolice/index.vue index 7a11efb..920a09a 100644 --- a/pages/common/callPolice/index.vue +++ b/pages/common/callPolice/index.vue @@ -72,8 +72,10 @@ import MescrollUni from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-uni.vue'; + import MqTool from '@/utils/MqHelper.js'; var timeout = null; var these = null; + var mq=null; export default { components: { CustomPopup, @@ -94,13 +96,28 @@ alarmApiMapping: [{ type: ['HBY100-J'], sendApi: deviceForceAlarmActivation, - statusTypeName: 'FunctionAccessBatchStatusRule_BJQ100J' + statusTypeName: 'FunctionAccessBatchStatusRule_BJQ100J', + sendType: 'FYSSend' }, { type: ['BJQ6170'], sendApi: deviceSendAlarmMessage, - statusTypeName: 'FunctionAccessBatchStatusRule_BJQ200J' + statusTypeName: 'FunctionAccessBatchStatusRule_BJQ200J', + sendType: 'FYSSend' }, + + { + type: ['BJQ6075J'], + sendApi: deviceSendAlarmMessage, + statusTypeName: '', + sendType: 'CommonSend' + }, + { + type: ['HBY670'], + sendApi: deviceSendAlarmMessage, + statusTypeName: '', + sendType: 'XSSend' + } ] }, loading: false, @@ -132,19 +149,20 @@ currentApiConfig() { const currentTypeName = this.sendInfo.typeName || ''; // 匹配到则用对应配置,匹配不到用默认配置 - let f= this.dic.alarmApiMapping.find(v=>{ - return v.type.indexOf(currentTypeName)>-1; + let f = this.dic.alarmApiMapping.find(v => { + return v.type.indexOf(currentTypeName) > -1; }); - if(f){ + if (f) { return f; - }else{ + } else { return { sendApi: deviceDefaultAlarm, - statusTypeName: 'FunctionAccessBatchStatusRule_Default' + statusTypeName: 'FunctionAccessBatchStatusRule_Default', + sendType:'FYSSend' }; } - - + + } }, methods: { @@ -189,12 +207,12 @@ selectAll() { console.log('123'); // 仅对在线设备进行全选/取消 - const allSelected = this.deviceList.every(item => item.checked); + const allSelected = this.deviceList.every(item => item.checked); this.deviceList.forEach(item => { // 离线设备不修改checked状态 - - item.checked = !allSelected; - + + item.checked = !allSelected; + }); this.$forceUpdate(); }, @@ -205,7 +223,7 @@ console.log(deviceType, 'deviceTypedeviceType'); this.loading = true; let data = { - pageNum: 1, + pageNum: this.mescroll?this.mescroll.num:1, pageSize: 50, deviceType: deviceType } @@ -217,11 +235,16 @@ checked: false })); this.total = res.total; - this.deviceList = newDevices; - + + if(data.pageNum===1){ + this.deviceList = newDevices; + }else{ + this.deviceList =this.deviceList.concat(newDevices); + } + + let hasNext = true; - if (res.rows.length < this.size || this.deviceList.length >= this - .total) { + if (res.rows.length < data.pageSize || this.deviceList.length >= this.total) { hasNext = false; } else { hasNext = true; @@ -271,7 +294,7 @@ this.pendingAlarmAction = 0 }, //动态调用对应接口 - async sendAlarmCommand() { + sendAlarmCommand() { const selectedDevices = this.deviceList.filter(item => item.checked); const deviceIds = selectedDevices.map(item => item.id); const deviceImeiList = selectedDevices.map(item => item.deviceImei); @@ -291,34 +314,78 @@ // 获取当前typeName对应的接口和参数配置 const { sendApi, - statusTypeName + statusTypeName, + sendType } = this.currentApiConfig; - // 准备请求数据 - // const batchId = generateShortId(); - const requestData = { - deviceIds: deviceIds, - typeName: this.sendInfo.typeName, - deviceImeiList: deviceImeiList, - // batchId: batchId, - voiceStrobeAlarm: this.pendingAlarmAction == 1 ? '1' : '0' - }; - // 动态调用匹配的接口 - const registerRes = await sendApi(requestData); - if (registerRes.code == 200) { + + //FYS的方法 + let FYSSend = async () => { + const requestData = { + deviceIds: deviceIds, + typeName: this.sendInfo.typeName, + deviceImeiList: deviceImeiList, + // batchId: batchId, + voiceStrobeAlarm: this.pendingAlarmAction == 1 ? '1' : '0' + }; + // 动态调用匹配的接口 + const registerRes = await sendApi(requestData); + if (registerRes.code == 200) { + uni.showToast({ + title: isAlarming ? '强制报警开启成功' : '报警已解除', + icon: 'success' + }); + this.showPopupFlag = false + uni.$emit('deviceStatusUpdate', {}); + setTimeout(() => { + uni.navigateBack() + }, 500) + } else { + uni.showToast({ + title: registerRes.msg || '状态查询失败', + icon: 'none' + }); + } + } + //XS的方法 + let XSSend = () => { + let json=JSON.stringify({ins_SOSGrade:[1]}); + for (let i = 0; i < deviceImeiList.length; i++) { + let imei = deviceImeiList[i]; + + mq.sendData("B/"+imei,json,false); + } + uni.showToast({ title: isAlarming ? '强制报警开启成功' : '报警已解除', icon: 'success' }); this.showPopupFlag = false - uni.$emit('deviceStatusUpdate', {}); - setTimeout(() => { - uni.navigateBack() - }, 500) - } else { + } + //统一通信协议方法 + let CommonSend = () => { + let json=JSON.stringify({ins_ShakeBit:1}); + for (let i = 0; i < deviceImeiList.length; i++) { + let imei = deviceImeiList[i]; + mq.sendData("B/"+imei,json,false); + } + uni.showToast({ - title: registerRes.msg || '状态查询失败', - icon: 'none' + title: isAlarming ? '强制报警开启成功' : '报警已解除', + icon: 'success' }); + this.showPopupFlag = false + } + + switch (sendType) { + case "FYSSend": + FYSSend(); + break; + case "XSSend": + XSSend(); + break; + case "CommonSend": + CommonSend(); + break; } } catch (error) { @@ -336,8 +403,18 @@ this.sendAlarmCommand(this.popupType); }, }, + onUnload() { + if(mq){ + mq.disconnect(); + } + }, onLoad(options) { these = this; + mq=MqTool.getMqTool(); + if(mq){ + mq.init(); + + } const eventChannel = this.getOpenerEventChannel(); // 监听 'deviceSend' 事件,获取传过来的数据 eventChannel.on('devicePolice', (data) => { diff --git a/pages/common/send/index.vue b/pages/common/send/index.vue index bd4d85c..68efc2d 100644 --- a/pages/common/send/index.vue +++ b/pages/common/send/index.vue @@ -28,21 +28,27 @@ - + - + - 编辑信息 - -