Files
app-govern/pages/device/list.vue

106 lines
2.9 KiB
Vue
Raw Normal View History

2023-02-01 16:59:32 +08:00
<template>
2023-08-02 09:10:45 +08:00
<Cn-page :loading="loading">
<view slot="body">
<view class="device-list device">
<Cn-empty v-if="projectList.length == 0"></Cn-empty>
<template v-else>
<uni-card
2023-08-10 09:18:17 +08:00
:title="item.name"
2023-08-02 09:10:45 +08:00
:sub-title="item.projectName"
2023-08-24 15:35:45 +08:00
:extra="item.mac"
2023-08-02 09:10:45 +08:00
padding="0"
v-for="(item, index) in projectList"
:key="index"
@click="jump(item)"
2023-08-11 11:03:31 +08:00
:thumbnail="deviceIcon(item.runStatus)"
2023-08-02 09:10:45 +08:00
>
</uni-card>
<uni-load-more status="nomore"></uni-load-more>
</template>
2023-02-01 16:59:32 +08:00
</view>
</view>
</Cn-page>
</template>
<script>
export default {
2023-08-02 09:10:45 +08:00
data() {
2023-02-01 16:59:32 +08:00
return {
loading: false,
current: 0,
items: ['正常', '报警', '离线'],
styleType: 'text',
activeColor: '#007aff',
2023-08-02 09:10:45 +08:00
content: [
{
iconPath: '/static/add.png',
text: '添加 ',
},
],
projectList: [],
2023-02-01 16:59:32 +08:00
}
},
methods: {
2023-08-11 11:03:31 +08:00
deviceIcon(e) {
let str = ''
switch (e) {
case 1:
str = '/static/device_bad.png'
break
case 2:
str = '/static/device.png'
break
default:
str = '/static/device.png'
break
}
return str
},
2023-08-02 09:10:45 +08:00
onClickItem(e) {
2023-02-01 16:59:32 +08:00
this.current = e.currentIndex
},
2023-08-02 09:10:45 +08:00
jump(item) {
2023-02-15 16:32:21 +08:00
uni.navigateTo({
2023-08-11 11:03:31 +08:00
url: '/pages/device/APF/detail?id=' + item.id + '&isPrimaryUser=0',
2023-02-15 16:32:21 +08:00
})
},
2023-08-02 09:10:45 +08:00
trigger(e) {
2023-02-01 16:59:32 +08:00
if (e.index === 0) {
uni.navigateTo({
2023-08-02 09:10:45 +08:00
url: '/pages/device/new',
2023-02-01 16:59:32 +08:00
})
}
2023-08-02 09:10:45 +08:00
},
},
onLoad(options) {
this.projectList = JSON.parse(decodeURIComponent(options.projectList))
console.log(this.projectList);
switch (options.type) {
case 'alarmLineDevs':
uni.setNavigationBarTitle({
title: '报警设备',
})
break
case 'offLineDevs':
uni.setNavigationBarTitle({
title: '离线设备',
})
break
2023-02-01 16:59:32 +08:00
}
2023-08-02 09:10:45 +08:00
},
2023-02-01 16:59:32 +08:00
}
</script>
2023-08-02 09:10:45 +08:00
<style lang="scss">
2023-02-01 16:59:32 +08:00
.device-list {
2023-08-10 09:18:17 +08:00
padding-top: 20rpx;
2023-02-01 16:59:32 +08:00
.header {
position: sticky;
top: 0;
left: 0;
z-index: 10;
background: #fff;
padding: 10rpx 20rpx 20rpx;
box-shadow: 0 0 10rpx #eee;
}
}
2023-08-02 09:10:45 +08:00
</style>