|
|
@@ -0,0 +1,192 @@
|
|
|
+<template>
|
|
|
+ <div class="page_list">
|
|
|
+ <nav-bar></nav-bar>
|
|
|
+ <van-row>
|
|
|
+ <van-col span="24">
|
|
|
+ <org-tree
|
|
|
+ v-model="search.orgId"
|
|
|
+ @changeItem="changeTree"
|
|
|
+ @checked="orgCheckChanged"
|
|
|
+ showChecked
|
|
|
+ defaultChecked
|
|
|
+ ></org-tree>
|
|
|
+ </van-col>
|
|
|
+ </van-row>
|
|
|
+ <van-row>
|
|
|
+ <van-col span="24">
|
|
|
+ <van-tabs @click="tabActiveHandler">
|
|
|
+ <van-tab name="smokeCheck" title="烟感" :badge="smokeCheckBadge"></van-tab>
|
|
|
+ <van-tab name="gasCheck" title="燃气" :badge="gasCheckBadge"></van-tab>
|
|
|
+ <van-tab name="temperatureAndHumidityCHeck" title="温湿度" :badge="temperatureAndHumidityCHeckBadge"></van-tab>
|
|
|
+ </van-tabs>
|
|
|
+ </van-col>
|
|
|
+ <van-col span="12" class="customVanCell">
|
|
|
+ <van-cell title="设备总数:" :value="totalCount" />
|
|
|
+ </van-col>
|
|
|
+ <van-col span="12" class="customVanCell">
|
|
|
+ <van-cell title="当前告警:" :value="alarmCount" />
|
|
|
+ </van-col>
|
|
|
+ </van-row>
|
|
|
+ <div class="container">
|
|
|
+ <k-list :list="list" :params="search" :auto="false" ref="list">
|
|
|
+ <template slot-scope="{ data }">
|
|
|
+ <item :data="data"></item>
|
|
|
+ </template>
|
|
|
+ </k-list>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import NavBar from '@/components/NavBar'
|
|
|
+import { mapGetters } from 'vuex'
|
|
|
+import { deviceTypeCount } from '@/api/iot/fireWarning.js'
|
|
|
+import { list } from '@/api/iot/donghuan.js'
|
|
|
+import KList from '@/components/list/index.vue'
|
|
|
+import Item from './components/item.vue'
|
|
|
+import OrgTree from '@/components/orgTree'
|
|
|
+export default {
|
|
|
+ components: { NavBar, KList, Item, OrgTree },
|
|
|
+ name: 'iot_fireWarning',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ search: {
|
|
|
+ orgId: this.orgId,
|
|
|
+ checkSub: true,
|
|
|
+ deviceType: '4182',
|
|
|
+ deviceName:null,
|
|
|
+ state: null,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10
|
|
|
+ },
|
|
|
+ smokeCheckBadge: null,
|
|
|
+ gasCheckBadge: null,
|
|
|
+ temperatureAndHumidityCHeckBadge: null,
|
|
|
+ totalCount: null,
|
|
|
+ alarmCount: null,
|
|
|
+ dataInfo:{},
|
|
|
+ tabName:"smokeCheck"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeRouteEnter(to,from,next){
|
|
|
+ next(vm=>{
|
|
|
+ if(to.params.event === 'refresh'){
|
|
|
+ vm.reSet()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ watch: {},
|
|
|
+ created() {
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.search.orgId = this.orgId;
|
|
|
+ this.getBadge();
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(['orgName', 'orgId', 'dictionary'])
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ list,
|
|
|
+ reSet(){
|
|
|
+ this.search= {
|
|
|
+ orgId: this.orgId,
|
|
|
+ checkSub: true,
|
|
|
+ deviceType: '4182',
|
|
|
+ deviceName:null,
|
|
|
+ state: null,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10
|
|
|
+ };
|
|
|
+ },
|
|
|
+ //改变机构后将重新发起请求
|
|
|
+ changeTree(node) {
|
|
|
+ // console.log(selectedOptions,'aaaaaa')
|
|
|
+ // this.search.orgId = selectedOptions[selectedOptions.length-1].id;
|
|
|
+ // let option = selectedOptions[selectedOptions.length - 1]
|
|
|
+ this.search.orgId = node.id;
|
|
|
+ this.getBadge();
|
|
|
+ },
|
|
|
+ orgCheckChanged(v) {
|
|
|
+ this.search.checkSub = v;
|
|
|
+ this.getBadge();
|
|
|
+ },
|
|
|
+ getBadge(){
|
|
|
+ deviceTypeCount(this.search).then(r =>{
|
|
|
+ this.dataInfo = r.data;
|
|
|
+ if (r.data.smokeAlarmCount){
|
|
|
+ this.smokeCheckBadge=r.data.smokeAlarmCount > 99 ? '99+' : r.data.smokeAlarmCount;
|
|
|
+ this.alarmCount = r.data.smokeAlarmCount;
|
|
|
+ }else {
|
|
|
+ this.smokeCheckBadge = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (r.data.gasAlarmCount){
|
|
|
+ this.gasCheckBadge=r.data.gasAlarmCount > 99 ? '99+' : r.data.gasAlarmCount;
|
|
|
+ }else {
|
|
|
+ this.gasCheckBadge = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (r.data.temperatureAndHumidityAlarmCount){
|
|
|
+ this.temperatureAndHumidityCHeckBadge=r.data.temperatureAndHumidityAlarmCount > 99 ? '99+' : r.data.temperatureAndHumidityAlarmCount;
|
|
|
+ }else {
|
|
|
+ this.temperatureAndHumidityCHeckBadge = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.tabActiveHandler(this.tabName);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ tabActiveHandler(name){
|
|
|
+ if (name === "smokeCheck"){
|
|
|
+ this.totalCount = this.dataInfo.smokeCount;
|
|
|
+ this.alarmCount = this.dataInfo.smokeAlarmCount;
|
|
|
+ this.search.deviceType = "4182";
|
|
|
+ }else if (name === "gasCheck"){
|
|
|
+ this.totalCount = this.dataInfo.gasCount;
|
|
|
+ this.alarmCount = this.dataInfo.gasAlarmCount;
|
|
|
+ this.search.deviceType = "41885";
|
|
|
+ }else if (name === "temperatureAndHumidityCHeck"){
|
|
|
+ this.totalCount = this.dataInfo.temperatureAndHumidityCount;
|
|
|
+ this.alarmCount = this.dataInfo.temperatureAndHumidityAlarmCount;
|
|
|
+ this.search.deviceType = "4183";
|
|
|
+ }
|
|
|
+ this.tabName = name;
|
|
|
+ //this.$forceUpdate()
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.page_list {
|
|
|
+ background-color: transparent;
|
|
|
+ display: block;
|
|
|
+
|
|
|
+ .van-row{
|
|
|
+ .customVanCell{
|
|
|
+ .van-cell{
|
|
|
+ // padding-left: 1vw !important;
|
|
|
+ .van-cell__title{
|
|
|
+ color: #969799 !important;
|
|
|
+ flex:none !important;
|
|
|
+ margin-left: 20%;
|
|
|
+ }
|
|
|
+ .van-cell__value {
|
|
|
+ color: #969799 !important;
|
|
|
+ flex: none !important;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .container {
|
|
|
+ // overflow: auto;
|
|
|
+ // height: calc(100vh - 11rem);
|
|
|
+ .k-content-repair {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ justify-content: space-between;
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|