地图打点动态数据加载,
This commit is contained in:
@ -35,11 +35,13 @@
|
||||
<!-- 强制报警提示弹框 -->
|
||||
<CustomPopup v-if="popupType === 'force'" :show="showPopupFlag" popupBorder="1rpx solid rgba(224, 52, 52, 0.3)"
|
||||
:message="popupMessage" icon="/static/images/6170/bj.png" :confirm-text="popupConfirmText"
|
||||
:show-cancel="false" @confirm="onPopupConfirm" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" />
|
||||
:show-cancel="false" @close="onclosePopup" @confirm="onPopupConfirm" confirmBtnBg="rgba(224, 52, 52, 1)"
|
||||
confirmBtnColor="#fff" />
|
||||
<!-- 解除报警 -->
|
||||
<CustomPopup v-if="popupType === 'cancel'" :show="showPopupFlag" popupBorder="1rpx solid rgba(224, 52, 52, 0.3)"
|
||||
:message="popupMessage" icon="/static/images/6170/svg.png" :confirm-text="popupConfirmText"
|
||||
:show-cancel="false" @confirm="onPopupConfirm" confirmBtnBg="rgba(224, 52, 52, 1)" confirmBtnColor="#fff" />
|
||||
:show-cancel="false" @close="onclosePopup" @confirm="onPopupConfirm" confirmBtnBg="rgba(224, 52, 52, 1)"
|
||||
confirmBtnColor="#fff" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -49,8 +51,8 @@
|
||||
deviceInfo,
|
||||
} from '@/api/common/index.js'
|
||||
import {
|
||||
deviceSendMessage
|
||||
} from '@/api/6170/deviceControl.js'
|
||||
deviceSendAlarmMessage
|
||||
} from '@/api/6170/callPolice.js'
|
||||
export default {
|
||||
components: {
|
||||
CustomPopup
|
||||
@ -64,6 +66,7 @@
|
||||
popupMessage: '确认要对所选设备开启强制报警?',
|
||||
popupConfirmText: '确认',
|
||||
popupType: 'force', // 'force' or 'cancel'
|
||||
pendingAlarmAction: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -72,6 +75,9 @@
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onclosePopup() {
|
||||
this.showPopupFlag = false
|
||||
},
|
||||
toggleSelect(index) {
|
||||
this.deviceList[index].checked = !this.deviceList[index].checked
|
||||
this.$forceUpdate()
|
||||
@ -122,6 +128,8 @@
|
||||
this.popupType = 'force';
|
||||
this.popupMessage = '确认要对所选设备开启强制报警?';
|
||||
this.showPopupFlag = true;
|
||||
this.pendingAlarmAction = 1
|
||||
|
||||
},
|
||||
// 解除报警
|
||||
cancelAlarm() {
|
||||
@ -136,6 +144,8 @@
|
||||
this.popupType = 'cancel';
|
||||
this.popupMessage = '确认要解除所选设备的报警状态?';
|
||||
this.showPopupFlag = true;
|
||||
this.pendingAlarmAction = 1
|
||||
|
||||
},
|
||||
sendAlarmCommand(type) {
|
||||
const selectedDevices = this.deviceList.filter(item => item.checked);
|
||||
@ -143,12 +153,20 @@
|
||||
|
||||
let data = {
|
||||
deviceIds: deviceIds,
|
||||
commandType: type // '强制或者解除'
|
||||
instructValue: this.pendingAlarmAction, // '强制或者解除'
|
||||
}
|
||||
|
||||
deviceSendMessage(data).then((res) => {
|
||||
deviceSendAlarmMessage(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.showPopupFlag = true;
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
});
|
||||
this.showPopupFlag = false
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
|
||||
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
@ -159,10 +177,8 @@
|
||||
},
|
||||
// 点击确认状态
|
||||
onPopupConfirm() {
|
||||
this.showPopupFlag = false
|
||||
uni.navigateBack()
|
||||
console.log('用户点击了确定')
|
||||
this.sendAlarmCommand(this.popupType);
|
||||
|
||||
// 处理确认逻辑
|
||||
},
|
||||
},
|
||||
|
@ -222,9 +222,9 @@
|
||||
<!-- 上传画面弹窗 -->
|
||||
<view class="agreement-popupC" @click.stop>
|
||||
<!-- 标题 -->
|
||||
<view class="popup-title">确认开启激光模式?</view>
|
||||
<view class="popup-title">{{ isLaserOn ? '确认关闭激光模式?' : '确认开启激光模式?' }}</view>
|
||||
<view class="popup-content">
|
||||
<view class="popup-Title">
|
||||
<view class="popup-Title" v-if="!isLaserOn">
|
||||
<view>注意事项</view>
|
||||
<view>1.禁止直视光源或反射面!</view>
|
||||
<view>2.避免直射人或易燃物!</view>
|
||||
@ -326,7 +326,7 @@
|
||||
file: '',
|
||||
selectedItemIndex: 0,
|
||||
popupType: 'person', //弹框类型
|
||||
timer: null
|
||||
isLaserOn: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -346,20 +346,13 @@
|
||||
// 添加调试日志
|
||||
uni.navigateTo({
|
||||
url: '/pages/common/map/index',
|
||||
success: (res) => {
|
||||
// 确保使用深拷贝
|
||||
const mapData = {
|
||||
deviceLocation: {
|
||||
longitude: String(item.longitude), // 强制转为字符串
|
||||
latitude: String(item.latitude),
|
||||
deviceImage: item.devicePic || '',
|
||||
deviceName: item.deviceImei || ''
|
||||
}
|
||||
}
|
||||
res.eventChannel.emit('MapData', JSON.parse(JSON.stringify(mapData)))
|
||||
events: {
|
||||
ack: function(data) {}
|
||||
},
|
||||
fail: (err) => {
|
||||
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('Map', {
|
||||
data: item
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -558,9 +551,10 @@
|
||||
},
|
||||
// 激光确认框提交
|
||||
handleBtn() {
|
||||
const instructValue = this.isLaserOn ? 0 : 1;
|
||||
let data = {
|
||||
deviceId: this.deviceID,
|
||||
instructValue: 1
|
||||
instructValue: instructValue
|
||||
}
|
||||
laserModeSettings(data).then((res) => {
|
||||
if (res.code == 200) {
|
||||
@ -568,6 +562,7 @@
|
||||
icon: 'none',
|
||||
title: res.msg
|
||||
})
|
||||
this.isLaserOn = !this.isLaserOn;
|
||||
this.lightModeC = false
|
||||
} else {
|
||||
uni.showToast({
|
||||
@ -885,7 +880,8 @@
|
||||
this.mqttClient.subscribe(statusTopic, (payload) => {
|
||||
console.log(`收到来自 ${statusTopic} 的消息:`, payload);
|
||||
//收到电量上报。延迟20s请求接口数据
|
||||
const parsedMessage = typeof payload === 'string' ? JSON.parse(payload) : payload;
|
||||
const parsedMessage = typeof payload === 'string' ? JSON.parse(payload) :
|
||||
payload;
|
||||
const deviceState = parsedMessage.state; // 直接取 state 数组
|
||||
// ✅ 发送全局事件通知主页面更新
|
||||
uni.$emit('deviceStatusUpdate', {
|
||||
@ -896,7 +892,7 @@
|
||||
setTimeout(() => {
|
||||
this.fetchDeviceDetail(data.data.id);
|
||||
}, 20000);
|
||||
|
||||
|
||||
// 这里判断电量低于20%,弹框提示
|
||||
if (this.deviceInfo.batteryPercentage < 20) {
|
||||
this.popupType = 'bettery'
|
||||
|
Reference in New Issue
Block a user