Browse Source

普通用户桥梁切换,数据更新

luyanan 6 years ago
parent
commit
ed17a69608

+ 0 - 24
src/api/bridgeInfo.js

@ -1,13 +1,5 @@
1 1
import request from '@/utils/request'
2 2
3
export function getUserAllResource(params) { // 用户所有信息
4
  return request({
5
    url: '/ajax/all/byUser',
6
    method: 'get',
7
    params
8
  })
9
}
10
11 3
export function getBridgeList(params) { // 用户所有桥梁
12 4
  return request({
13 5
    url: '/ajax/bridge/byUser',
@ -32,22 +24,6 @@ export function getBridgeServers(params) { // 桥梁服务器
32 24
  })
33 25
}
34 26
35
export function getServerInfo(params) { // 某个服务器
36
  return request({
37
    url: '/ajax/server/qo',
38
    method: 'get',
39
    params
40
  })
41
}
42
43
export function getDeviceInfo(params) { // 某个采集盒
44
  return request({
45
    url: '/ajax/device/qo',
46
    method: 'get',
47
    params
48
  })
49
}
50
51 27
// 报警信息
52 28
export function getDangerList(params) {
53 29
  return request({

+ 57 - 0
src/components/DefaultPage/index.vue

@ -0,0 +1,57 @@
1
<template>
2
  <div class="ev_content" v-show="show">
3
    <div class="notice_d" v-show="noResult">
4
      <div class="d_prompt">
5
        <p class="d_2">{{message2}}</p>
6
      </div>
7
    </div>
8
  </div>
9
</template>
10
11
<script>
12
13
export default {
14
  props: {
15
    show: {
16
      type: Boolean,
17
      default: true
18
    },
19
    noResult: {
20
      type: Boolean,
21
      default: true
22
    },
23
    message2: {
24
      type: String,
25
      default: '没有相关数据'
26
    }
27
  }
28
}
29
</script>
30
31
<style rel="stylesheet/scss" lang="scss" scoped>
32
  .ev_content{
33
    width: 100%;
34
    height: 42%;
35
    z-index: 11;
36
    padding:40px;
37
    box-sizing: border-box;
38
    display: flex;
39
    justify-content:center;
40
  }
41
42
  .d_prompt p{
43
    margin: 0;
44
    font-size: 0;
45
  }
46
47
  .d_prompt .d_2{
48
    height: auto;
49
    margin: 0 auto;
50
    word-break: break-word;
51
    font-size: 13px;
52
    color: #999999;
53
    text-align: center;
54
    margin-top: 10px;
55
  }
56
57
</style>

+ 20 - 8
src/components/Marqueebox/index.vue

@ -2,8 +2,9 @@
2 2
  <div>
3 3
    <el-dialog title="系统消息编辑" :visible.sync="dialogFormVisible">
4 4
      <el-form :model="formNotice" ref="formNotice" :rules="rules">
5
        <el-input type="textarea" v-model="formNotice.desc"></el-input>
5
        <el-input type="textarea" rows="6" maxlength="100" v-model="formNotice.desc" @input="limitFn"></el-input>
6 6
      </el-form>
7
      <div class="limit_num">还可以输入{{ableNum}}字</div>
7 8
      <div slot="footer" class="dialog-footer">
8 9
        <el-button @click="dialogFormVisible = false">取 消</el-button>
9 10
        <el-button type="primary" @click="setNotice('formNotice')">确 定</el-button>
@ -12,7 +13,8 @@
12 13
    <el-menu class="message-box" mode="horizontal">
13 14
      <div class="marquee_box">
14 15
        <span class="tit">系统公告:</span>
15
        <el-tooltip :content="formNotice.desc" placement="bottom-end" effect="dark">
16
        <el-tooltip placement="bottom-end" effect="dark">
17
          <div slot="content" class="popper-tips">{{formNotice.desc}}</div>
16 18
          <div class="marquee_text">{{formNotice.desc}}</div>
17 19
        </el-tooltip>
18 20
        <span class="btn-span" v-if="isShow" @click="openNoticeDialog">设置</span>
@ -32,7 +34,7 @@ export default {
32 34
  data() {
33 35
    return {
34 36
      dialogFormVisible: false,
35
      animate: true,
37
      ableNum: 100,
36 38
      formNotice: {
37 39
        desc: ''
38 40
      },
@ -48,10 +50,14 @@ export default {
48 50
    this.getNotice()
49 51
  },
50 52
  methods: {
53
    limitFn() {
54
      this.ableNum = 100 - this.formNotice.desc.length
55
    },
51 56
    getNotice() {
52 57
      getNotice().then(res => {
53 58
        if (res.success) {
54 59
          this.formNotice.desc = res.data
60
          this.limitFn()
55 61
        }
56 62
      })
57 63
    },
@ -113,11 +119,17 @@ export default {
113 119
      cursor: pointer;
114 120
    }
115 121
  }
116
  .anim{
117
    transition: all 0.5s;
118
  }
119 122
}
120
.el-textarea .el-textarea__inner{
121
  height: 160px;
123
.limit_num{
124
  font-size: 14px;
125
  color: #ff0000;
126
  text-align: right;
127
}
128
.popper-tips{
129
  font-size:14px;
130
  line-height: 20px;
131
  display:block;
132
  max-width: 500px;
133
  word-break: break-all;
122 134
}
123 135
</style>

+ 4 - 2
src/router/index.js

@ -41,6 +41,7 @@ export const constantRouterMap = [
41 41
    component: Layout,
42 42
    redirect: '/dashboard',
43 43
    hidden: true,
44
    meta: { noCache: true },
44 45
    children: [{
45 46
      path: 'dashboard',
46 47
      component: () => import('@/views/dashboard'),
@ -87,7 +88,7 @@ export const constantRouterMap = [
87 88
                path: 'dangerDetail',
88 89
                name: 'dangerDetail',
89 90
                component: () => import('@/views/bridgesConsole/bridgeDanger/dangerDetail'),
90
                meta: { title: '报警信息浏览' }
91
                meta: { title: '报警信息浏览', noCache: true }
91 92
              }
92 93
            ]
93 94
          },
@ -98,7 +99,8 @@ export const constantRouterMap = [
98 99
            meta: {
99 100
              title: '历史监测信息查询',
100 101
              roles: ['0'],
101
              noCache: true }
102
              noCache: true
103
            }
102 104
          }
103 105
        ]
104 106
      }

+ 71 - 0
src/utils/queryInfo.js

@ -0,0 +1,71 @@
1
import request from '@/utils/request'
2
3
/*eslint one-var: ["error", { "initialized": "always", "uninitialized": "never" }]*/
4
var serverList = [],
5
  deviceList = [],
6
  transducerList = [],
7
  queryAllInfo = function() {
8
    request({
9
      url: '/ajax/all/byUser',
10
      method: 'get',
11
      params: {
12
        active: 1
13
      }
14
    }).then(res => {
15
      if (res.success) {
16
        serverList = res.data.server
17
        deviceList = res.data.device
18
        transducerList = res.data.transducer
19
      }
20
    })
21
  },
22
  queryServers = function(bid, flag) {
23
    const obj = serverList
24
    /*eslint one-var: ["error", { "initialized": "always", "uninitialized": "never" }]*/
25
    var servers = [], serverSeqArr = []
26
    for (let i = 0; i < obj.length; ++i) {
27
      if (bid === obj[i].bridgeId) {
28
        servers.push(obj[i])
29
        serverSeqArr.push(obj[i].seq)
30
      }
31
    }
32
    return flag ? serverSeqArr : servers
33
  },
34
  queryDevices = function(bid) {
35
    var devices = []
36
    for (let i = 0; i < serverList.length; ++i) {
37
      if (bid === serverList[i].bridgeId) {
38
        for (let j = 0; j < deviceList.length; ++j) {
39
          if (serverList[i].id === deviceList[j].serverId) {
40
            deviceList[j].serverCode = serverList[i].code
41
            devices.push(deviceList[j])
42
          }
43
        }
44
      }
45
    }
46
    return devices
47
  },
48
  queryTrans = function(bid) {
49
    var trans = []
50
    for (let i = 0; i < serverList.length; ++i) {
51
      if (bid === serverList[i].bridgeId) {
52
        for (let j = 0; j < deviceList.length; ++j) {
53
          for (let m = 0; m < transducerList.length; ++m) {
54
            if (serverList[i].id === transducerList[m].serverId) {
55
              transducerList[m].deviceCode = deviceList[j].code
56
              trans.push(transducerList[m])
57
            }
58
          }
59
        }
60
      }
61
    }
62
    return trans
63
  },
64
  ret = {
65
    queryAllInfo: queryAllInfo,
66
    queryServers: queryServers,
67
    queryDevices: queryDevices,
68
    queryTrans: queryTrans
69
  }
70
71
export default ret

+ 19 - 9
src/views/bridgesConsole/bridgeDanger/dangerList.vue

@ -4,7 +4,7 @@
4 4
      <div slot="header" class="block-title">
5 5
        <span>报警信息</span>
6 6
      </div>
7
      <ul class="item-ul">
7
      <ul class="item-ul" v-if="dangerList.length">
8 8
        <li :class="!item.readed ? 'readed-li' : ''" v-for="item in dangerShowList" :key="item.index" @click="alarmShow(item.aid, item.device)">
9 9
          <span>{{item.alarmTime}}</span>
10 10
          <span>{{item.device}},请点击查看。</span>
@ -13,6 +13,7 @@
13 13
          </span>
14 14
        </li>
15 15
      </ul>
16
      <DefaultPage v-if="!dangerList.length"></DefaultPage>
16 17
      <div class="pagination-container">
17 18
        <el-pagination
18 19
          background
@ -20,7 +21,7 @@
20 21
          :current-page.sync="pageNo"
21 22
          :page-size="pageSize"
22 23
          layout="prev, pager, next, jumper"
23
          :total="total">
24
          :total="dangerList.length">
24 25
        </el-pagination>
25 26
      </div>
26 27
    </el-card>
@ -29,19 +30,22 @@
29 30
30 31
31 32
<script>
33
import queryInfo from '@/utils/queryInfo'
34
import Cookies from 'js-cookie'
32 35
import { parseTime } from '@/utils'
33 36
import { getDangerList } from '@/api/bridgeInfo'
34 37
38
import DefaultPage from '@/components/DefaultPage'
39
35 40
export default {
36
  props: {
37
    bridgeName: {
38
      type: String
39
    }
41
  components: {
42
    DefaultPage
40 43
  },
41 44
  data() {
42 45
    return {
46
      bridgeId: '',
47
      bridgeName: '',
43 48
      dangerList: [],
44
      total: 0,
45 49
      pageSize: 4,
46 50
      pageNo: 1
47 51
    }
@ -52,11 +56,17 @@ export default {
52 56
    }
53 57
  },
54 58
  created() {
55
    this.getDangerList()
59
    this.bridgeId = Cookies.get('bridgeId')
60
    this.bridgeName = Cookies.get('bridgeName')
61
    this.serverSeqArr = queryInfo.queryServers(this.bridgeId, true)
62
    if (this.serverSeqArr) {
63
      this.getDangerList(this.serverSeqArr)
64
    }
56 65
  },
57 66
  methods: {
58
    getDangerList() {
67
    getDangerList(arr) {
59 68
      const param = {
69
        seq: arr,
60 70
        pageSize: 18,
61 71
        pageNo: 1
62 72
      }

+ 1 - 11
src/views/bridgesConsole/bridgeDanger/index.vue

@ -1,20 +1,10 @@
1 1
<template>
2 2
  <div>
3
    <router-view :bridgeName="bridgeName"></router-view>
3
    <router-view></router-view>
4 4
  </div>
5 5
</template>
6 6
<script>
7 7
import '@/styles/roleuser.scss'
8
import Cookies from 'js-cookie'
9
10 8
export default {
11
  data() {
12
    return {
13
      bridgeName: ''
14
    }
15
  },
16
  created() {
17
    this.bridgeName = Cookies.get('bridgeName')
18
  }
19 9
}
20 10
</script>

+ 1 - 1
src/views/bridgesConsole/bridgeDetail/components/BInfoDialog01.vue

@ -35,7 +35,7 @@
35 35
        </el-col>
36 36
        <el-col :xs="10" :sm="10" :lg="10">
37 37
          <div style="width:100%">
38
            <img :src="'/data/bridge'+ dataInfo.img" :alt="dataInfo.shortName" width="90%">
38
            <img :src="'/data/bridge'+ dataInfo.img" :alt="dataInfo.shortName" width="100%">
39 39
          </div>
40 40
        </el-col>
41 41
        <el-col :span="24" v-if="dataInfo.descp">

+ 10 - 5
src/views/bridgesConsole/bridgeDetail/components/BInfoDialog02.vue

@ -1,7 +1,7 @@
1 1
<template>
2 2
  <el-dialog title="采集服务器信息" :visible.sync="dialogTableVisible" :width="dialogW">
3 3
    <el-form class="form-main">
4
      <el-row :gutter="16">
4
      <el-row :gutter="16" v-if="serverList.length">
5 5
        <el-col :xs="12" :sm="12" :lg="12" v-for="item in serverShowList" :key="item.index">
6 6
          <div class="list-item">
7 7
            <el-row>
@ -23,6 +23,7 @@
23 23
          </div>
24 24
        </el-col>
25 25
      </el-row>
26
      <DefaultPage v-if="!serverList.length"></DefaultPage>
26 27
      <div class="pagination-container">
27 28
        <el-pagination
28 29
          background
@ -46,16 +47,18 @@
46 47
47 48
<script>
48 49
import './style.scss'
50
import DefaultPage from '@/components/DefaultPage'
51
import queryInfo from '@/utils/queryInfo'
49 52
50 53
export default {
51
  props: {
52
    serverList: {
53
      type: Array
54
    }
54
  components: {
55
    DefaultPage
55 56
  },
56 57
  data() {
57 58
    return {
59
      serverList: [],
58 60
      dialogW: '',
61
      bridgeId: '',
59 62
      bridgeName: '',
60 63
      dialogTableVisible: false,
61 64
      pageSize: 4,
@ -63,8 +66,10 @@ export default {
63 66
    }
64 67
  },
65 68
  created() {
69
    this.bridgeId = this.$parent.bridgeId
66 70
    this.bridgeName = this.$parent.bridgeName
67 71
    this.dialogW = this.$parent.dialogW
72
    this.serverList = queryInfo.queryServers(this.bridgeId)
68 73
  },
69 74
  computed: {
70 75
    serverShowList() {

+ 10 - 5
src/views/bridgesConsole/bridgeDetail/components/BInfoDialog03.vue

@ -1,7 +1,7 @@
1 1
<template>
2 2
  <el-dialog title="采集盒信息" :visible.sync="dialogTableVisible" :width="dialogW">
3 3
    <el-form class="form-main">
4
      <el-row :gutter="16">
4
      <el-row :gutter="16" v-if="deviceList.length">
5 5
        <el-col :xs="12" :sm="12" :lg="12" v-for="item in deviceShowList" :key="item.index">
6 6
          <div class="list-item">
7 7
            <el-row>
@ -23,6 +23,7 @@
23 23
          </div>
24 24
        </el-col>
25 25
      </el-row>
26
      <DefaultPage v-if="!deviceList.length"></DefaultPage>
26 27
      <div class="pagination-container">
27 28
        <el-pagination
28 29
          background
@ -46,23 +47,27 @@
46 47
47 48
<script>
48 49
import './style.scss'
50
import DefaultPage from '@/components/DefaultPage'
51
import queryInfo from '@/utils/queryInfo'
49 52
50 53
export default {
51
  props: {
52
    deviceList: {
53
      type: Array
54
    }
54
  components: {
55
    DefaultPage
55 56
  },
56 57
  data() {
57 58
    return {
58 59
      dialogW: '',
60
      deviceList: [],
61
      bridgeId: '',
59 62
      dialogTableVisible: false,
60 63
      pageSize: 4,
61 64
      pageNo: 1
62 65
    }
63 66
  },
64 67
  created() {
68
    this.bridgeId = this.$parent.bridgeId
65 69
    this.dialogW = this.$parent.dialogW
70
    this.deviceList = queryInfo.queryDevices(this.bridgeId)
66 71
  },
67 72
  computed: {
68 73
    deviceShowList() {

+ 10 - 5
src/views/bridgesConsole/bridgeDetail/components/BInfoDialog04.vue

@ -1,7 +1,7 @@
1 1
<template>
2 2
  <el-dialog title="传感器信息" :visible.sync="dialogTableVisible" :width="dialogW">
3 3
    <el-form class="form-main">
4
      <el-row :gutter="16">
4
      <el-row :gutter="16" v-if="transducerList.length">
5 5
        <el-col :xs="12" :sm="12" :lg="12" v-for="item in transducerShowList" :key="item.index">
6 6
          <div class="list-item">
7 7
            <el-row>
@ -26,6 +26,7 @@
26 26
          </div>
27 27
        </el-col>
28 28
      </el-row>
29
      <DefaultPage v-if="!transducerList.length"></DefaultPage>
29 30
      <div class="pagination-container">
30 31
        <el-pagination
31 32
          background
@ -49,16 +50,18 @@
49 50
50 51
<script>
51 52
import './style.scss'
53
import DefaultPage from '@/components/DefaultPage'
54
import queryInfo from '@/utils/queryInfo'
52 55
53 56
export default {
54
  props: {
55
    transducerList: {
56
      type: Array
57
    }
57
  components: {
58
    DefaultPage
58 59
  },
59 60
  data() {
60 61
    return {
61 62
      dialogW: '',
63
      bridgeId: '',
64
      transducerList: [],
62 65
      childCableMain: [],
63 66
      childAddr: [],
64 67
      dialogTableVisible: false,
@ -70,6 +73,8 @@ export default {
70 73
    this.childCableMain = this.$parent.cableMain
71 74
    this.childAddr = this.$parent.addr
72 75
    this.dialogW = this.$parent.dialogW
76
    this.bridgeId = this.$parent.bridgeId
77
    this.transducerList = queryInfo.queryTrans(this.bridgeId)
73 78
  },
74 79
  computed: {
75 80
    transducerShowList() {

+ 63 - 100
src/views/bridgesConsole/bridgeDetail/index.vue

@ -1,9 +1,9 @@
1 1
<template>
2 2
  <div class="dashboard-editor-container">
3 3
    <BInfoDialog01 ref="BInfoDialog01"></BInfoDialog01>
4
    <BInfoDialog02 ref="BInfoDialog02" :serverList="serverList"></BInfoDialog02>
5
    <BInfoDialog03 ref="BInfoDialog03" :deviceList="deviceList"></BInfoDialog03>
6
    <BInfoDialog04 ref="BInfoDialog04" :transducerList="transducerList"></BInfoDialog04>
4
    <BInfoDialog02 ref="BInfoDialog02"></BInfoDialog02>
5
    <BInfoDialog03 ref="BInfoDialog03"></BInfoDialog03>
6
    <BInfoDialog04 ref="BInfoDialog04"></BInfoDialog04>
7 7
8 8
    <updatePersonInfo ref="updatePersonInfo"></updatePersonInfo>
9 9
    <updateLoginPwd ref="updateLoginPwd"></updateLoginPwd>
@ -15,7 +15,7 @@
15 15
            <span>报警信息</span>
16 16
            <el-button type="text" @click="queryDangerInfo">查看全部</el-button>
17 17
          </div>
18
          <ul class="item-ul">
18
          <ul class="item-ul" v-if="dangerList.length">
19 19
            <li :class="!item.readed ? 'readed-li' : ''" v-for="item in dangerList" :key="item.index" @click="alarmShow(item.aid, item.device)">
20 20
              <span>{{item.alarmTime}}</span>
21 21
              <span>{{item.device}},请点击查看。</span>
@ -24,16 +24,18 @@
24 24
              </span>
25 25
            </li>
26 26
          </ul>
27
          <DefaultPage v-if="!dangerList.length"></DefaultPage>
27 28
        </el-card>
28 29
        <el-card class="box-card block-group">
29 30
          <div slot="header" class="block-title">
30 31
            <span>实时监测</span>
31 32
          </div>
32
          <el-row class="line-chart-box">
33
          <el-row class="line-chart-box" v-if="monitorList.length">
33 34
            <el-col :xs="24" :sm="24" :lg="24" v-for="item in monitorShowList" :key="item.index">
34 35
              <lineChart2 :chartData="item"></lineChart2>
35 36
            </el-col>
36 37
          </el-row>
38
          <DefaultPage v-if="!monitorList.length"></DefaultPage>
37 39
          <div class="pagination-container">
38 40
            <el-pagination
39 41
              background
@ -78,8 +80,9 @@
78 80
<script>
79 81
import '@/styles/roleuser.scss'
80 82
import Cookies from 'js-cookie'
81
import { parseTime, turnTime } from '@/utils'
82
import { getUserAllResource, getDangerList, getTimingMonitor, getServerInfo, getDeviceInfo } from '@/api/bridgeInfo'
83
import queryInfo from '@/utils/queryInfo'
84
import { urlParse, parseTime, turnTime } from '@/utils'
85
import { getDangerList, getTimingMonitor } from '@/api/bridgeInfo'
83 86
import { mainCable, location, provinceCityDistrict } from '@/api/numberDictionary'
84 87
85 88
import lineChart2 from '../lineChart/LineChart2'
@ -91,6 +94,8 @@ import BInfoDialog04 from './components/BInfoDialog04'
91 94
import updatePersonInfo from './components/updatePersonInfo'
92 95
import updateLoginPwd from './components/updateLoginPwd'
93 96
97
import DefaultPage from '@/components/DefaultPage'
98
94 99
export default {
95 100
  name: 'dashboard-other',
96 101
  components: {
@ -100,20 +105,19 @@ export default {
100 105
    BInfoDialog03,
101 106
    BInfoDialog04,
102 107
    updatePersonInfo,
103
    updateLoginPwd
108
    updateLoginPwd,
109
    DefaultPage
104 110
  },
105 111
  data() {
106 112
    return {
107
      dialogW: '880px',
113
      bridgeId: '',
114
      bridgeName: '',
115
      dialogW: '860px',
108 116
      citys: [],
109 117
      cableMain: [],
110 118
      addr: [],
111 119
      dangerList: '',
112
      bridgeList: [],
113
      serverList: [],
114 120
      serverSeqArr: [],
115
      deviceList: [],
116
      transducerList: [],
117 121
      monitorList: [],
118 122
      currentNo: 1,
119 123
      currentSize: 4,
@ -128,20 +132,30 @@ export default {
128 132
    }
129 133
  },
130 134
  created() {
131
    this.bridgeId = Cookies.get('bridgeId')
132
    this.bridgeName = Cookies.get('bridgeName')
135
    if (urlParse('id')) {
136
      this.bridgeId = urlParse('id')
137
      this.bridgeName = urlParse('name')
138
    } else {
139
      this.bridgeId = Cookies.get('bridgeId')
140
      this.bridgeName = Cookies.get('bridgeName')
141
    }
133 142
    this.getDictoryData()
134
    this.getUserAllResource()
135
    this.getDangerList()
136
143
    if (this.bridgeId) {
144
      this.serverSeqArr = queryInfo.queryServers(this.bridgeId, true)
145
      if (this.serverSeqArr.length) {
146
        this.getTimingMonitor(this.serverSeqArr)
147
        this.getDangerList(this.serverSeqArr)
148
      }
149
    }
137 150
    // setInterval(() => {
138 151
    //   this.addData(true)
139 152
    //   this.getTimingMonitor()
140 153
    // }, 60000)
141 154
  },
142 155
  methods: {
143
    getDangerList() {
156
    getDangerList(arr) {
144 157
      const param = {
158
        seq: arr,
145 159
        pageSize: 5,
146 160
        pageNo: 1
147 161
      }
@ -158,90 +172,42 @@ export default {
158 172
        }
159 173
      })
160 174
    },
161
    getUserAllResource() {
162
      var _this = this
175
    getTimingMonitor(arr) {
176
      var that = this
163 177
      const param = {
164
        active: 1
178
        seq: arr
165 179
      }
166
      getUserAllResource(param).then(res => {
167
        if (res.success) {
168
          res.data.bridge.map((value, index, array) => {
169
            if (value.id === _this.bridgeId) {
170
              _this.bridgeName = value.shortName
171
            }
172
          })
173
          res.data.server.map((value, index, array) => {
174
            if (value.bridgeId === _this.bridgeId) {
175
              _this.serverList.push(value)
176
              _this.serverSeqArr.push(value.seq)
177
              _this.$forceUpdate()
178
              res.data.device.map((value2, index2, array2) => {
179
                if (value2.serverId === value.id) {
180
                  getServerInfo({ id: value2.serverId }).then(res => {
181
                    if (res.success && res.data) {
182
                      value2.serverCode = res.data.code
183
                      _this.$forceUpdate()
184
                    }
185
                  })
186
                  _this.deviceList.push(value2)
187
                  res.data.transducer.map((value3, index3, array3) => {
188
                    if (value3.serverId === value.id) {
189
                      getDeviceInfo({ id: value3.deviceId }).then(res => {
190
                        if (res.success && res.data) {
191
                          value3.deviceCode = res.data.code
192
                          _this.$forceUpdate()
193
                        }
194
                      })
195
                      _this.transducerList.push(value3)
196
                    }
197
                  })
198
                }
199
              })
200
            }
201
          })
202
          _this.getTimingMonitor()
203
        }
204
      })
205
    },
206
    getTimingMonitor() {
207
      var that = this
208
      const arr = this.serverSeqArr
209
      if (arr) {
210
        const param = {
211
          seq: arr
212
        }
213
        getTimingMonitor(param).then(res => {
214
          if (res.success && res.data) {
215
            var monitorList = []
216
            for (let i = 0; i < res.data.length; i++) {
217
              var str = res.data[i].cid
218
              var monitorData = null
219
              for (let j = 0; j < monitorList.length; ++j) {
220
                if (str === monitorList[j].tit) {
221
                  monitorData = monitorList[j]
222
                  break
223
                }
180
      getTimingMonitor(param).then(res => {
181
        if (res.success && res.data) {
182
          var monitorList = []
183
          for (let i = 0; i < res.data.length; i++) {
184
            var str = res.data[i].cid
185
            var monitorData = null
186
            for (let j = 0; j < monitorList.length; ++j) {
187
              if (str === monitorList[j].tit) {
188
                monitorData = monitorList[j]
189
                break
224 190
              }
225
              if (!monitorData) {
226
                monitorData = {
227
                  xData: [],
228
                  seData: {
229
                    max: [],
230
                    min: []
231
                  }
191
            }
192
            if (!monitorData) {
193
              monitorData = {
194
                xData: [],
195
                seData: {
196
                  max: [],
197
                  min: []
232 198
                }
233
                monitorList.push(monitorData)
234
                monitorData.tit = str
235
                that.addData()
236 199
              }
237
              monitorData.xData.push(that.dateArr)
238
              monitorData.seData.max.push(res.data[i].hvalue)
239
              monitorData.seData.min.push(res.data[i].lvalue)
200
              monitorList.push(monitorData)
201
              monitorData.tit = str
202
              that.addData()
240 203
            }
241
            that.monitorList = monitorList
204
            monitorData.xData.push(that.dateArr)
205
            monitorData.seData.max.push(res.data[i].hvalue)
206
            monitorData.seData.min.push(res.data[i].lvalue)
242 207
          }
243
        })
244
      }
208
          that.monitorList = monitorList
209
        }
210
      })
245 211
    },
246 212
    getDictoryData() {
247 213
      mainCable().then(response => {
@ -287,10 +253,7 @@ export default {
287 253
      this.$router.push({ name: 'dangerList' })
288 254
    },
289 255
    queryMonitorInfo() {
290
      this.$router.push({
291
        name: 'bridgeMonitor',
292
        query: { arr: this.serverSeqArr }
293
      })
256
      this.$router.push({ name: 'bridgeMonitor' })
294 257
    },
295 258
    queryBirdgeInfo() {
296 259
      this.$refs.BInfoDialog01.dialogTableVisible = true

+ 46 - 42
src/views/bridgesConsole/bridgeMonitor/index.vue

@ -10,11 +10,12 @@
10 10
          </el-date-picker>
11 11
          <el-button type="primary" @click="getMonitorByDay">查询</el-button>
12 12
      </div>
13
      <el-row class="line-chart-box">
13
      <el-row class="line-chart-box" v-if="alarmList.length">
14 14
        <el-col :xs="24" :sm="24" :lg="24" v-for="item in alarmShowList" :key="item.index">
15 15
          <lineChart2 :chartData="item"></lineChart2>
16 16
        </el-col>
17 17
      </el-row>
18
      <DefaultPage v-if="!alarmList.length"></DefaultPage>
18 19
      <div class="pagination-container">
19 20
        <el-pagination
20 21
          background
@ -32,14 +33,18 @@
32 33
33 34
<script>
34 35
import '@/styles/roleuser.scss'
35
import { urlParse, parseTime } from '@/utils'
36
import { Message } from 'element-ui'
36
import Cookies from 'js-cookie'
37
import queryInfo from '@/utils/queryInfo'
38
import { parseTime } from '@/utils'
37 39
import { getMonitorByDay } from '@/api/bridgeInfo'
38 40
import lineChart2 from '../lineChart/LineChart2'
39 41
42
import DefaultPage from '@/components/DefaultPage'
43
40 44
export default {
41 45
  data() {
42 46
    return {
47
      bridgeId: '',
43 48
      valueDate: new Date().toISOString().substring(0, 10).replace(/-/g, ''),
44 49
      serverSeqArr: [],
45 50
      alarmList: [],
@ -48,7 +53,8 @@ export default {
48 53
    }
49 54
  },
50 55
  components: {
51
    lineChart2
56
    lineChart2,
57
    DefaultPage
52 58
  },
53 59
  computed: {
54 60
    alarmShowList() {
@ -56,52 +62,50 @@ export default {
56 62
    }
57 63
  },
58 64
  created() {
59
    this.serverSeqArr = urlParse('arr')
60
    this.getMonitorByDay()
65
    this.bridgeId = Cookies.get('bridgeId')
66
    this.serverSeqArr = queryInfo.queryServers(this.bridgeId, true)
67
    if (this.serverSeqArr.length) {
68
      this.getMonitorByDay(this.serverSeqArr)
69
    }
61 70
  },
62 71
  methods: {
63
    getMonitorByDay() {
72
    getMonitorByDay(arr) {
64 73
      var that = this
65
      const arr = this.serverSeqArr
66
      if (arr) {
67
        var date = that.valueDate
68
        var param = {
69
          seq: arr,
70
          day: date
71
        }
72
        getMonitorByDay(param).then(res => {
73
          if (res.success && res.data) {
74
            var monitorList = []
75
            for (let i = 0; i < res.data.length; i++) {
76
              var str = res.data[i].cid
77
              var monitorData = null
78
              for (let j = 0; j < monitorList.length; ++j) {
79
                if (str === monitorList[j].tit) {
80
                  monitorData = monitorList[j]
81
                  break
82
                }
74
      var date = that.valueDate
75
      var param = {
76
        seq: arr,
77
        day: date
78
      }
79
      getMonitorByDay(param).then(res => {
80
        if (res.success && res.data) {
81
          var monitorList = []
82
          for (let i = 0; i < res.data.length; i++) {
83
            var str = res.data[i].cid
84
            var monitorData = null
85
            for (let j = 0; j < monitorList.length; ++j) {
86
              if (str === monitorList[j].tit) {
87
                monitorData = monitorList[j]
88
                break
83 89
              }
84
              if (!monitorData) {
85
                monitorData = {
86
                  xData: [],
87
                  seData: {
88
                    max: [],
89
                    min: []
90
                  }
90
            }
91
            if (!monitorData) {
92
              monitorData = {
93
                xData: [],
94
                seData: {
95
                  max: [],
96
                  min: []
91 97
                }
92
                monitorList.push(monitorData)
93
                monitorData.tit = str
94 98
              }
95
              monitorData.xData.push(parseTime(res.data[i].ctime, true, true))
96
              monitorData.seData.max.push(res.data[i].hvalue)
97
              monitorData.seData.min.push(res.data[i].lvalue)
99
              monitorList.push(monitorData)
100
              monitorData.tit = str
98 101
            }
99
            that.alarmList = monitorList
102
            monitorData.xData.push(parseTime(res.data[i].ctime, true, true))
103
            monitorData.seData.max.push(res.data[i].hvalue)
104
            monitorData.seData.min.push(res.data[i].lvalue)
100 105
          }
101
        })
102
      } else {
103
        Message.error('当前没有任何采集服务器,请检查')
104
      }
106
          that.alarmList = monitorList
107
        }
108
      })
105 109
    },
106 110
    changeDate(val) {
107 111
      this.valueDate = val

+ 22 - 47
src/views/dashboard/other/index.vue

@ -27,12 +27,12 @@
27 27
28 28
<script>
29 29
import {
30
  getBridgeServers,
31 30
  getBridgeList,
32 31
  getBridgeUnread
33 32
} from '@/api/bridgeInfo'
34 33
import '@/styles/roleuser.scss'
35 34
import Cookies from 'js-cookie'
35
import queryInfo from '@/utils/queryInfo'
36 36
37 37
export default {
38 38
  data() {
@ -41,19 +41,13 @@ export default {
41 41
      total: 0,
42 42
      pageSize: 10,
43 43
      pageNo: 1,
44
      dataList: [],
45
      bridgeList: [],
46
      serverList: [],
47
      serverSeqArr: [],
48
      deviceList: [],
49
      transducerList: []
44
      dataList: []
50 45
    }
51 46
  },
52 47
  created() {
48
    queryInfo.queryAllInfo()
53 49
    this.getBridgeLists()
54 50
  },
55
  components: {
56
  },
57 51
  methods: {
58 52
    getBridgeLists() {
59 53
      const param = {
@ -63,53 +57,34 @@ export default {
63 57
      }
64 58
      getBridgeList(param).then(res => {
65 59
        if (res.success) {
66
          if (res.data.data.length > 0) {
60
          var $data = res.data.data
61
          if ($data.length > 0) {
67 62
            this.total = res.data.total
68
            this.getBridgeServers(res.data.data)
63
            for (let i = 0; i < $data.length; i++) {
64
              var svrs = queryInfo.queryServers($data[i].id, true)
65
              this.getBridgeUnread($data[i], svrs)
66
            }
67
            this.dataList = $data
69 68
          }
70 69
        }
71 70
      })
72 71
    },
73
    getBridgeServers($data) {
74
      var that = this
75
      for (let i = 0; i < $data.length; i++) {
76
        (function(i) {
77
          const param = {
78
            active: 1,
79
            id: $data[i].id
80
          }
81
          getBridgeServers(param).then(res => {
82
            if (res.success) {
83
              var serverSeqArr = []
84
              if (res.data.length > 0) {
85
                for (let j = 0; j < res.data.length; j++) {
86
                  serverSeqArr.push(res.data[j].seq)
87
                }
88
                that.getBridgeUnread($data[i], serverSeqArr)
89
              }
90
            }
91
          })
92
        })(i)
93
      }
94
      this.dataList = $data
95
    },
96
    getBridgeUnread($data, $arr) {
72
    getBridgeUnread($data, svrs) {
97 73
      var that = this
98
      const param = {
99
        server: $arr
100
      }
101 74
      var alarmNum = 0
102
      getBridgeUnread(param).then(res => {
103
        if (res.success) {
104
          if (res.data.length > 0) {
105
            for (let j = 0; j < res.data.length; j++) {
106
              alarmNum += res.data[j].num
75
      if (svrs.length) {
76
        getBridgeUnread({ server: svrs }).then(res => {
77
          if (res.success) {
78
            if (res.data.length > 0) {
79
              for (let j = 0; j < res.data.length; j++) {
80
                alarmNum += res.data[j].num
81
              }
82
              $data.alarmNum = alarmNum
83
              that.$forceUpdate()
107 84
            }
108
            $data.alarmNum = alarmNum
109
            that.$forceUpdate()
110 85
          }
111
        }
112
      })
86
        })
87
      }
113 88
    },
114 89
    goToDashboardC(id, name) {
115 90
      this.$router.push({ name: 'bridgeHome' })

+ 7 - 5
src/views/layout/components/TopNavbar.vue

@ -7,7 +7,7 @@
7 7
          {{showName ? showName : '选择桥梁'}}<i class="el-icon-arrow-down el-icon--right"></i>
8 8
        </span>
9 9
        <el-dropdown-menu class="drop-menu-list" style="min-width:120px;" slot="dropdown">
10
          <el-dropdown-item v-for="(item,index) in dataList" :key="item.index" :disabled="item.disab" @click.native="goToDashboardC(index, item.id, item.shortName)">{{item.shortName}}
10
          <el-dropdown-item v-for="item in dataList" :key="item.index" :disabled="item.disab" @click.native="goToDashboardC(item.id, item.shortName)">{{item.shortName}}
11 11
            <i v-if="item.disab" class="el-icon-check"></i>
12 12
          </el-dropdown-item>
13 13
        </el-dropdown-menu>
@ -54,7 +54,7 @@ export default {
54 54
  },
55 55
  watch: {
56 56
    '$route'(to, from) {
57
      if (this.$route.path === '/') {
57
      if (to.path === '/dashboard') {
58 58
        this.showName = ''
59 59
      } else {
60 60
        this.bridgeId = Cookies.get('bridgeId')
@ -103,12 +103,14 @@ export default {
103 103
        }
104 104
      })
105 105
    },
106
    goToDashboardC(index, id, name) {
107
      this.$router.push({ name: 'bridgeDetail' })
108
      this.dataList[index].disab = true
106
    goToDashboardC(id, name) {
109 107
      this.showName = name
110 108
      Cookies.set('bridgeId', id)
111 109
      Cookies.set('bridgeName', name)
110
      this.$router.push({
111
        name: 'bridgeDetail',
112
        query: { id: id, name: name }
113
      })
112 114
    }
113 115
  }
114 116
}