|
|
@@ -8,7 +8,7 @@ |
|
|
|
<template> |
|
|
|
<div classs="device-setting"> |
|
|
|
<div class="tree-select"> |
|
|
|
<van-tree-select :items="settingItems" :main-active-index.sync="active" :height="clientHeight" @click-nav="onCkickNav"> |
|
|
|
<van-tree-select :items="settingItems" :main-active-index.sync="active" :height="clientHeight" @click-nav="onCkickNav"> |
|
|
|
<template #content> |
|
|
|
<div class="item" v-for="(item, index) in settingItems" :key="index" v-show="item.index === active"> |
|
|
|
<div class="item-setting" v-for="(child, index) in item.data" :key="index"> |
|
|
@@ -36,7 +36,7 @@ export default { |
|
|
|
return { |
|
|
|
active: 0, |
|
|
|
settingItems: [ |
|
|
|
{ text: '设备状态', index: 0, data: [],}, |
|
|
|
{ text: '设备状态', index: 0, data: [], className: '',}, |
|
|
|
{ text: '监护角色', index: 1, data: [],}, |
|
|
|
{ text: '场景模式', index: 2, data: []}, |
|
|
|
{ text: '加强省电模式', index: 3, data: []}, |
|
|
@@ -63,6 +63,7 @@ export default { |
|
|
|
created() { |
|
|
|
this.getAuth(); |
|
|
|
this.getUrlQueryParams(); |
|
|
|
this.loadRequest(); |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
/* this.$toast.loading({message: "加载中"}); |
|
|
@@ -78,8 +79,6 @@ export default { |
|
|
|
this.clientHeight = document.documentElement.clientHeight; |
|
|
|
this.active = Number(this.$store.getters.active) || 0; |
|
|
|
this.$toast.success({message: "加载完成"}); */ |
|
|
|
//this.loadRequest(); |
|
|
|
this.loadRequest(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 加载接口 |
|
|
@@ -652,6 +651,7 @@ export default { |
|
|
|
return item.index === index |
|
|
|
}); |
|
|
|
if(data.code === 200) { |
|
|
|
this.settingItems[findIndex].className = this.calcDeviceStatus(data.data.data.status, true); |
|
|
|
this.settingItems[findIndex].text = `设备状态(${this.calcDeviceStatus(data.data.data.status)})`; |
|
|
|
} else { |
|
|
|
this.settingItems[findIndex].text = `设备状态(无数据)`; |
|
|
@@ -661,24 +661,29 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 计算设备状态 |
|
|
|
calcDeviceStatus(status) { |
|
|
|
calcDeviceStatus(status, isCallClass) { |
|
|
|
let result = '' |
|
|
|
let className = ''; |
|
|
|
switch(status) { |
|
|
|
case 'ONLINE': |
|
|
|
result = '在线'; |
|
|
|
className = 'device-status-online'; |
|
|
|
break; |
|
|
|
case 'OFFLINE': |
|
|
|
result = '离线'; |
|
|
|
className = 'device-status-other'; |
|
|
|
break; |
|
|
|
case 'UNACTIVE': |
|
|
|
result = '未激活'; |
|
|
|
className = 'device-status-other'; |
|
|
|
break; |
|
|
|
case 'DISABLE': |
|
|
|
result = '已禁用'; |
|
|
|
className = 'device-status-other'; |
|
|
|
break; |
|
|
|
default: break; |
|
|
|
}; |
|
|
|
return result; |
|
|
|
return isCallClass ? className : result; |
|
|
|
}, |
|
|
|
// 点击左边树形图 |
|
|
|
onCkickNav(value) { |
|
|
@@ -751,6 +756,16 @@ export default { |
|
|
|
.van-tree-select__nav-item { |
|
|
|
padding: 15px 5px !important; |
|
|
|
} |
|
|
|
.device-status-other { |
|
|
|
.van-sidebar-item__text { |
|
|
|
color: red !important; |
|
|
|
} |
|
|
|
} |
|
|
|
.device-status-online { |
|
|
|
.van-sidebar-item__text { |
|
|
|
color: green !important; |
|
|
|
} |
|
|
|
} |
|
|
|
.van-tree-select__content { |
|
|
|
padding: 5px; |
|
|
|
} |
|
|
@@ -760,6 +775,7 @@ export default { |
|
|
|
.van-tree-select__content { |
|
|
|
@include center(); |
|
|
|
} |
|
|
|
|
|
|
|
</style> |
|
|
|
<style scoped lang="scss"> |
|
|
|
@import "./index.scss"; |
|
|
|