设备发送
This commit is contained in:
@ -66,7 +66,6 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
deviceList: [],
|
deviceList: [],
|
||||||
messageToSend: '', //发送信息
|
|
||||||
showPopupFlag: false,
|
showPopupFlag: false,
|
||||||
popupTitle: '',
|
popupTitle: '',
|
||||||
popupMessage: '确认要对所选设备开启强制报警?',
|
popupMessage: '确认要对所选设备开启强制报警?',
|
||||||
@ -163,7 +162,6 @@
|
|||||||
// 强制报警
|
// 强制报警
|
||||||
forceAlarm() {
|
forceAlarm() {
|
||||||
const selectedDevices = this.deviceList.filter(item => item.checked)
|
const selectedDevices = this.deviceList.filter(item => item.checked)
|
||||||
const deviceIds = selectedDevices.map(item => item.id);
|
|
||||||
if (selectedDevices.length === 0) {
|
if (selectedDevices.length === 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请选择一个设备',
|
title: '请选择一个设备',
|
||||||
@ -192,25 +190,25 @@
|
|||||||
this.showPopupFlag = true;
|
this.showPopupFlag = true;
|
||||||
this.pendingAlarmAction = 0
|
this.pendingAlarmAction = 0
|
||||||
},
|
},
|
||||||
async sendAlarmCommand(type) {
|
// 确认
|
||||||
|
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);
|
||||||
let loadingShown = false;
|
const isAlarming = this.pendingAlarmAction == 1;
|
||||||
try {
|
try {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '报警中...',
|
title: isAlarming ? '设备报警中...' : '解除报警中...',
|
||||||
mask: true
|
mask: true
|
||||||
});
|
});
|
||||||
loadingShown = true;
|
|
||||||
// 2. 准备请求数据
|
// 2. 准备请求数据
|
||||||
const batchId = generateShortId();
|
const batchId = generateShortId();
|
||||||
const data = {
|
const data = {
|
||||||
sendMsg: this.messageToSend,
|
|
||||||
deviceIds: deviceIds,
|
deviceIds: deviceIds,
|
||||||
batchId: batchId,
|
batchId: batchId,
|
||||||
typeName: this.sendInfo.typeName,
|
typeName: this.sendInfo.typeName,
|
||||||
deviceImeiList: deviceImeiList
|
deviceImeiList: deviceImeiList,
|
||||||
|
instructValue: this.pendingAlarmAction == 1 ? '1' : '0'
|
||||||
};
|
};
|
||||||
// 3.人员信息
|
// 3.人员信息
|
||||||
const registerRes = await deviceSendAlarmMessage(data);
|
const registerRes = await deviceSendAlarmMessage(data);
|
||||||
|
@ -63,11 +63,9 @@
|
|||||||
{{ deviceInfo.address }}
|
{{ deviceInfo.address }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<view class="callpolice" v-if="deviceInfo.onlineStatus == 0 && deviceInfo.alarmStatus == 1">
|
<view class="callpolice" v-if="deviceInfo.onlineStatus == 1 && deviceInfo.alarmStatus == 1">
|
||||||
<view class="">设备强制报警中</view>
|
<view class="">设备强制报警中</view>
|
||||||
<view>
|
<view>
|
||||||
<uni-icons type="closeempty" size="15" color="rgba(255, 255, 255, 0.9)"
|
<uni-icons type="closeempty" size="15" color="rgba(255, 255, 255, 0.9)"
|
||||||
@ -78,8 +76,6 @@
|
|||||||
<text class="info-label">灯光亮度</text>
|
<text class="info-label">灯光亮度</text>
|
||||||
<text class="info-value status-running">{{ sliderValue }}%</text>
|
<text class="info-value status-running">{{ sliderValue }}%</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<!-- 灯光亮度控制 -->
|
<!-- 灯光亮度控制 -->
|
||||||
<view class="control-card" @touchstart="cardTouchStart" @touchmove="cardTouchMove"
|
<view class="control-card" @touchstart="cardTouchStart" @touchmove="cardTouchMove"
|
||||||
@touchend="cardTouchEnd">
|
@touchend="cardTouchEnd">
|
||||||
@ -164,8 +160,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="form-row">
|
<view class="form-row">
|
||||||
<input class="form-input1" maxlength="20" placeholder="请输入文字" v-model="messageToSend"
|
<input class="form-input1" maxlength="20" placeholder="请输入文字" v-model="messageToSend" />
|
||||||
@input="filterChinese" />
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 产品信息 -->
|
<!-- 产品信息 -->
|
||||||
@ -390,15 +385,6 @@
|
|||||||
};
|
};
|
||||||
return checkStatus();
|
return checkStatus();
|
||||||
},
|
},
|
||||||
filterChinese(e) {
|
|
||||||
const value = e.detail.value;
|
|
||||||
// 允许中文和常见中文标点
|
|
||||||
this.messageToSend = value.replace(/[^\u4e00-\u9fa5,。?!、;:“”‘’()【】《》…—]/g, '');
|
|
||||||
// 修复某些平台输入法兼容性问题
|
|
||||||
this.$nextTick(() => {
|
|
||||||
e.target.value = this.messageToSend;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 点击弹框外的区域关闭
|
// 点击弹框外的区域关闭
|
||||||
closePopup() {
|
closePopup() {
|
||||||
this.lightModeA = false;
|
this.lightModeA = false;
|
||||||
@ -422,12 +408,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 强制报警()
|
|
||||||
handlePolice() {
|
|
||||||
this.popupType = 'cancel';
|
|
||||||
this.popupMessage = '确认要解除所选设备的报警状态';
|
|
||||||
this.showPopupFlag = true;
|
|
||||||
},
|
|
||||||
// ***********进度条***********
|
// ***********进度条***********
|
||||||
cardTouchStart(e) {
|
cardTouchStart(e) {
|
||||||
if (!this.cardRect) return;
|
if (!this.cardRect) return;
|
||||||
@ -891,34 +872,61 @@
|
|||||||
this.isSending = false;
|
this.isSending = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 所有弹框,确定关闭按钮
|
||||||
onPopupConfirm() {
|
onPopupConfirm() {
|
||||||
this.showPopupFlag = false
|
this.showPopupFlag = false
|
||||||
},
|
},
|
||||||
// 解除报警
|
// 强制报警()
|
||||||
onPopupConfirmPolice() {
|
handlePolice() {
|
||||||
let data = {
|
this.popupType = 'cancel';
|
||||||
|
this.popupMessage = '确认要解除所选设备的报警状态';
|
||||||
|
this.showPopupFlag = true;
|
||||||
|
},
|
||||||
|
// 解除报警逻辑
|
||||||
|
async onPopupConfirmPolice() {
|
||||||
|
try {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '解除告警中...',
|
||||||
|
mask: true
|
||||||
|
});
|
||||||
|
// 2. 准备请求数据
|
||||||
|
const batchId = generateShortId();
|
||||||
|
const data = {
|
||||||
deviceIds: this.apiType === 'listA' ? [this.deviceID] : [this.itemInfo.deviceId],
|
deviceIds: this.apiType === 'listA' ? [this.deviceID] : [this.itemInfo.deviceId],
|
||||||
|
batchId: batchId,
|
||||||
|
typeName: this.itemInfo.typeName,
|
||||||
|
deviceImeiList: [this.itemInfo.deviceImei],
|
||||||
instructValue: 0, // '解除报警'
|
instructValue: 0, // '解除报警'
|
||||||
}
|
};
|
||||||
deviceSendAlarmMessage(data).then((res) => {
|
// 3.人员信息
|
||||||
if (res.code == 200) {
|
const registerRes = await deviceSendAlarmMessage(data);
|
||||||
|
if (registerRes.code !== 200) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: registerRes.msg,
|
||||||
|
icon: 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 4. 获取设备状态 ,批量的报警,解除报警,发送信息,都传2,单次的都传1
|
||||||
|
const statusRes = await this.getdeviceSTatus(2, batchId);
|
||||||
|
if (statusRes.data.functionAccess === 'OK') {
|
||||||
|
uni.showToast({
|
||||||
|
title: statusRes.msg,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
this.showPopupFlag = false
|
// 刷新详情接口
|
||||||
setTimeout(() => {
|
|
||||||
this.fetchDeviceDetail(this.deviceID);
|
this.fetchDeviceDetail(this.deviceID);
|
||||||
uni.$emit('deviceStatusUpdate', {});
|
uni.$emit('deviceStatusUpdate', {});
|
||||||
}, 500)
|
this.showPopupFlag = false
|
||||||
|
}
|
||||||
} else {
|
} catch (error) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: error.message,
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
},
|
},
|
||||||
// 发送文本消息
|
// 发送文本消息
|
||||||
async sendTextMessage() {
|
async sendTextMessage() {
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
|
<block v-for="(item, index) in deviceList" :key="index" :ref="'swipeItem_' + index">
|
||||||
<uni-swipe-action-item :right-options="Options"
|
<uni-swipe-action-item :right-options="Options"
|
||||||
@click="handleSwipeClick($event, item, index)" class="device-card"
|
@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 @click.stop="handleFile(item)">
|
||||||
<view class="device-header">
|
<view class="device-header">
|
||||||
<view class="deviceIMG">
|
<view class="deviceIMG">
|
||||||
@ -54,7 +54,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="device-callpolice"
|
<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>
|
||||||
<view v-if="item.communicationMode==1">
|
<view v-if="item.communicationMode==1">
|
||||||
<view class="device-status online">已连接</view>
|
<view class="device-status online">已连接</view>
|
||||||
|
Reference in New Issue
Block a user