Merge branch 'new-20250827' of http://47.107.152.87:3000/liubiao/APP into new-20250827
# Conflicts: # config/index.js
This commit is contained in:
@ -24,10 +24,68 @@ export function deviceDeleteAudioFile(params) {
|
||||
})
|
||||
}
|
||||
|
||||
// 更新语音,使用语音
|
||||
export function deviceUpdateVoice(data) {
|
||||
return request({
|
||||
url: `/app/hby100j/device/updateVoice`,
|
||||
method: 'post',
|
||||
data:data
|
||||
})
|
||||
}
|
||||
// 100J信息
|
||||
export function deviceDetail(id) {
|
||||
return request({
|
||||
url: `/app/hby100/device/${id}`,
|
||||
url: `/app/hby100j/device/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
// 爆闪模式
|
||||
export function deviceStrobeMode(data) {
|
||||
return request({
|
||||
url: `/app/hby100j/device/strobeMode`,
|
||||
method: 'post',
|
||||
data:data
|
||||
})
|
||||
}
|
||||
|
||||
// 强制报警
|
||||
export function deviceForceAlarmActivation(data) {
|
||||
return request({
|
||||
url: `/app/hby100j/device/forceAlarmActivation`,
|
||||
method: 'post',
|
||||
data:data
|
||||
})
|
||||
}
|
||||
// 爆闪频率
|
||||
export function deviceStrobeFrequency(data) {
|
||||
return request({
|
||||
url: `/app/hby100j/device/strobeFrequency`,
|
||||
method: 'post',
|
||||
data:data
|
||||
})
|
||||
}
|
||||
// 灯光调节亮度
|
||||
export function deviceLightAdjustment(data) {
|
||||
return request({
|
||||
url: `/app/hby100j/device/lightAdjustment`,
|
||||
method: 'post',
|
||||
data:data
|
||||
})
|
||||
}
|
||||
|
||||
// 调节音量
|
||||
export function deviceUpdateVolume(data) {
|
||||
return request({
|
||||
url: `/app/hby100j/device/updateVolume`,
|
||||
method: 'post',
|
||||
data:data
|
||||
})
|
||||
}
|
||||
// 语音播放
|
||||
export function deviceVoiceBroadcast(data) {
|
||||
return request({
|
||||
url: `/app/hby100j/device/voiceBroadcast`,
|
||||
method: 'post',
|
||||
data:data
|
||||
})
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
const config = {
|
||||
// 开发环境
|
||||
development: {
|
||||
BASE_URL: 'http://192.168.110.57:8000',//http://139.224.253.23:8000
|
||||
BASE_URL: 'http://192.168.110.172:8000',//http://139.224.253.23:8000
|
||||
API_PREFIX: '',
|
||||
// MQTT 配置
|
||||
MQTT_HOST: 'www.cnxhyc.com',
|
||||
|
||||
@ -40,19 +40,19 @@
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="lbl">设备状态</text>
|
||||
<text
|
||||
class="value status-running">{{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus === 2 ? '故障' : '在线' }}</text>
|
||||
<text class="value">{{ deviceInfo.onlineStatus === 0 ? '离线' : deviceInfo.onlineStatus
|
||||
=== 2 ? '故障' : '在线' }}</text>
|
||||
</view>
|
||||
<view class="item">
|
||||
<text class="lbl">定位信息</text>
|
||||
<view class="info-value status-running">
|
||||
<view class="info-value status-running">
|
||||
<view class="info-value">
|
||||
<view class="value" @click="gpsPosition(deviceInfo)">
|
||||
{{ deviceInfo && deviceInfo.longitude ? Number(deviceInfo.longitude).toFixed(4) : '' }}
|
||||
{{ deviceInfo && deviceInfo.latitude ? Number(deviceInfo.latitude).toFixed(4) : '' }}
|
||||
</view>
|
||||
<view class="info-value status-running locationGPS">
|
||||
<!-- <uni-icons @click="toggleForm" type="location" size="17" color="rgba(255, 255, 255, 0.8)"
|
||||
style="vertical-align: bottom;" /> -->
|
||||
<view class="locationGPS">
|
||||
<uni-icons type="location" size="17" color="rgba(255, 255, 255, 0.8)"
|
||||
style="vertical-align: bottom;" />
|
||||
{{ deviceInfo.address }}
|
||||
</view>
|
||||
</view>
|
||||
@ -62,7 +62,7 @@
|
||||
<view class="sosContent">
|
||||
<view class="btnSos openSos center" :class="{ active: formData.sta_SOSType === 1 }"
|
||||
@click="sosSetting(1)">
|
||||
{{ formData.sta_SOSType === 1 ? '报警中' : '强制报警' }}
|
||||
{{ deviceInfo.chargeState === 1 ? '报警中' : '强制报警' }}
|
||||
</view>
|
||||
<view class="btnSos closeSos center" @click="sosSetting(0)">解除</view>
|
||||
</view>
|
||||
@ -97,19 +97,18 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="lampMode">
|
||||
<view class="mode fleft " v-on:click.stop="openVolume(null, '8')"
|
||||
:class="{ 'active': formData.sta_VoiceType === '8' }">
|
||||
<view class="mode fleft " v-on:click.stop="openVolume(null, '7')"
|
||||
:class="{ 'active': formData.sta_VoiceType === '7' }">
|
||||
<view class="leftImg">
|
||||
<image class="img" :class="{ 'displayNone': formData.sta_VoiceType === '8' }"
|
||||
<image class="img" :class="{ 'displayNone': formData.sta_VoiceType === '7' }"
|
||||
src="/static/images/common/play.png" mode="aspectFit"></image>
|
||||
<image class="img" :class="{ 'displayNone': formData.sta_VoiceType !== '8' }"
|
||||
<image class="img" :class="{ 'displayNone': formData.sta_VoiceType !== '7' }"
|
||||
src="/static/images/common/pauseActive.png" mode="aspectFit"></image>
|
||||
</view>
|
||||
<view class="rightTxt">
|
||||
<text class="bigTxt">播放语音</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mode fleft marginLeft" v-on:click.stop="audioManager(deviceInfo)">
|
||||
<view class="leftImg">
|
||||
<image class="img" src="/static/images/common/uploadCloud.png" mode="aspectFit"></image>
|
||||
@ -161,27 +160,21 @@
|
||||
<text class="sliderTxt">频率</text>
|
||||
<text class="sliderVal">{{ formData.sta_LightFreq }}HZ</text>
|
||||
</view>
|
||||
|
||||
<view class="slider-container">
|
||||
<slider min="0.5" max="10" step="0.5" :disabled="false" :value="formData.sta_LightFreq"
|
||||
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
|
||||
@change="onFreqChanging" @changing="onFreqChanging" class="custom-slider" />
|
||||
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="header paddingTop0">
|
||||
<text class="sliderTxt">音量</text>
|
||||
<text class="sliderVal">{{ formData.sta_VoiceVolume }}</text>
|
||||
</view>
|
||||
|
||||
<view class="slider-container">
|
||||
<slider min="1" max="8" step="1" :disabled="false" :value="formData.sta_VoiceVolume"
|
||||
activeColor="#bbe600" backgroundColor="#686767" block-size="20" block-color="#ffffffde"
|
||||
@change="onVolumeChanging" @changing="onVolumeChanging" class="custom-slider" />
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="proinfo lamp">
|
||||
<text class="title">产品信息</text>
|
||||
<view class="itemcontent">
|
||||
@ -202,7 +195,6 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 弹窗通知 -->
|
||||
<MessagePopup :visible="Status.Pop.showPop" :type="Status.Pop.popType" :bgColor="Status.Pop.bgColor"
|
||||
:borderColor="Status.Pop.borderColor" :textColor="Status.Pop.textColor"
|
||||
@ -228,7 +220,13 @@
|
||||
baseURL
|
||||
} from '@/utils/request.js';
|
||||
import {
|
||||
deviceDetail
|
||||
deviceDetail,
|
||||
deviceStrobeMode,
|
||||
deviceForceAlarmActivation,
|
||||
deviceStrobeFrequency,
|
||||
deviceLightAdjustment,
|
||||
deviceUpdateVolume,
|
||||
deviceVoiceBroadcast
|
||||
} from '@/api/100J/HBY100-J.js'
|
||||
var these = null;
|
||||
import Common from '@/utils/Common.js'
|
||||
@ -305,7 +303,7 @@
|
||||
macAddress: '',
|
||||
bleStatu: false,
|
||||
sta_address: '',
|
||||
sta_VoiceType: '',
|
||||
sta_VoiceType: '0',
|
||||
sta_VoiceVolume: 1,
|
||||
sta_LightType: '',
|
||||
sta_LightFreq: 0.5,
|
||||
@ -321,8 +319,8 @@
|
||||
name: '消防',
|
||||
show: true
|
||||
},
|
||||
"2": {
|
||||
key: "2",
|
||||
"0": {
|
||||
key: "0",
|
||||
name: '公安',
|
||||
show: true
|
||||
},
|
||||
@ -336,8 +334,8 @@
|
||||
name: '市政',
|
||||
show: true
|
||||
},
|
||||
"5": {
|
||||
key: "5",
|
||||
"2": {
|
||||
key: "2",
|
||||
name: '应急',
|
||||
show: true
|
||||
},
|
||||
@ -346,60 +344,60 @@
|
||||
name: '医疗',
|
||||
show: true
|
||||
},
|
||||
"7": {
|
||||
key: "7",
|
||||
"5": {
|
||||
key: "5",
|
||||
name: '铁道',
|
||||
show: true
|
||||
},
|
||||
"8": {
|
||||
key: "8",
|
||||
"7": {
|
||||
key: "7",
|
||||
name: 'app语音',
|
||||
show: false
|
||||
},
|
||||
"0": {
|
||||
key: "0",
|
||||
"-1": {
|
||||
key: "-1",
|
||||
name: '关闭',
|
||||
show: false
|
||||
}
|
||||
},
|
||||
|
||||
sta_LightType: [{
|
||||
key: "1",
|
||||
key: "6",
|
||||
name: '红蓝',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
key: "2",
|
||||
key: "0",
|
||||
name: '红闪',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
key: "3",
|
||||
key: "2",
|
||||
name: '黄闪',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
key: "4",
|
||||
key: "1",
|
||||
name: '蓝闪',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
key: "5",
|
||||
key: "3",
|
||||
name: '红流水',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
key: "6",
|
||||
key: "4",
|
||||
name: '黄流水',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
key: "7",
|
||||
key: "5",
|
||||
name: '蓝流水',
|
||||
show: true
|
||||
},
|
||||
{
|
||||
key: "0",
|
||||
key: "-1",
|
||||
name: '关闭',
|
||||
show: false
|
||||
}
|
||||
@ -465,6 +463,7 @@
|
||||
console.log(data, 'datatatatat');
|
||||
these.fetchDeviceDetail(data.data.id)
|
||||
});
|
||||
this.createThrottledFunctions();
|
||||
|
||||
},
|
||||
onHide: function() {
|
||||
@ -476,7 +475,14 @@
|
||||
computed: {
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
createThrottledFunctions() {
|
||||
// 创建节流函数
|
||||
this.throttledBrightnessChange = this.throttle(this.handleBrightnessChange, 500);
|
||||
this.throttledFreqChange = this.throttle(this.handleFreqChange, 500);
|
||||
this.throttledVolumeChange = this.throttle(this.handleVolumeChange, 500);
|
||||
},
|
||||
// 获取设备详情(普通详情)
|
||||
fetchDeviceDetail(id) {
|
||||
deviceDetail(id).then((res) => {
|
||||
@ -502,9 +508,9 @@
|
||||
},
|
||||
success: (res) => {
|
||||
let json = {
|
||||
persissonType: '670'
|
||||
persissonType: '100J'
|
||||
};
|
||||
|
||||
Object.assign(json, this.deviceInfo);
|
||||
res.eventChannel.emit('share', {
|
||||
data: json
|
||||
});
|
||||
@ -516,18 +522,7 @@
|
||||
if (this.Status.apiType !== 'listA') {}
|
||||
uni.navigateTo({
|
||||
url: '/pages/100J/audioManager/AudioList',
|
||||
events: {
|
||||
audioApply: function(id) {
|
||||
//应用某个语音时,将数据发送给设备
|
||||
console.log("准备发送数据", id);
|
||||
showLoading(these, {
|
||||
text: '准备发送数据'
|
||||
});
|
||||
these.audioData.hexs = uni.getStorageSync(Common.pcmStorageKey + "_" + id);
|
||||
console.log("hexs.length=", these.audioData.hexs.length)
|
||||
these.HoldYouHand();
|
||||
}
|
||||
},
|
||||
events: {},
|
||||
success: (res) => {
|
||||
// 页面跳转成功后的回调函数
|
||||
res.eventChannel.emit('deviceData', {
|
||||
@ -539,17 +534,153 @@
|
||||
//频率
|
||||
onFreqChanging(e) {
|
||||
this.formData.sta_LightFreq = e.detail.value;
|
||||
this.throttledFreqChange(e.detail.value);
|
||||
},
|
||||
//音量
|
||||
onVolumeChanging(e) {
|
||||
this.formData.sta_VoiceVolume = e.detail.value;
|
||||
this.throttledVolumeChange(e.detail.value);
|
||||
},
|
||||
|
||||
// 亮度调节
|
||||
onBrightnessChanging(e) {
|
||||
this.formData.sta_LightDimmer = e.detail.value;
|
||||
this.throttledBrightnessChange(e.detail.value);
|
||||
},
|
||||
// 亮度调节
|
||||
handleBrightnessChange(brightnessValue) {
|
||||
let data = {
|
||||
deviceId: this.deviceInfo.deviceId,
|
||||
brightness: brightnessValue
|
||||
};
|
||||
console.log('发送亮度调节请求:', data);
|
||||
deviceLightAdjustment(data).then((res) => {
|
||||
if (res.code === 200) {
|
||||
console.log('亮度调节成功');
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg || '调节失败',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
});
|
||||
}
|
||||
}).catch((err) => {
|
||||
|
||||
});
|
||||
},
|
||||
// 频率调节
|
||||
handleFreqChange(freqValue) {
|
||||
let data = {
|
||||
deviceId: this.deviceInfo.deviceId,
|
||||
frequency: freqValue
|
||||
};
|
||||
|
||||
deviceStrobeFrequency(data).then((res) => {
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg || '调节失败',
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
});
|
||||
}
|
||||
}).catch((err) => {});
|
||||
},
|
||||
// 音量调节处理函数
|
||||
handleVolumeChange(volumeValue) {
|
||||
let data = {
|
||||
deviceId: this.deviceInfo.deviceId,
|
||||
volume: volumeValue
|
||||
};
|
||||
deviceUpdateVolume(data).then((res) => {
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
});
|
||||
}
|
||||
}).catch((err) => {});
|
||||
},
|
||||
// 节流函数
|
||||
throttle(func, delay = 500) {
|
||||
let timer = null;
|
||||
let lastArgs = null;
|
||||
let lastThis = null;
|
||||
return function(...args) {
|
||||
lastArgs = args;
|
||||
lastThis = this;
|
||||
if (!timer) {
|
||||
timer = setTimeout(() => {
|
||||
timer = null;
|
||||
func.apply(lastThis, lastArgs);
|
||||
}, delay);
|
||||
}
|
||||
};
|
||||
|
||||
},
|
||||
// *******定位******
|
||||
gpsPosition(item) {
|
||||
// 添加调试日志
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/map/index',
|
||||
events: {
|
||||
ack: function(data) {}
|
||||
},
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('Map', {
|
||||
data: item
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
// 警示灯开关闭
|
||||
lightTypeSet(item, index) {
|
||||
this.formData.sta_LightType = item.key;
|
||||
let val = item.key;
|
||||
// 切换选中/取消选中逻辑
|
||||
if (this.formData.sta_LightType === val) {
|
||||
val = '-1';
|
||||
}
|
||||
this.formData.sta_LightType = val;
|
||||
let data = {
|
||||
deviceId: this.deviceInfo.deviceId,
|
||||
// 开启/关闭:选中模式时传1,关闭时传0
|
||||
enable: val === '-1' ? 0 : 1,
|
||||
// 0 红色爆闪,1 蓝色爆闪,2 黄色爆闪,3,红色顺时针旋转爆闪,4黄色顺时针旋转爆闪,5,红蓝顺时针旋转爆闪,6 红蓝交替爆闪
|
||||
mode: item.key
|
||||
};
|
||||
deviceStrobeMode(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
const tipText = data.enable === 1 ? '开启成功' : '关闭成功';
|
||||
uni.showToast({
|
||||
title: tipText,
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
// 报警模式
|
||||
setUsrToggle() {
|
||||
@ -557,22 +688,48 @@
|
||||
},
|
||||
// 播放语音
|
||||
openVolume(item, index) {
|
||||
if (item) {
|
||||
console.log(item.key, 'keyyy');
|
||||
this.formData.sta_VoiceType = item.key;
|
||||
} else if (index === '8') { // 点击“播放语音”的场景
|
||||
this.formData.sta_VoiceType = '8';
|
||||
|
||||
if (!item) {
|
||||
item = this.dic.sta_VoiceType[index];
|
||||
}
|
||||
let val = item.key;
|
||||
if (this.formData.sta_VoiceType === val) {
|
||||
val = '-1';
|
||||
}
|
||||
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) {
|
||||
console.log(this.deviceInfo, '44444');
|
||||
console.log(item, 'tent');
|
||||
const isClose = item === 0;
|
||||
if (!this.Status) this.Status = {};
|
||||
if (!this.Status.Pop) this.Status.Pop = {
|
||||
showPop: false
|
||||
};
|
||||
//弹窗配置
|
||||
|
||||
// 弹窗配置
|
||||
this.Status.Pop = {
|
||||
...this.Status.Pop,
|
||||
showPop: true,
|
||||
@ -583,11 +740,32 @@
|
||||
showCancel: true,
|
||||
buttonCancelText: '取消',
|
||||
okCallback: () => {
|
||||
this.formData.sta_SOSType = item;
|
||||
console.log(this.formData.sta_SOSType, 'this.formData.sta_SOSType');
|
||||
this.formData.sta_SOSType = isClose ? 0 : 1;
|
||||
const data = {
|
||||
deviceIds: [this.deviceInfo.deviceId],
|
||||
// 声光报警开关:关闭传0,开启传1
|
||||
voiceStrobeAlarm: isClose ? 0 : 1,
|
||||
mode: this.formData.sta_VoiceType
|
||||
};
|
||||
deviceForceAlarmActivation(data).then((res) => {
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: isClose ? '声光报警已解除' : '强制报警已开启',
|
||||
icon: 'none'
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}).catch((err) => {
|
||||
uni.showToast({
|
||||
title: '请求失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
},
|
||||
@ -597,7 +775,6 @@
|
||||
bleStateBreak() {},
|
||||
bleStateRecovry() {},
|
||||
previewImg(img) {},
|
||||
|
||||
bleValueNotify: function(receive, device, path, recArr) { //订阅消息
|
||||
if (receive.deviceId !== this.formData.deviceId) {
|
||||
return;
|
||||
@ -792,7 +969,7 @@
|
||||
border-radius: 16rpx;
|
||||
background: rgba(26, 26, 26, 1);
|
||||
box-sizing: border-box;
|
||||
padding: 14rpx 0rpx;
|
||||
padding: 15rpx 0rpx 40rpx 0rpx;
|
||||
}
|
||||
|
||||
.eqinfo .item {
|
||||
@ -824,11 +1001,18 @@
|
||||
font-family: PingFang SC;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
|
||||
letter-spacing: 0.07px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.eqinfo .info-value {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
|
||||
.eqinfo .status-running {
|
||||
color: rgba(174, 214, 0, 1);
|
||||
}
|
||||
|
||||
.lamp {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
@ -27,8 +27,8 @@
|
||||
</view>
|
||||
<view class="itemRight ">
|
||||
<view class="btn" @click.stop="Apply(item,index)"
|
||||
:class="{'active':item.isApply,'btn-default':!item.isApply}">
|
||||
{{item.isApply ?'使用中':'使用'}}
|
||||
:class="{'active':item.useStatus,'btn-default':!item.useStatus}">
|
||||
{{item.useStatus==1 ?'使用中':'使用'}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="clear"></view>
|
||||
@ -94,7 +94,8 @@
|
||||
import {
|
||||
deviceVoliceList,
|
||||
videRenameAudioFile,
|
||||
deviceDeleteAudioFile
|
||||
deviceDeleteAudioFile,
|
||||
deviceUpdateVoice
|
||||
} from '@/api/100J/HBY100-J.js'
|
||||
import {
|
||||
showLoading,
|
||||
@ -185,9 +186,6 @@
|
||||
createTime: "", //创建时间
|
||||
fileUrl: "", //本地地址
|
||||
fileUrl: "", //网络地址
|
||||
statu: "", //状态,是否公开
|
||||
isApply: "" //是否使用中
|
||||
|
||||
},
|
||||
cPlay: {
|
||||
Id: "", //编号
|
||||
@ -195,8 +193,6 @@
|
||||
createTime: "", //创建时间
|
||||
fileUrl: "", //本地地址
|
||||
fileUrl: "", //网络地址
|
||||
statu: "", //状态,是否公开
|
||||
isApply: "" //是否使用中
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -208,7 +204,7 @@
|
||||
console.log(rec, 'ressss');
|
||||
this.blue = rec.ble;
|
||||
this.device = rec.data;
|
||||
this.getinitData(rec.data.deviceId,true)
|
||||
this.getinitData(rec.data.deviceId, true)
|
||||
});
|
||||
|
||||
},
|
||||
@ -220,7 +216,7 @@
|
||||
},
|
||||
methods: {
|
||||
//语音管理列表
|
||||
getinitData(val,isLoadMore = false) {
|
||||
getinitData(val, isLoadMore = false) {
|
||||
let data = {
|
||||
deviceId: this.device.deviceId
|
||||
}
|
||||
@ -456,40 +452,56 @@
|
||||
}
|
||||
},
|
||||
Apply(item, index) {
|
||||
if (item.isApply) {
|
||||
return;
|
||||
console.log(item, 'itemmm');
|
||||
let data = {
|
||||
id: item.id
|
||||
}
|
||||
let task = () => {
|
||||
let fileList = uni.getStorageSync(Common.audioStorageKey);
|
||||
for (let i = 0; i < these.dataListA.length; i++) {
|
||||
let ele = these.dataListA[i];
|
||||
if (i === index) {
|
||||
these.$set(these.dataListA[index], "isApply", true);
|
||||
fileList.find(v => {
|
||||
if (!v.devices) {
|
||||
v.devices = [];
|
||||
}
|
||||
if (v.Id == ele.Id) {
|
||||
v.devices.push(these.device.id);
|
||||
return true;
|
||||
} else {
|
||||
for (let j = 0; j < v.devices.length; j++) {
|
||||
if (v.devices[j] === these.device.id) {
|
||||
v.devices.splice(j, 1);
|
||||
break
|
||||
};
|
||||
}
|
||||
}
|
||||
return false;
|
||||
deviceUpdateVoice(data).then((RES) => {
|
||||
if (RES.code == 200) {
|
||||
uni.showToast({
|
||||
title: RES.msg,
|
||||
icon: 'none',
|
||||
duration: 1000
|
||||
});
|
||||
} else {
|
||||
these.$set(these.dataListA[i], "isApply", false);
|
||||
}
|
||||
}
|
||||
console.log("状态修改完成");
|
||||
eventChannel.emit('audioApply', item.Id);
|
||||
// eventChannel.emit('audioApply', item.Id);
|
||||
console.log("返回上一页");
|
||||
setTimeout(()=>{
|
||||
uni.navigateBack();
|
||||
},1000)
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
let task = () => {
|
||||
//let fileList = uni.getStorageSync(Common.audioStorageKey);
|
||||
// for (let i = 0; i < these.dataListA.length; i++) {
|
||||
// let ele = these.dataListA[i];
|
||||
// if (i === index) {
|
||||
// these.$set(these.dataListA[index], "isApply", true);
|
||||
// fileList.find(v => {
|
||||
// if (!v.devices) {
|
||||
// v.devices = [];
|
||||
// }
|
||||
// if (v.Id == ele.Id) {
|
||||
// v.devices.push(these.device.id);
|
||||
// return true;
|
||||
// } else {
|
||||
// for (let j = 0; j < v.devices.length; j++) {
|
||||
// if (v.devices[j] === these.device.id) {
|
||||
// v.devices.splice(j, 1);
|
||||
// break
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// });
|
||||
// } else {
|
||||
// these.$set(these.dataListA[i], "isApply", false);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
},
|
||||
closePop: function() {
|
||||
|
||||
@ -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 => {
|
||||
// 离线设备不修改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 = {
|
||||
// 获取当前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)
|
||||
}
|
||||
} catch (error) {
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: error.message,
|
||||
title: registerRes.msg || '状态查询失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('报警操作异常:', error);
|
||||
uni.showToast({
|
||||
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;
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@
|
||||
addCode() {
|
||||
debugger;
|
||||
if (!this.formData.inputCode) {
|
||||
MsgWarning("请输入条码","确定", this);
|
||||
MsgWarning("请输入二维码内容","确定", this);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@
|
||||
if (res && res.code == 200) {
|
||||
console.log("res=", res);
|
||||
let data = res.data;
|
||||
this.serverDevice = data;
|
||||
|
||||
if (data && data.id) {
|
||||
resolve(data);
|
||||
return;
|
||||
|
||||
@ -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' }">
|
||||
|
||||
@ -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 = [];
|
||||
|
||||
Reference in New Issue
Block a user