Browse Source

普通用户信息展示

luyanan 6 years ago
parent
commit
6a2b06d4e3
32 changed files with 1356 additions and 571 deletions
  1. 100 0
      src/api/bridgeInfo.js
  2. 35 6
      src/api/login.js
  3. 0 41
      src/api/table.js
  4. 132 0
      src/components/Marqueebox/index.vue
  5. 1 0
      src/icons/svg/msgvc.svg
  6. 1 0
      src/icons/svg/unread.svg
  7. 28 2
      src/router/index.js
  8. 1 0
      src/store/getters.js
  9. 7 0
      src/store/modules/user.js
  10. 106 0
      src/styles/roleuser.scss
  11. 1 1
      src/styles/sidebar.scss
  12. 30 48
      src/utils/index.js
  13. 97 0
      src/views/bridgesConsole/bridgeDanger/dangerDetail.vue
  14. 92 0
      src/views/bridgesConsole/bridgeDanger/dangerList.vue
  15. 5 0
      src/views/bridgesConsole/bridgeDanger/index.vue
  16. 4 2
      src/views/bridgesConsole/bridgeDetail/components/BInfoDialog01.vue
  17. 22 26
      src/views/bridgesConsole/bridgeDetail/components/BInfoDialog02.vue
  18. 22 31
      src/views/bridgesConsole/bridgeDetail/components/BInfoDialog03.vue
  19. 23 32
      src/views/bridgesConsole/bridgeDetail/components/BInfoDialog04.vue
  20. 16 0
      src/views/bridgesConsole/bridgeDetail/components/style.scss
  21. 15 25
      src/views/bridgesConsole/bridgeDetail/components/updateLoginPwd.vue
  22. 84 54
      src/views/bridgesConsole/bridgeDetail/components/updatePersonInfo.vue
  23. 195 75
      src/views/bridgesConsole/bridgeDetail/index.vue
  24. 125 0
      src/views/bridgesConsole/bridgeMonitor/index.vue
  25. 38 33
      src/views/dashboard/admin/components/LineChart.vue
  26. 28 28
      src/views/bridgesConsole/bridgeDetail/components/LineChart.vue
  27. 71 79
      src/views/dashboard/other/index.vue
  28. 6 2
      src/views/layout/Layout.vue
  29. 0 66
      src/views/layout/LayoutC.vue
  30. 19 6
      src/views/layout/components/Navbar.vue
  31. 42 1
      src/views/layout/components/TopNavbar.vue
  32. 10 13
      src/views/login/index.vue

+ 100 - 0
src/api/bridgeInfo.js

@ -0,0 +1,100 @@
1
import request from '@/utils/request'
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) { // 用户所有桥梁
12
  return request({
13
    url: '/ajax/bridge/byUser',
14
    method: 'get',
15
    params
16
  })
17
}
18
19
export function getBridgeInfo(params) { // 桥梁信息
20
  return request({
21
    url: '/ajax/bridge/qo',
22
    method: 'get',
23
    params
24
  })
25
}
26
27
export function getBridgeServers(params) { // 桥梁服务器
28
  return request({
29
    url: '/ajax/server/byBridge',
30
    method: 'get',
31
    params
32
  })
33
}
34
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
// 报警信息
52
export function getDangerList(params) {
53
  return request({
54
    url: '/ajax/alarm/msg',
55
    method: 'get',
56
    params
57
  })
58
}
59
export function getDangerDetail(params) {
60
  return request({
61
    url: '/ajax/alarm/detail',
62
    method: 'get',
63
    params
64
  })
65
}
66
// 报警信息
67
68
// 未读报警
69
export function getBridgeUnread(params) {
70
  return request({
71
    url: '/ajax/alarm/msg/unread',
72
    method: 'get',
73
    params
74
  })
75
}
76
export function setUnreadToRead(params) {
77
  return request({
78
    url: '/ajax/alarm/msg/read',
79
    method: 'post',
80
    data: params
81
  })
82
}
83
// 未读报警
84
85
// 监测信息
86
export function getMonitorByDay(params) {
87
  return request({
88
    url: '/ajax/collect/wave/server/day',
89
    method: 'get',
90
    params
91
  })
92
}
93
export function getTimingMonitor(params) {
94
  return request({
95
    url: '/ajax/collect/wave/curr',
96
    method: 'get',
97
    params
98
  })
99
}
100
// 监测信息

+ 35 - 6
src/api/login.js

