1
0
forked from dyf/APP

100J页面功能完成

This commit is contained in:
fengerli
2026-02-05 11:40:56 +08:00
parent d62d3f734a
commit 1fc02b5f5a
6 changed files with 1563 additions and 1479 deletions

View File

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

View File

@ -40,18 +40,18 @@
</view> </view>
<view class="item"> <view class="item">
<text class="lbl">设备状态</text> <text class="lbl">设备状态</text>
<text class="value status-running">{{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus <text class="value">{{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus
=== 2 ? '故障' : '在线' }}</text> === 2 ? '故障' : '在线' }}</text>
</view> </view>
<view class="item"> <view class="item">
<text class="lbl">定位信息</text> <text class="lbl">定位信息</text>
<view class="info-value status-running"> <view class="info-value">
<view class="info-value status-running"> <view class="value" @click="gpsPosition(deviceInfo)">
{{ deviceInfo && deviceInfo.longitude ? Number(deviceInfo.longitude).toFixed(4) : '' }} {{ deviceInfo && deviceInfo.longitude ? Number(deviceInfo.longitude).toFixed(4) : '' }}
{{ deviceInfo && deviceInfo.latitude ? Number(deviceInfo.latitude).toFixed(4) : '' }} {{ deviceInfo && deviceInfo.latitude ? Number(deviceInfo.latitude).toFixed(4) : '' }}
</view> </view>
<view class="info-value status-running locationGPS"> <view class="locationGPS">
<uni-icons @click="toggleForm" type="location" size="17" color="rgba(255, 255, 255, 0.8)" <uni-icons type="location" size="17" color="rgba(255, 255, 255, 0.8)"
style="vertical-align: bottom;" /> style="vertical-align: bottom;" />
{{ deviceInfo.address }} {{ deviceInfo.address }}
</view> </view>
@ -97,12 +97,12 @@
</view> </view>
</view> </view>
<view class="lampMode"> <view class="lampMode">
<view class="mode fleft " v-on:click.stop="openVolume(null, '9')" <view class="mode fleft " v-on:click.stop="openVolume(null, '7')"
:class="{ 'active': formData.sta_VoiceType === '9' }"> :class="{ 'active': formData.sta_VoiceType === '7' }">
<view class="leftImg"> <view class="leftImg">
<image class="img" :class="{ 'displayNone': formData.sta_VoiceType === '9' }" <image class="img" :class="{ 'displayNone': formData.sta_VoiceType === '7' }"
src="/static/images/common/play.png" mode="aspectFit"></image> src="/static/images/common/play.png" mode="aspectFit"></image>
<image class="img" :class="{ 'displayNone': formData.sta_VoiceType !== '9' }" <image class="img" :class="{ 'displayNone': formData.sta_VoiceType !== '7' }"
src="/static/images/common/pauseActive.png" mode="aspectFit"></image> src="/static/images/common/pauseActive.png" mode="aspectFit"></image>
</view> </view>
<view class="rightTxt"> <view class="rightTxt">
@ -225,7 +225,8 @@ import {
deviceForceAlarmActivation, deviceForceAlarmActivation,
deviceStrobeFrequency, deviceStrobeFrequency,
deviceLightAdjustment, deviceLightAdjustment,
deviceUpdateVolume deviceUpdateVolume,
deviceVoiceBroadcast
} from '@/api/100J/HBY100-J.js' } from '@/api/100J/HBY100-J.js'
var these = null; var these = null;
import Common from '@/utils/Common.js' import Common from '@/utils/Common.js'
@ -348,8 +349,8 @@ export default {
name: '铁道', name: '铁道',
show: true show: true
}, },
"9": { "7": {
key: "9", key: "7",
name: 'app语音', name: 'app语音',
show: false show: false
}, },
@ -507,9 +508,9 @@ export default {
}, },
success: (res) => { success: (res) => {
let json = { let json = {
persissonType: '670' persissonType: '100J'
}; };
Object.assign(json, this.deviceInfo);
res.eventChannel.emit('share', { res.eventChannel.emit('share', {
data: json data: json
}); });
@ -593,8 +594,7 @@ export default {
duration: 1000 duration: 1000
}); });
} }
}).catch((err) => { }).catch((err) => {});
});
}, },
// 音量调节处理函数 // 音量调节处理函数
handleVolumeChange(volumeValue) { handleVolumeChange(volumeValue) {
@ -616,8 +616,7 @@ export default {
duration: 1000 duration: 1000
}); });
} }
}).catch((err) => { }).catch((err) => {});
});
}, },
// 节流函数 // 节流函数
throttle(func, delay = 500) { throttle(func, delay = 500) {
@ -627,7 +626,6 @@ export default {
return function(...args) { return function(...args) {
lastArgs = args; lastArgs = args;
lastThis = this; lastThis = this;
if (!timer) { if (!timer) {
timer = setTimeout(() => { timer = setTimeout(() => {
timer = null; timer = null;
@ -637,6 +635,21 @@ export default {
}; };
}, },
// *******定位******
gpsPosition(item) {
// 添加调试日志
uni.navigateTo({
url: '/pages/common/map/index',
events: {
ack: function(data) {}
},
success: (res) => {
res.eventChannel.emit('Map', {
data: item
});
}
})
},
// 警示灯开关闭 // 警示灯开关闭
lightTypeSet(item, index) { lightTypeSet(item, index) {
let val = item.key; let val = item.key;
@ -683,12 +696,34 @@ export default {
val = '-1'; val = '-1';
} }
this.formData.sta_VoiceType = val; this.formData.sta_VoiceType = val;
console.log(this.formData.sta_VoiceType, 'this.formData.sta_VoiceType')
// 模式类型为7时才去判断
if (val == '7') {
let data = {
deviceId: this.deviceInfo.deviceId,
voiceBroadcast: Number(this.formData.sta_VoiceType) === -1 ? 0 : 1
}
deviceVoiceBroadcast(data).then((res) => {
if (res.code == 200) {
uni.showToast({
title: res.msg,
icon: 'none'
});
} else {
uni.showToast({
title: res.msg,
icon: 'none'
});
}
})
}
}, },
// 报警模式 // 报警模式
sosSetting(item) { sosSetting(item) {
console.log(this.deviceInfo, '44444'); console.log(this.deviceInfo, '44444');
console.log(item, 'tent'); console.log(item, 'tent');
const isClose = item.key === "-1"; const isClose = item === 0;
if (!this.Status) this.Status = {}; if (!this.Status) this.Status = {};
if (!this.Status.Pop) this.Status.Pop = { if (!this.Status.Pop) this.Status.Pop = {
showPop: false showPop: false
@ -706,6 +741,7 @@ export default {
buttonCancelText: '取消', buttonCancelText: '取消',
okCallback: () => { okCallback: () => {
console.log(this.formData.sta_SOSType, 'this.formData.sta_SOSType'); console.log(this.formData.sta_SOSType, 'this.formData.sta_SOSType');
this.formData.sta_SOSType = isClose ? 0 : 1;
const data = { const data = {
deviceIds: [this.deviceInfo.deviceId], deviceIds: [this.deviceInfo.deviceId],
// 声光报警开关关闭传0开启传1 // 声光报警开关关闭传0开启传1
@ -739,7 +775,6 @@ export default {
bleStateBreak() {}, bleStateBreak() {},
bleStateRecovry() {}, bleStateRecovry() {},
previewImg(img) {}, previewImg(img) {},
bleValueNotify: function(receive, device, path, recArr) { //订阅消息 bleValueNotify: function(receive, device, path, recArr) { //订阅消息
if (receive.deviceId !== this.formData.deviceId) { if (receive.deviceId !== this.formData.deviceId) {
return; return;
@ -934,7 +969,7 @@ export default {
border-radius: 16rpx; border-radius: 16rpx;
background: rgba(26, 26, 26, 1); background: rgba(26, 26, 26, 1);
box-sizing: border-box; box-sizing: border-box;
padding: 14rpx 0rpx; padding: 15rpx 0rpx 40rpx 0rpx;
} }
.eqinfo .item { .eqinfo .item {
@ -969,6 +1004,11 @@ export default {
letter-spacing: 0.07px; letter-spacing: 0.07px;
text-align: left; text-align: left;
} }
.eqinfo .info-value {
margin-top: 30rpx;
}
.eqinfo .status-running { .eqinfo .status-running {
color: rgba(174, 214, 0, 1); color: rgba(174, 214, 0, 1);
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="maincontent contentBg"> <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' }"> :down="downOption" :fixed="false" :style="{ height: mescrollHeight + 'px' }">
<uni-swipe-action ref="swipeAction"> <uni-swipe-action ref="swipeAction">
<view v-for="(item, index) in dataListA" class="li" :key="index" :ref="'swipeItem_' + index"> <view v-for="(item, index) in dataListA" class="li" :key="index" :ref="'swipeItem_' + index">

View File

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

View File

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

View File

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