优化设备控制,提交后,实时获取设备返回状态信息
This commit is contained in:
@ -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 ? '1px solid rgba(224, 52, 52, 1)' : 'none' }">
|
||||
:style="{ border: item.communicationMode==0 && item.onlineStatus==0 && 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,8 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="device-callpolice"
|
||||
v-if="item.communicationMode==0 && item.onlineStatus==0">报警中</view>
|
||||
v-if="item.communicationMode==0 && item.onlineStatus==0 && item.alarmStatus==1">
|
||||
报警中</view>
|
||||
<view v-if="item.communicationMode==1">
|
||||
<view class="device-status online">已连接</view>
|
||||
<view class="device-status unline">未连接</view>
|
||||
@ -144,6 +145,10 @@
|
||||
deviceReName
|
||||
} from '@/api/common/index.js'
|
||||
export default {
|
||||
onPullDownRefresh() {
|
||||
// 执行下拉刷新时的操作,比如重新获取数据
|
||||
this.onIntall();
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
navBarHeight: 70 + uni.getSystemInfoSync().statusBarHeight,
|
||||
@ -313,16 +318,18 @@
|
||||
this.showTooltip = false; // 关闭弹窗
|
||||
switch (item.action) {
|
||||
case 'scan':
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/common/scan/scan'
|
||||
// });
|
||||
// 扫一扫
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
console.log('条码内容:' + res.result);
|
||||
console.log('条码内容:', res);
|
||||
// 清除之前的数据
|
||||
this.previousScanResult = null;
|
||||
// 处理新的扫码结果
|
||||
const cleanedResult = res.result.trim();
|
||||
console.log('扫码结果:', cleanedResult);
|
||||
// 跳转并传递扫描结果
|
||||
uni.navigateTo({
|
||||
url: `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(res.result)}`
|
||||
url: `/pages/common/qrcode/qrcode?deviceId=${encodeURIComponent(cleanedResult)}`
|
||||
});
|
||||
},
|
||||
fail: (err) => {
|
||||
@ -438,7 +445,7 @@
|
||||
},
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('devicePolice', {
|
||||
data: deviceType
|
||||
data: currentTab
|
||||
});
|
||||
}
|
||||
})
|
||||
@ -455,7 +462,8 @@
|
||||
},
|
||||
success: (res) => {
|
||||
res.eventChannel.emit('deviceSend', {
|
||||
data: deviceType
|
||||
//data: deviceType,
|
||||
data: currentTab
|
||||
});
|
||||
}
|
||||
})
|
||||
@ -526,7 +534,12 @@
|
||||
onIntall() {
|
||||
this.page = 1;
|
||||
this.finished = false;
|
||||
this.getData(this.deviceType); // 重新加载第一页数据
|
||||
const deviceType = this.activeTabInfo?.id === '' ? undefined : this.activeTabInfo?.id;
|
||||
this.getData(deviceType); // 重新加载第一页数据
|
||||
setTimeout(() => {
|
||||
// 停止下拉刷新动画
|
||||
uni.stopPullDownRefresh();
|
||||
}, 800);
|
||||
},
|
||||
updateDeviceStatus(data) {
|
||||
this.deviceList = this.deviceList
|
||||
|
Reference in New Issue
Block a user