@ -55,14 +55,43 @@ export function resetPwdByTel(pw, vc) {
55 55
}
56 56
57 57
// 修改密码
58
export function changePw(id, oldPw, newPw) {
58
export function changePw(params) {
59 59
  return request({
60 60
    url: '/ajax/sys/changePw',
61 61
    method: 'post',
62
    data: {
63
      id,
64
      oldPw,
65
      newPw
66
    }
62
    data: params
63
  })
64
}
65
66
// 获取修改个人信息
67
export function getMyself(params) {
68
  return request({
69
    url: '/ajax/sys/qo',
70
    method: 'get',
71
    params
72
  })
73
}
74
75
export function updateMyself(params) {
76
  return request({
77
    url: '/ajax/sys/update',
78
    method: 'post',
79
    data: params
80
  })
81
}
82
83
// 获取公告信息
84
export function getNotice() {
85
  return request({
86
    url: '/ajax/sys/notice',
87
    method: 'get'
88
  })
89
}
90
91
export function updateNotice(params) {
92
  return request({
93
    url: '/ajax/sys/notice',
94
    method: 'post',
95
    data: params
67 96
  })
68 97
}

+ 0 - 41
src/api/table.js

@ -1,41 +0,0 @@
1
import request from '@/utils/request'
2
3
export function getBridgeList(params) {
4
  return request({
5
    url: '/ajax/bridge/byUser',
6
    method: 'get',
7
    params
8
  })
9
}
10
11
export function getBridgeInfo(params) {
12
  return request({
13
    url: '/ajax/bridge/qo',
14
    method: 'get',
15
    params
16
  })
17
}
18
19
export function getBridgeServers(params) {
20
  return request({
21
    url: '/ajax/server/byBridge',
22
    method: 'get',
23
    params
24
  })
25
}
26
27
export function getBridgeDevices(params) {
28
  return request({
29
    url: '/ajax/device/byServer',
30
    method: 'get',
31
    params
32
  })
33
}
34
35
export function getBridgeSensors(params) {
36
  return request({
37
    url: '/ajax/transducer/byDevice',
38
    method: 'get',
39
    params
40
  })
41
}

+ 132 - 0
src/components/Marqueebox/index.vue

@ -0,0 +1,132 @@
1
<template>
2
  <div>
3
    <el-dialog title="系统消息编辑" :visible.sync="dialogFormVisible">
4
      <el-form :model="formNotice" ref="formNotice" :rules="rules">
5
        <el-input type="textarea" v-model="formNotice.desc"></el-input>
6
      </el-form>
7
      <div slot="footer" class="dialog-footer">
8
        <el-button @click="dialogFormVisible = false">取 消</el-button>
9
        <el-button type="primary" @click="setNotice('formNotice')">确 定</el-button>
10
      </div>
11
    </el-dialog>
12
    <el-menu class="message-box" mode="horizontal">
13
      <div class="marquee_box">
14
        <span class="tit">系统公告:</span>
15
        <div ref="rollul" class="marquee_text" :class="{anim:animate}">
16
          {{formNotice.desc}}
17
        </div>
18
        <span class="btn-span" v-if="isShow" @click="openNoticeDialog">设置</span>
19
      </div>
20
    </el-menu>
21
  </div>
22
</template>
23
 
24
<script>
25
import { getNotice, updateNotice } from '@/api/login'
26
export default {
27
  props: {
28
    isShow: {
29
      type: Boolean
30
    }
31
  },
32
  data() {
33
    return {
34
      dialogFormVisible: false,
35
      animate: true,
36
      formNotice: {
37
        desc: ''
38
      },
39
      rules: {
40
        desc: [
41
          { required: true, message: '请编辑内容发送', trigger: 'blur' },
42
          { max: 100, message: '不得超过100个字', trigger: 'blur' }
43
        ]
44
      }
45
    }
46
  },
47
  created() {
48
    this.getNotice()
49
    setInterval(this.scroll, 3000)
50
  },
51
  methods: {
52
    getNotice() {
53
      getNotice().then(res => {
54
        if (res.success) {
55
          this.formNotice.desc = res.data
56
        }
57
      })
58
    },
59
    openNoticeDialog() {
60
      this.dialogFormVisible = true
61
    },
62
    setNotice(formName) {
63
      this.$refs[formName].validate((valid) => {
64
        if (valid) {
65
          const param = {
66
            cnt: this.formNotice.desc
67
          }
68
          updateNotice(param).then(res => {
69
            if (res.success) {
70
              this.dialogFormVisible = false
71
              this.$refs[formName].resetFields()
72
            }
73
          })
74
        } else {
75
          return false
76
        }
77
      })
78
    },
79
    scroll() {
80
      // const con1 = this.$refs.rollul
81
      // con1.style.marginTop = '0px'
82
      // this.animate = !this.animate
83
      // var that = this
84
      // setTimeout(() => {
85
      //   con1.style.marginTop = '-50px'
86
      //   that.animate = !that.animate
87
      // }, 1000)
88
    }
89
  }
90
}
91
</script>
92
 
93
<style rel="stylesheet/scss" lang="scss" scoped>
94
.message-box{
95
  height: 50px;
96
  line-height: 50px;
97
  padding: 0 10px;
98
  border-radius: 0px !important;
99
  color: #303133;
100
  background: #c7e3ff;
101
  padding: 0 20px;
102
  font-size: 14px;
103
  .marquee_box {
104
    width: 100%;
105
    position: relative;
106
    height: 50px;
107
    overflow: hidden;
108
    .marquee_text {
109
      line-height: 50px;
110
      position:absolute;
111
      top:0;
112
      padding-left:68px;
113
      padding-right: 80px;
114
      width:100%;
115
      box-sizing: border-box;
116
      overflow: hidden;
117
    }
118
    .btn-span{
119
      position:absolute;
120
      top:0;
121
      right:0;
122
      cursor: pointer;
123
    }
124
  }
125
  .anim{
126
    transition: all 0.5s;
127
  }
128
}
129
.el-textarea .el-textarea__inner{
130
  height: 160px;
131
}
132
</style>

+ 1 - 0
src/icons/svg/msgvc.svg

@ -0,0 +1 @@
1
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1534314336166" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1053" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M835.1 200.9c-7.7 0.3-15.3 0.4-22.7 0.4-194.9 0-280.9-82.6-281.6-83.3l-19.4-19.7-19.6 19.7c-0.8 0.9-85 83.3-281.5 83.3-7.4 0-15-0.1-22.7-0.4l-27.4-0.9v374.4c0 98 35.4 241 341.6 350.4l9.6 3.4 9.6-3.4c306.2-109.4 341.6-252.4 341.6-350.4V200l-27.5 0.9M481.2 671.2L304.8 517.6l46.8-37.3 93.8 68S574.9 416.6 700 355l17.9 19.8S561.6 502.2 481.2 671.2m0 0" p-id="1054"></path></svg>

+ 1 - 0
src/icons/svg/unread.svg

@ -0,0 +1 @@
1
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1534314532421" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2816" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M511.999488 66.861804c-245.826801 0-445.138196 199.203948-445.138196 445.138196 0 245.826801 199.311395 445.138196 445.138196 445.138196 245.825778 0 445.138196-199.311395 445.138196-445.138196C957.137685 266.065751 757.824243 66.861804 511.999488 66.861804zM484.177839 230.311433c0-15.431457 12.443403-27.821649 27.821649-27.821649s27.821649 12.389168 27.821649 27.821649l0 389.495922c0 15.32401-12.443403 27.821649-27.821649 27.821649s-27.821649-12.497639-27.821649-27.821649L484.177839 230.311433zM511.999488 807.599392c-22.985504 0-41.73145-18.800181-41.73145-41.73145 0-23.039739 18.745946-41.73145 41.73145-41.73145s41.73145 18.692734 41.73145 41.73145C553.730938 788.79921 534.984992 807.599392 511.999488 807.599392z" p-id="2817"></path></svg>

+ 28 - 2
src/router/index.js

@ -8,7 +8,6 @@ Vue.use(Router)
8 8
9 9
/* Layout */
10 10
import Layout from '../views/layout/Layout'
11
import LayoutC from '../views/layout/LayoutC'
12 11
13 12
/** note: submenu only apppear when children.length>=1
14 13
*   detail see  https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
@ -52,7 +51,7 @@ export const constantRouterMap = [
52 51
53 52
  {
54 53
    path: '',
55
    component: LayoutC,
54
    component: Layout,
56 55
    name: 'bridgesConsole',
57 56
    meta: {
58 57
      noCache: true
@ -63,6 +62,33 @@ export const constantRouterMap = [
63 62
        name: 'bridgeDetail',
64 63
        component: () => import('@/views/bridgesConsole/bridgeDetail/index'),
65 64
        meta: { noCache: true }
65
      },
66
      {
67
        path: 'danger',
68
        name: 'danger',
69
        redirect: 'noredirect',
70
        meta: { title: '历史报警信息查询', noCache: true },
71
        component: () => import('@/views/bridgesConsole/bridgeDanger/index'),
72
        children: [
73
          {
74
            path: 'dangerList',
75
            name: 'dangerList',
76
            component: () => import('@/views/bridgesConsole/bridgeDanger/dangerList'),
77
            meta: { noCache: true }
78
          },
79
          {
80
            path: 'dangerDetail',
81
            name: 'dangerDetail',
82
            component: () => import('@/views/bridgesConsole/bridgeDanger/dangerDetail'),
83
            meta: { title: '报警信息浏览', noCache: true }
84
          }
85
        ]
86
      },
87
      {
88
        path: 'bridgeMonitor',
89
        name: 'bridgeMonitor',
90
        component: () => import('@/views/bridgesConsole/bridgeMonitor/index'),
91
        meta: { title: '历史监测信息查询', noCache: true }
66 92
      }
67 93
    ]
68 94
  },

+ 1 - 0
src/store/getters.js

@ -1,6 +1,7 @@
1 1
const getters = {
2 2
  sidebar: state => state.app.sidebar,
3 3
  device: state => state.app.device,
4
  account: state => state.user.account,
4 5
  userid: state => state.user.userid,
5 6
  name: state => state.user.name,
6 7
  roles: state => state.user.roles,

+ 7 - 0
src/store/modules/user.js

@ -3,6 +3,7 @@ import { getSession, removeSession } from '@/utils/auth'
3 3
4 4
const user = {
5 5
  state: {
6
    account: '',
6 7
    userid: '',
7 8
    name: '',
8 9
    roles: [],
@ -10,6 +11,9 @@ const user = {
10 11
    session: getSession()
11 12
  },
12 13
  mutations: {
14
    SET_ACCOUNT: (state, account) => {
15
      state.account = account
16
    },
13 17
    SET_USERID: (state, userid) => {
14 18
      state.userid = userid
15 19
    },
@ -39,6 +43,7 @@ const user = {
39 43
            if (response.data) {
40 44
              const dataS = response.data
41 45
              if (dataS.active) {
46
                commit('SET_ACCOUNT', dataS.account)
42 47
                commit('SET_USERID', dataS.id)
43 48
                commit('SET_ROLES', [dataS.type.toString()])
44 49
                commit('SET_NAME', dataS.name)
@ -61,6 +66,7 @@ const user = {
61 66
            if (response.data) {
62 67
              const dataS = response.data
63 68
              if (dataS.active) {
69
                commit('SET_ACCOUNT', dataS.account)
64 70
                commit('SET_USERID', dataS.id)
65 71
                commit('SET_ROLES', [dataS.type.toString()])
66 72
                commit('SET_NAME', dataS.name)
@ -78,6 +84,7 @@ const user = {
78 84
    LogOut({ commit, state }) {
79 85
      return new Promise((resolve, reject) => {
80 86
        logout().then(() => {
87
          commit('SET_ACCOUNT', '')
81 88
          commit('SET_USERID', '')
82 89
          commit('SET_ROLES', [])
83 90
          commit('SET_NAME', '')

+ 106 - 0
src/styles/roleuser.scss

@ -0,0 +1,106 @@
1
.dashboard-editor-container{
2
  padding: 32px;
3
  .block-group{
4
    background: #fff;
5
    margin-bottom: 20px;
6
    .block-title{
7
      display: flex;
8
      justify-content: space-between;
9
      .el-button{
10
        padding: 3px 0;
11
      }
12
    }
13
    .item-ul{
14
      margin: 0;
15
      padding: 0 10px;
16
      li{
17
        padding: 8px 0;
18
        margin: 0;
19
        list-style: none;
20
        cursor: pointer;
21
        &.readed-li{
22
          color: #de0000;
23
        }
24
        span{
25
          display: inline-block;
26
          margin-right: 15px;
27
        }
28
      }
29
    }
30
    .grid-content{
31
      height: 100px;
32
      display: flex;
33
      text-align: center;
34
      justify-content: center;
35
      align-items: center;
36
      background-color: #f8f8f8;
37
      margin-bottom: 8px;
38
      padding:20px;
39
      cursor: pointer;
40
      &:hover {
41
        transition: all 0.2s ease-out;
42
        color: #fff;
43
        background: #36a3f7;
44
      }
45
    }
46
  }
47
  .panel-group {
48
    margin-top: 18px;
49
    .card-panel-col{
50
      margin-bottom: 32px;
51
    }
52
    .card-panel {
53
      cursor: pointer;
54
      padding: 15px;
55
      font-size: 12px;
56
      position: relative;
57
      overflow: hidden;
58
      color: #666;
59
      background: #fff;
60
      box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
61
      border-color: rgba(0, 0, 0, .05);
62
      &:hover {
63
        .card-panel-icon-wrapper {
64
          color: #fff;
65
        }
66
      }
67
      .card-panel-icon-wrapper {
68
        margin: 10px 0;
69
        transition: all 0.38s ease-out;
70
        border-radius: 6px;
71
      }
72
      .card-image{
73
        width: 100%;
74
        max-width: 280px;
75
        margin: auto;
76
        height: 160px;
77
        border: 1px solid #d0d0d0;
78
        background-position: center;
79
        background-size: cover;
80
      }
81
      .card-panel-icon {
82
        font-size: 48px;
83
      }
84
      .card-panel-description {
85
        font-weight: bold;
86
        margin-top:12px;
87
        .card-panel-text {
88
          line-height: 24px;
89
          color: rgba(0, 0, 0, 0.45);
90
          font-size: 16px;
91
        }
92
        .card-panel-text-red {
93
          color: #de0000
94
        }
95
        .card-panel-num {
96
          font-size: 20px;
97
        }
98
      }
99
    }
100
  }
101
  .line-chart-box{
102
    .el-col{
103
      margin: 15px 0;
104
    }
105
  }
106
}

+ 1 - 1
src/styles/sidebar.scss

@ -2,7 +2,7 @@
2 2
  // 主体区域
3 3
  .main-container {
4 4
    min-height: 100%;
5
    top:50px;
5
    padding-top:50px;
6 6
    transition: margin-left .28s;
7 7
    margin-left: 240px;
8 8
    position: relative;

+ 30 - 48
src/utils/index.js

@ -3,58 +3,40 @@
3 3
 */
4 4
export const comUrl = 'http://localhost:90'
5 5
6
export function parseTime(time, cFormat) {
7
  if (arguments.length === 0) {
8
    return null
9
  }
10
  const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
11
  let date
12
  if (typeof time === 'object') {
13
    date = time
6
/**
7
 * 解析url参数
8
 * @example ?id=12345&a=b
9
 * @return Object {id:12345,a:b}
10
 */
11
export function urlParse(name) {
12
  return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || ['', ''])[1].replace(/\+/g, '%20')) || null
13
}
14
15
export function parseTime(startTime, flag, fa) {
16
  if (flag) {
17
    if (!fa) {
18
      return startTime.substring(0, 4) + '年' + startTime.substring(4, 6) + '月' + startTime.substring(6, 8) + '日 ' + startTime.substring(8, 10) + ':' + startTime.substring(10, 12)
19
    } else {
20
      return startTime.substring(0, 4) + '/' + startTime.substring(4, 6) + '/' + startTime.substring(6, 8) + ' ' + startTime.substring(8, 10) + ':' + startTime.substring(10, 12) + ':' + startTime.substring(12, 14)
21
    }
14 22
  } else {
15
    if (('' + time).length === 10) time = parseInt(time) * 1000
16
    date = new Date(time)
23
    return startTime.substring(0, 4) + '/' + startTime.substring(4, 6) + '/' + startTime.substring(6, 8)
17 24
  }
18
  const formatObj = {
19
    y: date.getFullYear(),
20
    m: date.getMonth() + 1,
21
    d: date.getDate(),
22
    h: date.getHours(),
23
    i: date.getMinutes(),
24
    s: date.getSeconds(),
25
    a: date.getDay()
26
  }
27
  const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
28
    let value = formatObj[key]
29
    if (key === 'a') return ['一', '二', '三', '四', '五', '六', '日'][value - 1]
30
    if (result.length > 0 && value < 10) {
31
      value = '0' + value
32
    }
33
    return value || 0
34
  })
35
  return time_str
