设备发送

This commit is contained in:
fengerli
2025-08-14 16:05:16 +08:00
parent a773823c3f
commit 9bac0995a3
3 changed files with 1363 additions and 1357 deletions

View File

@ -66,7 +66,6 @@
data() {
return {
deviceList: [],
messageToSend: '', //发送信息
showPopupFlag: false,
popupTitle: '',
popupMessage: '确认要对所选设备开启强制报警?',
@ -88,12 +87,12 @@
* @param {string} batchId - 批次ID
* @param {number} [interval=1000] - 轮询间隔(毫秒)
*/
async getdeviceSTatus(val, batchId, interval =800) {
async getdeviceSTatus(val, batchId, interval = 800) {
let retries = 0;
const checkStatus = async () => {
try {
const data = {
functionMode: val, //批量的传2
functionMode: val, //批量的传2
batchId: batchId,
typeName: this.sendInfo.typeName,
deviceImei: this.sendInfo.deviceImei
@ -163,7 +162,6 @@
// 强制报警
forceAlarm() {
const selectedDevices = this.deviceList.filter(item => item.checked)
const deviceIds = selectedDevices.map(item => item.id);
if (selectedDevices.length === 0) {
uni.showToast({
title: '请选择一个设备',
@ -192,25 +190,25 @@
this.showPopupFlag = true;
this.pendingAlarmAction = 0
},
async sendAlarmCommand(type) {
// 确认
async sendAlarmCommand() {
const selectedDevices = this.deviceList.filter(item => item.checked);
const deviceIds = selectedDevices.map(item => item.id);
const deviceImeiList = selectedDevices.map(item => item.deviceImei);
let loadingShown = false;
const isAlarming = this.pendingAlarmAction == 1;
try {
uni.showLoading({
title: '报警中...',
title: isAlarming ? '设备报警中...' : '解除报警中...',
mask: true
});
loadingShown = true;
// 2. 准备请求数据
const batchId = generateShortId();
const data = {
sendMsg: this.messageToSend,
deviceIds: deviceIds,
batchId: batchId,
typeName: this.sendInfo.typeName,
deviceImeiList: deviceImeiList
deviceImeiList: deviceImeiList,
instructValue: this.pendingAlarmAction == 1 ? '1' : '0'
};
// 3.人员信息
const registerRes = await deviceSendAlarmMessage(data);

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
<uni-swipe-action-item :right-options="Options"
@click="handleSwipeClick($event, item, index)" class="device-card"
:style="{ border: item.communicationMode==0 && item.onlineStatus==0 && item.alarmStatus==1 ? '1px solid rgba(224, 52, 52, 1)' : 'none' }">
:style="{ border: item.communicationMode==0 && item.onlineStatus==1 && item.alarmStatus==1 ? '1px solid rgba(224, 52, 52, 1)' : 'none' }">
<view @click.stop="handleFile(item)">
<view class="device-header">
<view class="deviceIMG">
@ -54,7 +54,7 @@
</view>
</view>
<view class="device-callpolice"
v-if="item.communicationMode==0 && item.onlineStatus==0 && item.alarmStatus==1">
v-if="item.communicationMode==0 && item.onlineStatus==1 && item.alarmStatus==1">
报警中</view>
<view v-if="item.communicationMode==1">
<view class="device-status online">已连接</view>