声脉桥梁云监控平台

dangerList.vue 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <div class="dashboard-editor-container">
  3. <el-card class="box-card block-group">
  4. <div slot="header" class="block-title">
  5. <span>报警信息</span>
  6. </div>
  7. <div class="load-box" v-loading="loadprogress">
  8. <ul class="item-ul" v-if="dangerList.length">
  9. <li :class="!item.readed ? 'readed-li' : ''" v-for="item in dangerList" :key="item.index" @click="alarmShow(item.aid, item.readed, item.alarmTime, item.device)">
  10. <span>{{item.alarmTime}}</span>
  11. <span>{{item.device}},请点击查看。</span>
  12. <span class="svg-container" v-if="!item.readed">
  13. <svg-icon icon-class="unread"></svg-icon>
  14. </span>
  15. </li>
  16. </ul>
  17. <DefaultPage v-if="!dangerList.length && !loadprogress"></DefaultPage>
  18. </div>
  19. <div class="pagination-container">
  20. <el-pagination
  21. background
  22. @current-change="handleCurrentChange"
  23. :current-page.sync="pageNo"
  24. :page-size="pageSize"
  25. layout="prev, pager, next, jumper"
  26. :total="total"
  27. v-if="total !== 0">
  28. </el-pagination>
  29. </div>
  30. </el-card>
  31. </div>
  32. </template>
  33. <script>
  34. import queryInfo from '@/utils/queryInfo'
  35. import Cookies from 'js-cookie'
  36. import { parseTime } from '@/utils'
  37. import { getDangerList } from '@/api/bridgeInfo'
  38. import DefaultPage from '@/components/DefaultPage'
  39. export default {
  40. components: {
  41. DefaultPage
  42. },
  43. data() {
  44. return {
  45. bridgeId: '',
  46. bridgeName: '',
  47. loadprogress: false,
  48. dangerList: [],
  49. pageSize: 20,
  50. pageNo: 1,
  51. total: 0
  52. }
  53. },
  54. created() {
  55. var that = this
  56. that.pageNo = sessionStorage.getItem('d-cur-page') || 1
  57. that.bridgeId = Cookies.get('bridgeId')
  58. that.bridgeName = Cookies.get('bridgeName')
  59. queryInfo.qaiCb(function() {
  60. if (that.bridgeId) {
  61. that.serverSeqArr = queryInfo.queryServers(that.bridgeId, true)
  62. if (that.serverSeqArr.length) {
  63. that.getDangerList()
  64. }
  65. }
  66. })
  67. },
  68. methods: {
  69. getDangerList() {
  70. var that = this
  71. var arr = this.serverSeqArr
  72. const param = {
  73. seq: arr,
  74. pageSize: this.pageSize,
  75. pageNo: this.pageNo
  76. }
  77. that.loadprogress = true
  78. getDangerList(param).then(res => {
  79. if (res.success && res.data.data) {
  80. that.loadprogress = false
  81. const dataS = res.data.data
  82. that.total = res.data.total
  83. for (let i = 0; i < dataS.length; i++) {
  84. if (dataS[i].alarmTime) {
  85. dataS[i].alarmTime = parseTime(dataS[i].alarmTime, true)
  86. }
  87. dataS[i].device = `${that.bridgeName}大桥${dataS[i].device}采集盒检测到异常情况`
  88. }
  89. that.dangerList = dataS
  90. }
  91. })
  92. },
  93. alarmShow(id, flag, time, msg) {
  94. this.$router.push({
  95. name: 'dangerDetail',
  96. query: { aid: id, msg: msg, _t: time, flag: flag }
  97. })
  98. },
  99. handleCurrentChange(val) {
  100. this.pageNo = val
  101. sessionStorage.setItem('d-cur-page', this.pageNo)
  102. this.getDangerList()
  103. }
  104. }
  105. }
  106. </script>
  107. <style rel="stylesheet/scss" lang="scss" scoped>
  108. .item-ul{
  109. min-height: 400px;
  110. }
  111. </style>