发送信息列表接口联调,

This commit is contained in:
fengerli
2025-07-16 11:33:26 +08:00
parent f3a3778452
commit 80dd83bb3d
4 changed files with 85 additions and 28 deletions

View File

@ -11,14 +11,17 @@
<view class="device-content">
<view class="device-header">
<view class="deviceIMG">
<image src="/static/images/device.png" mode="" class="IMG"></image>
<image :src="item.devicePic" mode="" class="IMG"></image>
</view>
<view class="device-name">
<view>设备:001-00</view>
<view class="ID">ID:{{ item.id }}</view>
<view>设备:{{item.deviceName}}</view>
<view class="ID">ID:{{ item.deviceImei }}</view>
</view>
</view>
<view class="device-status online">已连接</view>
<view class="" v-if="item.communicationMode==1">
<view class="device-status online">已连接</view>
<view class="device-status unline">未连接</view>
</view>
<view class="device-info">
<text class="onlines">在线</text>
<text class="line"></text>
@ -39,14 +42,13 @@
</template>
<script>
import {
deviceInfo,
} from '@/api/common/index.js'
export default {
data() {
return {
deviceList: Array(6).fill().map((_, i) => ({
id: `1321615${i}`,
checked: false,
showConfirm: false
})),
deviceList:[],
}
},
methods: {
@ -61,8 +63,40 @@
title: `已发送到${selectedDevices.length}台设备`,
icon: 'success'
})
}
}
},
// 获取设备列表
getData(deviceType) {
this.loading = true;
let data = {
pageNum: 1,
pageSize: 50,
deviceType:deviceType
}
deviceInfo(data).then((res) => {
if (res.code == 200) {
const newDevices = res.rows.map(device => ({
...device,
showConfirm: false,
checked:false
}));
this.total = res.total;
this.deviceList =newDevices
}
}).finally(() => {
this.loading = false;
});
},
},
onLoad(options) {
const eventChannel = this.getOpenerEventChannel();
// 监听 'deviceSend' 事件,获取传过来的数据
eventChannel.on('deviceSend', (data) => {
console.log('Received detail data:', data);
this.getData(data.data)
});
// 如果需要向调用页面返回数据,可以触发 'ack' 事件
eventChannel.emit('ack', {})
},
}
</script>
@ -146,7 +180,9 @@
.online {
color: rgb(187, 230, 0);
}
.unline {
color: rgba(255, 255, 255, 0.4);
}
.device-info {
display: flex;
justify-content: space-evenly;