Browse Source

大桥除湿系统

lipengtao 6 years ago
parent
commit
a626642eba
39 changed files with 3013 additions and 245 deletions
  1. 80 0
      src/api/sensorAdmin.js
  2. 82 0
      src/api/serverAdmin.js
  3. 7 0
      src/components/Breadcrumb/index.vue
  4. 92 0
      src/components/Detection/index.vue
  5. 1 0
      src/icons/svg/arefaction.svg
  6. 1 0
      src/icons/svg/bridge.svg
  7. 1 0
      src/icons/svg/logout.svg
  8. 1 15
      src/permission.js
  9. 142 25
      src/router/index.js
  10. 4 35
      src/store/modules/permission.js
  11. 0 1
      src/store/modules/user.js
  12. 40 0
      src/utils/queryBridgeAllResource.js
  13. 141 0
      src/views/account/modifyData.vue
  14. 98 0
      src/views/account/modifyPassword.vue
  15. 3 16
      src/views/bridgesConsole/bridgeDetail/index.vue
  16. 2 1
      src/views/dashboard/other/index.vue
  17. 417 0
      src/views/dehumidificationSystem/airClamp.vue
  18. 45 0
      src/views/dehumidificationSystem/airPreparationStation.vue
  19. 78 0
      src/views/dehumidificationSystem/anchorChamber.vue
  20. 55 0
      src/views/dehumidificationSystem/download.vue
  21. 156 0
      src/views/dehumidificationSystem/history.vue
  22. 187 0
      src/views/dehumidificationSystem/lineChart/LineChart.vue
  23. 45 0
      src/views/dehumidificationSystem/saddleRoom.vue
  24. 45 0
      src/views/dehumidificationSystem/steelBoxGirder.vue
  25. 492 0
      src/views/dehumidificationSystemAdmin/sensor.vue
  26. 414 0
      src/views/dehumidificationSystemAdmin/serverConfig.vue
  27. 1 1
      src/views/layout/Layout.vue
  28. 100 0
      src/views/layout/com.vue
  29. 2 5
      src/views/layout/components/Navbar.vue
  30. 1 1
      src/views/layout/components/Sidebar/SidebarItem.vue
  31. 3 6
      src/views/layout/components/Sidebar/index.vue
  32. 209 139
      src/views/layout/components/TopNavbar.vue
  33. 1 0
      src/views/layout/components/index.js
  34. 67 0
      src/views/layout/components/nava.vue
  35. BIN
      static/01.png
  36. BIN
      static/02.png
  37. BIN
      static/03.png
  38. BIN
      static/04.png
  39. BIN
      static/bridges.jpg

+ 80 - 0
src/api/sensorAdmin.js

@ -0,0 +1,80 @@
1
import request from '@/utils/request'
2
3
/*  添加传感器 */
4
export function addDevice(params) {
5
  return request({
6
    url: '/ajax/envData/transducer',
7
    method: 'post',
8
    data: params
9
  })
10
}
11
12
/*  更新传感器信息 */
13
export function updateDevice(params) {
14
  return request({
15
    url: '/ajax/envData/transducer/update',
16
    method: 'post',
17
    data: params
18
  })
19
}
20
21
/*  删除传感器信息 */
22
export function deleteDevice(params) {
23
  return request({
24
    url: '/ajax/envData/transducer/delete',
25
    method: 'get',
26
    params
27
  })
28
}
29
30
/*  查询单个传感器 */
31
export function queryDevice(params) {
32
  return request({
33
    url: '/ajax/envData/transducer/qo',
34
    method: 'get',
35
    params
36
  })
37
}
38
39
/*  分页查询传感器 */
40
export function pageQueryDevice(params) {
41
  return request({
42
    url: '/ajax/envData/transducer/pq',
43
    method: 'get',
44
    params
45
  })
46
}
47
48
/*  传感器所属采集盒编号列表 */
49
export function DeviceOfservice() {
50
  return request({
51
    url: '/ajax/envData/server/typeCode',
52
    method: 'get'
53
  })
54
}
55
56
/*  校验传感器编号 */
57
export function checkDeviceCode(params) {
58
  return request({
59
    url: '/ajax/envData/transducer/checkCode',
60
    method: 'get',
61
    params
62
  })
63
}
64
65
/*  校验传感器内部编号 */
66
export function checkDeviceInternalCode(params) {
67
  return request({
68
    url: '/ajax/envData/transducer/checkSeq',
69
    method: 'get',
70
    params
71
  })
72
}
73
74
/*  所属方位 */
75
export function ownPosition() {
76
  return request({
77
    url: '/ajax/envData/transducer/position',
78
    method: 'get'
79
  })
80
}

+ 82 - 0
src/api/serverAdmin.js

@ -0,0 +1,82 @@
1
import request from '@/utils/request'
2
3
/*  添加服务器 */
4
export function addDevice(params) {
5
  return request({
6
    url: '/ajax/envData/server',
7
    method: 'post',
8
    data: params
9
  })
10
}
11
12
/*  更新服务器信息 */
13
export function updateDevice(params) {
14
  return request({
15
    url: '/ajax/envData/server/update',
16
    method: 'post',
17
    data: params
18
  })
19
}
20
21
/*  删除服务器信息 */
22
export function deleteDevice(params) {
23
  return request({
24
    url: '/ajax/envData/server/delete',
25
    method: 'get',
26
    params
27
  })
28
}
29
30
/*  查询单个服务器 */
31
export function queryDevice(params) {
32
  return request({
33
    url: '/ajax/envData/server/qo',
34
    method: 'get',
35
    params
36
  })
37
}
38
39
/*  分页查询服务器 */
40
export function pageQueryDevice(params) {
41
  return request({
42
    url: '/ajax/envData/server/pq',
43
    method: 'get',
44
    params
45
  })
46
}
47
48
/*  服务器所属采桥梁列表 */
49
export function DeviceOfservice(params) {
50
  return request({
51
    url: '/ajax/bridge/list',
52
    method: 'get',
53
    params
54
  })
55
}
56
57
/*  校验服务器编号 */
58
export function checkDeviceCode(params) {
59
  return request({
60
    url: '/ajax/envData/server/checkCode',
61
    method: 'get',
62
    params
63
  })
64
}
65
66
/*  校验服务器内部编号 */
67
export function checkDeviceInternalCode(params) {
68
  return request({
69
    url: '/ajax/envData/server/checkSeq',
70
    method: 'get',
71
    params
72
  })
73
}
74
75
/*  校验采集服务器ip */
76
export function checkIp(params) {
77
  return request({
78
    url: '/ajax/envData/server/checkIp',
79
    method: 'get',
80
    params
81
  })
82
}

+ 7 - 0
src/components/Breadcrumb/index.vue

@ -11,6 +11,7 @@
11 11
12 12
<script>
13 13
import Cookies from 'js-cookie'
14
import { urlParse } from '@/utils/index'
14 15
export default {
15 16
  created() {
16 17
    this.getBreadcrumb()
@ -34,10 +35,16 @@ export default {
34 35
        }
35 36
        return item.name
36 37
      })
38
      if (matched.length === 2 && matched[0].name === 'odule') {
39
        matched = [{ path: '/bridgeHome', meta: { title: bridgeName }}].concat(matched)
40
      }
37 41
      const first = matched[0]
38 42
      if (first && first.name !== 'dashboard') {
39 43
        matched = [{ path: '/dashboard', meta: { title: '主页' }}].concat(matched)
40 44
      }
45
      if (matched[matched.length - 1].path === '/history') {
46
        matched[matched.length - 1].meta.title = urlParse('title')
47
      }
41 48
      this.levelList = matched
42 49
    }
43 50
  }

+ 92 - 0
src/components/Detection/index.vue

@ -0,0 +1,92 @@
1
<template>
2
  <div class="tagBox">
3
    <div class="tagBoxContent">
4
      <div class="tagCard" @click="change">
5
        <el-card v-for="item in list" :key="item.index" style="position:relative;">
6
          <img :src="src(item)" class="image">
7
          <div class="tagCardText">
8
            <span>{{item.name}}</span>
9
          </div>
10
          <p style="position: absolute;top: 80px;left:100px;font-size: 24px;">{{item.lastValue}}<span style="font-size:14px;">{{unitObj[item.unit]}}</span></p>
11
        </el-card>
12
      </div>
13
    </div>
14
    <p class="tagBoxGroup">{{num}}</p>
15
  </div>
16
</template>
17
18
<script>
19
  export default {
20
    props: ['list', 'num', 'tagText', 'tx'],
21
    name: 'complexTable',
22
    data() {
23
      return {
24
        arr: {},
25
        unitObj: {
26
          '01': '℃',
27
          '02': '%',
28
          '03': 'kPa',
29
          '04': 'm3/h'
30
        }
31
      }
32
    },
33
    created() {
34
      for (let i = 0; i < this.list.length; i++) {
35
        this.arr[this.list[i].code] = this.list[i].unit
36
      }
37
    },
38
    methods: {
39
      change() {
40
        if (this.tx) {
41
          this.$router.push({ name: 'history', query: { id: JSON.stringify(this.arr), title: `${this.tx}${this.tagText}${this.num}历史监测` }})
42
        } else {
43
          this.$router.push({ name: 'history', query: { id: JSON.stringify(this.arr), title: `${this.tagText}${this.num}历史监测` }})
44
        }
45
      },
46
      src(item) {
47
        return `/static/${item.unit}.png`
48
      }
49
    }
50
  }
51
</script>
52
53
<style rel="stylesheet/scss" lang="scss" scoped>
54
  .tagBox {
55
    margin-right: 10px;
56
    max-width: 460px;
57
58
    .tagBoxContent {
59
      box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
60
      .tagCard {
61
        max-width: 460px;
62
        overflow: hidden;
63
        cursor: pointer;
64
        .el-card {
65
          margin: 30px;
66
          overflow: hidden;
67
          display: flex;
68
          justify-content: center;
69
          align-items: center;
70
          width: 166px;
71
          float: left;
72
73
          .tagCardText {
74
            padding: 14px 0;
75
            text-align: center;
76
          }
77
78
          .image {
79
            width: 120px;
80
            height: 120px;
81
            display: block;
82
          }
83
        }
84
      }
85
    }
86
87
    .tagBoxGroup {
88
      text-align: center;
89
      color: #304156;
90
    }
91
  }
92
</style>

+ 1 - 0
src/icons/svg/arefaction.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="1552895764699" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2395" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M267.283 596.789c1.95 0.98 3.9 0.98 5.86 0.98 11.72 0 21.48-8.789 24.41-20.51 5.86-26.369 15.63-50.779 29.3-74.22l2.93-3.9c3.9-9.771 10.74-23.44 20.51-42 9.76-18.55 33.2-57.61 70.31-117.18 37.11-59.57 79.1-121.1 125-184.57 13.67 18.55 26.37 37.11 39.061 55.66 4.88 6.84 11.72 10.74 20.51 10.74 4.88 0 9.76-1.95 13.67-4.88 11.72-7.81 14.65-23.44 6.84-34.18-18.56-28.32-38.09-56.64-58.6-84.96 0 0-0.97-0.98-1.95-1.95 0 0 0 0-0.98 0l0-0.98-4.88-3.91-0.979 0 0-0.97-0.97 0-0.98 0-0.979-0.98-0.971 0-0.979 0-0.98-0.98-0.97 0-0.98 0-0.97 0-0.979 0-0.98 0-0.97 0-0.98 0-0.979 0-0.971 0-0.979 0-0.979 0-0.971 0-0.979 0.98-0.98 0-0.97 0-0.98 0 0 0.98-0.979 0-0.97 0c0 0.97 0 0.97-0.98 0.97l-4.88 3.91-0.98 0.98-1.949 1.95c-48.831 65.43-92.78 129.88-132.811 191.41-40.04 61.52-65.43 104.49-78.13 127.93-12.7 23.43-22.46 42.96-30.27 58.59-16.6 28.32-29.3 58.589-36.14 90.82C245.793 581.17 254.583 593.859 267.283 596.789L267.283 596.789 267.283 596.789zM851.263 634.879 851.263 633.9l0-1.951c0-55.67-14.649-108.398-42.97-156.25l-0.97-0.98-5.86-10.74c-15.63-27.34-59.57-3.91-43.95 24.41 2.931 4.89 5.86 8.79 6.84 11.72l1.95 2.93c23.44 40.04 35.16 83.011 35.16 128.909l0 8.791c-2.93 35.15-32.23 62.5-67.38 62.5-35.16 0-65.431-28.32-66.41-63.48l0-3.9c0-12.699-10.74-24.42-25.39-24.42-14.65 0-25.391 11.721-25.391 24.42l0 3.9c-0.979 16.6-7.81 31.25-20.51 42.971-14.65 13.67-31.25 20.51-49.8 20.51-14.65 0-29.3-4.881-42-13.67-24.41-18.561-55.66 22.459-28.32 41.01 21.49 14.65 44.92 22.459 70.32 22.459 32.22 0 60.54-10.738 83.979-33.199 3.91-3.91 7.811-7.811 10.74-12.699 23.44 30.279 54.69 45.898 92.78 45.898 14.64 0 28.319-1.949 41.01-6.83-12.69 24.41-28.32 46.871-48.83 66.4-49.8 49.811-109.37 74.221-179.68 74.221-51.76 0-99.61-14.65-141.61-42.971-27.34-18.549-55.66 23.441-28.32 42 51.76 34.18 108.4 50.781 169.93 50.781 83.979 0 156.25-29.301 215.819-88.871 56.641-56.641 85.931-125 88.86-205.08l0-6.83L851.26 634.879 851.263 634.879zM808.293 182.73l-629.88 629.879c-20.51 23.441 12.7 58.6 36.13 35.16l628.91-629.88C867.863 196.4 832.713 161.25 808.293 182.73L808.293 182.73z" p-id="2396"></path></svg>

+ 1 - 0
src/icons/svg/bridge.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="1552895977130" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6672" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M223.799968 525.440076c8.878964-2.919112 13.86578-10.21689 19.217484-17.028151 9.852001-7.297779 18.852595-15.568595 25.785485-25.785485h-0.121629c29.556004-19.947262 53.638674-45.976007 76.748307-72.734529 8.149186-7.541038 19.825632-11.068298 25.420596-21.650077 45.976007-36.124005 95.844162-64.098824 156.415727-57.895712 60.449935 6.203112 111.534387 35.637487 159.334838 72.36964 36.853783 28.339708 62.03112 67.504454 97.425347 96.69557 16.663262 24.690818 38.07008 35.272598 69.450529 33.204893 46.462525-3.162371 93.289939-0.729778 140.117353-0.729778 0.243259 49.746526 0.364889 99.371422 1.094667 148.996318 0.12163 10.825039-3.162371 14.473928-14.595558 14.473928-115.669795-0.364889-231.339589-0.243259-347.009383 0-10.825039 0-14.595558-2.675852-14.960447-14.109039-1.946074-49.989785-5.473334-99.97957-7.662668-149.969355-0.486519-11.798076-7.419408-19.704003-13.014372-28.461337-14.960447-23.231263-58.260601-47.435562-94.262976-37.583561-32.596745 2.554223-58.017342 16.176743-72.49127 46.705784-14.352298 13.62252-7.419408 31.380449-8.757335 47.435563-0.729778 8.270816-0.12163 16.663262-0.121629 25.055707-5.108445 3.40563-4.257038 8.514075-4.257038 13.500891l0.729778 89.39779c-2.432593 9.852001-10.33852 7.784297-17.27141 7.784298-118.710536 0.12163-237.421071-0.12163-356.131607 0.364889-12.162965 0-15.933484-3.770519-15.811854-15.690225 0.608148-49.016748 0.364889-98.033496 0.608148-147.050243 56.071267-0.243259 112.142535-0.486519 168.213802-0.973037 9.122224-0.12163 18.974225 2.432593 25.907115-6.324742z m0 0" fill="#BFBFBF" p-id="6673"></path></svg>

