设备发送

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