2023-02-09 08:50:01 +08:00
|
|
|
<template>
|
2023-02-23 08:44:46 +08:00
|
|
|
<view class="index-zhuyonghu">
|
2023-02-09 08:50:01 +08:00
|
|
|
<div class="header">
|
|
|
|
|
<div class="header-item">
|
|
|
|
|
<div class="header-item-value">3</div>
|
|
|
|
|
<div class="header-item-label">正常设备</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="header-item">
|
|
|
|
|
<div class="header-item-value">1</div>
|
|
|
|
|
<div class="header-item-label">报警设备</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="header-item">
|
|
|
|
|
<div class="header-item-value">0</div>
|
|
|
|
|
<div class="header-item-label">离线设备</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-03-01 10:51:00 +08:00
|
|
|
<!-- <view style="padding:20rpx 20rpx 0">
|
2023-02-28 16:39:58 +08:00
|
|
|
<Cn-grid title="常用功能">
|
|
|
|
|
<Cn-grid-item src="/static/device2.png" text="设备注册" @click="registerDevice"></Cn-grid-item>
|
|
|
|
|
<Cn-grid-item src="/static/gateway2.png" text="网关注册" @click="registerGateway"></Cn-grid-item>
|
2023-02-23 08:44:46 +08:00
|
|
|
</Cn-grid>
|
2023-03-01 10:51:00 +08:00
|
|
|
</view> -->
|
2023-02-23 08:44:46 +08:00
|
|
|
<view class="nav">
|
2023-02-28 14:03:38 +08:00
|
|
|
<picker @change="projectNameChange" :value="select.projectNameIndex" :range="projectList" range-key="text">
|
|
|
|
|
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectName }">{{
|
|
|
|
|
select.projectName || '项目' }} </view>
|
|
|
|
|
</picker>
|
|
|
|
|
<picker @change="projectTypeChange" :value="select.projectTypeIndex" :range="projectType" range-key="text">
|
|
|
|
|
<view class="nav-menu" :class="{ 'nav-menu-active': select.projectType }">{{
|
|
|
|
|
select.projectType || '类型' }} </view>
|
|
|
|
|
</picker>
|
2023-02-23 08:44:46 +08:00
|
|
|
</view>
|
|
|
|
|
<view class="content device" :style="{ minHeight: minHeight }">
|
|
|
|
|
<uni-card :title="item.name" :sub-title="item.project" :extra="item.type" padding="0"
|
|
|
|
|
v-for="(item, index) in deviceListFilter" :key="index" @click="jump(item)" thumbnail="/static/device.png">
|
|
|
|
|
<!-- <text>{{ item.project }} {{ item.type }}</text> -->
|
|
|
|
|
</uni-card>
|
|
|
|
|
<uni-load-more status="nomore"></uni-load-more>
|
|
|
|
|
</view>
|
2023-02-09 08:50:01 +08:00
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
2023-02-23 08:44:46 +08:00
|
|
|
loading: false,
|
2023-02-28 14:03:38 +08:00
|
|
|
select: {
|
|
|
|
|
projectName: '',
|
|
|
|
|
projectNameIndex: 0,
|
|
|
|
|
projectType: '',
|
|
|
|
|
projectTypeIndex: 0
|
|
|
|
|
},
|
|
|
|
|
projectType: [
|
2023-02-23 08:44:46 +08:00
|
|
|
{
|
2023-02-28 14:03:38 +08:00
|
|
|
text: '全部类型',
|
|
|
|
|
value: 0
|
2023-02-23 08:44:46 +08:00
|
|
|
},
|
|
|
|
|
{
|
2023-02-28 14:03:38 +08:00
|
|
|
text: '监测',
|
|
|
|
|
value: 1
|
2023-02-23 08:44:46 +08:00
|
|
|
},
|
|
|
|
|
{
|
2023-02-28 14:03:38 +08:00
|
|
|
text: '用能',
|
|
|
|
|
value: 2
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: '环境',
|
|
|
|
|
value: 3
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: '安防',
|
|
|
|
|
value: 4
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: '其他',
|
|
|
|
|
value: 5
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
projectList: [
|
|
|
|
|
{
|
|
|
|
|
text: '全部项目',
|
|
|
|
|
value: 1
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: 'XXX项目1',
|
|
|
|
|
value: 1
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: 'XXX项目2',
|
|
|
|
|
value: 1
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: 'XXX项目3',
|
|
|
|
|
value: 1
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
navHeight: 0,
|
|
|
|
|
minHeight: '',
|
|
|
|
|
deviceList: [
|
|
|
|
|
{
|
|
|
|
|
name: '设备APF-1',
|
|
|
|
|
des: '设备描述1',
|
|
|
|
|
type: '监测',
|
|
|
|
|
project: 'XXX项目1',
|
2023-02-23 08:44:46 +08:00
|
|
|
},
|
|
|
|
|
{
|
2023-02-28 14:03:38 +08:00
|
|
|
name: '设备APF-2',
|
|
|
|
|
des: '设备描述1',
|
|
|
|
|
type: '监测',
|
|
|
|
|
project: 'XXX项目1',
|
2023-02-23 08:44:46 +08:00
|
|
|
},
|
|
|
|
|
{
|
2023-02-28 14:03:38 +08:00
|
|
|
name: '设备APF-3',
|
|
|
|
|
des: '设备描述2',
|
|
|
|
|
type: '用能',
|
|
|
|
|
project: 'XXX项目2'
|
2023-02-23 08:44:46 +08:00
|
|
|
},
|
|
|
|
|
{
|
2023-02-28 14:03:38 +08:00
|
|
|
name: '设备DVR-1',
|
|
|
|
|
des: '设备描述3',
|
|
|
|
|
type: '监测',
|
|
|
|
|
project: 'XXX项目3'
|
2023-02-23 08:44:46 +08:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
deviceListFilter () {
|
2023-02-28 14:03:38 +08:00
|
|
|
return this.deviceList.filter(item => {
|
|
|
|
|
if (this.select.projectName) {
|
|
|
|
|
return item.project === this.select.projectName
|
|
|
|
|
} else if (this.select.projectType) {
|
|
|
|
|
return item.type === this.select.projectType
|
|
|
|
|
} else {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
})
|
2023-02-09 08:50:01 +08:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2023-03-01 08:48:52 +08:00
|
|
|
submitFeedBack () {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/device/feedback'
|
|
|
|
|
})
|
|
|
|
|
},
|
2023-02-28 14:03:38 +08:00
|
|
|
projectTypeChange (e) {
|
|
|
|
|
// 重置name
|
|
|
|
|
this.select.projectName = ''
|
|
|
|
|
this.select.projectNameIndex = 0
|
|
|
|
|
|
|
|
|
|
this.select.projectTypeIndex = e.detail.value
|
|
|
|
|
if (e.detail.value === 0) {
|
|
|
|
|
this.select.projectType = ''
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.select.projectType = this.projectType[e.detail.value].text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
projectNameChange (e) {
|
|
|
|
|
console.log(e);
|
|
|
|
|
// 重置type
|
|
|
|
|
this.select.projectType = ''
|
|
|
|
|
this.select.projectTypeIndex = 0
|
|
|
|
|
|
|
|
|
|
this.select.projectNameIndex = e.detail.value
|
|
|
|
|
if (e.detail.value === 0) {
|
|
|
|
|
this.select.projectName = ''
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.select.projectName = this.projectList[e.detail.value].text
|
|
|
|
|
},
|
2023-02-23 08:44:46 +08:00
|
|
|
registerDevice () {
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: '提示',
|
|
|
|
|
content: '请选择设备类型',
|
|
|
|
|
confirmText: '直连装置',
|
|
|
|
|
cancelText: '网关接入',
|
|
|
|
|
cancelColor: '#007aff',
|
|
|
|
|
success: ({ confirm, cancel }) => {
|
|
|
|
|
if (confirm) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/device/new'
|
|
|
|
|
})
|
|
|
|
|
} else if (cancel) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/gateway/list'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
registerGateway () {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: '/pages/gateway/new'
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
navMenuClick (index) {
|
|
|
|
|
this.navMenuActive = index
|
|
|
|
|
},
|
2023-02-09 16:37:53 +08:00
|
|
|
jump (item) {
|
2023-02-28 14:03:38 +08:00
|
|
|
if (item.name.indexOf('APF') > -1) {
|
2023-02-23 08:44:46 +08:00
|
|
|
uni.navigateTo({
|
2023-02-10 09:16:17 +08:00
|
|
|
url: '/pages/device/APF/detail'
|
2023-02-09 16:37:53 +08:00
|
|
|
})
|
2023-02-28 14:03:38 +08:00
|
|
|
} else if (item.name.indexOf('DVR') > -1) {
|
2023-02-09 16:37:53 +08:00
|
|
|
uni.navigateTo({
|
2023-02-10 09:16:17 +08:00
|
|
|
url: '/pages/device/DVR/detail'
|
2023-02-09 16:37:53 +08:00
|
|
|
})
|
|
|
|
|
}
|
2023-02-09 08:50:01 +08:00
|
|
|
},
|
2023-02-23 08:44:46 +08:00
|
|
|
},
|
|
|
|
|
mounted () {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
// 获取nav高度
|
|
|
|
|
uni.createSelectorQuery().select('.nav').boundingClientRect((rect) => {
|
|
|
|
|
this.navHeight = rect.height
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
this.minHeight = 'calc(100vh - env(safe-area-inset-bottom) - ' + (50 + this.navHeight) + 'px)'
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef APP-PLUS
|
|
|
|
|
this.minHeight = 'calc(100vh - ' + this.navHeight + 'px)'
|
|
|
|
|
// #endif
|
|
|
|
|
}).exec()
|
|
|
|
|
}, 1000);
|
2023-02-09 08:50:01 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2023-02-28 14:03:38 +08:00
|
|
|
<style lang='scss'></style>
|