+ 1 - 0
src/icons/svg/logout.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="1552978079054" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2526" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M511.365 956.889c-221.971 0-402.647-180.613-402.647-402.647 0-150.625 83.028-287.444 216.661-357.228 12.245-6.372 27.364-1.624 33.736 10.621s1.624 27.364-10.621 33.736c-117.077 61.1-189.797 180.988-189.797 312.871 0 194.42 158.185 352.605 352.605 352.605s352.605-158.185 352.605-352.605c0-135.319-75.469-256.582-196.856-316.432-12.37-6.122-17.493-21.116-11.37-33.486 6.122-12.432 21.116-17.43 33.486-11.37 138.693 68.409 224.782 206.852 224.782 361.351 0.062 221.971-180.551 402.584-402.584 402.584z" p-id="2527"></path><path d="M511.365 542.497c-13.807 0-24.99-11.183-24.99-24.99V88.996c0-13.807 11.245-24.99 24.99-24.99 13.807 0 25.052 11.183 25.052 24.99v428.449c-0.063 13.807-11.246 25.052-25.052 25.052z" p-id="2528"></path></svg>

+ 1 - 15
src/permission.js

@ -7,14 +7,7 @@ import queryInfo from '@/utils/queryInfo'
7 7
8 8
NProgress.configure({ showSpinner: false })// NProgress Configuration
9 9
10
function hasPermission(roles, permissionRoles) {
11
  if (roles.indexOf('1') >= 0) return true
12
  if (!permissionRoles) return true
13
  return roles.some(role => permissionRoles.indexOf(role) >= 0)
14
}
15
16 10
const whiteList = ['/login', '/findPwd'] // 不重定向白名单
17
18 11
router.beforeEach((to, from, next) => {
19 12
  NProgress.start()
20 13
  if (getCookiesName()) {
@ -24,7 +17,6 @@ router.beforeEach((to, from, next) => {
24 17
    } else {
25 18
      queryInfo.queryAllInfo()
26 19
      if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息
27
        // console.log(5555)
28 20
        store.dispatch('GetUserInfo').then(res => { // 拉取user_info
29 21
          if (res.success) {
30 22
            const roles = [res.data.type.toString()]
@ -35,12 +27,7 @@ router.beforeEach((to, from, next) => {
35 27
          }
36 28
        })
37 29
      } else {
38
        // console.log(4444)
39
        if (hasPermission(store.getters.roles, to.meta.roles)) {
40
          next()
41
        } else {
42
          // console.log(777)
43
        }
30
        next()
44 31
      }
45 32
    }
46 33
  } else {
@ -52,7 +39,6 @@ router.beforeEach((to, from, next) => {
52 39
    }
53 40
  }
54 41
})
55
56 42
router.afterEach(() => {
57 43
  NProgress.done() // 结束Progress
58 44
})

+ 142 - 25
src/router/index.js

@ -5,6 +5,7 @@ Vue.use(Router)
5 5
6 6
/* Layout */
7 7
import Layout from '../views/layout/Layout'
8
import com from '../views/layout/com'
8 9
9 10
/**
10 11
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
@ -39,7 +40,21 @@ export const constantRouterMap = [
39 40
      name: 'dashboard',
40 41
      meta: { title: '主页' }
41 42
    }]
42
  },
43
  }
44
]
45
46
// 实例化vue的时候只挂载constantRouter
47
48
export default new Router({
49
  // mode: 'history', //后端支持可开
50
  scrollBehavior: () => ({ y: 0 }),
51
  routes: constantRouterMap
52
})
53
54
// 异步挂载的路由
55
// 动态需要根据权限加载的路由表
56
57
export const asyncRouterMapGeneralUser = [
43 58
  {
44 59
    path: '',
45 60
    hidden: true,
@ -86,21 +101,104 @@ export const constantRouterMap = [
86 101
            name: 'bridgeMonitor',
87 102
            component: () => import('@/views/bridgesConsole/bridgeMonitor/index'),
88 103
            meta: {
89
              title: '历史监测信息查询',
90
              roles: ['0']
104
              title: '历史监测信息查询'
91 105
            }
92 106
          }
93 107
        ]
94 108
      }
95 109
    ]
96 110
  },
111
  {
112
    path: '',
113
    name: 'account',
114
    component: com,
115
    hidden: true,
116
    meta: { title: '账户设置' },
117
    children: [
118
      {
119
        path: 'modifyData',
120
        name: 'modifyData',
121
        component: () => import('@/views/account/modifyData'),
122
        meta: {
123
          title: '修改账户资料'
124
        }
125
      },
126
      {
127
        path: 'modifyPassword',
128
        name: 'modifyPassword',
129
        component: () => import('@/views/account/modifyPassword'),
130
        meta: {
131
          title: '修改账户资料'
132
        }
133
      }
134
    ]
97 135
136
  },
137
  {
138
    path: '',
139
    component: com,
140
    name: 'odule',
141
    redirect: 'noredirect',
142
    meta: {
143
      title: '除湿系统',
144
      icon: 'arefaction',
145
      roles: ['0']
146
    },
147
    children: [
148
      {
149
        path: 'gasHolder',
150
        name: 'gasHolder',
151
        component: () => import('@/views/dehumidificationSystem/airClamp'),
152
        meta: { title: '气夹监测' }
153
      },
154
      {
155
        path: 'saddleRoom',
156
        name: 'saddleRoom',
157
        component: () => import('@/views/dehumidificationSystem/saddleRoom'),
158
        meta: { title: '鞍室监测' }
159
      },
160
      {
161
        path: 'anchorChamber',
162
        name: 'anchorChamber',
163
        component: () => import('@/views/dehumidificationSystem/anchorChamber'),
164
        meta: { title: '锚室监测' }
165
      },
166
      {
167
        path: 'airPreparationStation',
168
        name: 'airPreparationStation',
169
        component: () => import('@/views/dehumidificationSystem/airPreparationStation'),
170
        meta: { title: '空气制备站监测' }
171
      },
172
      {
173
        path: 'steelBoxGirder',
174
        name: 'steelBoxGirder',
175
        component: () => import('@/views/dehumidificationSystem/steelBoxGirder'),
176
        meta: { title: '钢箱梁监测' }
177
      },
178
      {
179
        path: 'history',
180
        hidden: true,
181
        name: 'history',
182
        component: () => import('@/views/dehumidificationSystem/history'),
183
        meta: { title: '历史监测' }
184
      },
185
      {
186
        path: 'download',
187
        name: 'download',
188
        component: () => import('@/views/dehumidificationSystem/download'),
189
        meta: { title: '监测数据下载' }
190
      }
191
    ]
192
  }, { path: '*', redirect: '/404', hidden: true }
193
]
194
195
export const asyncRouterMapAdmin = [
98 196
  {
99 197
    path: '',
100 198
    component: Layout,
101 199
    name: 'peoplesManage',
102 200
    meta: {
103
      title: '用户系统管理',
201
      title: '用户管理系统',
104 202
      icon: 'peoples',
105 203
      roles: ['1']
106 204
    },
@ -117,19 +215,30 @@ export const constantRouterMap = [
117 215
  {
118 216
    path: '',
119 217
    component: Layout,
120
    name: 'BaseInfoManage',
218
    name: 'bridgeManage',
121 219
    meta: {
122
      title: '基础信息管理',
123
      icon: 'list',
124 220
      roles: ['1']
125 221
    },
222
    alwaysShow: false,
126 223
    children: [
127 224
      {
128 225
        path: 'bridgesInfo',
129 226
        name: 'BridgesInfo',
130 227
        component: () => import('@/views/baseInfoManage/bridgesInfo/index'),
131
        meta: { title: '桥梁信息管理' }
132
      },
228
        meta: { title: '桥梁信息管理', icon: 'bridge' }
229
      }
230
    ]
231
  },
232
  {
233
    path: '',
234
    component: Layout,
235
    name: 'BaseInfoManage',
236
    meta: {
237
      title: '声脉系统',
238
      icon: 'list',
239
      roles: ['1']
240
    },
241
    children: [
133 242
      {
134 243
        path: 'serversConfig',
135 244
        name: 'ServersConfig',
@ -150,20 +259,28 @@ export const constantRouterMap = [
150 259
      }
151 260
    ]
152 261
  },
153
154
  { path: '*', redirect: '/404', hidden: true }
155
]
156
157
// 实例化vue的时候只挂载constantRouter
158
159
export default new Router({
160
  // mode: 'history', //后端支持可开
161
  scrollBehavior: () => ({ y: 0 }),
162
  routes: constantRouterMap
163
})
164
165
// 异步挂载的路由
166
// 动态需要根据权限加载的路由表
167
168
export const asyncRouterMap = [
262
  {
263
    path: '',
264
    component: Layout,
265
    name: 'arefactionManage',
266
    meta: {
267
      title: '除湿系统',
268
      icon: 'arefaction',
269
      roles: ['1']
270
    },
271
    children: [
272
      {
273
        path: 'serversConfigAdmin',
274
        name: 'serversConfigAdmin',
275
        component: () => import('@/views/dehumidificationSystemAdmin/serverConfig'),
276
        meta: { title: '采集服务器配置' }
277
      },
278
      {
279
        path: 'sensorAdmin',
280
        name: 'sensorAdmin',
281
        component: () => import('@/views/dehumidificationSystemAdmin/sensor'),
282
        meta: { title: '传感器配置' }
283
      }
284
    ]
285
  }, { path: '*', redirect: '/404', hidden: true }
169 286
]

+ 4 - 35
src/store/modules/permission.js

@ -1,35 +1,4 @@
1
import { asyncRouterMap, constantRouterMap } from '@/router'
2
3
/**
4
 * 通过meta.role判断是否与当前用户权限匹配
5
 * @param roles
6
 * @param route
7
 */
8
function hasPermission(roles, route) {
9
  if (route.meta && route.meta.roles) {
10
    return roles.some(role => route.meta.roles.indexOf(role) >= 0)
11
  } else {
12
    return true
13
  }
14
}
15
16
/**
17
 * 递归过滤异步路由表,返回符合用户角色权限的路由表
18
 * @param asyncRouterMap
19
 * @param roles
20
 */
21
function filterAsyncRouter(asyncRouterMap, roles) {
22
  const accessedRouters = asyncRouterMap.filter(route => {
23
    if (hasPermission(roles, route)) {
24
      if (route.children && route.children.length) {
25
        route.children = filterAsyncRouter(route.children, roles)
26
      }
27
      return true
28
    }
29
    return false
30
  })
31
  return accessedRouters
32
}
1
import { asyncRouterMapAdmin, constantRouterMap, asyncRouterMapGeneralUser } from '@/router'
33 2
34 3
const permission = {
35 4
  state: {
@ -39,7 +8,7 @@ const permission = {
39 8
  mutations: {
40 9
    SET_ROUTERS: (state, routers) => {
41 10
      state.addRouters = routers
42
      state.routers = constantRouterMap.concat(routers)
11
      state.routers = [...constantRouterMap, ...routers]
43 12
    }
44 13
  },
45 14
  actions: {
@ -48,9 +17,9 @@ const permission = {
48 17
        const { roles } = data
49 18
        let accessedRouters
50 19
        if (roles.indexOf('1') >= 0) {
51
          accessedRouters = asyncRouterMap
20
          accessedRouters = asyncRouterMapAdmin
52 21
        } else {
53
          accessedRouters = filterAsyncRouter(asyncRouterMap, roles)
22
          accessedRouters = asyncRouterMapGeneralUser
54 23
        }
55 24
        commit('SET_ROUTERS', accessedRouters)
56 25
        resolve()

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

@ -45,7 +45,6 @@ const user = {
45 45
              if (dataS.active) {
46 46
                commit('SET_ACCOUNT', dataS.account)
47 47
                commit('SET_USERID', dataS.id)
48
                commit('SET_ROLES', [dataS.type.toString()])
49 48
                commit('SET_NAME', dataS.name)
50 49
                setCookiesName(dataS.name)
51 50
              }

+ 40 - 0
src/utils/queryBridgeAllResource.js

@ -0,0 +1,40 @@
1
import request from '@/utils/request'
2
3
const bridge = {
4
5
}
6
export function byBridgeAll(id, callback) {
7
  if (bridge[id]) {
8
    callback(bridge[id])
9
  } else {
10
    request({
11
      url: '/ajax/envData/all/byBridge',
12
      method: 'get',
13
      params: {
14
        active: 1,
15
        bridgeId: id
16
      }
17
    }).then(res => {
18
      if (res.success) {
19
        const $data = res.data
20
        const tranducer = $data.transducer
21
        bridge[id] = { server: $data.server }
22
        for (let i = 0; i < tranducer.length; i++) {
23
          const sys = tranducer[i].system
24
          const org = tranducer[i].organize
25
          if (bridge[id][sys]) {
26
            if (bridge[id][sys][org]) {
27
              bridge[id][sys][org].push(tranducer[i])
28
            } else {
29
              bridge[id][sys][org] = [tranducer[i]]
30
            }
31
          } else {
32
            bridge[id][sys] = {}
33
            bridge[id][sys][org] = [tranducer[i]]
34
          }
35
        }
36
      }
37
      callback(bridge[id])
38
    })
39
  }
40
}

+ 141 - 0
src/views/account/modifyData.vue

@ -0,0 +1,141 @@
1
<template>
2
  <div class="modifyBox">
3
    <el-form class="demo-ruleForm formBox" label-width="80px" :model="ruleForm" ref="ruleForm" :rules="formRules">
4
      <el-row :gutter='20'>
5
        <el-col :span="12">
6
          <el-form-item label="账 号">{{account}}</el-form-item>
7
        </el-col>
8
        <el-col :span="12">
9
          <el-form-item label="用户姓名">{{name}}</el-form-item>
10
        </el-col>
11
        <el-col :span="12">
12
          <el-form-item label="职 位" prop="job">
13
            <el-input v-model="ruleForm.job" placeholder="请填写职位"></el-input>
14
          </el-form-item>
15
        </el-col>
16
        <el-col :span="12">
17
          <el-form-item label="所在机构" prop="comp">
18
            <el-input v-model="ruleForm.comp" placeholder="请填写所在机构"></el-input>
19
          </el-form-item>
20
        </el-col>
21
        <el-col :span="12">
22
          <el-form-item label="联系电话" prop="phone">
23
            <el-input v-model="ruleForm.phone" placeholder="请填写联系电话" maxlength="11"></el-input>
24
          </el-form-item>
25
        </el-col>
26
        <el-col :span="12">
27
          <el-form-item label="联系邮箱" prop="email">
28
            <el-input v-model="ruleForm.email" placeholder="请填写联系邮箱"></el-input>
29
          </el-form-item>
30
        </el-col>
31
        <el-col :span="24" class="el-btn-col">
32
          <div class="el-btn-col-box">
33
            <el-button type="primary" @click.native.prevent="submitForm('ruleForm')">保存</el-button>
34
          </div>
35
        </el-col>
36
      </el-row>
37
    </el-form>
38
  </div>
39
</template>
40
41
<script>
42
  import { MessageBox } from 'element-ui'
43
  import { getMyself, updateMyself } from '@/api/login'
44
  import store from '@/store'
45
46
  export default {
47
    data() {
48
      var validPhone = (rule, value, callback) => {
49
        const reg = /^1[3|4|5|7|8][0-9]\d{8}$/
50
        if (value.length > 0) {
51
          if (!reg.test(value)) {
52
            callback(new Error('请输入正确的手机号码'))
53
          } else {
54
            callback()
55
          }
56
        } else {
57
          callback()
58
        }
59
      }
60
      return {
61
        account: store.getters.account,
62
        userid: store.getters.userid,
63
        name: store.getters.name,
64
        type: '',
65
        ruleForm: {
66
          job: '',
67
          comp: '',
68
          phone: '',
69
          email: ''
70
        },
71
        formRules: {
72
          comp: [
73
            { required: true, message: '所在机构不能为空', trigger: 'blur' }
74
          ],
75
          phone: [
76
            { trigger: 'blur', validator: validPhone }
77
          ],
78
          email: [
79
            { type: 'email', message: '请输入正确的邮箱地址', trigger: 'blur' }
80
          ]
81
        }
82
      }
83
    },
84
    methods: {
85
      getUserSelf() {
86
        const id = this.userid
87
        getMyself({ id }).then((res) => {
88
          if (res.success) {
89
            this.ruleForm.job = res.data.job
90
            this.ruleForm.comp = res.data.comp
91
            this.ruleForm.phone = res.data.phone
92
            this.ruleForm.email = res.data.email
93
            this.type = res.data.type
94
          }
95
        })
96
      },
97
      submitForm(formName) {
98
        this.$refs[formName].validate((valid) => {
99
          if (valid) {
100
            const paramsData = {
101
              id: this.userid,
102
              account: this.account,
103
              name: this.name,
104
              job: this.ruleForm.job,
105
              comp: this.ruleForm.comp,
106
              phone: this.ruleForm.phone,
107
              email: this.ruleForm.email,
108
              type: this.type
109
            }
110
            updateMyself(paramsData).then((res) => {
111
              if (res.success) {
112
                MessageBox.alert('您的信息修改成功!', '提示', {
113
                  confirmButtonText: '确定',
114
                  type: 'success',
115
                  center: true,
116
                  callback: action => {
117
                    if (action === 'confirm') {
118
                      this.$refs[formName].resetFields()
119
                    }
120
                  }
121
                })
122
              }
123
            })
124
          }
125
        })
126
      }
127
    }
128
  }
129
</script>
130
131
<style rel="stylesheet/scss" lang="scss" scoped>
132
  .modifyBox {
133
    display: flex;
134
    justify-content: center;
135
136
    .formBox {
137
      width: 900px;
138
      margin-top: 100px;
139
    }
140
  }
141
</style>

+ 98 - 0
src/views/account/modifyPassword.vue

@ -0,0 +1,98 @@
1
<template>
2
  <div class="modifyBox">
3
    <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" class="demo-ruleForm formBox">
4
      <el-form-item prop="pass">
5
        <el-input type="password" v-model="ruleForm2.pass" placeholder="请设置您的新密码" auto-complete="off"></el-input>
6
      </el-form-item>
7
      <el-form-item prop="checkPass">
8
        <el-input type="password" v-model="ruleForm2.checkPass" placeholder="请再次输入密码确认" auto-complete="off"></el-input>
9
      </el-form-item>
10
      <el-form-item class="el-btn-col">
11
        <div class="el-btn-col-box">
12
          <el-button type="primary" @click.native.prevent="resetPwd('ruleForm2')">确定</el-button>
13
        </div>
14
      </el-form-item>
15
    </el-form>
16
  </div>
17
</template>
18
19
<script>
20
  import { changePw } from '@/api/login'
21
  import { MessageBox } from 'element-ui'
22
23
  export default {
24
    data() {
25
      var validatePass = (rule, value, callback) => {
26
        if (value === '') {
27
          callback(new Error('请设置您的新密码'))
28
        } else if (value.length < 6 || value.length > 24) {
29
          callback(new Error('密码由6-24个字符组成,区分大小写'))
30
        } else {
31
          if (this.ruleForm2.checkPass !== '') {
32
            this.$refs.ruleForm2.validateField('checkPass')
33
          }
34
          callback()
35
        }
36
      }
37
      var validatePass2 = (rule, value, callback) => {
38
        if (value === '') {
39
          callback(new Error('请再次输入密码确认'))
40
        } else if (value !== this.ruleForm2.pass) {
41
          callback(new Error('两次输入密码不一致,请重新输入!'))
42
        } else {
43
          callback()
44
        }
45
      }
46
      return {
47
        ruleForm2: {
48
          pass: '',
49
          checkPass: ''
50
        },
51
        rules2: {
52
          pass: [
53
            { required: true, validator: validatePass, trigger: 'blur' }
54
          ],
55
          checkPass: [
56
            { required: true, validator: validatePass2, trigger: 'blur' }
57
          ]
58
        }
59
      }
60
    },
61
    methods: {
62
      resetPwd(formName) {
63
        this.$refs[formName].validate((valid) => {
64
          if (valid) {
65
            const newPw = this.ruleForm2.checkPass
66
            changePw({ newPw }).then((res) => {
67
              if (res.success) {
68
                MessageBox.alert('密码修改成功!', '提示', {
69
                  confirmButtonText: '确定',
70
                  type: 'success',
71
                  center: true,
72
                  callback: action => {
73
                    if (action === 'confirm') {
74
                      this.$refs[formName].resetFields()
75
                    }
76
                  }
77
                })
78
              }
79
            })
80
          } else {
81
            return false
82
          }
83
        })
84
      }
85
    }
86
  }
87
</script>
88
<style rel="stylesheet/scss" lang="scss" scoped>
89
  .modifyBox {
90
    display: flex;
91
    justify-content: center;
92
93
    .formBox {
94
      width: 400px;
95
      margin-top: 100px;
96
    }
97
  }
98
</style>

+ 3 - 16
src/views/bridgesConsole/bridgeDetail/index.vue

@ -5,8 +5,6 @@
5 5
    <BInfoDialog03 ref="BInfoDialog03"></BInfoDialog03>
6 6
    <BInfoDialog04 ref="BInfoDialog04"></BInfoDialog04>
7 7
8
    <updatePersonInfo ref="updatePersonInfo"></updatePersonInfo>
9
    <updateLoginPwd ref="updateLoginPwd"></updateLoginPwd>
10 8
11 9
    <el-row :gutter="20">
12 10
      <el-col :xs="24" :sm="15" :lg="18">
@ -72,8 +70,6 @@
72 70
          <el-row :gutter="10" class="item-row">
73 71
            <el-col :span="12"><div class="grid-content" @click="queryDangerInfo">历史报警信息查询</div></el-col>
74 72
            <el-col :span="12"><div class="grid-content" @click="queryMonitorInfo">历史监测信息查询</div></el-col>
75
            <el-col :span="12"><div class="grid-content" @click="updatePersonInfo">修改个人信息</div></el-col>
76
            <el-col :span="12"><div class="grid-content" @click="updateLoginPwd">修改登录密码</div></el-col>
77 73
          </el-row>
78 74
        </el-card>
79 75
      </el-col>
@ -90,6 +86,7 @@ import queryDict from '@/utils/queryDict'
90 86
import monModel from '@/utils/timingConstruct'
91 87
import { urlParse, parseTime, isEqualArr } from '@/utils'
92 88
import { getDangerList, getSysTime, getMonitorByTime } from '@/api/bridgeInfo'
89
import { byBridgeAll } from '@/utils/queryBridgeAllResource'
93 90
94 91
import lineChart from '../lineChart/LineChart'
95 92
import BInfoDialog01 from './components/BInfoDialog01'
@ -97,9 +94,6 @@ import BInfoDialog02 from './components/BInfoDialog02'
97 94
import BInfoDialog03 from './components/BInfoDialog03'
98 95
import BInfoDialog04 from './components/BInfoDialog04'
99 96
100
import updatePersonInfo from './components/updatePersonInfo'
101
import updateLoginPwd from './components/updateLoginPwd'
102
103 97
import DefaultPage from '@/components/DefaultPage'
104 98
105 99
export default {
@ -110,8 +104,6 @@ export default {
110 104
    BInfoDialog02,
111 105
    BInfoDialog03,
112 106
    BInfoDialog04,
113
    updatePersonInfo,
114
    updateLoginPwd,
115 107
    DefaultPage
116 108
  },
117 109
  data() {
@ -160,6 +152,8 @@ export default {
160 152
      that.bridgeName = Cookies.get('bridgeName')
161 153
    }
162 154
    that.getDictoryData()
155
    byBridgeAll(that.bridgeId, (res) => {
156
    })
163 157
    queryInfo.qaiCb(function() {
164 158
      if (that.bridgeId) {
165 159
        that.serverSeqArr = queryInfo.queryServers(that.bridgeId, true)
@ -374,13 +368,6 @@ export default {
374 368
    querySensorInfo() {
375 369
      this.$refs.BInfoDialog04.queryTransList()
376 370
      this.$refs.BInfoDialog04.dialogTableVisible = true
377
    },
378
    updatePersonInfo() {
379
      this.$refs.updatePersonInfo.getUserSelf()
380
      this.$refs.updatePersonInfo.dialogTableVisible = true
381
    },
382
    updateLoginPwd() {
383
      this.$refs.updateLoginPwd.dialogTableVisible = true
384 371
    }
385 372
  },
386 373
  beforeDestroy() {

+ 2 - 1
src/views/dashboard/other/index.vue

@ -8,7 +8,7 @@
8 8
              <div class="card-panel-icon-wrapper">
9 9
                <div class="card-image" :style="{ backgroundImage: 'url(/data/bridge'+ item.img +')'}"></div>
10 10
              </div>
11
              <div class="card-panel-description">
11
              <div class="card-panel-description" style="text-align: center;">
12 12
                <div class="card-panel-text">桥梁名称 <span>{{item.shortName}}</span></div>
13 13
                <div class="card-panel-text" :class="item.alarmNum>0?'card-panel-text-red':''">未读报警 {{item.alarmNum ? item.alarmNum : alarmNum}}条</div>
14 14
              </div>
@ -64,6 +64,7 @@ export default {
64 64
    ])
65 65
  },
66 66
  created() {
67
    console.log(this.$store)
67 68
    this.getBridgeLists()
68 69
  },
69 70
  methods: {

+ 417 - 0
src/views/dehumidificationSystem/airClamp.vue

@ -0,0 +1,417 @@
1
<template>
2
  <div class="app-container" style="padding-bottom: 0px;padding-top: 0px;">
3
    <h4>气夹监测系统</h4>
4
    <div class="filter-container" style="overflow: auto;" v-loading="loadprogress">
5
      <div class="airItem">
6
        <p class="pText">上游气夹监测</p>
7
        <div class="imgBox">
8
          <img src="/static/bridges.jpg" alt="" style="" />
9
          <div class="state-info Normal" @click="change(arr1,arr1obj.txt)">
10
            <p class="airHumidity" v-for="item in arr1" :key='item.code'>{{item.lastValue}}{{unitObj[item.unit]}}</p>
11
          </div>
12
          <div class="state-info Normal" @click="change(arr2,arr2obj.txt)">
13
            <p class="airHumidity" v-for="item in arr2" :key='item.code'>{{item.lastValue}}{{unitObj[item.unit]}}</p>
14
          </div>
15
          <div class="state-info Normal" @click="change(arr3,arr3obj.txt)">
16
            <p class="airHumidity" v-for="item in arr3" :key='item.code'>{{item.lastValue}}{{unitObj[item.unit]}}</p>
17
          </div>
18
          <div class="state-info Normal" @click="change(arr4,arr4obj.txt)">
19
            <p class="airHumidity" v-for="item in arr4" :key='item.code'>{{item.lastValue}}{{unitObj[item.unit]}}</p>
20
          </div>
21
          <div class="state-info Normal" @click="change(arr5,arr5obj.txt)">
22
            <p class="airHumidity" v-for="item in arr5" :key='item.code'>{{item.lastValue}}{{unitObj[item.unit]}}</p>
23
          </div>
24
          <div class="state-info Normal" @click="change(arr6,arr6obj.txt)">
25
            <p class="airHumidity" v-for="item in arr6" :key='item.code'>{{item.lastValue}}{{unitObj[item.unit]}}</p>
26
          </div>
27
          <div class="titlText">
28
            <p><span></span>进气夹</p>
29
            <p><span class="gass"></span>排气夹</p>
30
          </div>
31
          <div class="pukou">
32
            浦口侧
33
          </div>
34
          <div class="jianye">
35
            建邺侧
36
          </div>
37
        </div>
38
      </div>
39
      <div class="airItem">
40
        <p class="pText">下游气夹监测</p>
41
        <div class="imgBox">
42
          <img src="/static/bridges.jpg" alt="" style="transform:rotateY(180deg);" />
43
          <div class="stateNormal" @click="change(arr7,arr7obj.txt)">
44
            <p class="airHumidity" v-for="item in arr7" :key='item.code'>{{item.lastValue}}{{unitObj[item.unit]}}</p>
45
          </div>
46
          <div class="stateNormal" @click="change(arr8,arr8obj.txt)">
47
            <p class="airHumidity" v-for="item in arr8" :key='item.code'>{{item.lastValue}}{{unitObj[item.unit]}}</p>
48
          </div>
49
          <div class="stateNormal" @click="change(arr9,arr9obj.txt)">
50
            <p class="airHumidity" v-for="item in arr9" :key='item.code'>{{item.lastValue}}{{unitObj[item.unit]}}</p>
51
          </div>
52
          <div class="stateNormal" @click="change(arr10,arr10obj.txt)">
53
            <p class="airHumidity" v-for="item in arr10" :key='item.code'>{{item.lastValue}}{{unitObj[item.unit]}}</p>
54
          </div>
55
          <div class="stateNormal" @click="change(arr12,arr12obj.txt)">
56
            <p class="airHumidity" v-for="item in arr11" :key='item.code'>{{item.lastValue}}{{unitObj[item.unit]}}</p>
57
          </div>
58
          <div class="stateNormal" @click="change(arr12,arr12obj.txt)">
59
            <p class="airHumidity" v-for="item in arr12" :key='item.code'>{{item.lastValue}}{{unitObj[item.unit]}}</p>
60
          </div>
61
          <div class="titlText">
62
            <p><span></span>进气夹</p>
63
            <p><span class="gass"></span>排气夹</p>
64
          </div>
65
          <div class="pukou">
66
            建邺侧
67
          </div>
68
          <div class="jianye">
69
            浦口侧
70
          </div>
71
        </div>
72
      </div>
73
    </div>
74
  </div>
75
</template>
76
77
<script>
78
  import Cookies from 'js-cookie'
79
  import { byBridgeAll } from '@/utils/queryBridgeAllResource'
80
  export default {
81
    name: 'complexTable',
82
    data() {
83
      return {
84
        saddleObj: {},
85
        loadprogress: true,
86
        bridgeId: '',
87
        arr1obj: {
88
          txt: '浦口侧上游排气夹',
89
          '7709': 0,
90
          '7710': 1,
91
          '7711': 2
92
        },
93
        arr1: [],
94
        arr2obj: {
95
          txt: '浦口侧上游进气夹',
96
          '7706': 0,
97
          '7707': 1,
98
          '7708': 2
99
        },
100
        arr2: [],
101
        arr3obj: {
102
          txt: '浦口侧上游上排气夹和上排气',
103
          '7535': 0,
104
          '7536': 1
105
        },
106
        arr3: [],
107
        arr4obj: {
108
          txt: '建邺侧上游上排气夹和上排气',
109
          '7531': 0,
110
          '7532': 1
111
        },
112
        arr4: [],
113
        arr5obj: {
114
          txt: '建邺侧上游进气夹',
115
          '7694': 0,
116
          '7695': 1,
117
          '7696': 2
118
        },
119
        arr5: [],
120
        arr6obj: {
121
          txt: '建邺侧上游排气夹',
122
          '7697': 0,
123
          '7698': 1,
124
          '7699': 2
125
        },
126
        arr6: [],
127
        arr7obj: {
128
          txt: '建邺侧下游排气夹',
129
          '7703': 0,
130
          '7704': 1,
131
          '7705': 2
132
        },
133
        arr7: [],
134
        arr8obj: {
135
          txt: '建邺侧下游进气夹',
136
          '7700': 0,
137
          '7701': 1,
138
          '7702': 2
139
        },
140
        arr8: [],
141
        arr9obj: {
142
          txt: '建邺侧下游上排气夹和上排气',
143
          '7533': 0,
144
          '7534': 1
145
        },
146
        arr9: [],
147
        arr10obj: {
148
          txt: '浦口侧下游上排气夹和上排气',
149
          '7537': 0,
150
          '7538': 1
151
        },
152
        arr10: [],
153
        arr11obj: {
154
          txt: '浦口侧下游进气夹',
155
          '7712': 0,
156
          '7713': 1,
157
          '7714': 2
158
        },
159
        arr12: [],
160
        arr12obj: {
161
          txt: '浦口侧下游排气夹',
162
          '7715': 0,
163
          '7716': 1,
164
          '7717': 2
165
        },
166
        arr11: [],
167
        unitObj: {
168
          '01': '℃',
169
          '02': '%',
170
          '03': 'kPa',
171
          '04': 'm3/h'
172
        }
173
      }
174
    },
175
    created() {
176
      this.bridgeId = Cookies.get('bridgeId')
177
      byBridgeAll(this.bridgeId, (res) => {
178
        this.loadprogress = false
179
        const array1 = ['', '', '']
180
        const array2 = ['', '', '']
181
        const array3 = ['', '']
182
        const array4 = ['', '']
183
        const array5 = ['', '', '']
184
        const array6 = ['', '', '']
185
        const array7 = ['', '', '']
186
        const array8 = ['', '', '']
187
        const array9 = ['', '']
188
        const array10 = ['', '']
189
        const array11 = ['', '', '']
190
        const array12 = ['', '', '']
191
        Object.keys(res['01']).forEach((key) => {
192
          res['01'][key].forEach((item) => {
193
            const code = item.code
194
            if (this.arr1obj[code] >= 0) {
195
              array1[this.arr1obj[code]] = item
196
            }
197
            if (this.arr2obj[code] >= 0) {
198
              array2[this.arr2obj[code]] = item
199
            }
200
            if (this.arr3obj[code] >= 0) {
201
              array3[this.arr3obj[code]] = item
202
            }
203
            if (this.arr4obj[code] >= 0) {
204
              array4[this.arr4obj[code]] = item
205
            }
206
            if (this.arr5obj[code] >= 0) {
207
              array5[this.arr5obj[code]] = item
208
            }
209
            if (this.arr6obj[code] >= 0) {
210
              array6[this.arr6obj[code]] = item
211
            }
212
            if (this.arr7obj[code] >= 0) {
213
              array7[this.arr7obj[code]] = item
214
            }
215
            if (this.arr8obj[code] >= 0) {
216
              array8[this.arr8obj[code]] = item
217
            }
218
            if (this.arr9obj[code] >= 0) {
219
              array9[this.arr9obj[code]] = item
220
            }
221
            if (this.arr10obj[code] >= 0) {
222
              array10[this.arr10obj[code]] = item
223
            }
224
            if (this.arr11obj[code] >= 0) {
225
              array11[this.arr11obj[code]] = item
226
            }
227
            if (this.arr12obj[code] >= 0) {
228
              array12[this.arr12obj[code]] = item
229
            }
230
          })
231
          this.arr1 = array1
232
          this.arr2 = array2
233
          this.arr3 = array3
234
          this.arr4 = array4
235
          this.arr5 = array5
236
          this.arr6 = array6
237
          this.arr7 = array7
238
          this.arr8 = array8
239
          this.arr9 = array9
240
          this.arr10 = array10
241
          this.arr11 = array11
242
          this.arr12 = array12
243
        })
244
      })
245
    },
246
    methods: {
247
      change(arr, txt) {
248
        const pAy = {}
249
        for (let i = 0; i < arr.length; i++) {
250
          pAy[arr[i].code] = arr[i].unit
251
        }
252
        this.$router.push({ name: 'history', query: { id: JSON.stringify(pAy), title: `${txt}历史监测` }})
253
      }
254
    }
255
  }
256
</script>
257
258
<style rel="stylesheet/scss" lang="scss" scoped>
259
  .airItem {
260
    border-radius: 2px;
261
    border: 2px solid #ccc;
262
    box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
263
    width: 1546px;
264
    margin-bottom: 10px;
265
266
    .pText {
267
      margin-left: 15px;
268
    }
269
270
    .imgBox {
271
      position: relative;
272
273
      .stateNormal {
274
        cursor: pointer;
275
        font-size: 14px;
276
        line-height: 17px;
277
        color: #515151;
278
        text-align: right;
279
        width: 75px;
280
        position: absolute;
281
        border-radius: 10px;
282
        box-sizing: border-box;
283
        padding: 6px 8px 6px 0;
284
        border: 2px solid transparent;
285
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
286
        background-color: rgba(246, 250, 255, 0.8);
287
288
        &:nth-child(2) {
289
          top: 215px;
290
          left: 201px;
291
        }
292
293
        &:nth-child(3) {
294
          top: 130px;
295
          left: 484px;
296
        }
297
298
        &:nth-child(4) {
299
          top: 51px;
300
          left: 772px;
301
        }
302
303
        &:nth-child(5) {
304
          top: 51px;
305
          left: 1009px;
306
        }
307
308
        &:nth-child(6) {
309
          top: 132px;
310
          right: 290px;
311
        }
312
313
        &:nth-child(7) {
314
          top: 215px;
315
          right: 146px;
316
        }
317
318
        p {
319
          margin: 0;
320
          padding: 0;
321
        }
322
      }
323
324
      .state-info {
325
        cursor: pointer;
326
        font-size: 14px;
327
        line-height: 17px;
328
        color: #515151;
329
        text-align: right;
330
        width: 75px;
331
        position: absolute;
332
        border-radius: 10px;
333
        box-sizing: border-box;
334
        padding: 6px 8px 6px 0;
335
        border: 2px solid transparent;
336
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
337
        background-color: rgba(246, 250, 255, 0.8);
338
339
        &:nth-child(2) {
340
          top: 215px;
341
          left: 147px;
342
        }
343
344
        &:nth-child(3) {
345
          top: 130px;
346
          left: 290px;
347
        }
348
349
        &:nth-child(4) {
350
          top: 51px;
351
          left: 458px;
352
        }
353
354
        &:nth-child(5) {
355
          top: 51px;
356
          left: 695px;
357
        }
358
359
        &:nth-child(6) {
360
          top: 132px;
361
          right: 483px;
362
        }
363
364
        &:nth-child(7) {
365
          top: 215px;
366
          right: 201px;
367
        }
368
369
        p {
370
          margin: 0;
371
          padding: 0;
372
        }
373
      }
374
375
      .titlText {
376
        position: absolute;
377
        top: 10px;
378
        left: 10px;
379
380
        p {
381
          color: #515151;
382
383
          span {
384
            display: inline-block;
385
            width: 15px;
386
            height: 15px;
387
            background-color: #00a0e9;
388
            border-radius: 50%;
389
            vertical-align: top;
390
            margin-right: 10px;
391
          }
392
393
          .gass {
394
            background-color: #c45995;
395
          }
396
        }
397
      }
398
399
      .pukou {
400
        position: absolute;
401
        top: 170px;
402
        height: 40px;
403
        width: 20px;
404
        left: 25px;
405
      }
406
407
      .jianye {
408
        position: absolute;
409
        top: 170px;
410
        height: 40px;
411
        width: 20px;
412
        right: 25px;
413
      }
414
    }
415
416
  }
417
</style>

+ 45 - 0
src/views/dehumidificationSystem/airPreparationStation.vue

@ -0,0 +1,45 @@
1
<template>
2
  <div class="app-container" style="padding-bottom: 0px;padding-top: 0px;">
3
    <h4>空气制备站监测系统</h4>
4
    <div class="contentbox" v-loading="loadprogress">
5
      <Detection v-for="(item,key,index) in saddleObj" :key="index" :list="item" :num="key" tagText="空气制备站"></Detection>
6
    </div>
7
  </div>
8
</template>
9
10
<script>
11
  import Detection from '@/components/Detection/index'
12
  import Cookies from 'js-cookie'
13
  import { byBridgeAll } from '@/utils/queryBridgeAllResource'
14
  export default {
15
    name: 'complexTable',
16
    data() {
17
      return {
18
        saddleObj: {},
19
        bridgeId: '',
20
        loadprogress: true
21
      }
22
    },
23
    created() {
24
      this.bridgeId = Cookies.get('bridgeId')
25
      byBridgeAll(this.bridgeId, (res) => {
26
        this.loadprogress = false
27
        this.saddleObj = res['04']
28
      })
29
    },
30
    components: {
31
      Detection
32
    },
33
    methods: {
34
35
    }
36
  }
37
</script>
38
39
<style rel="stylesheet/scss" lang="scss" scoped>
40
  .contentbox {
41
    display: flex;
42
    align-items:flex-start;
43
    flex-wrap: wrap;
44
  }
45
</style>

+ 78 - 0
src/views/dehumidificationSystem/anchorChamber.vue

@ -0,0 +1,78 @@
1
<template>
2
  <div class="app-container" style="padding-bottom: 0px;padding-top: 0px;" v-loading="loadprogress">
3
    <h4>锚室监测系统</h4>
4
      <div v-for="(itemlist,val,index) in saddleObj" :key="index" :list="itemlist">
5
        <h6>{{restaurants[val]}}</h6>
6
        <div class="contentbox">
7
          <Detection v-for="(item,key,index) in itemlist" :key="index" :list="item" :num="key" :tagText="restaurants[val]" tx="锚室"></Detection>
8
        </div>
9
      </div>  
10
    </div>
11
  </div>
12
</template>
13
14
<script>
15
  import Detection from '@/components/Detection/index'
16
  import Cookies from 'js-cookie'
17
  import { byBridgeAll } from '@/utils/queryBridgeAllResource'
18
  import { ownPosition } from '@/api/sensorAdmin'
19
  export default {
20
    name: 'complexTable',
21
    data() {
22
      return {
23
        saddleObj: {},
24
        bridgeId: '',
25
        restaurants: {},
26
        arr: [],
27
        loadprogress: true
28
      }
29
    },
30
    created() {
31
      this.bridgeId = Cookies.get('bridgeId')
32
      ownPosition().then(res => {
33
        if (res.success) {
34
          for (let i = 0; i < res.data.length; i++) {
35
            this.arr.push(res.data[i])
36
          }
37
        }
38
        byBridgeAll(this.bridgeId, (res) => {
39
          this.loadprogress = false
40
          const obj = {}
41
          const oFl = { '01': '上游', '02': '下游' }
42
          Object.keys(res['03']).forEach((key) => {
43
            res['03'][key].forEach((item) => {
44
              const index = this.arr.indexOf(item.position)
45
              if (obj[index + item.cableType]) {
46
                if (obj[index + item.cableType][key]) {
47
                  obj[index + item.cableType][key].push(item)
48
                } else {
49
                  obj[index + item.cableType][key] = [item]
50
                  this.restaurants[index + item.cableType] = `${this.arr[index]}${oFl[item.cableType]}`
51
                }
52
              } else {
53
                obj[index + item.cableType] = {}
54
                this.restaurants[index + item.cableType] = `${this.arr[index]}${oFl[item.cableType]}`
55
                obj[index + item.cableType][key] = [item]
56
              }
57
            })
58
          })
59
          this.saddleObj = obj
60
        })
61
      })
62
    },
63
    components: {
64
      Detection
65
    },
66
    methods: {
67
68
    }
69
  }
70
</script>
71
72
<style rel="stylesheet/scss" lang="scss" scoped>
73
  .contentbox {
74
    display: flex;
75
    align-items:flex-start;
76
    flex-wrap: wrap;
77
  }
78
</style>

+ 55 - 0
src/views/dehumidificationSystem/download.vue

@ -0,0 +1,55 @@
1
<template>
2
  <div class="app-container" style="padding-bottom: 0px;padding-top: 0px;">
3
    <h4>监测数据下载</h4>
4
    <div class="filter-container contentBox">
5
      <div>
6
        <el-date-picker v-model="dateTime" type="datetimerange" align="right" start-placeholder="开始日期" end-placeholder="结束日期">
7
        </el-date-picker>
8
        <el-button type="primary" icon="el-icon-download" class="btnBox" @click.prevent="download">下载</el-button>
9
      </div>
10
    </div>
11
  </div>
12
</template>
13
14
<script>
15
  import { turnTime } from '@/utils/index'
16
  import Cookies from 'js-cookie'
17
  export default {
18
    name: 'complexTable',
19
    data() {
20
      return {
21
        dateTime: ''
22
      }
23
    },
24
    created() {
25
26
    },
27
    methods: {
28
      download() {
29
        if (!this.dateTime) {
30
          this.$message.error('请先选择时间后进行数据下载')
31
        } else {
32
          const t1 = (new Date(this.dateTime[1].getTime()) - new Date(this.dateTime[0].getTime())) / 1000
33
          if (t1 > 6 * 60 * 60) {
34
            this.$message.error('时间间隔不能超过6小时')
35
          } else {
36
            const time1 = turnTime(this.dateTime[0], 'time', false)
37
            const time2 = turnTime(this.dateTime[1], 'time', false)
38
            location.href = `ajax/envDataExcel?bridgeId=${Cookies.get('bridgeId')}&bt=${time1}&et=${time2}`
39
          }
40
        }
41
      }
42
    }
43
  }
44
</script>
45
46
<style rel="stylesheet/scss" lang="scss" scoped>
47
  .contentBox {
48
    display: flex;
49
    justify-content: center;
50
51
    .btnBox {
52
      margin-left: 15px;
53
    }
54
  }
55
</style>

+ 156 - 0
src/views/dehumidificationSystem/history.vue

@ -0,0 +1,156 @@
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>{{alarmTit}}</span>
6
      </div>
7
      <div class="load-box" v-loading="loadprogress">
8
        <el-row class="line-chart-box">
9
          <el-col :xs="24" :sm="24" :lg="24" v-for="item in alarmList" :key="item.index">
10
            <lineChart :chartData="item" :historyM="historyM"></lineChart>
11
          </el-col>
12
        </el-row>
13
      </div>
14
15
    </el-card>
16
  </div>
17
</template>
18
19
<script>
20
  import { parseTime, turnTime } from '@/utils'
21
  import lineChart from './lineChart/LineChart'
22
  import request from '@/utils/request'
23
24
  export default {
25
    data() {
26
      return {
27
        historyM: true,
28
        alarmTit: '',
29
        alarmList: [],
30
        loadprogress: false,
31
        array: [],
32
        truObject: {}
33
      }
34
    },
35
    components: {
36
      lineChart
37
    },
38
    created() {
39
      this.truObject = JSON.parse(this.$route.query.id)
40
      Object.keys(this.truObject).forEach(res => {
41
        this.array.push(res)
42
      })
43
      this.alarmTit = this.$route.query.title
44
      this.getDustrurDetail()
45
    },
46
    methods: {
47
      getDustrurDetail() {
48
        this.loadprogress = true
49
        request({
50
          url: 'ajax/envData/history',
51
          method: 'get',
52
          params: {
53
            bt: this.getDate(),
54
            transducers: this.array
55
          }
56
        }).then(res => {
57
          if (res.success) {
58
            const $data = res.data
59
            const rList = []
60
            const rWsata = {
61
              tit: '',
62
              arr: [],
63
              xData: [],
64
              weData: [],
65
              seData: [],
66
              xInterval: 0
67
            }
68
            let sf = false
69
            Object.keys($data).forEach(key => {
70
              const rData = {
71
                tit: '',
72
                arr: [],
73
                xData: [],
74
                seData: [],
75
                xInterval: 0
76
              }
77
              if (this.truObject[key] === '01' || this.truObject[key] === '02') {
78
                if (this.truObject[key] === '01') {
79
                  rWsata.arr.push('温度')
80
                  rWsata.tit = '温度℃ '
81
                } else {
82
                  rWsata.arr.push('湿度')
83
                  if (rWsata.tit) {
84
                    rWsata.tit += '/ 湿度%'
85
                  } else {
86
                    rWsata.tit += '湿度%'
87
                  }
88
                }
89
                if (!sf) {
90
                  rList.push(rWsata)
91
                  sf = true
92
                }
93
              } else {
94
                if (this.truObject[key] === '03') {
95
                  rData.arr.push('压力')
96
                  rData.tit = '压力kPa'
97
                } else {
98
                  rData.arr.push('风量')
99
                  rData.tit = '风量m3/h'
100
                }
101
                rList.push(rData)
102
              }
103
              if (this.truObject[key] === '01' || this.truObject[key] === '02') {
104
                rWsata.xData = []
105
                $data[key].forEach((item, index) => {
106
                  if (index % 2 === 0) {
107
                    const startTime = parseTime(item.createTime, true, true).substr(0, 16)
108
                    rWsata.xData.unshift(startTime)
109
                    if (this.truObject[key] === '02') {
110
                      rWsata.weData.unshift(item.itemValue)
111
                    } else {
112
                      rWsata.seData.unshift(item.itemValue)
113
                    }
114
                  } else {
115
                    rWsata.xData.unshift('')
116
                    if (this.truObject[key] === '02') {
117
                      rWsata.weData.unshift(item.itemValue)
118
                    } else {
119
                      rWsata.seData.unshift(item.itemValue)
120
                    }
121
                  }
122
                })
123
              } else {
124
                $data[key].forEach((item, index) => {
125
                  if (index % 2 === 0) {
126
                    const startTime = parseTime(item.createTime, true, true).substr(0, 16)
127
                    rData.xData.unshift(startTime)
128
                    rData.seData.unshift(item.itemValue)
129
                  } else {
130
                    rData.xData.unshift('')
131
                    rData.seData.unshift(item.itemValue)
132
                  }
133
                })
134
              }
135
            })
136
            this.alarmList = rList
137
            this.loadprogress = false
138
          }
139
        })
140
      },
141
      getDate() {
142
        const currentTime = new Date(new Date().getTime() - 6 * 60 * 60 * 1000)
143
        return `${turnTime(currentTime, 'time').substr(0, 12)}00`
144
      }
145
    }
146
  }
147
</script>
148
<style rel="stylesheet/scss" lang="scss" scoped>
149
  .dashboard-editor-container .block-group .block-title {
150
    justify-content: flex-start;
151
152
    span {
153
      margin-right: 15px;
154
    }
155
  }
156
</style>

+ 187 - 0
src/views/dehumidificationSystem/lineChart/LineChart.vue

@ -0,0 +1,187 @@
1
<template>
2
  <div :class="className" :style="{height:height,width:width}"></div>
3
</template>
4
5
<script>
6
  import echarts from 'echarts'
7
  require('echarts/theme/macarons') // echarts theme
8
  import { debounce } from '@/utils'
9
10
  export default {
11
    props: {
12
      lineColor: {
13
        type: Number,
14
        default: 0
15
      },
16
      className: {
17
        type: String,
18
        default: 'chart'
19
      },
20
      width: {
21
        type: String,
22
        default: '100%'
23
      },
24
      height: {
25
        type: String,
26
        default: '350px'
27
      },
28
      autoResize: {
29
        type: Boolean,
30
        default: true
31
      },
32
      chartData: {
33
        type: Object
34
      },
35
      maxXcount: {
36
        type: Number
37
      },
38
      historyM: { // 判断是否需要坐标轴上的滚动条
39
        type: Boolean
40
      }
41
    },
42
    data() {
43
      return {
44
        lineColorNow: this.lineColor % 2 === 0 ? '#FF005A' : '#3888fa',
45
        chart: null
46
      }
47
    },
48
    mounted() {
49
      this.initChart()
50
      if (this.autoResize) {
51
        this.__resizeHanlder = debounce(() => {
52
          if (this.chart) {
53
            this.chart.resize()
54
          }
55
        }, 100)
56
        window.addEventListener('resize', this.__resizeHanlder)
57
      }
58
    },
59
    beforeDestroy() {
60
      if (!this.chart) {
61
        return
62
      }
63
      if (this.autoResize) {
64
        window.removeEventListener('resize', this.__resizeHanlder)
65
      }
66
67
      this.chart.dispose()
68
      this.chart = null
69
    },
70
    watch: {
71
      chartData: {
72
        deep: true,
73
        handler(val) {
74
          this.setOptions(val)
75
        }
76
      }
77
    },
78
    methods: {
79
      setOptions(datastr) {
80
        this.chart.setOption({
81
          title: {
82
            text: datastr.tit,
83
            textStyle: {
84
              color: '#333',
85
              fontSize: 14
86
            },
87
            top: '0'
88
          },
89
          grid: {
90
            left: 10,
91
            right: 10,
92
            bottom: 20,
93
            top: 60,
94
            containLabel: true
95
          },
96
          tooltip: {
97
            trigger: 'axis',
98
            axisPointer: {
99
              type: 'cross'
100
            },
101
            padding: [5, 10]
102
          },
103
          xAxis: {
104
            data: datastr.xData,
105
            max: this.maxXcount
106
          },
107
          yAxis: {
108
            type: 'value',
109
            max: 100,
110
            min: -90
111
          },
112
          legend: {
113
            data: datastr.arr
114
          }
115
        })
116
        if (datastr.arr.length === 2) {
117
          this.chart.setOption({
118
            series: [
119
              {
120
                name: datastr.arr[0], itemStyle: {
121
                  normal: {
122
                    color: this.lineColorNow,
123
                    lineStyle: {
124
                      color: this.lineColorNow,
125
                      width: 2
126
                    }
127
                  }
128
                },
129
                smooth: true,
130
                type: 'line',
131
                data: datastr.seData,
132
                animationDuration: 2800,
133
                animationEasing: 'cubicInOut'
134
              }, {
135
                name: datastr.arr[1],
136
                type: 'line',
137
                data: datastr.weData
138
              }
139
            ]
140
          })
141
        } else {
142
          this.chart.setOption({
143
            series: [
144
              {
145
                name: datastr.arr[0], itemStyle: {
146
                  normal: {
147
                    color: this.lineColorNow,
148
                    lineStyle: {
149
                      color: this.lineColorNow,
150
                      width: 2
151
                    }
152
                  }
153
                },
154
                smooth: true,
155
                type: 'line',
156
                data: datastr.seData,
157
                animationDuration: 2800,
158
                animationEasing: 'cubicInOut'
159
              }
160
            ]
161
          })
162
        }
163
        if (this.historyM) {
164
          this.chart.setOption({
165
            dataZoom: [
166
              {
167
                type: 'slider',
168
                start: 98,
169
                end: 100
170
              },
171
              {
172
                type: 'inside'
173
              }
174
            ]
175
          })
176
        }
177
      },
178
      initChart() {
179
        this.chart = echarts.init(this.$el, 'macarons')
180
        var that = this
181
        setTimeout(function() {
182
          that.setOptions(that.chartData)
183
        }, 1)
184
      }
185
    }
186
  }
187
</script>

+ 45 - 0
src/views/dehumidificationSystem/saddleRoom.vue

@ -0,0 +1,45 @@
1
<template>
2
  <div class="app-container" style="padding-bottom: 0px;padding-top: 0px;">
3
    <h4>鞍室监测系统</h4>
4
    <div class="contentbox" v-loading="loadprogress">
5
      <Detection v-for="(item,key,index) in saddleObj" :key="index" :list="item" :num="key" tagText="鞍室"></Detection>
6
    </div>
7
  </div>
8
</template>
9
10
<script>
11
  import Detection from '@/components/Detection/index'
12
  import Cookies from 'js-cookie'
13
  import { byBridgeAll } from '@/utils/queryBridgeAllResource'
14
  export default {
15
    name: 'complexTable',
16
    data() {
17
      return {
18
        saddleObj: {},
19
        bridgeId: '',
20
        loadprogress: true
21
      }
22
    },
23
    created() {
24
      this.bridgeId = Cookies.get('bridgeId')
25
      byBridgeAll(this.bridgeId, (res) => {
26
        this.loadprogress = false
27
        this.saddleObj = res['02']
28
      })
29
    },
30
    components: {
31
      Detection
32
    },
33
    methods: {
34
35
    }
36
  }
37
</script>
38
39
<style rel="stylesheet/scss" lang="scss" scoped>
40
  .contentbox {
41
    display: flex;
42
    align-items:flex-start;
43
    flex-wrap: wrap;
44
  }
45
</style>

+ 45 - 0
src/views/dehumidificationSystem/steelBoxGirder.vue

@ -0,0 +1,45 @@
1
<template>
2
  <div class="app-container" style="padding-bottom: 0px;padding-top: 0px;">
3
    <h4>钢箱梁监测系统</h4>
4
    <div class="contentbox" v-loading="loadprogress">
5
      <Detection v-for="(item,key,index) in saddleObj" :key="index" :list="item" :num="key" tagText="钢箱梁"></Detection>
6
    </div>
7
  </div>
8
</template>
9
10
<script>
11
  import Detection from '@/components/Detection/index'
12
  import Cookies from 'js-cookie'
13
  import { byBridgeAll } from '@/utils/queryBridgeAllResource'
14
  export default {
15
    name: 'complexTable',
16
    data() {
17
      return {
18
        saddleObj: {},
19
        bridgeId: '',
20
        loadprogress: true
21
      }
22
    },
23
    created() {
24
      this.bridgeId = Cookies.get('bridgeId')
25
      byBridgeAll(this.bridgeId, (res) => {
26
        this.loadprogress = false
27
        this.saddleObj = res['05']
28
      })
29
    },
30
    components: {
31
      Detection
32
    },
33
    methods: {
34
35
    }
36
  }
37
</script>
38
39
<style rel="stylesheet/scss" lang="scss" scoped>
40
  .contentbox {
41
    display: flex;
42
    align-items:flex-start;
43
    flex-wrap: wrap;
44
  }
45
</style>

+ 492 - 0
src/views/dehumidificationSystemAdmin/sensor.vue

@ -0,0 +1,492 @@
1
<template>
2
  <div class="app-container">
3
    <div class="filter-container" style="margin-bottom:20px">
4
      <el-input style="width: 200px;" class="filter-item" placeholder="所属桥梁简称" v-model="listQuery.bridgeName">
5
      </el-input>
6
      <el-input style="width: 200px;" class="filter-item" placeholder="所属服务器编号" v-model="listQuery.serverCode">
7
      </el-input>
8
      <el-select v-model="listQuery.system" placeholder="请选择所属系统" style="width: 200px;">
9
        <el-option v-for="item in systemList" :key="item.value" :label="item.label" :value="item.value">
10
        </el-option>
11
      </el-select>
12
      <el-input style="width: 200px;" class="filter-item" placeholder="传感器编号" v-model="listQuery.code">
13
      </el-input>
14
      <el-button v-waves class="filter-item" style="margin-left: 10px;" @click="handleFilter" type="primary" icon="el-icon-search">查找</el-button>
15
      <el-button v-waves class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加传感器</el-button>
16
    </div>
17
    <el-table :key='tableKey' :data="listG" v-loading="listLoading" border fit highlight-current-row style="width: 100%;min-height:550px;">
18
      <el-table-column width="150px" align="center" label="所属桥梁简称" prop="bridgeName"></el-table-column>
19
      <el-table-column width="150px" align="center" label="所属服务器" prop="serverName"></el-table-column>
20
      <el-table-column width="150px" align="center" label="所属系统" prop="systemText"></el-table-column>
21
      <el-table-column width="150px" align="center" label="传感器编号" prop="code"></el-table-column>
22
      <el-table-column width="150px" align="center" label="内部编号" prop="seq"></el-table-column>
23
      <el-table-column width="150px" align="center" label="名称" prop="name"></el-table-column>
24
      <el-table-column width="150px" align="center" label="所属方位" prop="position"></el-table-column>
25
      <el-table-column width="150px" align="center" label="所属主缆" prop="cableTypeText"></el-table-column>
26
      <el-table-column width="150px" align="center" label="单位" prop="unitText"></el-table-column>
27
      <el-table-column min-width="200px" align="center" label="备注" prop="remark"></el-table-column>
28
      <el-table-column align="center" label="操作" width="230" class-name="small-padding fixed-width">
29
        <template slot-scope="scope">
30
          <el-button v-waves type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
31
          <el-button v-waves size="mini" type="danger" @click="handleModifyStatus(scope.row,'deleted')">删除
32
          </el-button>
33
        </template>
34
      </el-table-column>
35
    </el-table>
36
    <el-dialog title="传感器配置" ref="ruleForm" :visible.sync="dialogTableVisible" width="860px" @close='closed'>
37
      <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" class="form-main" label-position='right' status-icon>
38
        <el-row>
39
          <el-col :span="8">
40
            <el-form-item label="所属服务器" prop="serverId">
41
              <el-select v-model="ruleForm2.serverId" placeholder="请选择所属服务器">
42
                <el-option v-for="item in serverList" :key="item.value" :label="item.caption" :value="item.code">
43
                </el-option>
44
              </el-select>
45
            </el-form-item>
46
          </el-col>
47
          <el-col :span="8">
48
            <el-form-item label="所属系统" prop="system">
49
              <el-select v-model="ruleForm2.system" placeholder="请选择所属系统">
50
                <el-option v-for="item in systemList" :key="item.value" :label="item.label" :value="item.value">
51
                </el-option>
52
              </el-select>
53
            </el-form-item>
54
          </el-col>
55
          <el-col :span="8">
56
            <el-form-item label="所属组" prop="organize">
57
              <el-select v-model="ruleForm2.organize" placeholder="请选择所属系统">
58
                <el-option v-for="item in 100" :key="item" :value="item">
59
                </el-option>
60
              </el-select>
61
            </el-form-item>
62
          </el-col>
63
          <el-col :span="8">
64
            <el-form-item label="传感器编号" prop="code">
65
              <el-input placeholder="请输入传感器编号" v-model="ruleForm2.code" maxlength=10></el-input>
66
            </el-form-item>
67
          </el-col>
68
          <el-col :span="8">
69
            <el-form-item label="内部编号" prop="seq">
70
              <el-input placeholder="请输入内部编号" v-model="ruleForm2.seq" maxlength=10></el-input>
71
            </el-form-item>
72
          </el-col>
73
          <el-col :span="8">
74
            <el-form-item label="名称" prop="name">
75
              <el-input placeholder="请输入名称" v-model="ruleForm2.name" maxlength=30></el-input>
76
            </el-form-item>
77
          </el-col>
78
          <el-col :span="8">
79
            <el-form-item label="所属方位" prop="position">
80
              <el-autocomplete class="inline-input" v-model="ruleForm2.position" :fetch-suggestions="querySearch"
81
                placeholder="请输入内容" @select="handleSelect">
82
              </el-autocomplete>
83
            </el-form-item>
84
          </el-col>
85
          <el-col :span="8">
86
            <el-form-item label="所属主缆" prop="cableType">
87
              <el-select v-model="ruleForm2.cableType" placeholder="请选择所属主缆">
88
                <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
89
                </el-option>
90
              </el-select>
91
            </el-form-item>
92
          </el-col>
93
          <el-col :span="8">
94
            <el-form-item label="数据单位" prop="unit">
95
              <el-select v-model="ruleForm2.unit" placeholder="请选择数据单位">
96
                <el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value">
97
                </el-option>
98
              </el-select>
99
            </el-form-item>
100
          </el-col>
101
          <el-col :span="24">
102
            <el-form-item label="备注" prop="remark">
103
              <el-input type="textarea" maxlength=500 v-model="ruleForm2.remark" rows=4></el-input>
104
            </el-form-item>
105
          </el-col>
106
          <el-col :span="24" class="el-btn-col">
107
            <div class="el-btn-col-box">
108
              <el-button v-waves type="primary" @click="submitForm('ruleForm2')">确认</el-button>
109
              <el-button v-waves type="info" @click="resetForm('ruleForm2')">返回</el-button>
110
            </div>
111
          </el-col>
112
        </el-row>
113
      </el-form>
114
    </el-dialog>
115
    <div class="pagination-container" style="text-align:center;">
116
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.pageNo"
117
        :page-size="listQuery.pageSize" layout="prev, pager, next, jumper" :total="total">
118
      </el-pagination>
119
    </div>
120
  </div>
121
</template>
122
123
<script>
124
  import { addDevice, updateDevice, deleteDevice, pageQueryDevice, DeviceOfservice, checkDeviceCode, checkDeviceInternalCode, ownPosition } from '@/api/sensorAdmin'
125
  import { queryDevice } from '@/api/serverAdmin'
126
  import queryBase from '@/utils/queryBase'
127
  import waves from '@/directive/waves'
128
  import queryDict from '@/utils/queryDict'
129
  export default {
130
    name: 'complexTable',
131
    directives: {
132
      waves
133
    },
134
    data() {
135
      var seq = (rule, value, callback) => {
136
        const num = /^[0-9]*$/
137
        if (value === '') {
138
          callback(new Error('请输入内部编号'))
139
        } else {
140
          if (!num.test(value)) {
141
            callback('请输入数字')
142
            return
143
          }
144
          if (this.edit) {
145
            checkDeviceInternalCode({ seq: value, id: this.edit, serverId: this.ruleForm2.serverId, active: 1 }).then(response => {
146
              if (response.data) {
147
                callback(new Error('内部编号已存在,请重新输入'))
148
              } else {
149
                callback()
150
              }
151
            })
152
          } else {
153
            checkDeviceInternalCode({ seq: value, serverId: this.ruleForm2.serverId, active: 1 }).then(response => {
154
              if (response.data) {
155
                callback(new Error('内部编号已存在,请重新输入'))
156
              } else {
157
                callback()
158
              }
159
            })
160
          }
161
        }
162
      }
163
      var code = (rule, value, callback) => {
164
        if (value === '') {
165
          callback(new Error('请输入传感器编号'))
166
        } else {
167
          if (this.edit) {
168
            checkDeviceCode({ code: value, id: this.edit, active: 1 }).then(response => {
169
              if (response.data) {
170
                callback(new Error('传感器编号已存在,请重新输入'))
171
              } else {
172
                callback()
173
              }
174
            })
175
          } else {
176
            checkDeviceCode({ code: value, active: 1 }).then(response => {
177
              if (response.data) {
178
                callback(new Error('传感器编号已存在,请重新输入'))
179
              } else {
180
                callback()
181
              }
182
            })
183
          }
184
        }
185
      }
186
      return {
187
        restaurants: [],
188
        cableMain: [],
189
        addr: [],
190
        options: [],
191
        options1: [],
192
        systemList: [],
193
        serverList: [],
194
        edit: '',
195
        unitObj: {},
196
        systemObj: {},
197
        ruleForm2: {
198
          organize: '',
199
          name: '',
200
          position: '',
201
          unit: '',
202
          system: '',
203
          code: '',
204
          cableType: '',
205
          device: '',
206
          seq: '',
207
          serverId: '',
208
          remark: ''
209
        },
210
        rules2: {
211
          serverId: [
212
            { required: true, message: '请选所属服务器' }
213
          ],
214
          system: [
215
            { required: true, message: '请选择所属系统' }
216
          ],
217
          organize: [
218
            { required: true, message: '请选择所属组' }
219
          ],
220
          code: [
221
            { required: true, validator: code, trigger: 'blur' }
222
          ],
223
          seq: [
224
            { required: true, validator: seq, trigger: 'blur' }
225
          ],
226
          name: [
227
            { required: true, message: '请输入名称', trigger: 'blur' }
228
          ],
229
          position: [
230
            { required: true, message: '请选择所属方位' }
231
          ],
232
          cableType: [
233
            { required: true, message: '请选择所属主缆', trigger: 'blur' }
234
          ],
235
          unit: [
236
            { required: true, message: '请选择数据单位', trigger: 'blur' }
237
          ]
238
        },
239
        dialogTableVisible: false,
240
        tableKey: 0,
241
        listG: [],
242
        total: null,
243
        listLoading: true,
244
        listQuery: {
245
          serverCode: '',
246
          bridgeName: '',
247
          system: '',
248
          code: '',
249
          active: 1,
250
          pageSize: 10,
251
          pageNo: 1
252
        }
253
      }
254
    },
255
    created() {
256
      DeviceOfservice().then(res => {
257
        if (res.success) {
258
          this.serverList = res.data
259
        }
260
      })
261
      this.getDictoryData()
262
    },
263
    methods: {
264
      querySearch(queryString, cb) {
265
        cb(this.restaurants)
266
      },
267
      handleSelect(item) {
268
        console.log(item)
269
      },
270
      getDictoryData() {
271
        queryDict.applyDict('CSZL', dictData => {
272
          dictData.map(item => {
273
            this.options.push({ value: item.code, label: item.caption })
274
            this.cableMain[item.code] = item.caption
275
          })
276
          queryDict.applyDict('CSXT', dictData => { // 系统
277
            dictData.map(item => {
278
              this.systemObj[item.code] = item.caption
279
              this.systemList.push({ value: item.code, label: item.caption })
280
              this.addr[item.code] = item.caption
281
            })
282
            queryDict.applyDict('CSDW', dictData => { // 单位
283
              dictData.map(item => {
284
                this.options1.push({ value: item.code, label: item.caption })
285
                this.unitObj[item.code] = item.caption
286
              })
287
              this.getList()
288
            })
289
          })
290
        })
291
      },
292
      submitForm(formName) {
293
        this.$refs[formName].validate((valid) => {
294
          if (valid) {
295
            if (!this.edit) {
296
              addDevice(this.ruleForm2).then(response => {
297
                if (response.success) {
298
                  this.getList()
299
                  setTimeout(() => {
300
                    this.pop('已成功添加传感器')
301
                  }, 1000)
302
                  this.resetForm('ruleForm2')
303
                  this.dialogTableVisible = false
304
                }
305
              }).catch(error => {
306
                console.log(error)
307
              })
308
            } else {
309
              const par = this.ruleForm2
310
              par.id = this.edit
311
              updateDevice(par).then(response => {
312
                if (response.success) {
313
                  setTimeout(() => {
314
                    this.pop('已成功更新传感器')
315
                  }, 1000)
316
                  this.resetForm('ruleForm2')
317
                  this.getList()
318
                  this.dialogTableVisible = false
319
                  this.edit = ''
320
                  this.ruleForm2 = {
321
                    organize: '',
322
                    name: '',
323
                    position: '',
324
                    unit: '',
325
                    system: '',
326
                    code: '',
327
                    cableType: '',
328
                    device: '',
329
                    seq: '',
330
                    serverId: '',
331
                    remark: ''
332
                  }
333
                }
334
              })
335
            }
336
          }
337
        })
338
      },
339
      resetForm(formName) {
340
        this.dialogTableVisible = false
341
        this.$refs[formName].resetFields()
342
        this.edit = ''
343
      },
344
      closed() {
345
        this.$refs['ruleForm2'].resetFields()
346
        this.edit = ''
347
      },
348
      getList() {
349
        this.listLoading = true
350
        pageQueryDevice(this.listQuery).then(response => {
351
          if (response.success) {
352
            var $data = response.data.data
353
            var hdata = { num: 0, data: $data }
354
            for (let i = 0; i < $data.length; i++) {
355
              hdata.num++
356
              $data[i].cableTypeText = this.cableMain[$data[i].cableType]
357
              $data[i].systemText = this.addr[$data[i].system]
358
              $data[i].unitText = this.unitObj[$data[i].unit]
359
              queryDevice({ id: $data[i].serverId }).then(res => {
360
                if (res.success) {
361
                  $data[i].serverName = res.data.code
362
                  queryBase.getBridge(res.data.bridgeId, (sc, value) => {
363
                    if (sc) {
364
                      $data[i].bridgeName = value.shortName
365
                      hdata.num--
366
                      if (hdata.num === 0) {
367
                        this.listG = $data
368
                      }
369
                    }
370
                  })
371
                }
372
              })
373
            }
374
            if (hdata.num === 0) {
375
              this.listG = hdata.data
376
            }
377
            this.total = response.data.total
378
            setTimeout(() => {
379
              this.listLoading = false
380
            }, 1.5 * 1000)
381
          }
382
        })
383
      },
384
      handleFilter() {
385
        this.listQuery.pageNo = 1
386
        this.getList()
387
      },
388
      handleSizeChange(val) {
389
        this.listQuery.pageSize = val
390
        this.getList()
391
      },
392
      handleCurrentChange(val) {
393
        this.listQuery.pageNo = val
394
        this.getList()
395
      },
396
      handleModifyStatus(row, status) {
397
        this.$confirm('确定要删除:传感器' + row.code + '吗?', '提示', {
398
          confirmButtonText: '确定',
399
          cancelButtonText: '取消',
400
          type: 'warning',
401
          center: true
402
        }).then(() => {
403
          deleteDevice({ id: row.id }).then(response => {
404
            if (response.success) {
405
              this.getList()
406
              this.pop('已成功删除该传感器')
407
            }
408
          })
409
        }).catch(() => {
410
411
        })
412
      },
413
      pop($par) {
414
        this.$confirm($par, '提示', {
415
          confirmButtonText: '确定',
416
          cancelButtonText: '取消',
417
          type: 'success',
418
          showCancelButton: false,
419
          center: true
420
        }).then(() => {
421
422
        }).catch(() => {
423
424
        })
425
      },
426
      resetTemp(row) {
427
        this.ruleForm2 = {
428
          code: row.code,
429
          cableType: row.cableType,
430
          seq: row.seq,
431
          serverId: row.serverId,
432
          name: row.name,
433
          unit: row.unit,
434
          system: row.system,
435
          position: row.position,
436
          organize: row.organize,
437
          remark: row.remark || ''
438
        }
439
        this.edit = row.id
440
      },
441
      handleCreate() {
442
        this.restaurants = []
443
        ownPosition().then(res => {
444
          if (res.success) {
445
            for (let i = 0; i < res.data.length; i++) {
446
              this.restaurants.push({ value: res.data[i] })
447
            }
448
          }
449
          this.dialogTableVisible = true
450
        })
451
      },
452
      handleUpdate(row) {
453
        this.restaurants = []
454
        ownPosition().then(res => {
455
          if (res.success) {
456
            for (let i = 0; i < res.data.length; i++) {
457
              this.restaurants.push({ value: res.data[i] })
458
            }
459
          }
460
          this.dialogTableVisible = true
461
          this.resetTemp(row)
462
        })
463
      }
464
    }
465
  }
466
</script>
467
468
<style rel="stylesheet/scss" lang="scss" scoped>
469
  .el-autocomplete {
470
    display: block
471
  }
472
473
  .el-btn-col {
474
    margin-top: 45px
475
  }
476
477
  .el-form-item {
478
    margin: 0px 10px
479
  }
480
481
  .el-select {
482
    width: 100%
483
  }
484
485
  .el-col {
486
    margin-bottom: 15px
487
  }
488
489
  .el-form-item__label {
490
    padding: 0px
491
  }
492
</style>

+ 414 - 0
src/views/dehumidificationSystemAdmin/serverConfig.vue

@ -0,0 +1,414 @@
1
<template>
2
  <div class="app-container">
3
    <div class="filter-container" style="margin-bottom:20px">
4
      <el-input style="width: 200px;" class="filter-item" placeholder="所属桥梁名称" v-model="listQuery.key">
5
      </el-input>
6
      <el-input style="width: 200px;" class="filter-item" placeholder="服务器编号" v-model="listQuery.code">
7
      </el-input>
8
      <el-button v-waves class="filter-item" style="margin-left: 10px;" @click="handleFilter" type="primary" icon="el-icon-search">查找</el-button>
9
      <el-button v-waves class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">添加服务器</el-button>
10
    </div>
11
12
    <el-table :key='tableKey' :data="list" v-loading="listLoading" border fit highlight-current-row style="width: 100%;min-height:550px;">
13
      <el-table-column width="150px" align="center" label="服务器编号" prop="code"></el-table-column>
14
      <el-table-column width="150px" align="center" label="内部编号" prop="seq"></el-table-column>
15
      <el-table-column width="150px" align="center" label="IP" prop="ipAddress"></el-table-column>
16
      <el-table-column min-width="150px" align="center" label="所属桥梁" prop="bridgeName"></el-table-column>
17
      <el-table-column min-width="200px" align="center" label="备注信息" prop="remark"></el-table-column>
18
      <el-table-column align="center" label="操作" width="230" class-name="small-padding fixed-width">
19
        <template slot-scope="scope">
20
          <el-button v-waves type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
21
          <el-button v-waves size="mini" type="danger" @click="handleModifyStatus(scope.row,'deleted')">删除
22
          </el-button>
23
        </template>
24
      </el-table-column>
25
    </el-table>
26
    <el-dialog title="采集服务器配置" ref="ruleForm" :visible.sync="dialogTableVisible" width="860px" @close='closed'>
27
      <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" class="form-main" label-position='right' status-icon>
28
        <el-row>
29
          <el-col :span="12">
30
            <el-form-item label="服务器编号" prop="code">
31
              <el-input placeholder="请输入服务器编号" v-model="ruleForm2.code" maxlength=10></el-input>
32
            </el-form-item>
33
          </el-col>
34
          <el-col :span="12">
35
              <el-form-item label="内部编号" prop="seq">
36
                <el-input placeholder="请输入内部编号" v-model="ruleForm2.seq" maxlength=10></el-input>
37
              </el-form-item>
38
            </el-col>
39
          <el-col :span="12">
40
            <el-form-item label="IP" prop="ipAddress">
41
              <el-input placeholder="请输入IP" v-model="ruleForm2.ipAddress"></el-input>
42
            </el-form-item>
43
          </el-col>
44
          <el-col :span="12">
45
            <el-form-item label="所属桥梁" prop="bridge">
46
              <el-autocomplete v-model="ruleForm2.bridge" :fetch-suggestions="querySearchAsync" placeholder="请选择所属桥梁"
47
                @select="handleSelect">
48
              </el-autocomplete>
49
            </el-form-item>
50
          </el-col>
51
          
52
          <el-col :span="24">
53
            <el-form-item label="备注" prop="remark">
54
              <el-input type="textarea" maxlength=500 v-model="ruleForm2.remark" rows=4></el-input>
55
            </el-form-item>
56
          </el-col>
57
          <el-col :span="24" class="el-btn-col">
58
            <div class="el-btn-col-box">
59
              <el-button v-waves type="primary" @click="submitForm('ruleForm2')">确认</el-button>
60
              <el-button v-waves type="info" @click="resetForm('ruleForm2')">返回</el-button>
61
            </div>
62
          </el-col>
63
        </el-row>
64
      </el-form>
65
    </el-dialog>
66
    <div class="pagination-container" style="text-align:center;">
67
      <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.pageNo"
68
        :page-size="listQuery.pageSize" layout="prev, pager, next, jumper" :total="total">
69
      </el-pagination>
70
    </div>
71
  </div>
72
</template>
73
74
<script>
75
  import { addDevice, checkDeviceCode, checkDeviceInternalCode, updateDevice, deleteDevice, pageQueryDevice, DeviceOfservice, checkIp } from '@/api/serverAdmin'
76
  import waves from '@/directive/waves'
77
  import queryBase from '@/utils/queryBase'
78
  export default {
79
    name: 'complexTable',
80
    directives: {
81
      waves
82
    },
83
    data() {
84
      var bridge = (rule, value, callback) => {
85
        const that = this
86
        setTimeout(function() {
87
          if (that.ruleForm2.bridge === '' || that.ruleForm2.bridgeId === '') {
88
            callback(new Error('请选择所属桥梁'))
89
          } else {
90
            callback()
91
          }
92
        }, 300)
93
      }
94
      var seq = (rule, value, callback) => {
95
        const num = /^[0-9a-zA-Z]*$/
96
        if (value === '') {
97
          callback(new Error('请输入内部编号'))
98
        } else {
99
          if (!num.test(value)) {
100
            callback('请输入数字或字母')
101
            return
102
          }
103
          if (this.edit) {
104
            checkDeviceInternalCode({ seq: value, id: this.edit, bridgeId: this.ruleForm2.bridgeId, active: 1 }).then(response => {
105
              if (response.data) {
106
                callback(new Error('内部编号已存在,请重新输入'))
107
              } else {
108
                callback()
109
              }
110
            })
111
          } else {
112
            checkDeviceInternalCode({ seq: value, bridgeId: this.ruleForm2.bridgeId, active: 1 }).then(response => {
113
              if (response.data) {
114
                callback(new Error('内部编号已存在,请重新输入'))
115
              } else {
116
                callback()
117
              }
118
            })
119
          }
120
        }
121
      }
122
      var code = (rule, value, callback) => {
123
        if (value === '') {
124
          callback(new Error('请输入服务器编号'))
125
        } else {
126
          if (this.edit) {
127
            checkDeviceCode({ code: value, id: this.edit, active: 1 }).then(response => {
128
              if (response.data) {
129
                callback(new Error('服务器编号已存在,请重新输入'))
130
              } else {
131
                callback()
132
              }
133
            })
134
          } else {
135
            checkDeviceCode({ code: value, active: 1 }).then(response => {
136
              if (response.data) {
137
                callback(new Error('服务器编号已存在,请重新输入'))
138
              } else {
139
                callback()
140
              }
141
            })
142
          }
143
        }
144
      }
145
      var checkIpCode = (rule, value, callback) => {
146
        if (value === '') {
147
          callback(new Error('请输入IP'))
148
        } else {
149
          if (this.edit) {
150
            checkIp({ ipAddress: value, id: this.edit, active: 1 }).then(response => {
151
              if (response.data) {
152
                callback(new Error('IP编号已存在,请重新输入'))
153
              } else {
154
                callback()
155
              }
156
            })
157
          } else {
158
            checkIp({ ipAddress: value, active: 1 }).then(response => {
159
              if (response.data) {
160
                callback(new Error('IP编号已存在,请重新输入'))
161
              } else {
162
                callback()
163
              }
164
            })
165
          }
166
        }
167
      }
168
      return {
169
        edit: '',
170
        ruleForm2: {
171
          code: '',
172
          bridge: '',
173
          seq: '',
174
          bridgeId: '',
175
          remark: '',
176
          ipAddress: ''
177
        },
178
        rules2: {
179
          code: [
180
            { required: true, validator: code, trigger: 'blur' }
181
          ],
182
          bridge: [
183
            { required: true, validator: bridge, trigger: 'blur' }
184
          ],
185
          ipAddress: [
186
            { required: true, validator: checkIpCode, trigger: 'blur' }
187
          ],
188
          seq: [
189
            { required: true, validator: seq, trigger: 'blur' }
190
          ]
191
        },
192
        timeout: null,
193
        dialogTableVisible: false,
194
        tableKey: 0,
195
        list: null,
196
        total: null,
197
        listLoading: true,
198
        listQuery: {
199
          key: '',
200
          code: '',
201
          active: 1,
202
          pageSize: 10,
203
          pageNo: 1
204
        }
205
      }
206
    },
207
    filters: {
208
      typeFilter(type) {
209
210
      }
211
    },
212
    created() {
213
      this.getList()
214
    },
215
    methods: {
216
      submitForm(formName) {
217
        const that = this
218
        this.$refs[formName].validate((valid) => {
219
          if (valid) {
220
            if (!this.edit) {
221
              addDevice(this.ruleForm2).then(response => {
222
                if (response.success) {
223
                  this.getList()
224
                  setTimeout(function() {
225
                    that.pop('已成功添加服务器')
226
                  }, 1000)
227
                  this.resetForm('ruleForm2')
228
                  this.dialogTableVisible = false
229
                }
230
              }).catch(error => {
231
                console.log(error)
232
              })
233
            } else {
234
              const par = this.ruleForm2
235
              par.id = this.edit
236
              updateDevice(par).then(response => {
237
                if (response.success) {
238
                  setTimeout(function() {
239
                    that.pop('已成功更新服务器')
240
                  }, 1000)
241
                  this.resetForm('ruleForm2')
242
                  this.getList()
243
                  this.dialogTableVisible = false
244
                  this.edit = ''
245
                  this.ruleForm2 = {
246
                    code: '',
247
                    bridge: '',
248
                    seq: '',
249
                    bridgeId: '',
250
                    ipAddress: '',
251
                    remark: ''
252
                  }
253
                }
254
              })
255
            }
256
          }
257
        })
258
      },
259
      resetForm(formName) {
260
        this.dialogTableVisible = false
261
        this.$refs[formName].resetFields()
262
        this.edit = ''
263
      },
264
      closed() {
265
        this.$refs['ruleForm2'].resetFields()
266
        this.edit = ''
267
      },
268
      getList() {
269
        var that = this
270
        this.listLoading = true
271
        pageQueryDevice(this.listQuery).then(response => {
272
          if (response.success) {
273
            const $data = response.data.data
274
            var hdata = { num: 1, data: $data }
275
            for (let i = 0; i < $data.length; i++) {
276
              hdata.num++
277
              const str = $data[i]
278
              queryBase.getBridge(str.bridgeId, function(sc, value) {
279
                if (sc) {
280
                  str.bridgeName = value.shortName
281
                  hdata.num--
282
                  if (hdata.num === 0) {
283
                    that.list = hdata.data
284
                  }
285
                }
286
              })
287
            }
288
            hdata.num--
289
            if (hdata.num === 0) {
290
              that.list = hdata.data
291
            }
292
            that.total = response.data.total
293
            setTimeout(() => {
294
              that.listLoading = false
295
            }, 1.5 * 1000)
296
          }
297
        })
298
      },
299
      handleFilter() {
300
        this.listQuery.pageNo = 1
301
        this.getList()
302
      },
303
      handleSizeChange(val) {
304
        this.listQuery.pageSize = val
305
        this.getList()
306
      },
307
      handleCurrentChange(val) {
308
        this.listQuery.pageNo = val
309
        this.getList()
310
      },
311
      handleModifyStatus(row, status) {
312
        this.$confirm('确定要删除:服务器' + row.code + '吗?', '提示', {
313
          confirmButtonText: '确定',
314
          cancelButtonText: '取消',
315
          type: 'warning',
316
          center: true
317
        }).then(() => {
318
          deleteDevice({ id: row.id }).then(response => {
319
            if (response.success) {
320
              this.getList()
321
              this.pop('已成功删除该服务器')
322
            }
323
          })
324
        }).catch(() => {
325
326
        })
327
      },
328
      pop($par) {
329
        this.$confirm($par, '提示', {
330
          confirmButtonText: '确定',
331
          cancelButtonText: '取消',
332
          type: 'success',
333
          showCancelButton: false,
334
          center: true
335
        }).then(() => {
336
337
        }).catch(() => {
338
339
        })
340
      },
341
      resetTemp(row) {
342
        this.ruleForm2 = {
343
          code: row.code,
344
          bridge: row.bridgeName,
345
          seq: row.seq,
346
          bridgeId: row.bridgeId,
347
          ipAddress: row.ipAddress,
348
          remark: row.remark
349
        }
350
        this.edit = row.id
351
      },
352
      handleCreate() {
353
        this.dialogTableVisible = true
354
      },
355
      handleUpdate(row) {
356
        setTimeout(() => {
357
          this.resetTemp(row)
358
        }, 500)
359
        this.dialogTableVisible = true
360
      },
361
      querySearchAsync(queryString, cb) {
362
        this.ruleForm2.bridgeId = ''
363
        clearTimeout(this.timeout)
364
        this.timeout = setTimeout(() => {
365
          DeviceOfservice({ key: this.ruleForm2.bridge, active: 1 }).then(response => {
366
            const $info = response.data
367
            if ($info.length) {
368
              const $data = $info.map(item => {
369
                return { 'value': item.shortName, 'id': item.id }
370
              })
371
              cb($data)
372
              if ($info.length === 1 && this.ruleForm2.bridge === $info[0].shortName) {
373
                this.ruleForm2.bridgeId = $info[0].id
374
              } else {
375
                this.ruleForm2.bridgeId = ''
376
              }
377
            } else {
378
              cb([])
379
            }
380
          })
381
        }, 3000 * Math.random())
382
      },
383
      handleSelect(item) {
384
        this.ruleForm2.bridgeId = item.id
385
      }
386
    }
387
  }
388
</script>
389
390
<style rel="stylesheet/scss" lang="scss" scoped>
391
  .el-autocomplete {
392
    display: block
393
  }
394
395
  .el-btn-col {
396
    margin-top: 45px
397
  }
398
399
  .el-form-item {
400
    margin: 0px 10px
401
  }
402
403
  .el-select {
404
    width: 100%
405
  }
406
407
  .el-col {
408
    margin-bottom: 15px
409
  }
410
411
  .el-form-item__label {
412
    padding: 0px
413
  }
414
</style>

+ 1 - 1
src/views/layout/Layout.vue

@ -1,8 +1,8 @@
1 1
<template>
2 2
  <div class="app-wrapper" :class="classObj">
3 3
    <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"></div>
4
    <TopNavbar></TopNavbar>
5 4
    <sidebar class="sidebar-container" v-if="roles.indexOf('1')>=0"></sidebar>
5
    <TopNavbar></TopNavbar>
6 6
    <div class="main-container" :style="(roles.indexOf('1')>=0) ? '' : 'marginLeft:0'">
7 7
      <navbar></navbar>
8 8
      <app-main></app-main>

+ 100 - 0
src/views/layout/com.vue

@ -0,0 +1,100 @@
1
<template>
2
  <div class="app-wrapper" :class="classObj">
3
    <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"></div>
4
    <TopNavbar></TopNavbar>
5
    <sidebar class="sidebar-container"></sidebar>
6
    <div class="main-container">
7
      <nava></nava>
8
      <app-main></app-main>
9
    </div>
10
    <div class="main-footer">
11
      <div style="margin:0 auto;line-height:20px;color:#939393; padding:12px 0;overflow: hidden;width:380px">
12
        <a style="margin: 0 5px 0 0;float:left">京ICP备16026450号-2 |</a>
13
        <a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11010802027571" style="display:inline-block;text-decoration:none;float:left">
14
          <img src="./img/beian.png" width="18" style="float:left;" />
15
          <p style="float:left;margin: 0 0 0 5px;">京公网安备 11010802027571号</p>
16
        </a>
17
      </div>
18
    </div>
19
  </div>
20
</template>
21
22
<script>
23
  import { mapGetters } from 'vuex'
24
  import { TopNavbar, nava, Sidebar, AppMain } from './components'
25
  import ResizeMixin from './mixin/ResizeHandler'
26
27
  export default {
28
    name: 'com',
29
    components: {
30
      TopNavbar,
31
      nava,
32
      Sidebar,
33
      AppMain
34
    },
35
    mixins: [ResizeMixin],
36
    computed: {
37
      ...mapGetters([
38
        'roles'
39
      ]),
40
      sidebar() {
41
        return this.$store.state.app.sidebar
42
      },
43
      device() {
44
        return this.$store.state.app.device
45
      },
46
      classObj() {
47
        return {
48
          hideSidebar: !this.sidebar.opened,
49
          openSidebar: this.sidebar.opened,
50
          withoutAnimation: this.sidebar.withoutAnimation,
51
          mobile: this.device === 'mobile'
52
        }
53
      }
54
    },
55
    methods: {
56
      handleClickOutside() {
57
        this.$store.dispatch('CloseSideBar', { withoutAnimation: false })
58
      }
59
    }
60
  }
61
</script>
62
63
<style rel="stylesheet/scss" lang="scss" scoped>
64
  @import "src/styles/mixin.scss";
65
66
  .app-wrapper {
67
    @include clearfix;
68
    position: relative;
69
    height: 100%;
70
    width: 100%;
71
72
    &.mobile.openSidebar {
73
      position: fixed;
74
      top: 0;
75
    }
76
  }
77
78
  .drawer-bg {
79
    background: #000;
80
    opacity: 0.3;
81
    width: 100%;
82
    top: 0;
83
    height: 100%;
84
    position: absolute;
85
    z-index: 999;
86
  }
87
88
  .main-footer {
89
    z-index: 2002;
90
    position: fixed;
91
    background: rgba(48, 65, 86, 1);
92
    border-top: 1px solid #e6e6e6;
93
    bottom: 0;
94
    left: 0;
95
    right: 0;
96
    font-size: 14px;
97
    text-align: center;
98
    color: #333;
99
  }
100
</style>

+ 2 - 5
src/views/layout/components/Navbar.vue

@ -1,6 +1,5 @@
1 1
<template>
2 2
  <div>
3
    <marqueebox :isShow="roles.indexOf('1')>=0"></marqueebox>
4 3
    <el-menu class="navbar" mode="horizontal">
5 4
      <hamburger v-if="roles.indexOf('1')>=0" class="hamburger-container" :toggleClick="toggleSideBar" :isActive="sidebar.opened"></hamburger>
6 5
      <breadcrumb></breadcrumb>
@ -10,15 +9,13 @@
10 9
11 10
<script>
12 11
import { mapGetters } from 'vuex'
13
import Marqueebox from '@/components/Marqueebox'
14 12
import Breadcrumb from '@/components/Breadcrumb'
15 13
import Hamburger from '@/components/Hamburger'
16 14
17 15
export default {
18 16
  components: {
19 17
    Breadcrumb,
20
    Hamburger,
21
    Marqueebox
18
    Hamburger
22 19
  },
23 20
  computed: {
24 21
    ...mapGetters([
@ -32,7 +29,7 @@ export default {
32 29
    },
33 30
    logout() {
34 31
      this.$store.dispatch('LogOut').then(() => {
35
        location.reload() // 为了重新实例化vue-router对象 避免bug
32
        location.reload() // 为锟斤拷锟斤拷锟斤拷实锟斤拷锟斤拷vue-router锟斤拷锟斤拷 锟斤拷锟斤拷bug
36 33
      })
37 34
    }
38 35
  }

+ 1 - 1
src/views/layout/components/Sidebar/SidebarItem.vue

@ -1,5 +1,5 @@
1 1
<template>
2
  <div v-if="!item.hidden&&item.children" class="menu-wrapper">
2
  <div v-if="!item.hidden" class="menu-wrapper">
3 3
4 4
      <router-link v-if="hasOneShowingChild(item.children) && !onlyOneChild.children&&!item.alwaysShow" :to="resolvePath(onlyOneChild.path)">
5 5
        <el-menu-item :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">

+ 3 - 6
src/views/layout/components/Sidebar/index.vue

@ -9,7 +9,7 @@
9 9
      text-color="#bfcbd9"
10 10
      active-text-color="#409EFF"
11 11
    >
12
      <sidebar-item v-for="route in routes" :key="route.name" :item="route" :base-path="route.path"></sidebar-item>
12
      <sidebar-item v-for="route in permission_routers" :key="permission_routers.name" :item="route" :base-path="route.path"></sidebar-item>
13 13
    </el-menu>
14 14
  </el-scrollbar>
15 15
</template>
@ -22,12 +22,9 @@ export default {
22 22
  components: { SidebarItem },
23 23
  computed: {
24 24
    ...mapGetters([
25
      // 'permission_routers',
26
      'sidebar'
25
      'sidebar',
26
      'permission_routers'
27 27
    ]),
28
    routes() {
29
      return this.$router.options.routes
30
    },
31 28
    isCollapse() {
32 29
      return !this.sidebar.opened
33 30
    }

+ 209 - 139
src/views/layout/components/TopNavbar.vue

@ -1,7 +1,9 @@
1 1
<template>
2 2
  <div class="topnavbar">
3 3
    <div class="logo-container">
4
      <div class="logo-wrapper" @click="toHome"><div class="logo-img"></div></div>
4
      <div class="logo-wrapper" @click="toHome">
5
        <div class="logo-img"></div>
6
      </div>
5 7
      <el-dropdown v-if="roles.indexOf('1')<0 && dataList.length>0" trigger="click" class="drop-menu">
6 8
        <span class="el-dropdown-link">
7 9
          {{showName ? showName : '选择桥梁'}}<i class="el-icon-arrow-down el-icon--right"></i>
@ -12,169 +14,237 @@
12 14
          </el-dropdown-item>
13 15
        </el-dropdown-menu>
14 16
      </el-dropdown>
17
      <div class="watchText" v-if="roles.indexOf('1') < 0 && dashFalg">
18
        <span @click="voiceWatch">音频监测</span>
19
        <span @click="wetC">除湿监测</span>
20
      </div>
15 21
    </div>
16 22
    <div class="name-box">
17
      <span>您好,{{ name }}</span>
18
      <span class="exit-btn" @click="logout">退出登录</span>
23
      <el-dropdown @command="handleCommand">
24
        <span class="el-dropdown-link" style="color:#fff;">
25
          您好,{{ name }}<i class="el-icon-arrow-down el-icon--right"></i>
26
        </span>
27
        <el-dropdown-menu slot="dropdown">
28
          <el-dropdown-item command="/modifyData" v-if="roles.indexOf('0')>-1">修改账户资料</el-dropdown-item>
29
          <el-dropdown-item command="/modifyPassword" v-if="roles.indexOf('0')>-1">修改密码</el-dropdown-item>
30
          <el-dropdown-item command="c">退出</el-dropdown-item>
31
        </el-dropdown-menu>
32
      </el-dropdown>
19 33
    </div>
20 34
  </div>
21 35
</template>
22 36
23 37
<script>
24
import { mapGetters } from 'vuex'
25
import { MessageBox } from 'element-ui'
26
import { getBridgeList } from '@/api/bridgeInfo'
27
import Cookies from 'js-cookie'
28
29
export default {
30
  data() {
31
    return {
32
      bridgeId: '',
33
      showName: '',
34
      dataList: ''
35
    }
36
  },
37
  computed: {
38
    ...mapGetters([
39
      'name',
40
      'roles'
41
    ])
42
  },
43
  watch: {
44
    '$route'(to, from) {
45
      if (to.path === '/dashboard') {
46
        var dataList = this.dataList
47
        for (let i = 0; i < dataList.length; i++) {
48
          dataList[i].disab = false
49
        }
50
        Cookies.remove('bridgeId')
51
        Cookies.remove('bridgeName')
52
        this.showName = ''
53
      } else {
54
        this.bridgeId = Cookies.get('bridgeId')
55
        this.showName = Cookies.get('bridgeName')
56
        this.getBridgeLists()
38
  import { mapGetters } from 'vuex'
39
  import { MessageBox } from 'element-ui'
40
  import { getBridgeList } from '@/api/bridgeInfo'
41
  import Cookies from 'js-cookie'
42
43
  export default {
44
    data() {
45
      return {
46
        activeName: 'second',
47
        bridgeId: '',
48
        showName: '',
49
        dataList: '',
50
        dashFalg: false
57 51
      }
58
    }
59
  },
60
  created() {
61
    this.bridgeId = Cookies.get('bridgeId')
62
    this.showName = Cookies.get('bridgeName')
63
    this.getBridgeLists()
64
  },
65
  methods: {
66
    toHome() {
67
      this.$router.replace({ path: '/' })
68 52
    },
69
    toggleSideBar() {
70
      this.$store.dispatch('ToggleSideBar')
53
    computed: {
54
      ...mapGetters([
55
        'name',
56
        'roles'
57
      ])
71 58
    },
72
    logout() {
73
      MessageBox.confirm('您确认要退出登录吗?', '提示', {
74
        confirmButtonText: '确定',
75
        cancelButtonText: '取消',
76
        type: 'warning',
77
        center: true
78
      }).then(() => {
79
        this.$store.dispatch('LogOut').then(() => {
59
    watch: {
60
      '$route'(to, from) {
61
        if (to.path === '/dashboard') {
62
          this.dashFalg = false
63
          var dataList = this.dataList
64
          for (let i = 0; i < dataList.length; i++) {
65
            dataList[i].disab = false
66
          }
80 67
          Cookies.remove('bridgeId')
81 68
          Cookies.remove('bridgeName')
82
          location.reload() // 为了重新实例化vue-router对象 避免bug
83
        })
84
      }).catch(() => {
85
        console.log('已取消退出')
86
      })
69
          this.showName = ''
70
        } else {
71
          this.dashFalg = true
72
          this.bridgeId = Cookies.get('bridgeId')
73
          this.showName = Cookies.get('bridgeName')
74
          this.getBridgeLists()
75
        }
76
      }
87 77
    },
88
    getBridgeLists() {
89
      const param = {
90
        active: 1,
91
        pageSize: 10,
92
        pageNo: 1
78
    created() {
79
      if (this.$route.name === 'dashboard') {
80
        this.dashFalg = false
81
      } else {
82
        this.dashFalg = true
93 83
      }
94
      getBridgeList(param).then(res => {
95
        if (res.success) {
96
          for (let i = 0; i < res.data.data.length; i++) {
97
            if (res.data.data[i].id === this.bridgeId) {
98
              res.data.data[i].disab = true
99
            } else {
100
              res.data.data[i].disab = false
84
      this.bridgeId = Cookies.get('bridgeId')
85
      this.showName = Cookies.get('bridgeName')
86
      this.getBridgeLists()
87
    },
88
    methods: {
89
      voiceWatch() {
90
        if (location.href.substr(location.href.indexOf('#') + 1) !== '/bridgeHome/bridgeDetail') {
91
          this.$router.push('bridgeHome/bridgeDetail')
92
        }
93
      },
94
      wetC() {
95
        this.$router.push('/gasHolder')
96
      },
97
      handleCommand(command) {
98
        if (command === 'c') {
99
          this.logout()
100
        } else {
101
          this.$router.push(command)
102
        }
103
      },
104
      toHome() {
105
        this.$router.replace({ path: '/' })
106
      },
107
      toggleSideBar() {
108
        this.$store.dispatch('ToggleSideBar')
109
      },
110
      logout() {
111
        MessageBox.confirm('您确认要退出登录吗?', '提示', {
112
          confirmButtonText: '确定',
113
          cancelButtonText: '取消',
114
          type: 'warning',
115
          center: true
116
        }).then(() => {
117
          this.$store.dispatch('LogOut').then(() => {
118
            Cookies.remove('bridgeId')
119
            Cookies.remove('bridgeName')
120
            location.reload() // 为了重新实例化vue-router对象 避免bug
121
          })
122
        }).catch(() => {
123
          console.log('已取消退出')
124
        })
125
      },
126
      getBridgeLists() {
127
        const param = {
128
          active: 1,
129
          pageSize: 10,
130
          pageNo: 1
131
        }
132
        getBridgeList(param).then(res => {
133
          if (res.success) {
134
            for (let i = 0; i < res.data.data.length; i++) {
135
              if (res.data.data[i].id === this.bridgeId) {
136
                res.data.data[i].disab = true
137
              } else {
138
                res.data.data[i].disab = false
139
              }
101 140
            }
141
            this.dataList = res.data.data
102 142
          }
103
          this.dataList = res.data.data
104
        }
105
      })
106
    },
107
    goToDashboardC(id, name) {
108
      this.showName = name
109
      Cookies.set('bridgeId', id)
110
      Cookies.set('bridgeName', name)
111
      this.$router.replace({
112
        name: 'bridgeDetail',
113
        query: { id: id, name: name }
114
      })
143
        })
144
      },
145
      goToDashboardC(id, name) {
146
        this.showName = name
147
        Cookies.set('bridgeId', id)
148
        Cookies.set('bridgeName', name)
149
        this.$router.replace({
150
          name: 'bridgeDetail',
151
          query: { id: id, name: name }
152
        })
153
      }
115 154
    }
116 155
  }
117
}
118 156
</script>
119 157
120 158
<style rel="stylesheet/scss" lang="scss" scoped>
121
.topnavbar {
122
  position: fixed;
123
  font-size: 0px;
124
  top: 0;
125
  left: 0;
126
  right: 0;
127
  height: 50px;
128
  line-height: 50px;
129
  z-index:2002;
130
  border-radius: 0px !important;
131
  background-color: #2d3a4b;
132
  border-bottom: 1px solid #e6e6e6;
133
  .logo-container {
134
    display: inline-block;
135
    position: absolute;
136
    left:10px;
137
    overflow: hidden;
138
    .logo-wrapper {
139
      float:left;
140
      width:300px;
141
      padding: 0;
142
      margin:10px 12px;
143
      cursor: pointer;
159
  .topnavbar {
160
    position: fixed;
161
    font-size: 0px;
162
    top: 0;
163
    left: 0;
164
    right: 0;
165
    height: 50px;
166
    line-height: 50px;
167
    z-index: 2002;
168
    border-radius: 0px !important;
169
    background-color: #2d3a4b;
170
    border-bottom: 1px solid #e6e6e6;
171
172
    .logo-container {
173
      display: inline-block;
174
      position: absolute;
175
      left: 10px;
176
      overflow: hidden;
177
178
      .logo-wrapper {
179
        float: left;
180
        width: 300px;
181
        padding: 0;
182
        margin: 10px 12px;
183
        cursor: pointer;
184
      }
185
186
      .drop-menu {
187
        float: left;
188
        cursor: pointer;
189
        margin: 0;
190
        margin-left: 20px;
191
        color: #fff;
192
      }
193
194
      .watchText {
195
        font-size: 14px;
196
        margin-left: 30px;
197
        float: left;
198
        color: #fff;
199
200
        span {
201
          margin-right: 30px;
202
          cursor: pointer;
203
204
          &:hover {
205
            color: #409EFF;
206
          }
207
        }
208
209
      }
144 210
    }
145
    .drop-menu{
146
      float:left;
147
      cursor: pointer;
148
      margin:0;
149
      margin-left:20px;
150
      color: #fff;
211
212
    .name-middle {
213
      height: 50px;
214
      position: absolute;
215
      left: 500px;
216
      overflow: hidden;
151 217
    }
152
  }
153
  .name-box{
154
    display: inline-block;
155
    position: absolute;
156
    right: 20px;
157
    font-size:14px;
158
    overflow: hidden;
159
    color:#fff;
160
    .exit-btn {
161
      margin-left:30px;
162
      cursor: pointer;
218
219
    .name-box {
220
      height: 50px;
221
      display: inline-block;
222
      position: absolute;
223
      right: 20px;
224
      font-size: 14px;
225
      overflow: hidden;
226
      color: #fff;
227
228
      .exit-btn {
229
        margin-left: 30px;
230
        cursor: pointer;
231
      }
163 232
    }
164 233
  }
165
}
166
.drop-menu-list{
167
  .el-dropdown-menu__item{
168
    display: flex;
169
    align-items: center;
170
    justify-content: space-between;
171
    &.is-disabled{
172
      background: #f3f5f7;
173
    }
174
    .el-icon-check{
175
      font-weight: bold;
234
235
  .drop-menu-list {
236
    .el-dropdown-menu__item {
237
      display: flex;
238
      align-items: center;
239
      justify-content: space-between;
240
241
      &.is-disabled {
242
        background: #f3f5f7;
243
      }
244
245
      .el-icon-check {
246
        font-weight: bold;
247
      }
176 248
    }
177 249
  }
178
}
179 250
</style>
180

+ 1 - 0
src/views/layout/components/index.js

@ -1,4 +1,5 @@
1 1
export { default as TopNavbar } from './TopNavbar'
2 2
export { default as Navbar } from './Navbar'
3
export { default as nava } from './nava'
3 4
export { default as Sidebar } from './Sidebar'
4 5
export { default as AppMain } from './AppMain'

+ 67 - 0
src/views/layout/components/nava.vue

@ -0,0 +1,67 @@
1
<template>
2
  <div>
3
    <el-menu class="navbar" mode="horizontal">
4
      <hamburger class="hamburger-container" :toggleClick="toggleSideBar" :isActive="sidebar.opened"></hamburger>
5
      <breadcrumb></breadcrumb>
6
    </el-menu>
7
  </div>
8
</template>
9
10
<script>
11
  import { mapGetters } from 'vuex'
12
  import Breadcrumb from '@/components/Breadcrumb'
13
  import Hamburger from '@/components/Hamburger'
14
15
  export default {
16
    components: {
17
      Breadcrumb,
18
      Hamburger
19
    },
20
    computed: {
21
      ...mapGetters([
22
        'sidebar',
23
        'roles'
24
      ])
25
    },
26
    methods: {
27
      toggleSideBar() {
28
        this.$store.dispatch('ToggleSideBar')
29
      },
30
      logout() {
31
        this.$store.dispatch('LogOut').then(() => {
32
          location.reload() // Ϊ������ʵ����vue-router���� ����bug
33
        })
34
      }
35
    }
36
  }
37
</script>
38
39
<style rel="stylesheet/scss" lang="scss" scoped>
40
  .navbar {
41
    height: 50px;
42
    line-height: 50px;
43
    padding: 0 12px;
44
    border-radius: 0px !important;
45
46
    .hamburger-container {
47
      line-height: 58px;
48
      height: 50px;
49
      float: left;
50
      padding: 0 10px;
51
    }
52
53
    .screenfull {
54
      position: absolute;
55
      right: 90px;
56
      top: 16px;
57
      color: red;
58
    }
59
  }
60
61
  .message-box {
62
    color: #303133;
63
    background: #c7e3ff;
64
    padding: 0 20px;
65
    font-size: 14px;
66
  }
67
</style>

BIN
static/01.png


BIN
static/02.png


BIN
static/03.png


BIN
static/04.png


BIN
static/bridges.jpg