merge upstream

This commit is contained in:
2026-02-06 08:32:25 +08:00
6 changed files with 1563 additions and 1479 deletions

View File

@ -81,3 +81,11 @@ export function deviceUpdateVolume(data) {
data:data
})
}
// 语音播放
export function deviceVoiceBroadcast(data) {
return request({
url: `/app/hby100j/device/voiceBroadcast`,
method: 'post',
data:data
})
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<template>
<view class="maincontent contentBg">
<mescroll-uni class="device-list" @init=" " @down="downCallback" @up="upCallback" :up="upOption"
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
:down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
<uni-swipe-action ref="swipeAction">
<view v-for="(item, index) in dataListA" class="li" :key="index" :ref="'swipeItem_' + index">

View File

@ -55,12 +55,19 @@
import {
deviceInfo,
} from '@/api/common/index.js'
// 1. 导入所有需要的报警接口
import {
deviceSendAlarmMessage
deviceSendAlarmMessage, //6170对应类型接口
deviceDefaultAlarm
} from '@/api/6170/callPolice.js'
import {
deviceForceAlarmActivation
} from '@/api/100J/HBY100-J.js'
// BJQ100J 对应的接口
import {
deviceRealTimeStatus //设备状态
} from '@/api/6170/deviceControl.js'
export default {
components: {
CustomPopup
@ -74,12 +81,34 @@
popupConfirmText: '确认',
popupType: 'force', // 'force' or 'cancel'
pendingAlarmAction: '',
sendInfo: ''
sendInfo: '',
// 2. 核心typeName 与接口的映射表
alarmApiMapping: {
'HBY100-J': { //100J类型
sendApi: deviceForceAlarmActivation,
statusTypeName: 'FunctionAccessBatchStatusRule_BJQ100J'
},
'BJQ6170': { //6170类型
sendApi: deviceSendAlarmMessage,
statusTypeName: 'FunctionAccessBatchStatusRule_BJQ200J'
}
},
loading: false,
total: 0
}
},
computed: {
selectedDeviceIds() {
return this.deviceList.filter(item => item.checked).map(item => item.id);
},
// 自动匹配当前typeName对应的接口配置
currentApiConfig() {
const currentTypeName = this.sendInfo.typeName || '';
// 匹配到则用对应配置,匹配不到用默认配置
return this.alarmApiMapping[currentTypeName] || {
sendApi: deviceDefaultAlarm,
statusTypeName: 'FunctionAccessBatchStatusRule_Default'
};
}
},
methods: {
@ -93,15 +122,19 @@
// 全选/取消全选
selectAll() {
console.log('123');
const allSelected = this.deviceList.every(item => item.checked);
// 仅对在线设备进行全选/取消
const allSelected = this.deviceList.every(item => item.onlineStatus === 1 && item.checked);
this.deviceList.forEach(item => {
item.checked = !allSelected;
// 离线设备不修改checked状态
if (item.onlineStatus === 1) {
item.checked = !allSelected;
}
});
this.$forceUpdate();
},
// 获取设备列表
getData(deviceType) {
console.log(deviceType, 'deviceTypedeviceType');
this.loading = true;
let data = {
pageNum: 1,
@ -127,7 +160,7 @@
const selectedDevices = this.deviceList.filter(item => item.checked)
if (selectedDevices.length === 0) {
uni.showToast({
title: '请选择一个设备',
title: '请选择一个在线设备',
icon: 'none'
});
return;
@ -136,14 +169,13 @@
this.popupMessage = '确认要对所选设备开启强制报警?';
this.showPopupFlag = true;
this.pendingAlarmAction = 1
},
// 解除报警
cancelAlarm() {
const selectedDevices = this.deviceList.filter(item => item.checked);
if (selectedDevices.length === 0) {
uni.showToast({
title: '请选择一个设备',
title: '请选择一个在线设备',
icon: 'none'
});
return;
@ -153,61 +185,61 @@
this.showPopupFlag = true;
this.pendingAlarmAction = 0
},
// 确认
//动态调用对应接口
async sendAlarmCommand() {
const selectedDevices = this.deviceList.filter(item => item.checked);
const deviceIds = selectedDevices.map(item => item.id);
const deviceImeiList = selectedDevices.map(item => item.deviceImei);
const isAlarming = this.pendingAlarmAction == 1;
if (selectedDevices.length === 0) {
uni.showToast({
title: '请选择在线设备',
icon: 'none'
});
return;
}
try {
uni.showLoading({
title: isAlarming ? '设备报警中...' : '解除报警中...',
mask: true
});
// 2. 准备请求数据
const batchId = generateShortId();
const data = {
deviceIds: deviceIds,
// 获取当前typeName对应的接口和参数配置
const {
sendApi,
statusTypeName
} = this.currentApiConfig;
// 准备请求数据
// const batchId = generateShortId();
const requestData = {
deviceIds: deviceIds,
typeName: this.sendInfo.typeName,
deviceImeiList: deviceImeiList,
batchId: batchId,
instructValue: this.pendingAlarmAction == 1 ? '1' : '0'
// batchId: batchId,
voiceStrobeAlarm: this.pendingAlarmAction == 1 ? '1' : '0'
};
const registerRes = await deviceSendAlarmMessage(data);
if (registerRes.code !== 200) {
// 动态调用匹配的接口
const registerRes = await sendApi(requestData);
if (registerRes.code == 200) {
uni.showToast({
title: registerRes.msg,
icon: 'none'
})
return
}
// 4. 获取设备状态
let deviceImei = this.sendInfo.deviceImei
let typeName = this.sendInfo.typeName
const statusRes = await getdeviceSTatus({
functionMode: 2,
batchId,
typeName:'FunctionAccessBatchStatusRule',
deviceImei,
interval: 500
},
deviceRealTimeStatus
);
if (statusRes.data.functionAccess === 'OK') {
uni.showToast({
title: statusRes.msg,
icon: 'none'
title: isAlarming ? '强制报警开启成功' : '报警已解除',
icon: 'success'
});
this.showPopupFlag = false
uni.$emit('deviceStatusUpdate', {});
setTimeout(() => {
uni.navigateBack()
}, 500)
} else {
uni.showToast({
title: registerRes.msg || '状态查询失败',
icon: 'none'
});
}
} catch (error) {
console.error('报警操作异常:', error);
uni.showToast({
title: error.message,
title: '网络异常,请重试',
icon: 'none'
});
} finally {
@ -217,7 +249,6 @@
// 点击确认状态
onPopupConfirm() {
this.sendAlarmCommand(this.popupType);
// 处理确认逻辑
},
},
onLoad(options) {
@ -227,7 +258,6 @@
this.getData(data.data.id)
this.sendInfo = data.data
});
// 如果需要向调用页面返回数据,可以触发 'ack' 事件
eventChannel.emit('ack', {})
},
}
@ -236,7 +266,7 @@
<style scoped>
.container {
min-height: 100vh;
background-color:rgb(18, 18, 18);
background-color: rgb(18, 18, 18);
box-sizing: border-box;
overflow-x: hidden;

View File

@ -18,11 +18,11 @@
<image src="/static/images/common/more.png" mode="aspectFit" class="more"></image>
</view>
</view>
<view class="sendFlex" v-if="activeTab && activeTab.id !== ''&& activeTabInfo.communicationMode==0 || activeTabInfo.communicationMode==2">
<!-- <view class="sendFlex" v-if="activeTab && activeTab.id !== ''&& activeTabInfo.communicationMode==0 || activeTabInfo.communicationMode==2">
<view class="callpolice" @click="callpolice">报警</view>
<view class="Sendmessage" @click="location">位置</view>
<view class="Sendmessage" @click="handleSend">发送信息</view>
</view>
<view class="Sendmessage" @click="handleSend" v-if="activeTabInfo.typeName!=='HBY100-J'">发送信息</view>
</view> -->
<!-- <scroll-view class="device-list" scroll-y @scrolltolower="onScrollToLower" :lower-threshold="100" style="height:80vh;"> -->
<mescroll-uni class="device-list" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption"
:down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">

View File

@ -307,21 +307,21 @@ export default {
value: "50",
label: "报警模式",
checked: false,
type: ['100']
type: ['100','100J']
},
{
value: "51",
label: "警示灯",
checked: false,
type: ['100']
type: ['100','100J']
},
{
value: "52",
label: "语音管理",
checked: false,
type: ['100']
type: ['100','100J']
},
{
@ -342,6 +342,12 @@ export default {
checked: false,
type: ['4877']
},
{
value: "56",
label: "灯光类型设置",
checked: false,
type: ['100J']
},
]
let arr = [];