|
|
@@ -5,6 +5,7 @@
|
|
|
<van-col span="24">
|
|
|
<org-tree v-model="search.orgId" @changeItem="changeTree" @checked="orgCheckChanged" showChecked></org-tree>
|
|
|
</van-col>
|
|
|
+ <!--
|
|
|
<van-col span="24">
|
|
|
<span v-for="opt in deviceTypeOptions" :key="opt.value" class="search-devicetype">
|
|
|
<van-button
|
|
|
@@ -16,14 +17,50 @@
|
|
|
{{ opt.text }}</van-button
|
|
|
>
|
|
|
</span>
|
|
|
- </van-col>
|
|
|
- <van-col span="24" class="search-state">
|
|
|
+ </van-col> -->
|
|
|
+ <!-- <van-col span="24" class="search-state">
|
|
|
<span @click="onStateChanged(1)" :class="`${search.state === 1 ? 'alarm_state_selected' : ''}`">{{
|
|
|
alarmButtonText
|
|
|
}}</span>
|
|
|
<span @click="onStateChanged(0)" :class="`${search.state === 0 ? 'alarm_state_selected' : ''}`">{{
|
|
|
normalButtonText
|
|
|
}}</span>
|
|
|
+ </van-col> -->
|
|
|
+ </van-row>
|
|
|
+ <van-row>
|
|
|
+ <van-col span="12">
|
|
|
+ <van-cell
|
|
|
+ title="设备类型"
|
|
|
+ @click="showDeviceType = true"
|
|
|
+ is-link
|
|
|
+ arrow-direction="down"
|
|
|
+ :value="defaultDeviceType"
|
|
|
+ />
|
|
|
+ <van-popup v-model="showDeviceType" round position="bottom">
|
|
|
+ <van-picker
|
|
|
+ title="设备类型"
|
|
|
+ show-toolbar
|
|
|
+ :columns="deviceTypeOptions"
|
|
|
+ @confirm="onDeviceTypeConfirm"
|
|
|
+ @cancel="onCancel"
|
|
|
+ default-index="0"
|
|
|
+ :close-on-click-overlay="false"
|
|
|
+ />
|
|
|
+ </van-popup>
|
|
|
+ </van-col>
|
|
|
+ <van-col span="12">
|
|
|
+ <van-cell title="状态" @click="showStatus = true" is-link arrow-direction="down" :value="defaultStatus" />
|
|
|
+ <van-popup v-model="showStatus" round position="bottom">
|
|
|
+ <van-picker
|
|
|
+ title="状态"
|
|
|
+ show-toolbar
|
|
|
+ :columns="statusOptions"
|
|
|
+ @confirm="onStatusConfirm"
|
|
|
+ @cancel="onCancel"
|
|
|
+ default-index="0"
|
|
|
+ :close-on-click-overlay="false"
|
|
|
+ />
|
|
|
+ </van-popup>
|
|
|
</van-col>
|
|
|
</van-row>
|
|
|
<div class="container">
|
|
|
@@ -47,10 +84,11 @@ import Item from './components/item.vue'
|
|
|
import OrgTree from '@/components/orgTree'
|
|
|
export default {
|
|
|
components: { NavBar, KList, Item, OrgTree },
|
|
|
+ name: 'iot_donghuan',
|
|
|
data() {
|
|
|
return {
|
|
|
- alarmButtonText: '告警设备',
|
|
|
- normalButtonText: '正常设备',
|
|
|
+ // alarmButtonText: '告警设备',
|
|
|
+ // normalButtonText: '正常设备',
|
|
|
search: {
|
|
|
orgId: this.orgId,
|
|
|
checkSub: false,
|
|
|
@@ -59,6 +97,11 @@ export default {
|
|
|
pageNum: 1,
|
|
|
pageSize: 10
|
|
|
},
|
|
|
+ statusStatistic: null,
|
|
|
+ showDeviceType: false,
|
|
|
+ defaultDeviceType: '全部',
|
|
|
+ showStatus: false,
|
|
|
+ defaultStatus: '全部',
|
|
|
dicts: ['app_sensor_device_type', 'sensor_alarm_status']
|
|
|
}
|
|
|
},
|
|
|
@@ -73,7 +116,7 @@ export default {
|
|
|
computed: {
|
|
|
...mapGetters(['orgName', 'orgId', 'dictionary']),
|
|
|
deviceTypeOptions() {
|
|
|
- let r = [{ value:null, text: '全部' }]
|
|
|
+ let r = [{ value: null, text: '全部' }]
|
|
|
|
|
|
let dict = this.getDictItem('app_sensor_device_type')
|
|
|
if (dict) {
|
|
|
@@ -83,6 +126,25 @@ export default {
|
|
|
}
|
|
|
|
|
|
return r
|
|
|
+ },
|
|
|
+ statusOptions() {
|
|
|
+ let r = [{ value: null, text: '全部' }]
|
|
|
+
|
|
|
+ let dict = this.getDictItem('sensor_alarm_status')
|
|
|
+ if (dict) {
|
|
|
+ dict.forEach(element => {
|
|
|
+ let label = element.dictLabel
|
|
|
+
|
|
|
+ if (element.dictValue == 0 && this.statusStatistic) {
|
|
|
+ label += `(${this.statusStatistic.normal})`
|
|
|
+ } else if (element.dictValue == 1 && this.statusStatistic) {
|
|
|
+ label += `(${this.statusStatistic.alarm})`
|
|
|
+ }
|
|
|
+ r.push({ value: element.dictValue, text: label })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ return r
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -96,31 +158,39 @@ export default {
|
|
|
// console.log(res,'3333')
|
|
|
})
|
|
|
},
|
|
|
- stateStatistic() {
|
|
|
+ statisticState() {
|
|
|
stateStatistic(this.search).then(r => {
|
|
|
- if (r.data) {
|
|
|
- this.alarmButtonText = `告警设备(${r.data.alarm}台)`
|
|
|
- this.normalButtonText = `正常设备(${r.data.normal}台)`
|
|
|
- } else {
|
|
|
- this.alarmButtonText = `告警设备`
|
|
|
- this.normalButtonText = `正常设备`
|
|
|
- }
|
|
|
+ this.statusStatistic = r.data
|
|
|
})
|
|
|
},
|
|
|
- onStateChanged(state) {
|
|
|
- if (this.search.state === state) {
|
|
|
- this.search.state = null
|
|
|
- } else {
|
|
|
- this.search.state = state
|
|
|
- }
|
|
|
+ onDeviceTypeConfirm(opt) {
|
|
|
+ this.defaultDeviceType = opt.text
|
|
|
+ this.search.deviceType = opt.value
|
|
|
+ this.showDeviceType = false
|
|
|
},
|
|
|
- onDeviceTypeClick(deviceType) {
|
|
|
- if (this.search.deviceType === deviceType) {
|
|
|
- this.search.deviceType = null
|
|
|
- } else {
|
|
|
- this.search.deviceType = deviceType
|
|
|
- }
|
|
|
+ onStatusConfirm(opt) {
|
|
|
+ this.defaultStatus = opt.text
|
|
|
+ this.search.state = opt.value
|
|
|
+ this.showStatus = false
|
|
|
},
|
|
|
+ onCancel() {
|
|
|
+ this.showDeviceType = false
|
|
|
+ this.defaultStatus = false
|
|
|
+ },
|
|
|
+ // onStateChanged(state) {
|
|
|
+ // if (this.search.state === state) {
|
|
|
+ // this.search.state = null
|
|
|
+ // } else {
|
|
|
+ // this.search.state = state
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // onDeviceTypeClick(deviceType) {
|
|
|
+ // if (this.search.deviceType === deviceType) {
|
|
|
+ // this.search.deviceType = null
|
|
|
+ // } else {
|
|
|
+ // this.search.deviceType = deviceType
|
|
|
+ // }
|
|
|
+ // },
|
|
|
//改变机构后将重新发起请求
|
|
|
changeTree(node) {
|
|
|
// console.log(selectedOptions,'aaaaaa')
|
|
|
@@ -129,12 +199,12 @@ export default {
|
|
|
this.search.orgId = node.id
|
|
|
this.selectedOrgName = node.shortName
|
|
|
|
|
|
- this.stateStatistic()
|
|
|
+ this.statisticState()
|
|
|
},
|
|
|
|
|
|
orgCheckChanged(v) {
|
|
|
this.search.checkSub = v
|
|
|
- this.stateStatistic()
|
|
|
+ this.statisticState()
|
|
|
},
|
|
|
onFinish({ selectedOptions }) {
|
|
|
this.showOrg = false
|
|
|
@@ -160,16 +230,15 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-.search-devicetype{
|
|
|
+.search-devicetype {
|
|
|
width: 25%;
|
|
|
- display:inline-block;
|
|
|
+ display: inline-block;
|
|
|
text-align: center;
|
|
|
- margin-top:10px;
|
|
|
-
|
|
|
+ margin-top: 10px;
|
|
|
}
|
|
|
.search-state {
|
|
|
width: 100%;
|
|
|
- margin-top:10px;
|
|
|
+ margin-top: 10px;
|
|
|
padding-left: 10px;
|
|
|
padding-right: 10px;
|
|
|
> span {
|