Warning.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <div class="warning">
  4. <div class="warning-item" v-for="item in WARNING_CONFIG" :key="item.id" @click="$emit('click', item)">
  5. <div class="img"> <img :src="item.src" alt="" /> </div>
  6. <div class="text">{{ item.text }}</div>
  7. <div class="extra">监测数量</div>
  8. <div class="num">{{ get(warnData, item.prop1) }}</div>
  9. <div class="risk" :class="`warning-level_${get(warnData, item.prop2)}`">{{ get(warnData, item.prop2) }}</div>
  10. </div>
  11. </div>
  12. </template>
  13. <script lang="ts" setup>
  14. import { computed } from 'vue';
  15. import { BillboardType, DEFAULT_TEST_DATA, WARNING_CONFIG } from '../billboard.data';
  16. import { get } from '../utils';
  17. const props = withDefaults(
  18. defineProps<{
  19. data?: BillboardType;
  20. }>(),
  21. {
  22. data: () => DEFAULT_TEST_DATA,
  23. }
  24. );
  25. defineEmits(['click']);
  26. const warnData = computed<BillboardType['warnInfo']>(() => {
  27. const info = props.data.warnInfo;
  28. return info;
  29. });
  30. </script>
  31. <style lang="less" scoped>
  32. @import '/@/design/theme.less';
  33. @import '/@/design/theme.less';
  34. @font-face {
  35. font-family: 'douyuFont';
  36. src: url(/@/assets/images/files/douyuFont.otf);
  37. }
  38. .warning {
  39. height: 100%;
  40. // display: flex;
  41. // justify-content: space-evenly;
  42. // align-items: center;
  43. // flex-wrap: wrap;
  44. }
  45. .warning-item:first-of-type {
  46. background-image: url(/@/assets/images/vent/home/select-bg.png);
  47. background-size: auto 100%;
  48. background-position: left center;
  49. padding-left: 60px;
  50. .text {
  51. width: 130px;
  52. text-align: left;
  53. }
  54. .extra {
  55. display: none;
  56. }
  57. // .warning-level_5 {
  58. // color: red;
  59. // }
  60. // .warning-level_4 {
  61. // color: orange;
  62. // }
  63. // .warning-level_3 {
  64. // color: yellow;
  65. // }
  66. // .warning-level_2 {
  67. // color: green;
  68. // }
  69. }
  70. .warning-item {
  71. display: flex;
  72. align-items: center;
  73. background-image: url(/@/assets/images/company/list-item-9.png);
  74. background-size: auto 80%;
  75. background-repeat: no-repeat;
  76. background-position: right center;
  77. height: 40px;
  78. margin-top: 10px;
  79. .text {
  80. text-align: center;
  81. width: 60px;
  82. }
  83. .extra {
  84. text-align: center;
  85. width: 90px;
  86. }
  87. .num {
  88. text-align: center;
  89. width: 110px;
  90. }
  91. .risk {
  92. text-align: right;
  93. width: 80px;
  94. }
  95. }
  96. .num {
  97. font-size: 20px;
  98. font-family: douyuFont;
  99. color: @vent-gas-primary-text;
  100. }
  101. .risk {
  102. font-size: 20px;
  103. font-family: douyuFont;
  104. color: @vent-gas-primary-text;
  105. }
  106. </style>