36 25
}
37 26
38
export function formatTime(time, option) {
39
  time = +time * 1000
40
  const d = new Date(time)
41
  const now = Date.now()
42
43
  const diff = (now - d) / 1000
44
45
  if (diff < 30) {
46
    return '刚刚'
47
  } else if (diff < 3600) { // less 1 hour
48
    return Math.ceil(diff / 60) + '分钟前'
49
  } else if (diff < 3600 * 24) {
50
    return Math.ceil(diff / 3600) + '小时前'
51
  } else if (diff < 3600 * 24 * 2) {
52
    return '1天前'
53
  }
54
  if (option) {
55
    return parseTime(time, option)
56
  } else {
57
    return d.getMonth() + 1 + '月' + d.getDate() + '日' + d.getHours() + '时' + d.getMinutes() + '分'
27
export function turnTime(time, hasT, hasF) { // hasT='date/time'是否有时分秒,hasF是否需要显示格式
28
  if (hasT === 'time') {
29
    if (hasF) {
30
      return [time.getFullYear(), time.getMonth() + 1, time.getDate()].join('/') + ' ' + [time.getHours(), time.getMinutes(), time.getSeconds()].join(':')
31
    } else {
32
      return time.getFullYear() + (time.getMonth() + 1) + time.getDate() + time.getHours() + time.getMinutes() + time.getSeconds()
33
    }
34
  } else if (hasT === 'date') {
35
    if (hasF) {
36
      return [time.getFullYear(), time.getMonth() + 1, time.getDate()].join('/')
37
    } else {
38
      return time.getFullYear() + (time.getMonth() + 1) + time.getDate()
39
    }
58 40
  }
59 41
}
60 42

+ 97 - 0
src/views/bridgesConsole/bridgeDanger/dangerDetail.vue

@ -0,0 +1,97 @@
1
<template>
2
  <div class="dashboard-editor-container">
3
    <el-card class="box-card block-group">
4
      <div slot="header" class="block-title">
5
        <span>{{alarmTime}}</span>
6
        <span>{{alarmTit}}</span>
7
      </div>
8
      <el-row class="line-chart-box">
9
        <el-col :xs="24" :sm="24" :lg="24" v-for="(item, index) in alarmShowList" :key="item.index">
10
          <lineChart :chartData="item.data" :startTime="item.stime" :legendName="'传感器' + item.seq" :lineColor="index" :intervalTime="intervalTime"></lineChart>
11
        </el-col>
12
      </el-row>
13
      <div class="pagination-container">
14
        <el-pagination
15
          background
16
          @current-change="handleCurrentChange"
17
          :current-page.sync="pageNo"
18
          :page-size="pageSize"
19
          layout="prev, pager, next, jumper"
20
          :total="alarmList.length">
21
        </el-pagination>
22
      </div>
23
    </el-card>
24
  </div>
25
</template>
26
27
<script>
28
import '@/styles/roleuser.scss'
29
import { urlParse, parseTime } from '@/utils'
30
import { getDangerDetail, setUnreadToRead } from '@/api/bridgeInfo'
31
import lineChart from '../lineChart/LineChart'
32
33
export default {
34
  data() {
35
    return {
36
      alarmId: '',
37
      alarmTit: '',
38
      alarmList: [],
39
      pageSize: 6,
40
      pageNo: 1,
41
      intervalTime: 3 * 1000
42
    }
43
  },
44
  components: {
45
    lineChart
46
  },
47
  created() {
48
    this.alarmId = urlParse('aid')
49
    this.alarmTit = urlParse('msg')
50
    this.getDangerDetail()
51
    this.setUnreadToRead()
52
  },
53
  computed: {
54
    alarmTime() {
55
      const alramM = this.alarmId.split('_')
56
      return parseTime(alramM[ alramM.length - 1], true)
57
    },
58
    alarmShowList() {
59
      return this.alarmList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
60
    }
61
  },
62
  methods: {
63
    getDangerDetail() {
64
      const param = {
65
        aid: this.alarmId
66
      }
67
      getDangerDetail(param).then(res => {
68
        if (res.success && res.data) {
69
          for (let i = 0; i < res.data.length; i++) {
70
            const arr = JSON.parse('[' + String(res.data[i].data.split(',')) + ']')
71
            res.data[i].data = arr
72
          }
73
          this.alarmList = res.data
74
        }
75
      })
76
    },
77
    setUnreadToRead() {
78
      const param = {
79
        aid: this.alarmId
80
      }
81
      setUnreadToRead(param).then(res => {
82
      })
83
    },
84
    handleCurrentChange(val) {
85
      this.pageNo = val
86
    }
87
  }
88
}
89
</script>
90
<style rel="stylesheet/scss" lang="scss" scoped>
91
.dashboard-editor-container .block-group .block-title{
92
  justify-content: flex-start;
93
  span{
94
    margin-right: 15px;
95
  }
96
}
97
</style>

+ 92 - 0
src/views/bridgesConsole/bridgeDanger/dangerList.vue

@ -0,0 +1,92 @@
1
<template>
2
  <div class="dashboard-editor-container">
3
    <el-card class="box-card block-group">
4
      <div slot="header" class="block-title">
5
        <span>报警信息</span>
6
      </div>
7
      <ul class="item-ul">
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>
10
          <span>{{item.device}},请点击查看。</span>
11
          <span class="svg-container" v-if="!item.readed">
12
            <svg-icon icon-class="unread"></svg-icon>
13
          </span>
14
        </li>
15
      </ul>
16
      <div class="pagination-container">
17
        <el-pagination
18
          background
19
          @current-change="handleCurrentChange"
20
          :current-page.sync="pageNo"
21
          :page-size="pageSize"
22
          layout="prev, pager, next, jumper"
23
          :total="total">
24
        </el-pagination>
25
      </div>
26
    </el-card>
27
  </div>
28
</template>
29
30
31
<script>
32
import '@/styles/roleuser.scss'
33
import { urlParse, parseTime } from '@/utils'
34
import { getDangerList } from '@/api/bridgeInfo'
35
36
export default {
37
  data() {
38
    return {
39
      bridgeName: '',
40
      dangerList: [],
41
      total: 0,
42
      pageSize: 4,
43
      pageNo: 1
44
    }
45
  },
46
  computed: {
47
    dangerShowList() {
48
      return this.dangerList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
49
    }
50
  },
51
  created() {
52
    this.bridgeName = urlParse('name')
53
    this.getDangerList()
54
  },
55
  methods: {
56
    getDangerList() {
57
      const param = {
58
        pageSize: 18,
59
        pageNo: 1
60
      }
61
      getDangerList(param).then(res => {
62
        if (res.success && res.data.data) {
63
          const dataS = res.data.data
64
          this.total = res.data.total
65
          for (let i = 0; i < dataS.length; i++) {
66
            if (dataS[i].alarmTime) {
67
              dataS[i].alarmTime = parseTime(dataS[i].alarmTime, true)
68
            }
69
            dataS[i].device = `${this.bridgeName}大桥${dataS[i].device}采集盒检测到异常情况`
70
          }
71
          this.dangerList = dataS
72
        }
73
      })
74
    },
75
    alarmShow(id, msg) {
76
      this.$router.push({
77
        name: 'dangerDetail',
78
        query: { aid: id, msg: msg }
79
      })
80
    },
81
    handleCurrentChange(val) {
82
      this.pageNo = val
83
    }
84
  }
85
}
86
</script>
87
88
<style rel="stylesheet/scss" lang="scss" scoped>
89
.item-ul{
90
  min-height: 400px;
91
}
92
</style>

+ 5 - 0
src/views/bridgesConsole/bridgeDanger/index.vue

@ -0,0 +1,5 @@
1
<template>
2
  <div>
3
    <router-view></router-view>
4
  </div>
5
</template>

+ 4 - 2
src/views/bridgesConsole/bridgeDetail/components/BInfoDialog01.vue

@ -35,7 +35,7 @@
35 35
        </el-col>
36 36
        <el-col :xs="24" :sm="6" :lg="8">
37 37
          <div style="width:100%">
38
            <img :src="dataInfo.img" alt="桥梁图片" width="90%">
38
            <img :src="dataInfo.img" :alt="dataInfo.shortName" width="90%">
39 39
          </div>
40 40
        </el-col>
41 41
        <el-col :span="24" v-if="dataInfo.descp">
@ -59,7 +59,8 @@
59 59
</template>
60 60
61 61
<script>
62
import { getBridgeInfo } from '@/api/table'
62
import { getBridgeInfo } from '@/api/bridgeInfo'
63
import { parseTime } from '@/utils'
63 64
64 65
export default {
65 66
  props: {
@ -83,6 +84,7 @@ export default {
83 84
      }
84 85
      getBridgeInfo(param).then(res => {
85 86
        if (res.success) {
87
          res.data.serviceDay = parseTime(res.data.serviceDay)
86 88
          this.dataInfo = res.data
87 89
        }
88 90
      })

+ 22 - 26
src/views/bridgesConsole/bridgeDetail/components/BInfoDialog02.vue

@ -2,7 +2,7 @@
2 2
  <el-dialog title="采集服务器信息" :visible.sync="dialogTableVisible" width="80%">
3 3
    <el-form class="form-main">
4 4
      <el-row :gutter="16">
5
        <el-col :xs="12" :sm="12" :lg="12" v-for="item in [0,1,2,3]" :key="item.id">
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>
8 8
              <el-col :span="12">
@ -12,7 +12,7 @@
12 12
                <el-form-item label="采集器数量">{{item.devices}}</el-form-item>
13 13
              </el-col>
14 14
              <el-col :span="24">
15
                <el-form-item label="所属桥梁">{{item.bridgeId}}</el-form-item>
15
                <el-form-item label="所属桥梁">{{bridgeName}}</el-form-item>
16 16
              </el-col>
17 17
              <el-col :span="24">
18 18
                <el-form-item label="备注" class="el-to-block"><br />
@ -26,12 +26,11 @@
26 26
      <div class="pagination-container">
27 27
        <el-pagination
28 28
          background
29
          @size-change="handleSizeChange"
30 29
          @current-change="handleCurrentChange"
31
          :current-page.sync="currentPage"
32
          :page-size="4"
30
          :current-page.sync="pageNo"
31
          :page-size="pageSize"
33 32
          layout="prev, pager, next, jumper"
34
          :total="10">
33
          :total="serverList.length">
35 34
        </el-pagination>
36 35
      </div>
37 36
      <el-row>
@ -46,36 +45,33 @@
46 45
</template>
47 46
48 47
<script>
48
import './style.scss'
49 49
50 50
export default {
51
  props: {
52
    serverList: {
53
      type: Array
54
    },
55
    bridgeName: {
56
      type: String
57
    }
58
  },
51 59
  data() {
52 60
    return {
53 61
      dialogTableVisible: false,
54
      currentPage: 1
62
      pageSize: 4,
63
      pageNo: 1
64
    }
65
  },
66
  computed: {
67
    serverShowList() {
68
      return this.serverList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
55 69
    }
56 70
  },
57 71
  methods: {
58
    handleSizeChange(val) {
59
      console.log(`每页 ${val} 条`)
60
    },
61 72
    handleCurrentChange(val) {
62
      console.log(`当前页: ${val}`)
73
      this.pageNo = val
63 74
    }
64 75
  }
65 76
}
66 77
</script>
67
68
<style rel="stylesheet/scss" lang="scss" scoped>
69
  .el-form-item{
70
    margin: 0;
71
  }
72
  .textarea-div{
73
    line-height: 26px;
74
    margin-bottom: 10px;
75
  }
76
  .list-item{
77
    border: 1px solid #ccc;
78
    margin-bottom: 20px;
79
    padding: 10px 15px;
80
  }
81
</style>

+ 22 - 31
src/views/bridgesConsole/bridgeDetail/components/BInfoDialog03.vue

@ -2,23 +2,21 @@
2 2
  <el-dialog title="采集盒信息" :visible.sync="dialogTableVisible" width="80%">
3 3
    <el-form class="form-main">
4 4
      <el-row :gutter="16">
5
        <el-col :xs="12" :sm="12" :lg="12" v-for="item in [0,1,2,3]" :key="item.id">
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>
8 8
              <el-col :span="12">
9
                <el-form-item label="采集盒编号">000000001</el-form-item>
9
                <el-form-item label="采集盒编号">{{item.code}}</el-form-item>
10 10
              </el-col>
11 11
              <el-col :span="12">
12
                <el-form-item label="采集盒信道数量">2</el-form-item>
12
                <el-form-item label="采集盒信道数量">{{item.channels}}</el-form-item>
13 13
              </el-col>
14 14
              <el-col :span="24">
15
                <el-form-item label="采集盒所属服务器编号">1926831</el-form-item>
15
                <el-form-item label="采集盒所属服务器编号">{{item.serverCode}}</el-form-item>
16 16
              </el-col>
17 17
              <el-col :span="24">
18 18
                <el-form-item label="备注" class="el-to-block"><br />
19
                  <div class="textarea-div">
20
                  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar sic tempor. Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus pronin sapien nunc accuan eget.
21
                  </div>
19
                  <div class="textarea-div">{{item.remark}}</div>
22 20
                </el-form-item>
23 21
              </el-col>
24 22
            </el-row>
@ -28,12 +26,11 @@
28 26
      <div class="pagination-container">
29 27
        <el-pagination
30 28
          background
31
          @size-change="handleSizeChange"
32 29
          @current-change="handleCurrentChange"
33
          :current-page.sync="currentPage"
34
          :page-size="4"
30
          :current-page.sync="pageNo"
31
          :page-size="pageSize"
35 32
          layout="prev, pager, next, jumper"
36
          :total="10">
33
          :total="deviceList.length">
37 34
        </el-pagination>
38 35
      </div>
39 36
      <el-row>
@ -48,36 +45,30 @@
48 45
</template>
49 46
50 47
<script>
48
import './style.scss'
51 49
52 50
export default {
51
  props: {
52
    deviceList: {
53
      type: Array
54
    }
55
  },
53 56
  data() {
54 57
    return {
55 58
      dialogTableVisible: false,
56
      currentPage: 1
59
      pageSize: 4,
60
      pageNo: 1
61
    }
62
  },
63
  computed: {
64
    deviceShowList() {
65
      return this.deviceList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
57 66
    }
58 67
  },
59 68
  methods: {
60
    handleSizeChange(val) {
61
      console.log(`每页 ${val} 条`)
62
    },
63 69
    handleCurrentChange(val) {
64
      console.log(`当前页: ${val}`)
70
      this.pageNo = val
65 71
    }
66 72
  }
67 73
}
68 74
</script>
69
70
<style rel="stylesheet/scss" lang="scss" scoped>
71
  .el-form-item{
72
    margin: 0;
73
  }
74
  .textarea-div{
75
    line-height: 26px;
76
    margin-bottom: 10px;
77
  }
78
  .list-item{
79
    border: 1px solid #ccc;
80
    margin-bottom: 20px;
81
    padding: 10px 15px;
82
  }
83
</style>

+ 23 - 32
src/views/bridgesConsole/bridgeDetail/components/BInfoDialog04.vue

@ -2,26 +2,24 @@
2 2
  <el-dialog title="传感器信息" :visible.sync="dialogTableVisible" width="80%">
3 3
    <el-form class="form-main">
4 4
      <el-row :gutter="16">
5
        <el-col :xs="12" :sm="12" :lg="12" v-for="item in [0,1,2,3]" :key="item.id">
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>
8 8
              <el-col :span="12">
9
                <el-form-item label="采集盒编号">000000001</el-form-item>
9
                <el-form-item label="采集盒编号">{{item.deviceCode}}</el-form-item>
10 10
              </el-col>
11 11
              <el-col :span="12">
12
                <el-form-item label="传感器编号">8903420394</el-form-item>
12
                <el-form-item label="传感器编号">{{item.code}}</el-form-item>
13 13
              </el-col>
14 14
              <el-col :span="12">
15
                <el-form-item label="所属主缆">上游主缆</el-form-item>
15
                <el-form-item label="所属主缆">{{item.cableType}}</el-form-item>
16 16
              </el-col>
17 17
              <el-col :span="12">
18
                <el-form-item label="传感器位置">东段</el-form-item>
18
                <el-form-item label="传感器位置">{{item.locType}}</el-form-item>
19 19
              </el-col>
20 20
              <el-col :span="24">
21 21
                <el-form-item label="备注" class="el-to-block"><br />
22
                  <div class="textarea-div">
23
                  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar sic tempor. Sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus pronin sapien nunc accuan eget.
24
                  </div>
22
                  <div class="textarea-div">{{item.remark}}</div>
25 23
                </el-form-item>
26 24
              </el-col>
27 25
            </el-row>
@ -31,12 +29,11 @@
31 29
      <div class="pagination-container">
32 30
        <el-pagination
33 31
          background
34
          @size-change="handleSizeChange"
35 32
          @current-change="handleCurrentChange"
36
          :current-page.sync="currentPage"
37
          :page-size="4"
33
          :current-page.sync="pageNo"
34
          :page-size="pageSize"
38 35
          layout="prev, pager, next, jumper"
39
          :total="10">
36
          :total="transducerList.length">
40 37
        </el-pagination>
41 38
      </div>
42 39
      <el-row>
@ -51,36 +48,30 @@
51 48
</template>
52 49
53 50
<script>
51
import './style.scss'
54 52
55 53
export default {
54
  props: {
55
    transducerList: {
56
      type: Array
57
    }
58
  },
56 59
  data() {
57 60
    return {
58 61
      dialogTableVisible: false,
59
      currentPage: 1
62
      pageSize: 4,
63
      pageNo: 1
64
    }
65
  },
66
  computed: {
67
    transducerShowList() {
68
      return this.transducerList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
60 69
    }
61 70
  },
62 71
  methods: {
63
    handleSizeChange(val) {
64
      console.log(`每页 ${val} 条`)
65
    },
66 72
    handleCurrentChange(val) {
67
      console.log(`当前页: ${val}`)
73
      this.pageNo = val
68 74
    }
69 75
  }
70 76
}
71 77
</script>
72
73
<style rel="stylesheet/scss" lang="scss" scoped>
74
  .el-form-item{
75
    margin: 0;
76
  }
77
  .textarea-div{
78
    line-height: 26px;
79
    margin-bottom: 10px;
80
  }
81
  .list-item{
82
    border: 1px solid #ccc;
83
    margin-bottom: 20px;
84
    padding: 10px 15px;
85
  }
86
</style>

+ 16 - 0
src/views/bridgesConsole/bridgeDetail/components/style.scss

@ -0,0 +1,16 @@
1
.form-main{
2
  .el-form-item{
3
    margin: 0;
4
  }
5
}
6
.textarea-div{
7
  line-height: 26px;
8
  margin-bottom: 10px;
9
}
10
.list-item{
11
  border: 1px solid #ccc;
12
  margin-bottom: 20px;
13
  padding: 10px 15px;
14
  height: 200px;
15
  overflow: hidden;
16
}

+ 15 - 25
src/views/bridgesConsole/bridgeDetail/components/updateLoginPwd.vue

@ -1,19 +1,15 @@
1 1
<template>
2
  <el-dialog title="修改登录密码" ref="ruleForm" :visible.sync="dialogTableVisible" width="460px">
2
  <el-dialog title="修改登录密码" :visible.sync="dialogTableVisible" width="460px">
3 3
    <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" class="demo-ruleForm">
4
      <el-form-item prop="oldpass">
5
        <el-input type="password" v-model="ruleForm2.oldpass" placeholder="请输入您的旧密码" auto-complete="off"></el-input>
6
      </el-form-item>
7 4
      <el-form-item prop="pass">
8 5
        <el-input type="password" v-model="ruleForm2.pass" placeholder="请设置您的新密码" auto-complete="off"></el-input>
9 6
      </el-form-item>
10 7
      <el-form-item prop="checkPass">
11 8
        <el-input type="password" v-model="ruleForm2.checkPass" placeholder="请再次输入密码确认" auto-complete="off"></el-input>
12 9
      </el-form-item>
13
      <el-form-item></el-form-item>
14 10
      <el-form-item class="el-btn-col">
15 11
        <div class="el-btn-col-box">
16
          <el-button type="primary" @click="resetPwd('ruleForm2')">确定</el-button>
12
          <el-button type="primary" @click.native.prevent="resetPwd('ruleForm2')">确定</el-button>
17 13
        </div>
18 14
      </el-form-item>
19 15
    </el-form>
@ -22,7 +18,7 @@
22 18
23 19
<script>
24 20
import { changePw } from '@/api/login'
25
import { Alert } from 'element-ui'
21
import { MessageBox } from 'element-ui'
26 22
27 23
export default {
28 24
  data() {
@ -50,19 +46,15 @@ export default {
50 46
    return {
51 47
      dialogTableVisible: false,
52 48
      ruleForm2: {
53
        oldpass: '',
54 49
        pass: '',
55 50
        checkPass: ''
56 51
      },
57 52
      rules2: {
58
        oldpass: [
59
          { required: true, message: '请输入您的旧密码', trigger: 'blur' }
60
        ],
61 53
        pass: [
62
          { validator: validatePass, trigger: 'blur' }
54
          { required: true, validator: validatePass, trigger: 'blur' }
63 55
        ],
64 56
        checkPass: [
65
          { validator: validatePass2, trigger: 'blur' }
57
          { required: true, validator: validatePass2, trigger: 'blur' }
66 58
        ]
67 59
      }
68 60
    }
@ -71,21 +63,19 @@ export default {
71 63
    resetPwd(formName) {
72 64
      this.$refs[formName].validate((valid) => {
73 65
        if (valid) {
74
          const params = {
75
            oldPw: this.ruleForm2.oldpass,
76
            newpw: this.ruleForm2.checkPass
77
          }
78
          changePw(params).then((res) => {
66
          const newPw = this.ruleForm2.checkPass
67
          changePw({ newPw }).then((res) => {
79 68
            if (res.success) {
80
              Alert('提示', '密码修改成功!', {
69
              MessageBox.alert('提示', '密码修改成功!', {
81 70
                confirmButtonText: '确定',
82 71
                type: 'success',
83
                center: true
84
                // callback: action => {
85
                //   if (action === 'confirm') {
86
                //     this.$router.push({path: '/loginPlat'})
87
                //   }
88
                // }
72
                center: true,
73
                callback: action => {
74
                  if (action === 'confirm') {
75
                    this.dialogTableVisible = false
76
                    this.$refs[formName].resetFields()
77
                  }
78
                }
89 79
              })
90 80
            }
91 81
          })

+ 84 - 54
src/views/bridgesConsole/bridgeDetail/components/updatePersonInfo.vue

@ -1,36 +1,36 @@
1 1
<template>
2
  <el-dialog title="修改个人信息" ref="ruleForm" :visible.sync="dialogTableVisible" width="680px">
3
    <el-form class="form-main" label-width="80px">
4
      <el-row>
2
  <el-dialog title="修改个人信息" :visible.sync="dialogTableVisible" width="680px">
3
    <el-form class="demo-ruleForm" label-width="80px" :model="ruleForm" ref="ruleForm" :rules="formRules">
4
      <el-row :gutter='20'>
5 5
        <el-col :span="12">
6
          <el-form-item label="账 号">13679879708</el-form-item>
6
          <el-form-item label="账 号">{{account}}</el-form-item>
7 7
        </el-col>
8 8
        <el-col :span="12">
9
          <el-form-item label="用户姓名">李二蛋</el-form-item>
9
          <el-form-item label="用户姓名">{{name}}</el-form-item>
10 10
        </el-col>
11 11
        <el-col :span="12">
12
          <el-form-item label="职 位">
13
            <el-input placeholder="请填写职位"></el-input>
12
          <el-form-item label="职 位" prop="job">
13
            <el-input v-model="ruleForm.job" placeholder="请填写职位"></el-input>
14 14
          </el-form-item>
15 15
        </el-col>
16 16
        <el-col :span="12">
17
          <el-form-item label="所在机构">
18
            <el-input placeholder="请填写所在机构"></el-input>
17
          <el-form-item label="所在机构" prop="comp">
18
            <el-input v-model="ruleForm.comp" placeholder="请填写所在机构"></el-input>
19 19
          </el-form-item>
20 20
        </el-col>
21 21
        <el-col :span="12">
22
          <el-form-item label="联系电话">
23
            <el-input placeholder="请填写联系电话"></el-input>
22
          <el-form-item label="联系电话" prop="phone">
23
            <el-input v-model="ruleForm.phone" placeholder="请填写联系电话"></el-input>
24 24
          </el-form-item>
25 25
        </el-col>
26 26
        <el-col :span="12">
27
          <el-form-item label="联系邮箱">
28
            <el-input placeholder="请填写联系邮箱"></el-input>
27
          <el-form-item label="联系邮箱" prop="email">
28
            <el-input v-model="ruleForm.email" placeholder="请填写联系邮箱"></el-input>
29 29
          </el-form-item>
30 30
        </el-col>
31 31
        <el-col :span="24" class="el-btn-col">
32 32
          <div class="el-btn-col-box">
33
            <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
33
            <el-button type="primary" @click.native.prevent="submitForm('ruleForm')">保存</el-button>
34 34
          </div>
35 35
        </el-col>
36 36
      </el-row>
@ -39,56 +39,86 @@
39 39
</template>
40 40
41 41
<script>
42
import { MessageBox } from 'element-ui'
43
import { getMyself, updateMyself } from '@/api/login'
44
import store from '@/store'
42 45
43 46
export default {
44 47
  data() {
48
    var validPhone = (rule, value, callback) => {
49
      const reg = /^1[3|4|5|7|8][0-9]\d{8}$/
50
      if (!reg.test(value)) {
51
        callback(new Error('请输入正确的手机号码'))
52
      } else {
53
        callback()
54
      }
55
    }
45 56
    return {
46
      dialogTableVisible: false
57
      dialogTableVisible: false,
58
      account: store.getters.account,
59
      userid: store.getters.userid,
60
      name: store.getters.name,
61
      type: '',
62
      ruleForm: {
63
        job: '',
64
        comp: '',
65
        phone: '',
66
        email: ''
67
      },
68
      formRules: {
69
        comp: [
70
          { required: true, message: '所在机构不能为空', trigger: 'blur' }
71
        ],
72
        phone: [
73
          { trigger: 'blur', validator: validPhone }
74
        ],
75
        email: [
76
          { type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur' }
77
        ]
78
      }
47 79
    }
48 80
  },
49 81
  methods: {
82
    getUserSelf() {
83
      const id = this.userid
84
      getMyself({ id }).then((res) => {
85
        if (res.success) {
86
          this.ruleForm.job = res.data.job
87
          this.ruleForm.comp = res.data.comp
88
          this.ruleForm.phone = res.data.phone
89
          this.ruleForm.email = res.data.email
90
          this.type = res.data.type
91
        }
92
      })
93
    },
50 94
    submitForm(formName) {
51 95
      this.$refs[formName].validate((valid) => {
52 96
        if (valid) {
53
        //   let paramsData = {
54
        //     'title': this.ruleFormDem.demandTit,
55
        //     'descp': this.ruleFormDem.demandDesc,
56
        //     'province': this.ruleFormDem.province,
57
        //     'city': this.ruleFormDem.city,
58
        //     'invalidDay': util.dateFormatter(this.ruleFormDem.lastDate, false, true),
59
        //     'cost': this.selectCostRange,
60
        //     'duration': this.selectLongTime,
61
        //     'orgName': this.ruleFormDem.orgName,
62
        //     'contactNum': this.ruleFormDem.linkTel,
63
        //     'creator': this.kxUserId,
64
        //     'source': this.platSource
65
        //   };
66
        //   this.$axios.post(httpUrl.kxQurey.demand.add, paramsData).then((res) => {
67
        //     if (res.success) {
68
        //       this.$alert('我们已收到您的需求,马上为您对接合适的专家和专业机构,您可以登录科袖网与对方做进一步沟通。', '需求发布成功!', {
69
        //         confirmButtonText: '进入科袖网,发现更多服务和资源',
70
        //         type: 'success',
71
        //         center: true,
72
        //         cancelButtonText: '取消',
73
        //         callback: action => {
74
        //           if (action === 'confirm') {
75
        //             window.open(util.ekexiuUrl, '科袖网首页');
76
        //           };
77
        //         }
78
        //       });
79
        //       this.resetForm(formName);
80
        //       this.$emit('dialogChangedLogin', false);
81
        //     } else {
82
        //       this.$message({
83
        //         message: '需求发布失败,请重新发布!',
84
        //         type: 'warning'
85
        //       });
86
        //     };
87
        //     console.log(res);
88
        //   });
89
        // } else {
90
        //   console.log('error submit!!');
91
        //   return false
97
          const paramsData = {
98
            id: this.userid,
99
            account: this.account,
100
            name: this.name,
101
            job: this.ruleForm.job,
102
            comp: this.ruleForm.comp,
103
            phone: this.ruleForm.phone,
104
            email: this.ruleForm.email,
105
            type: this.type
106
          }
107
          updateMyself(paramsData).then((res) => {
108
            if (res.success) {
109
              MessageBox.alert('提示', '您的信息修改成功!', {
110
                confirmButtonText: '确定',
111
                type: 'success',
112
                center: true,
113
                callback: action => {
114
                  if (action === 'confirm') {
115
                    this.dialogTableVisible = false
116
                    this.$refs[formName].resetFields()
117
                  }
118
                }
119
              })
120
            }
121
          })
92 122
        }
93 123
      })
94 124
    }

+ 195 - 75
src/views/bridgesConsole/bridgeDetail/index.vue

@ -1,9 +1,9 @@
1 1
<template>
2 2
  <div class="dashboard-editor-container">
3
    <BInfoDialog01 ref="BInfoDialog01"></BInfoDialog01>
4
    <BInfoDialog02 ref="BInfoDialog02"></BInfoDialog02>
5
    <BInfoDialog03 ref="BInfoDialog03"></BInfoDialog03>
6
    <BInfoDialog04 ref="BInfoDialog04"></BInfoDialog04>
3
    <BInfoDialog01 ref="BInfoDialog01" :bridgeId="bridgeId"></BInfoDialog01>
4
    <BInfoDialog02 ref="BInfoDialog02" :serverList="serverList" :bridgeName="bridgeName"></BInfoDialog02>
5
    <BInfoDialog03 ref="BInfoDialog03" :deviceList="deviceList"></BInfoDialog03>
6
    <BInfoDialog04 ref="BInfoDialog04" :transducerList="transducerList"></BInfoDialog04>
7 7
8 8
    <updatePersonInfo ref="updatePersonInfo"></updatePersonInfo>
9 9
    <updateLoginPwd ref="updateLoginPwd"></updateLoginPwd>
@ -13,19 +13,37 @@
13 13
        <el-card class="box-card block-group">
14 14
          <div slot="header" class="block-title">
15 15
            <span>报警信息</span>
16
            <el-button type="text">查看全部</el-button>
16
            <el-button type="text" @click="queryDangerInfo">查看全部</el-button>
17 17
          </div>
18 18
          <ul class="item-ul">
19
            <li v-for="item in [0,1,2,3,4]" :key="item.id">2018年8月1日11:42      XXXXX大桥XXX采集盒XXX传感器检测到异常情况,请点击查看。    未读标记</li>
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>
21
              <span>{{item.device}},请点击查看。</span>
22
              <span class="svg-container" v-if="!item.readed">
23
                <svg-icon icon-class="unread"></svg-icon>
24
              </span>
25
            </li>
20 26
          </ul>
21 27
        </el-card>
22 28
        <el-card class="box-card block-group">
23 29
          <div slot="header" class="block-title">
24 30
            <span>实时监测</span>
25 31
          </div>
26
          <el-row>
27
            <!-- <line-chart :chart-data="lineChartData"></line-chart> -->
32
          <el-row class="line-chart-box">
33
            <el-col :xs="24" :sm="24" :lg="24" v-for="item in monitorShowList" :key="item.index">
34
              <lineChart2 :chartData="item"></lineChart2>
35
            </el-col>
28 36
          </el-row>
37
          <div class="pagination-container">
38
            <el-pagination
39
              background
40
              @current-change="handleCurrentChange"
41
              :current-page.sync="currentNo"
42
              :page-size="currentSize"
43
              layout="prev, pager, next, jumper"
44
              :total="this.monitorList.length">
45
            </el-pagination>
46
          </div>
29 47
        </el-card>
30 48
      </el-col>
31 49
      <el-col :xs="24" :sm="9" :lg="6">
@ -45,8 +63,8 @@
45 63
            <span>常用操作</span>
46 64
          </div>
47 65
          <el-row :gutter="10" class="item-row">
48
            <el-col :span="12"><div class="grid-content">历史报警信息查询</div></el-col>
49
            <el-col :span="12"><div class="grid-content">历史监测信息查询</div></el-col>
66
            <el-col :span="12"><div class="grid-content" @click="queryDangerInfo">历史报警信息查询</div></el-col>
67
            <el-col :span="12"><div class="grid-content" @click="queryMonitorInfo">历史监测信息查询</div></el-col>
50 68
            <el-col :span="12"><div class="grid-content" @click="updatePersonInfo">修改个人信息</div></el-col>
51 69
            <el-col :span="12"><div class="grid-content" @click="updateLoginPwd">修改登录密码</div></el-col>
52 70
          </el-row>
@ -58,7 +76,11 @@
58 76
59 77
60 78
<script>
61
import LineChart from './components/LineChart'
79
import '@/styles/roleuser.scss'
80
import { urlParse, parseTime, turnTime } from '@/utils'
81
import { getUserAllResource, getDangerList, getTimingMonitor, getServerInfo, getDeviceInfo } from '@/api/bridgeInfo'
82
83
import lineChart2 from '../lineChart/LineChart2'
62 84
import BInfoDialog01 from './components/BInfoDialog01'
63 85
import BInfoDialog02 from './components/BInfoDialog02'
64 86
import BInfoDialog03 from './components/BInfoDialog03'
@ -67,29 +89,10 @@ import BInfoDialog04 from './components/BInfoDialog04'
67 89
import updatePersonInfo from './components/updatePersonInfo'
68 90
import updateLoginPwd from './components/updateLoginPwd'
69 91
70
const lineChartData = {
71
  newVisitis: {
72
    expectedData: [100, 120, 161, 134, 105, 160, 165],
73
    actualData: [120, 82, 91, 154, 162, 140, 145]
74
  },
75
  messages: {
76
    expectedData: [200, 192, 120, 144, 160, 130, 140],
77
    actualData: [180, 160, 151, 106, 145, 150, 130]
78
  },
79
  purchases: {
80
    expectedData: [80, 100, 121, 104, 105, 90, 100],
81
    actualData: [120, 90, 100, 138, 142, 130, 130]
82
  },
83
  shoppings: {
84
    expectedData: [130, 140, 141, 142, 145, 150, 160],
85
    actualData: [120, 82, 91, 154, 162, 140, 130]
86
  }
87
}
88
89 92
export default {
90 93
  name: 'dashboard-other',
91 94
  components: {
92
    LineChart,
95
    lineChart2,
93 96
    BInfoDialog01,
94 97
    BInfoDialog02,
95 98
    BInfoDialog03,
@ -99,10 +102,169 @@ export default {
99 102
  },
100 103
  data() {
101 104
    return {
102
      lineChartData: lineChartData.newVisitis
105
      bridgeId: '',
106
      bridgeName: '',
107
      dangerList: '',
108
      bridgeList: [],
109
      serverList: [],
110
      serverSeqArr: [],
111
      deviceList: [],
112
      transducerList: [],
113
      monitorList: [],
114
      currentNo: 1,
115
      currentSize: 4,
116
      currentTime: turnTime(new Date()),
117
      dateArr: [],
118
      intervalTime: 60 * 1000
103 119
    }
104 120
  },
121
  computed: {
122
    monitorShowList() {
123
      return this.monitorList.slice((this.currentNo - 1) * this.currentSize, this.currentNo * this.currentSize)
124
    }
125
  },
126
  created() {
127
    this.bridgeId = urlParse('id')
128
    this.bridgeName = urlParse('name')
129
    this.getUserAllResource()
130
    this.getDangerList()
131
    // setInterval(() => {
132
    //   this.addData(true)
133
    //   this.getTimingMonitor()
134
    // }, 500)
135
  },
105 136
  methods: {
137
    getDangerList() {
138
      const param = {
139
        pageSize: 5,
140
        pageNo: 1
141
      }
142
      getDangerList(param).then(res => {
143
        if (res.success && res.data.data) {
144
          const dataS = res.data.data
145
          for (let i = 0; i < dataS.length; i++) {
146
            if (dataS[i].alarmTime) {
147
              dataS[i].alarmTime = parseTime(dataS[i].alarmTime, true)
148
            }
149
            dataS[i].device = `${this.bridgeName}大桥${dataS[i].device}采集盒检测到异常情况`
150
          }
151
          this.dangerList = dataS
152
        }
153
      })
154
    },
155
    getUserAllResource() {
156
      var _this = this
157
      const param = {
158
        active: 1
159
      }
160
      getUserAllResource(param).then(res => {
161
        if (res.success) {
162
          res.data.bridge.map((value, index, array) => {
163
            if (value.id === _this.bridgeId) {
164
              _this.bridgeName = value.shortName
165
            }
166
          })
167
          res.data.server.map((value, index, array) => {
168
            if (value.bridgeId === _this.bridgeId) {
169
              _this.serverList.push(value)
170
              _this.serverSeqArr.push(value.seq)
171
              _this.$forceUpdate()
172
              res.data.device.map((value2, index2, array2) => {
173
                if (value2.serverId === value.id) {
174
                  getServerInfo({ id: value2.serverId }).then(res => {
175
                    if (res.success && res.data) {
176
                      value2.serverCode = res.data.code
177
                      _this.$forceUpdate()
178
                    }
179
                  })
180
                  _this.deviceList.push(value2)
181
                  res.data.transducer.map((value3, index3, array3) => {
182
                    if (value3.serverId === value.id) {
183
                      getDeviceInfo({ id: value3.deviceId }).then(res => {
184
                        if (res.success && res.data) {
185
                          value3.deviceCode = res.data.code
186
                          _this.$forceUpdate()
187
                        }
188
                      })
189
                      _this.transducerList.push(value3)
190
                    }
191
                  })
192
                }
193
              })
194
            }
195
          })
196
          _this.getTimingMonitor()
197
        }
198
      })
199
    },
200
    getTimingMonitor() {
201
      var that = this
202
      const arr = this.serverSeqArr
203
      if (arr) {
204
        const param = {
205
          seq: arr
206
        }
207
        getTimingMonitor(param).then(res => {
208
          if (res.success && res.data) {
209
            var monitorList = []
210
            for (let i = 0; i < res.data.length; i++) {
211
              var str = res.data[i].cid
212
              var monitorData = null
213
              for (let j = 0; j < monitorList.length; ++j) {
214
                if (str === monitorList[j].tit) {
215
                  monitorData = monitorList[j]
216
                  break
217
                }
218
              }
219
              if (!monitorData) {
220
                monitorData = {
221
                  xData: [],
222
                  seData: {
223
                    max: [],
224
                    min: []
225
                  }
226
                }
227
                monitorList.push(monitorData)
228
                monitorData.tit = str
229
                that.addData()
230
              }
231
              monitorData.xData.push(that.dateArr)
232
              monitorData.seData.max.push(res.data[i].hvalue)
233
              monitorData.seData.min.push(res.data[i].lvalue)
234
            }
235
            that.monitorList = monitorList
236
          }
237
        })
238
      }
239
    },
240
    addData(shift) {
241
      this.dateArr.push(this.currentTime)
242
      if (shift) {
243
        this.dateArr.shift()
244
      }
245
      this.currentTime = turnTime(new Date(+new Date(this.currentTime) + this.intervalTime))
246
    },
247
    handleCurrentChange(val) {
248
      this.currentNo = val
249
    },
250
    alarmShow(id, msg) {
251
      this.$router.push({
252
        name: 'dangerDetail',
253
        query: { aid: id, msg: msg }
254
      })
255
    },
256
    queryDangerInfo() {
257
      this.$router.push({
258
        name: 'dangerList',
259
        query: { name: this.bridgeName }
260
      })
261
    },
262
    queryMonitorInfo() {
263
      this.$router.push({
264
        name: 'bridgeMonitor',
265
        query: { arr: this.serverSeqArr }
266
      })
267
    },
106 268
    queryBirdgeInfo() {
107 269
      this.$refs.BInfoDialog01.dialogTableVisible = true
108 270
    },
@ -117,6 +279,7 @@ export default {
117 279
    },
118 280
    updatePersonInfo() {
119 281
      this.$refs.updatePersonInfo.dialogTableVisible = true
282
      this.$refs.updatePersonInfo.getUserSelf()
120 283
    },
121 284
    updateLoginPwd() {
122 285
      this.$refs.updateLoginPwd.dialogTableVisible = true
@ -124,46 +287,3 @@ export default {
124 287
  }
125 288
}
126 289
</script>
127
128
<style rel="stylesheet/scss" lang="scss" scoped>
129
.dashboard-editor-container {
130
  padding: 32px;
131
  background-color: rgb(240, 242, 245);
132
  .block-group{
133
    background: #fff;
134
    margin-bottom: 20px;
135
    .block-title{
136
      display: flex;
137
      justify-content: space-between;
138
      .el-button{
139
        padding: 3px 0;
140
      }
141
    }
142
    .item-ul{
143
      margin: 0;
144
      padding: 0 10px;
145
      li{
146
        padding: 8px 0;
147
        margin: 0;
148
        list-style: none;
149
      }
150
    }
151
    .grid-content{
152
      height: 100px;
153
      display: flex;
154
      text-align: center;
155
      justify-content: center;
156
      align-items: center;
157
      background-color: #f8f8f8;
158
      margin-bottom: 8px;
159
      padding:20px;
160
      cursor: pointer;
161
      &:hover {
162
        transition: all 0.2s ease-out;
163
        color: #fff;
164
        background: #36a3f7;
165
      }
166
    }
167
  }
168
}
169
</style>

+ 125 - 0
src/views/bridgesConsole/bridgeMonitor/index.vue

@ -0,0 +1,125 @@
1
<template>
2
  <div class="dashboard-editor-container">
3
    <el-card class="box-card block-group">
4
      <div slot="header" class="block-title">
5
          <el-date-picker
6
            v-model="valueDate"
7
            type="date"
8
            value-format="yyyyMMdd"
9
            @change="changeDate">
10
          </el-date-picker>
11
          <el-button type="primary" @click="getMonitorByDay">查询</el-button>
12
      </div>
13
      <el-row class="line-chart-box">
14
        <el-col :xs="24" :sm="24" :lg="24" v-for="item in alarmShowList" :key="item.index">
15
          <lineChart2 :chartData="item"></lineChart2>
16
        </el-col>
17
      </el-row>
18
      <div class="pagination-container">
19
        <el-pagination
20
          background
21
          @current-change="handleCurrentChange"
22
          :current-page="pageNo"
23
          :page-size="pageSize"
24
          layout="prev, pager, next, jumper"
25
          :total="alarmList.length">
26
        </el-pagination>
27
      </div>
28
    </el-card>
29
  </div>
30
</template>
31
32
33
<script>
34
import '@/styles/roleuser.scss'
35
import { urlParse, parseTime } from '@/utils'
36
import { Message } from 'element-ui'
37
import { getMonitorByDay } from '@/api/bridgeInfo'
38
import lineChart2 from '../lineChart/LineChart2'
39
40
export default {
41
  data() {
42
    return {
43
      valueDate: new Date().toISOString().substring(0, 10).replace(/-/g, ''),
44
      serverSeqArr: [],
45
      alarmList: [],
46
      pageSize: 2,
47
      pageNo: 1
48
    }
49
  },
50
  components: {
51
    lineChart2
52
  },
53
  computed: {
54
    alarmShowList() {
55
      return this.alarmList.slice((this.pageNo - 1) * this.pageSize, this.pageNo * this.pageSize)
56
    }
57
  },
58
  created() {
59
    this.serverSeqArr = urlParse('arr')
60
    this.getMonitorByDay()
61
  },
62
  methods: {
63
    getMonitorByDay() {
64
      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
                }
83
              }
84
              if (!monitorData) {
85
                monitorData = {
86
                  xData: [],
87
                  seData: {
88
                    max: [],
89
                    min: []
90
                  }
91
                }
92
                monitorList.push(monitorData)
93
                monitorData.tit = str
94
              }
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)
98
            }
99
            that.alarmList = monitorList
100
          }
101
        })
102
      } else {
103
        Message.error('当前没有任何采集服务器,请检查')
104
      }
105
    },
106
    changeDate(val) {
107
      this.valueDate = val
108
      this.getMonitorByDay()
109
    },
110
    handleCurrentChange(val) {
111
      this.pageNo = val
112
    }
113
  }
114
}
115
</script>
116
117
<style rel="stylesheet/scss" lang="scss" scoped>
118
.dashboard-editor-container .block-group .block-title{
119
  justify-content: flex-start;
120
  .el-button{
121
    padding: 12px 20px;
122
    margin-left: 15px;
123
  }
124
}
125
</style>

+ 38 - 33
src/views/dashboard/admin/components/LineChart.vue

@ -4,11 +4,16 @@
4 4
5 5
<script>
6 6
import echarts from 'echarts'
7
import { parseTime, turnTime } from '@/utils'
7 8
require('echarts/theme/macarons') // echarts theme
8 9
import { debounce } from '@/utils'
9 10
10 11
export default {
11 12
  props: {
13
    lineColor: {
14
      type: Number,
15
      default: 0
16
    },
12 17
    className: {
13 18
      type: String,
14 19
      default: 'chart'
@ -19,18 +24,30 @@ export default {
19 24
    },
20 25
    height: {
21 26
      type: String,
22
      default: '350px'
27
      default: '260px'
23 28
    },
24 29
    autoResize: {
25 30
      type: Boolean,
26 31
      default: true
27 32
    },
28 33
    chartData: {
29
      type: Object
34
      type: Array
35
    },
36
    legendName: {
37
      type: String
38
    },
39
    startTime: {
40
      type: String
41
    },
42
    intervalTime: {
43
      type: Number
30 44
    }
31 45
  },
32 46
  data() {
33 47
    return {
48
      lineColorNow: this.lineColor % 2 === 0 ? '#FF005A' : '#3888fa',
49
      Ydate: [],
50
      nowTime: parseTime(this.startTime, true, true),
34 51
      chart: null
35 52
    }
36 53
  },
@ -46,8 +63,8 @@ export default {
46 63
    }
47 64
48 65
    // 监听侧边栏的变化
49
    const sidebarElm = document.getElementsByClassName('sidebar-container')[0]
50
    sidebarElm.addEventListener('transitionend', this.__resizeHanlder)
66
    // const sidebarElm = document.getElementsByClassName('sidebar-container')[0]
67
    // sidebarElm.addEventListener('transitionend', this.__resizeHanlder)
51 68
  },
52 69
  beforeDestroy() {
53 70
    if (!this.chart) {
@ -57,8 +74,8 @@ export default {
57 74
      window.removeEventListener('resize', this.__resizeHanlder)
58 75
    }
59 76
60
    const sidebarElm = document.getElementsByClassName('sidebar-container')[0]
61
    sidebarElm.removeEventListener('transitionend', this.__resizeHanlder)
77
    // const sidebarElm = document.getElementsByClassName('sidebar-container')[0]
78
    // sidebarElm.removeEventListener('transitionend', this.__resizeHanlder)
62 79
63 80
    this.chart.dispose()
64 81
    this.chart = null
@ -72,10 +89,14 @@ export default {
72 89
    }
73 90
  },
74 91
  methods: {
75
    setOptions({ expectedData, actualData } = {}) {
92
    addData() {
93
      this.Ydate.push(this.nowTime)
94
      this.nowTime = turnTime(new Date(+new Date(this.nowTime) + this.intervalTime), 'time', true)
95
    },
96
    setOptions(datastr) {
76 97
      this.chart.setOption({
77 98
        xAxis: {
78
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
99
          data: this.Ydate,
79 100
          boundaryGap: false,
80 101
          axisTick: {
81 102
            show: false
@ -96,52 +117,36 @@ export default {
96 117
          padding: [5, 10]
97 118
        },
98 119
        yAxis: {
120
          // name: '豪伏(-8192-8192)',
99 121
          axisTick: {
100 122
            show: false
101 123
          }
102 124
        },
103 125
        legend: {
104
          data: ['expected', 'actual']
126
          data: [this.legendName]
105 127
        },
106 128
        series: [{
107
          name: 'expected', itemStyle: {
129
          name: this.legendName, itemStyle: {
108 130
            normal: {
109
              color: '#FF005A',
131
              color: this.lineColorNow,
110 132
              lineStyle: {
111
                color: '#FF005A',
133
                color: this.lineColorNow,
112 134
                width: 2
113 135
              }
114 136
            }
115 137
          },
116 138
          smooth: true,
117 139
          type: 'line',
118
          data: expectedData,
140
          data: datastr,
119 141
          animationDuration: 2800,
120 142
          animationEasing: 'cubicInOut'
121
        },
122
        {
123
          name: 'actual',
124
          smooth: true,
125
          type: 'line',
126
          itemStyle: {
127
            normal: {
128
              color: '#3888fa',
129
              lineStyle: {
130
                color: '#3888fa',
131
                width: 2
132
              },
133
              areaStyle: {
134
                color: '#f3f8ff'
135
              }
136
            }
137
          },
138
          data: actualData,
139
          animationDuration: 2800,
140
          animationEasing: 'quadraticOut'
141 143
        }]
142 144
      })
143 145
    },
144 146
    initChart() {
147
      for (var i = 1; i < this.chartData.length; i++) {
148
        this.addData()
149
      }
145 150
      this.chart = echarts.init(this.$el, 'macarons')
146 151
      this.setOptions(this.chartData)
147 152
    }

+ 28 - 28
src/views/bridgesConsole/bridgeDetail/components/LineChart.vue

@ -44,10 +44,6 @@ export default {
44 44
      }, 100)
45 45
      window.addEventListener('resize', this.__resizeHanlder)
46 46
    }
47
48
    // 监听侧边栏的变化
49
    const sidebarElm = document.getElementsByClassName('sidebar-container')[0]
50
    sidebarElm.addEventListener('transitionend', this.__resizeHanlder)
51 47
  },
52 48
  beforeDestroy() {
53 49
    if (!this.chart) {
@ -57,9 +53,6 @@ export default {
57 53
      window.removeEventListener('resize', this.__resizeHanlder)
58 54
    }
59 55
60
    const sidebarElm = document.getElementsByClassName('sidebar-container')[0]
61
    sidebarElm.removeEventListener('transitionend', this.__resizeHanlder)
62
63 56
    this.chart.dispose()
64 57
    this.chart = null
65 58
  },
@ -72,14 +65,15 @@ export default {
72 65
    }
73 66
  },
74 67
  methods: {
75
    setOptions({ expectedData, actualData } = {}) {
68
    setOptions(datastr) {
76 69
      this.chart.setOption({
77
        xAxis: {
78
          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
79
          boundaryGap: false,
80
          axisTick: {
81
            show: false
82
          }
70
        title: {
71
          text: '传感器' + datastr.tit,
72
          textStyle: {
73
            color: '#333',
74
            fontSize: 14
75
          },
76
          left: 16
83 77
        },
84 78
        grid: {
85 79
          left: 10,
@ -95,16 +89,27 @@ export default {
95 89
          },
96 90
          padding: [5, 10]
97 91
        },
92
        xAxis: {
93
          data: datastr.xData,
94
          boundaryGap: false,
95
          axisTick: {
96
            show: false
97
          }
98
        },
98 99
        yAxis: {
100
          type: 'value',
101
          axisLabel: {
102
            formatter: '{value} mv'
103
          },
99 104
          axisTick: {
100 105
            show: false
101 106
          }
102 107
        },
103 108
        legend: {
104
          data: ['expected', 'actual']
109
          data: ['最大值', '最小值']
105 110
        },
106 111
        series: [{
107
          name: 'expected', itemStyle: {
112
          name: '最大值', itemStyle: {
108 113
            normal: {
109 114
              color: '#FF005A',
110 115
              lineStyle: {
@ -115,29 +120,24 @@ export default {
115 120
          },
116 121
          smooth: true,
117 122
          type: 'line',
118
          data: expectedData,
123
          data: datastr.seData.max,
119 124
          animationDuration: 2800,
120 125
          animationEasing: 'cubicInOut'
121
        },
122
        {
123
          name: 'actual',
124
          smooth: true,
125
          type: 'line',
126
          itemStyle: {
126
        }, {
127
          name: '最小值', itemStyle: {
127 128
            normal: {
128 129
              color: '#3888fa',
129 130
              lineStyle: {
130 131
                color: '#3888fa',
131 132
                width: 2
132
              },
133
              areaStyle: {
134
                color: '#f3f8ff'
135 133
              }
136 134
            }
137 135
          },
138
          data: actualData,
136
          smooth: true,
137
          type: 'line',
138
          data: datastr.seData.min,
139 139
          animationDuration: 2800,
140
          animationEasing: 'quadraticOut'
140
          animationEasing: 'cubicInOut'
141 141
        }]
142 142
      })
143 143
    },

+ 71 - 79
src/views/dashboard/other/index.vue

@ -1,14 +1,14 @@
1 1
<template>
2 2
  <div class="dashboard-editor-container">
3 3
    <el-row class="panel-group" :gutter="40">
4
      <el-col :xs="24" :sm="12" :lg="6" class="card-panel-col" v-for="item in dataList" :key="item.index" @click.native="goToDashboardC(item.id)">
4
      <el-col :xs="24" :sm="12" :lg="6" class="card-panel-col" v-for="item in dataList" :key="item.index" @click.native="goToDashboardC(item.id, item.shortName)">
5 5
        <div class='card-panel'>
6 6
          <div class="card-panel-icon-wrapper">
7 7
            <div class="card-image" :style="{ backgroundImage: 'url(/data/bridge'+ item.img +')'}"></div>
8 8
          </div>
9 9
          <div class="card-panel-description">
10 10
            <div class="card-panel-text">桥梁名称 <span>{{item.shortName}}</span></div>
11
            <div class="card-panel-text">未读报警 10条</div>
11
            <div class="card-panel-text" :class="item.alarmNum>0?'card-panel-text-red':''">未读报警 {{item.alarmNum ? item.alarmNum : alarmNum}}条</div>
12 12
          </div>
13 13
        </div>
14 14
      </el-col>
@ -26,110 +26,102 @@
26 26
</template>
27 27
28 28
<script>
29
import { getBridgeList } from '@/api/table'
29
import {
30
  getBridgeServers,
31
  getBridgeList,
32
  getBridgeUnread
33
} from '@/api/bridgeInfo'
34
import '@/styles/roleuser.scss'
30 35
31 36
export default {
32 37
  data() {
33 38
    return {
34
      listParameters: {},
39
      alarmNum: 0,
35 40
      total: 0,
41
      pageSize: 10,
42
      pageNo: 1,
36 43
      dataList: [],
37
      ifDefault: false
44
      bridgeList: [],
45
      serverList: [],
46
      serverSeqArr: [],
47
      deviceList: [],
48
      transducerList: []
38 49
    }
39 50
  },
40 51
  created() {
41
    this.listParameters = {
42
      active: 1,
43
      pageSize: 10,
44
      pageNo: 1
45
    }
46 52
    this.getBridgeLists()
47 53
  },
48 54
  components: {
49 55
  },
50 56
  methods: {
51 57
    getBridgeLists() {
52
      const param = this.listParameters
58
      const param = {
59
        active: 1,
60
        pageSize: this.pageSize,
61
        pageNo: this.pageNo
62
      }
53 63
      getBridgeList(param).then(res => {
54 64
        if (res.success) {
55
          if (res.data.data.length === 0) {
56
            this.ifDefault = true
57
          } else {
58
            this.ifDefault = false
65
          if (res.data.data.length > 0) {
66
            this.total = res.data.total
67
            this.getBridgeServers(res.data.data)
68
          }
69
        }
70
      })
71
    },
72
    getBridgeServers($data) {
73
      var that = this
74
      for (let i = 0; i < $data.length; i++) {
75
        (function(i) {
76
          const param = {
77
            active: 1,
78
            id: $data[i].id
79
          }
80
          getBridgeServers(param).then(res => {
81
            if (res.success) {
82
              console.log(res)
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
      console.log(this.dataList)
96
    },
97
    getBridgeUnread($data, $arr) {
98
      var that = this
99
      const param = {
100
        server: $arr
101
      }
102
      var alarmNum = 0
103
      getBridgeUnread(param).then(res => {
104
        if (res.success) {
105
          if (res.data.length > 0) {
106
            for (let j = 0; j < res.data.length; j++) {
107
              alarmNum += res.data[j].num
108
            }
109
            $data.alarmNum = alarmNum
110
            that.$forceUpdate()
59 111
          }
60
          this.dataList = res.data.data
61
          // this.disposeData(res.data.data);
62
          this.total = res.data.total
63 112
        }
64 113
      })
65 114
    },
66
    goToDashboardC(id) {
115
    goToDashboardC(id, name) {
67 116
      this.$router.push({
68
        path: '/bridgesConsole',
69
        query: { bridgeId: id }
117
        path: '/bridgeDetail',
118
        query: { id: id, name: name }
70 119
      })
71 120
    },
72 121
    handleCurrentChange(val) {
73
      this.expertParameters.pageNo = val
122
      this.pageNo = val
74 123
      this.getBridgeLists()
75 124
    }
76 125
  }
77 126
}
78 127
</script>
79
80
<style rel="stylesheet/scss" lang="scss" scoped>
81
.dashboard-editor-container{
82
  padding: 32px;
83
  .panel-group {
84
    margin-top: 18px;
85
    .card-panel-col{
86
      margin-bottom: 32px;
87
    }
88
    .card-panel {
89
      cursor: pointer;
90
      padding: 15px;
91
      font-size: 12px;
92
      position: relative;
93
      overflow: hidden;
94
      color: #666;
95
      background: #fff;
96
      box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
97
      border-color: rgba(0, 0, 0, .05);
98
      &:hover {
99
        .card-panel-icon-wrapper {
100
          color: #fff;
101
        }
102
      }
103
      .card-panel-icon-wrapper {
104
        margin: 10px 0;
105
        transition: all 0.38s ease-out;
106
        border-radius: 6px;
107
      }
108
      .card-image{
109
        width: 100%;
110
        max-width: 280px;
111
        margin: auto;
112
        height: 160px;
113
        border: 1px solid #d0d0d0;
114
        background-position: center;
115
        background-size: cover;
116
      }
117
      .card-panel-icon {
118
        font-size: 48px;
119
      }
120
      .card-panel-description {
121
        font-weight: bold;
122
        margin-top:12px;
123
        .card-panel-text {
124
          line-height: 24px;
125
          color: rgba(0, 0, 0, 0.45);
126
          font-size: 16px;
127
        }
128
        .card-panel-num {
129
          font-size: 20px;
130
        }
131
      }
132
    }
133
  }
134
}
135
</style>

+ 6 - 2
src/views/layout/Layout.vue

@ -2,8 +2,8 @@
2 2
  <div class="app-wrapper" :class="classObj">
3 3
    <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"></div>
4 4
    <TopNavbar></TopNavbar>
5
    <sidebar class="sidebar-container"></sidebar>
6
    <div class="main-container">
5
    <sidebar class="sidebar-container" v-if="roles.indexOf('1')>=0"></sidebar>
6
    <div class="main-container" :style="(roles.indexOf('1')>=0) ? '' : 'marginLeft:0'">
7 7
      <navbar></navbar>
8 8
      <app-main></app-main>
9 9
    </div>
@ -11,6 +11,7 @@
11 11
</template>
12 12
13 13
<script>
14
import { mapGetters } from 'vuex'
14 15
import { TopNavbar, Navbar, Sidebar, AppMain } from './components'
15 16
import ResizeMixin from './mixin/ResizeHandler'
16 17
@ -24,6 +25,9 @@ export default {
24 25
  },
25 26
  mixins: [ResizeMixin],
26 27
  computed: {
28
    ...mapGetters([
29
      'roles'
30
    ]),
27 31
    sidebar() {
28 32
      return this.$store.state.app.sidebar
29 33
    },

+ 0 - 66
src/views/layout/LayoutC.vue

@ -1,66 +0,0 @@
1
<template>
2
  <div class="app-wrapper" :class="classObj">
3
    <TopNavbar></TopNavbar>
4
    <div class="main-container">
5
      <navbar></navbar>
6
      <app-main></app-main>
7
    </div>
8
  </div>
9
</template>
10
11
<script>
12
import { TopNavbar, Navbar, AppMain } from './components'
13
import ResizeMixin from './mixin/ResizeHandler'
14
15
export default {
16
  name: 'layout',
17
  components: {
18
    TopNavbar,
19
    Navbar,
20
    AppMain
21
  },
22
  mixins: [ResizeMixin],
23
  computed: {
24
    device() {
25
      return this.$store.state.app.device
26
    },
27
    classObj() {
28
      return {
29
        mobile: this.device === 'mobile'
30
      }
31
    }
32
  },
33
  methods: {
34
35
  }
36
}
37
</script>
38
39
<style rel="stylesheet/scss" lang="scss" scoped>
40
  @import "src/styles/mixin.scss";
41
  #app .main-container {
42
    margin-left: 0;
43
  }
44
  #app .navbar .hamburger-container {
45
    display:none;
46
  }
47
  .app-wrapper {
48
    @include clearfix;
49
    position: relative;
50
    height: 100%;
51
    width: 100%;
52
    &.mobile.openSidebar{
53
      position: fixed;
54
      top: 0;
55
    }
56
  }
57
  .drawer-bg {
58
    background: #000;
59
    opacity: 0.3;
60
    width: 100%;
61
    top: 0;
62
    height: 100%;
63
    position: absolute;
64
    z-index: 999;
65
  }
66
</style>

+ 19 - 6
src/views/layout/components/Navbar.vue

@ -1,23 +1,29 @@
1 1
<template>
2
  <el-menu class="navbar" mode="horizontal">
3
    <hamburger class="hamburger-container" :toggleClick="toggleSideBar" :isActive="sidebar.opened"></hamburger>
4
    <breadcrumb></breadcrumb>
5
  </el-menu>
2
  <div>
3
    <marqueebox :isShow="roles.indexOf('1')>=0"></marqueebox>
4
    <el-menu class="navbar" mode="horizontal">
5
      <hamburger v-if="roles.indexOf('1')>=0" class="hamburger-container" :toggleClick="toggleSideBar" :isActive="sidebar.opened"></hamburger>
6
      <breadcrumb></breadcrumb>
7
    </el-menu>
8
  </div>
6 9
</template>
7 10
8 11
<script>
9 12
import { mapGetters } from 'vuex'
13
import Marqueebox from '@/components/Marqueebox'
10 14
import Breadcrumb from '@/components/Breadcrumb'
11 15
import Hamburger from '@/components/Hamburger'
12 16
13 17
export default {
14 18
  components: {
15 19
    Breadcrumb,
16
    Hamburger
20
    Hamburger,
21
    Marqueebox
17 22
  },
18 23
  computed: {
19 24
    ...mapGetters([
20
      'sidebar'
25
      'sidebar',
26
      'roles'
21 27
    ])
22 28
  },
23 29
  methods: {
@ -37,6 +43,7 @@ export default {
37 43
.navbar {
38 44
  height: 50px;
39 45
  line-height: 50px;
46
  padding: 0 10px;
40 47
  border-radius: 0px !important;
41 48
  .hamburger-container {
42 49
    line-height: 58px;
@ -51,5 +58,11 @@ export default {
51 58
    color: red;
52 59
  }
53 60
}
61
.message-box{
62
  color: #303133;
63
  background: #c7e3ff;
64
  padding: 0 20px;
65
  font-size: 14px;
66
}
54 67
</style>
55 68

+ 42 - 1
src/views/layout/components/TopNavbar.vue

@ -2,6 +2,14 @@
2 2
  <el-menu class="topnavbar" mode="horizontal">
3 3
    <div class="logo-container">
4 4
      <img class="logo-wrapper" src="/static/touchwave.png" alt="">
5
      <el-dropdown v-if="roles.indexOf('1')<0" trigger="click" style="cursor: pointer;margin-left:20px">
6
        <span class="el-dropdown-link">
7
          {{showName}}<i class="el-icon-arrow-down el-icon--right"></i>
8
        </span>
9
        <el-dropdown-menu style="min-width:120px;" slot="dropdown">
10
          <el-dropdown-item v-for="item in dataList" :key="item.index"@click.native="goToDashboardC(item.id, item.shortName)">{{item.shortName}}</el-dropdown-item>
11
        </el-dropdown-menu>
12
      </el-dropdown>
5 13
    </div>
6 14
    <el-dropdown class="avatar-container" trigger="click">
7 15
      <div class="avatar-wrapper">
@ -22,13 +30,27 @@
22 30
23 31
<script>
24 32
import { mapGetters } from 'vuex'
33
import { getBridgeList } from '@/api/bridgeInfo'
34
import { urlParse } from '@/utils'
25 35
26 36
export default {
37
  data() {
38
    return {
39
      bridgeId: '',
40
      showName: '选择大桥',
41
      dataList: ''
42
    }
43
  },
27 44
  computed: {
28 45
    ...mapGetters([
29
      'name'
46
      'name',
47
      'roles'
30 48
    ])
31 49
  },
50
  created() {
51
    this.bridgeId = urlParse('id')
52
    this.getBridgeLists()
53
  },
32 54
  methods: {
33 55
    toggleSideBar() {
34 56
      this.$store.dispatch('ToggleSideBar')
@ -37,6 +59,25 @@ export default {
37 59
      this.$store.dispatch('LogOut').then(() => {
38 60
        location.reload() // 为了重新实例化vue-router对象 避免bug
39 61
      })
62
    },
63
    getBridgeLists() {
64
      const param = {
65
        active: 1,
66
        pageSize: 10,
67
        pageNo: 1
68
      }
69
      getBridgeList(param).then(res => {
70
        if (res.success) {
71
          this.dataList = res.data.data
72
        }
73
      })
74
    },
75
    goToDashboardC(id, name) {
76
      this.$router.push({
77
        path: '/bridgeDetail',
78
        query: { id: id, name: name }
79
      })
80
      this.showName = name
40 81
    }
41 82
  }
42 83
}

+ 10 - 13
src/views/login/index.vue

@ -19,13 +19,13 @@
19 19
      </el-form-item>
20 20
      <el-form-item prop="imgVerifyCode">
21 21
        <span class="svg-container">
22
          <svg-icon icon-class="password"></svg-icon>
22
          <svg-icon icon-class="msgvc"></svg-icon>
23 23
        </span>
24
        <el-input v-model="loginForm.imgVerifyCode" placeholder="请输入图形验证码" class="code-btn">
24
        <el-input v-model="loginForm.imgVerifyCode" placeholder="请输入图形验证码" @keyup.enter.native="handleLogin" class="code-btn">
25 25
        <img slot="append" :src="imgVcUrl" @click="changeImgVc" /></el-input>
26 26
      </el-form-item>
27 27
      <el-form-item>
28
        <el-button class="log-btn" type="primary" :loading="loading" @click.native.prevent="handleLogin" @keyup.enter.native="handleLogin">登录</el-button>
28
        <el-button class="log-btn" type="primary" :loading="loading" @click.native.prevent="handleLogin">登录</el-button>
29 29
      </el-form-item>
30 30
      <el-form-item class="el-form-find">
31 31
        <el-button type="text" @click.native.prevent="goBackPwd">忘记密码?</el-button>
@ -90,17 +90,11 @@ export default {
90 90
            this.loading = false
91 91
            if (response.success) {
92 92
              if (response.data) {
93
                const dataS = response.data
94
                if (dataS.active) {
95
                  this.$store.dispatch('GetUserInfo').then(res => {
96
                  })
97
                  this.$router.push({ path: '/' })
98
                } else {
99
                  Message.error('您的账号已经被禁用')
100
                  return
101
                }
93
                this.$store.dispatch('GetUserInfo').then(res => {
94
                })
95
                this.$router.push({ path: '/' })
102 96
              } else {
103
                Message.error('登录账号与密码不匹配')
97
                Message.error('登录账号与密码不匹配,请检查后重试')
104 98
                return
105 99
              }
106 100
            } else {
@ -113,6 +107,9 @@ export default {
113 107
              }, {
114 108
                code: -60003,
115 109
                msg: '图形验证码不正确'
110
              }, {
111
                code: -60005,
112
                msg: '该账号已停用,请联系管理员'
116 113
              }]
117 114
              for (let i = 0; i < errorCode.length; i++) {
118 115
                if (response.code === errorCode[i].code) {