AlarmInfo.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div class="info__bg l-flex--col center jcenter ">
  3. <div class="info">
  4. <div class="l-flex--row center info__deviceName">
  5. {{ alarm.deviceName }}
  6. </div>
  7. <div
  8. class="l-flex--row center"
  9. :style="colorStyle"
  10. >
  11. <svg-icon
  12. class="alarm__icon"
  13. icon-class="v0-alarm"
  14. />
  15. <div class="alarm__name">
  16. {{ levelMap[alarm.level] }}
  17. </div>
  18. </div>
  19. <div class="l-flex--row center alarm__type">
  20. {{ alarm.type }}
  21. </div>
  22. <div
  23. v-for="(row, index) in rows"
  24. :key="index"
  25. class="l-flex--row info__row c-sibling-item--v far"
  26. >
  27. <div
  28. v-for="item in row"
  29. :key="item.key"
  30. class="l-flex--row l-flex__fill"
  31. >
  32. <div class="l-flex__none l-flex--row center row__label">
  33. {{ item.label }}
  34. </div>
  35. <div class="l-flex__fill row__value">
  36. {{ alarm[item.key] }}
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. export default {
  45. name: 'AlarmInfo',
  46. components: {},
  47. props: {
  48. alarm: {
  49. type: Object,
  50. required: true
  51. }
  52. },
  53. data () {
  54. return {
  55. levelMap: ['普通等级', '提示等级', '紧急等级'],
  56. rows: [
  57. [
  58. {
  59. label: '发生时间',
  60. key: 'happenTime'
  61. },
  62. {
  63. label: 'MAC',
  64. key: 'mac'
  65. }
  66. ],
  67. [
  68. {
  69. label: '系统配置预处理方式',
  70. key: 'handle'
  71. },
  72. {
  73. label: '执行结果',
  74. key: 'status'
  75. }
  76. ],
  77. [
  78. {
  79. label: '位置',
  80. key: 'address'
  81. }
  82. ]
  83. ]
  84. }
  85. },
  86. methods: {
  87. colorStyle () {
  88. return this.alarm
  89. ? {
  90. color: ['#04A681', '#FFA000', '#F40645'][this.alarm.level]
  91. }
  92. : null
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss" scoped>
  98. .info {
  99. color: #f40645;
  100. width: 640px;
  101. height: 360px;
  102. &__bg {
  103. width: 720px;
  104. height: 440px;
  105. background: url("~@/assets/v1/bg_alarm.png");
  106. background-size: 100%;
  107. background-position: center;
  108. background-repeat: no-repeat;
  109. }
  110. &__row {
  111. height: 40px;
  112. opacity: 0.5;
  113. font-size: 16px;
  114. background: rgba(#7b102c, 0.5);
  115. margin: 0 16px;
  116. .row__label {
  117. color: #9ea9cd;
  118. width: 150px;
  119. }
  120. .row__value {
  121. color: #fff;
  122. }
  123. }
  124. &__deviceName {
  125. line-height: 48px;
  126. font-size: 32px;
  127. font-weight: bold;
  128. margin: 20px 0 15px 0;
  129. }
  130. .alarm {
  131. &__icon {
  132. width: 24px;
  133. height: 24px;
  134. background-repeat: no-repeat;
  135. background-size: 100%;
  136. }
  137. &__name {
  138. font-size: 24px;
  139. line-height: 36px;
  140. font-weight: 500;
  141. }
  142. &__type {
  143. font-size: 32px;
  144. line-height: 48px;
  145. font-weight: bold;
  146. margin: 15px 0 15px 0;
  147. }
  148. }
  149. }
  150. </style>