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

90 lines
2.5 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
:title="item.equipmentName"
:sub-title="item.projectName"
:extra="item.projectType"
padding="0"
v-for="(item, index) in projectList"
:key="index"
@click="jump(item)"
thumbnail="/static/device.png"
>
</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-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-02 09:10:45 +08:00
url: '/pages/device/APF/detail?id=' + item.equipmentId + '&isPrimaryUser=' + item.isPrimaryUser,
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 {
.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>