Browse Source

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

luyanan 6 years ago
parent
commit
ed17a69608

+ 0 - 24
src/api/bridgeInfo.js

1
import request from '@/utils/request'
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
export function getBridgeList(params) { // 用户所有桥梁
3
export function getBridgeList(params) { // 用户所有桥梁
12
  return request({
4
  return request({
13
    url: '/ajax/bridge/byUser',
5
    url: '/ajax/bridge/byUser',
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
export function getDangerList(params) {
28
export function getDangerList(params) {
53
  return request({
29
  return request({

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

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
  <div>
2
  <div>
3
    <el-dialog title="系统消息编辑" :visible.sync="dialogFormVisible">
3
    <el-dialog title="系统消息编辑" :visible.sync="dialogFormVisible">
4
      <el-form :model="formNotice" ref="formNotice" :rules="rules">
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
      </el-form>
6
      </el-form>
7
      <div class="limit_num">还可以输入{{ableNum}}字</div>
7
      <div slot="footer" class="dialog-footer">
8
      <div slot="footer" class="dialog-footer">
8
        <el-button @click="dialogFormVisible = false">取 消</el-button>
9
        <el-button @click="dialogFormVisible = false">取 消</el-button>
9
        <el-button type="primary" @click="setNotice('formNotice')">确 定</el-button>
10
        <el-button type="primary" @click="setNotice('formNotice')">确 定</el-button>
12
    <el-menu class="message-box" mode="horizontal">
13
    <el-menu class="message-box" mode="horizontal">
13
      <div class="marquee_box">
14
      <div class="marquee_box">
14
        <span class="tit">系统公告:</span>
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
          <div class="marquee_text">{{formNotice.desc}}</div>
18
          <div class="marquee_text">{{formNotice.desc}}</div>
17
        </el-tooltip>
19
        </el-tooltip>
18
        <span class="btn-span" v-if="isShow" @click="openNoticeDialog">设置</span>
20
        <span class="btn-span" v-if="isShow" @click="openNoticeDialog">设置</span>
32
  data() {
34
  data() {
33
    return {
35
    return {
34
      dialogFormVisible: false,
36
      dialogFormVisible: false,
35
      animate: true,
37
      ableNum: 100,
36
      formNotice: {
38
      formNotice: {
37
        desc: ''
39
        desc: ''
38
      },
40
      },
48
    this.getNotice()
50
    this.getNotice()
49
  },
51
  },
50
  methods: {
52
  methods: {
53
    limitFn() {
54
      this.ableNum = 100 - this.formNotice.desc.length
55
    },
51
    getNotice() {
56
    getNotice() {
52
      getNotice().then(res => {
57
      getNotice().then(res => {
53
        if (res.success) {
58
        if (res.success) {
54
          this.formNotice.desc = res.data
59
          this.formNotice.desc = res.data
60
          this.limitFn()
55
        }
61
        }
56
      })
62
      })
57
    },
63
    },
113
      cursor: pointer;
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
</style>
135
</style>

+ 4 - 2
src/router/index.js

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

+ 71 - 0
src/utils/queryInfo.js

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

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

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

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

35
        </el-col>
35
        </el-col>
36
        <el-col :xs="10" :sm="10" :lg="10">
36
        <el-col :xs="10" :sm="10" :lg="10">
37
          <div style="width:100%">
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
          </div>
39
          </div>
40
        </el-col>
40
        </el-col>
41
        <el-col :span="24" v-if="dataInfo.descp">
41
        <el-col :span="24" v-if="dataInfo.descp">

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

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

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

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

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

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

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

1
<template>
1
<template>
2
  <div class="dashboard-editor-container">
2
  <div class="dashboard-editor-container">
3
    <BInfoDialog01 ref="BInfoDialog01"></BInfoDialog01>
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
    <updatePersonInfo ref="updatePersonInfo"></updatePersonInfo>
8
    <updatePersonInfo ref="updatePersonInfo"></updatePersonInfo>
9
    <updateLoginPwd ref="updateLoginPwd"></updateLoginPwd>
9
    <updateLoginPwd ref="updateLoginPwd"></updateLoginPwd>
15
            <span>报警信息</span>
15
            <span>报警信息</span>
16
            <el-button type="text" @click="queryDangerInfo">查看全部</el-button>
16
            <el-button type="text" @click="queryDangerInfo">查看全部</el-button>
17
          </div>
17
          </div>
18
          <ul class="item-ul">
18
          <ul class="item-ul" v-if="dangerList.length">
19
            <li :class="!item.readed ? 'readed-li' : ''" v-for="item in dangerList" :key="item.index" @click="alarmShow(item.aid, item.device)">
19
            <li :class="!item.readed ? 'readed-li' : ''" v-for="item in dangerList" :key="item.index" @click="alarmShow(item.aid, item.device)">
20
              <span>{{item.alarmTime}}</span>
20
              <span>{{item.alarmTime}}</span>
21
              <span>{{item.device}},请点击查看。</span>
21
              <span>{{item.device}},请点击查看。</span>
24
              </span>
24
              </span>
25
            </li>
25
            </li>
26
          </ul>
26
          </ul>
27
          <DefaultPage v-if="!dangerList.length"></DefaultPage>
27
        </el-card>
28
        </el-card>
28
        <el-card class="box-card block-group">
29
        <el-card class="box-card block-group">
29
          <div slot="header" class="block-title">
30
          <div slot="header" class="block-title">
30
            <span>实时监测</span>
31
            <span>实时监测</span>
31
          </div>
32
          </div>
32
          <el-row class="line-chart-box">
33
          <el-row class="line-chart-box" v-if="monitorList.length">
33
            <el-col :xs="24" :sm="24" :lg="24" v-for="item in monitorShowList" :key="item.index">
34
            <el-col :xs="24" :sm="24" :lg="24" v-for="item in monitorShowList" :key="item.index">
34
              <lineChart2 :chartData="item"></lineChart2>
35
              <lineChart2 :chartData="item"></lineChart2>
35
            </el-col>
36
            </el-col>
36
          </el-row>
37
          </el-row>
38
          <DefaultPage v-if="!monitorList.length"></DefaultPage>
37
          <div class="pagination-container">
39
          <div class="pagination-container">
38
            <el-pagination
40
            <el-pagination
39
              background
41
              background
78
<script>
80
<script>
79
import '@/styles/roleuser.scss'
81
import '@/styles/roleuser.scss'
80
import Cookies from 'js-cookie'
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
import { mainCable, location, provinceCityDistrict } from '@/api/numberDictionary'
86
import { mainCable, location, provinceCityDistrict } from '@/api/numberDictionary'
84
87
85
import lineChart2 from '../lineChart/LineChart2'
88
import lineChart2 from '../lineChart/LineChart2'
91
import updatePersonInfo from './components/updatePersonInfo'
94
import updatePersonInfo from './components/updatePersonInfo'
92
import updateLoginPwd from './components/updateLoginPwd'
95
import updateLoginPwd from './components/updateLoginPwd'
93
96
97
import DefaultPage from '@/components/DefaultPage'
98
94
export default {
99
export default {
95
  name: 'dashboard-other',
100
  name: 'dashboard-other',
96
  components: {
101
  components: {
100
    BInfoDialog03,
105
    BInfoDialog03,
101
    BInfoDialog04,
106
    BInfoDialog04,
102
    updatePersonInfo,
107
    updatePersonInfo,
103
    updateLoginPwd
108
    updateLoginPwd,
109
    DefaultPage
104
  },
110
  },
105
  data() {
111
  data() {
106
    return {
112
    return {
107
      dialogW: '880px',
113
      bridgeId: '',
114
      bridgeName: '',
115
      dialogW: '860px',
108
      citys: [],
116
      citys: [],
109
      cableMain: [],
117
      cableMain: [],
110
      addr: [],
118
      addr: [],
111
      dangerList: '',
119
      dangerList: '',
112
      bridgeList: [],
113
      serverList: [],
114
      serverSeqArr: [],
120
      serverSeqArr: [],
115
      deviceList: [],
116
      transducerList: [],
117
      monitorList: [],
121
      monitorList: [],
118
      currentNo: 1,
122
      currentNo: 1,
119
      currentSize: 4,
123
      currentSize: 4,
128
    }
132
    }
129
  },
133
  },
130
  created() {
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
    this.getDictoryData()
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
    // setInterval(() => {
150
    // setInterval(() => {
138
    //   this.addData(true)
151
    //   this.addData(true)
139
    //   this.getTimingMonitor()
152
    //   this.getTimingMonitor()
140
    // }, 60000)
153
    // }, 60000)
141
  },
154
  },
142
  methods: {
155
  methods: {
143
    getDangerList() {
156
    getDangerList(arr) {
144
      const param = {
157
      const param = {
158
        seq: arr,
145
        pageSize: 5,
159
        pageSize: 5,
146
        pageNo: 1
160
        pageNo: 1
147
      }
161
      }
158
        }
172
        }
159
      })
173
      })
160
    },
174
    },
161
    getUserAllResource() {
162
      var _this = this
175
    getTimingMonitor(arr) {
176
      var that = this
163
      const param = {
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
    getDictoryData() {
212
    getDictoryData() {
247
      mainCable().then(response => {
213
      mainCable().then(response => {
287
      this.$router.push({ name: 'dangerList' })
253
      this.$router.push({ name: 'dangerList' })
288
    },
254
    },
289
    queryMonitorInfo() {
255
    queryMonitorInfo() {
290
      this.$router.push({
291
        name: 'bridgeMonitor',
292
        query: { arr: this.serverSeqArr }
293
      })
256
      this.$router.push({ name: 'bridgeMonitor' })
294
    },
257
    },
295
    queryBirdgeInfo() {
258
    queryBirdgeInfo() {
296
      this.$refs.BInfoDialog01.dialogTableVisible = true
259
      this.$refs.BInfoDialog01.dialogTableVisible = true

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

10
          </el-date-picker>
10
          </el-date-picker>
11
          <el-button type="primary" @click="getMonitorByDay">查询</el-button>
11
          <el-button type="primary" @click="getMonitorByDay">查询</el-button>
12
      </div>
12
      </div>
13
      <el-row class="line-chart-box">
13
      <el-row class="line-chart-box" v-if="alarmList.length">
14
        <el-col :xs="24" :sm="24" :lg="24" v-for="item in alarmShowList" :key="item.index">
14
        <el-col :xs="24" :sm="24" :lg="24" v-for="item in alarmShowList" :key="item.index">
15
          <lineChart2 :chartData="item"></lineChart2>
15
          <lineChart2 :chartData="item"></lineChart2>
16
        </el-col>
16
        </el-col>
17
      </el-row>
17
      </el-row>
18
      <DefaultPage v-if="!alarmList.length"></DefaultPage>
18
      <div class="pagination-container">
19
      <div class="pagination-container">
19
        <el-pagination
20
        <el-pagination
20
          background
21
          background
32
33
33
<script>
34
<script>
34
import '@/styles/roleuser.scss'
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
import { getMonitorByDay } from '@/api/bridgeInfo'
39
import { getMonitorByDay } from '@/api/bridgeInfo'
38
import lineChart2 from '../lineChart/LineChart2'
40
import lineChart2 from '../lineChart/LineChart2'
39
41
42
import DefaultPage from '@/components/DefaultPage'
43
40
export default {
44
export default {
41
  data() {
45
  data() {
42
    return {
46
    return {
47
      bridgeId: '',
43
      valueDate: new Date().toISOString().substring(0, 10).replace(/-/g, ''),
48
      valueDate: new Date().toISOString().substring(0, 10).replace(/-/g, ''),
44
      serverSeqArr: [],
49
      serverSeqArr: [],
45
      alarmList: [],
50
      alarmList: [],
48
    }
53
    }
49
  },
54
  },
50
  components: {
55
  components: {
51
    lineChart2
56
    lineChart2,
57
    DefaultPage
52
  },
58
  },
53
  computed: {
59
  computed: {
54
    alarmShowList() {
60
    alarmShowList() {
56
    }
62
    }
57
  },
63
  },
58
  created() {
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
  methods: {
71
  methods: {
63
    getMonitorByDay() {
72
    getMonitorByDay(arr) {
64
      var that = this
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
    changeDate(val) {
110
    changeDate(val) {
107
      this.valueDate = val
111
      this.valueDate = val

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

27
27
28
<script>
28
<script>
29
import {
29
import {
30
  getBridgeServers,
31
  getBridgeList,
30
  getBridgeList,
32
  getBridgeUnread
31
  getBridgeUnread
33
} from '@/api/bridgeInfo'
32
} from '@/api/bridgeInfo'
34
import '@/styles/roleuser.scss'
33
import '@/styles/roleuser.scss'
35
import Cookies from 'js-cookie'
34
import Cookies from 'js-cookie'
35
import queryInfo from '@/utils/queryInfo'
36
36
37
export default {
37
export default {
38
  data() {
38
  data() {
41
      total: 0,
41
      total: 0,
42
      pageSize: 10,
42
      pageSize: 10,
43
      pageNo: 1,
43
      pageNo: 1,
44
      dataList: [],
45
      bridgeList: [],
46
      serverList: [],
47
      serverSeqArr: [],
48
      deviceList: [],
49
      transducerList: []
44
      dataList: []
50
    }
45
    }
51
  },
46
  },
52
  created() {
47
  created() {
48
    queryInfo.queryAllInfo()
53
    this.getBridgeLists()
49
    this.getBridgeLists()
54
  },
50
  },
55
  components: {
56
  },
57
  methods: {
51
  methods: {
58
    getBridgeLists() {
52
    getBridgeLists() {
59
      const param = {
53
      const param = {
63
      }
57
      }
64
      getBridgeList(param).then(res => {
58
      getBridgeList(param).then(res => {
65
        if (res.success) {
59
        if (res.success) {
66
          if (res.data.data.length > 0) {
60
          var $data = res.data.data
61
          if ($data.length > 0) {
67
            this.total = res.data.total
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
      var that = this
73
      var that = this
98
      const param = {
99
        server: $arr
100
      }
101
      var alarmNum = 0
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
    goToDashboardC(id, name) {
89
    goToDashboardC(id, name) {
115
      this.$router.push({ name: 'bridgeHome' })
90
      this.$router.push({ name: 'bridgeHome' })

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

7
          {{showName ? showName : '选择桥梁'}}<i class="el-icon-arrow-down el-icon--right"></i>
7
          {{showName ? showName : '选择桥梁'}}<i class="el-icon-arrow-down el-icon--right"></i>
8
        </span>
8
        </span>
9
        <el-dropdown-menu class="drop-menu-list" style="min-width:120px;" slot="dropdown">
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
            <i v-if="item.disab" class="el-icon-check"></i>
11
            <i v-if="item.disab" class="el-icon-check"></i>
12
          </el-dropdown-item>
12
          </el-dropdown-item>
13
        </el-dropdown-menu>
13
        </el-dropdown-menu>
54
  },
54
  },
55
  watch: {
55
  watch: {
56
    '$route'(to, from) {
56
    '$route'(to, from) {
57
      if (this.$route.path === '/') {
57
      if (to.path === '/dashboard') {
58
        this.showName = ''
58
        this.showName = ''
59
      } else {
59
      } else {
60
        this.bridgeId = Cookies.get('bridgeId')
60
        this.bridgeId = Cookies.get('bridgeId')
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
      this.showName = name
107
      this.showName = name
110
      Cookies.set('bridgeId', id)
108
      Cookies.set('bridgeId', id)
111
      Cookies.set('bridgeName', name)
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
}