RoadWarnings.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <div class="right_two">
  3. <CommonTitle title="道路预警" />
  4. <div class="content" v-loading="isLoading"
  5. element-loading-background="rgba(0, 22, 52, 0.75)">
  6. <div class="item" v-for="item in arr" :key="item.id">
  7. <div :class="`top center_center ${item.className1}`">
  8. {{item.LFXS_NAME}}
  9. </div>
  10. <div :class="`bottom ${item.className2}`">
  11. <div class="bottom_top center_center">
  12. {{item.WARNING_DLZC}}
  13. </div>
  14. <div class="bottom_bottom center_center">
  15. 公里
  16. </div>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. </template>
  22. <script setup>
  23. import {
  24. ref,
  25. onMounted,
  26. nextTick
  27. } from 'vue'
  28. import {
  29. getQueryRoadWarning
  30. } from '../service/http.js'
  31. import CommonTitle from "@/views/c-cpns/CommonTitle.vue";
  32. let arr = ref([]);
  33. const isLoading = ref(false);
  34. onMounted(() => {
  35. isLoading.value = true;
  36. getQueryRoadWarning().then(res => {
  37. isLoading.value = false;
  38. let arr1 = [];
  39. for(let i in res.data.data.Rows[0]) {
  40. arr1.push (res.data.data.Rows[0][i])
  41. }
  42. arr.value = arr1.filter(item=>{
  43. return item.LFXS_NAME != "其它"
  44. })
  45. arr.value.forEach(item=>{
  46. if(item.LFXS_NAME == "一幅路"){
  47. item["className1"] = "top_one"
  48. item["className2"] = "bottom_one"
  49. }else if(item.LFXS_NAME == "两幅路"){
  50. item["className1"] = "top_two"
  51. item["className2"] = "bottom_two"
  52. }else if(item.LFXS_NAME == "三幅路"){
  53. item["className1"] = "top_three"
  54. item["className2"] = "bottom_three"
  55. }else if(item.LFXS_NAME == "四幅路"){
  56. item["className1"] = "top_four"
  57. item["className2"] = "bottom_four"
  58. }else{
  59. item["className1"] = "top_five"
  60. item["className2"] = "bottom_five"
  61. }
  62. })
  63. })
  64. })
  65. </script>
  66. <style scoped lang="scss">
  67. .center {
  68. display: flex;
  69. justify-content: flex-start;
  70. align-items: center;
  71. }
  72. .center_center{
  73. display: flex;
  74. justify-content: center;
  75. align-items: center;
  76. }
  77. .right_two{
  78. height: 17%;
  79. padding-top: 10px;
  80. box-sizing: border-box;
  81. .content {
  82. height: 85%;
  83. margin: 0 20px;
  84. box-sizing: border-box;
  85. display: flex;
  86. justify-content: space-between;
  87. align-items: center;
  88. .item{
  89. width: 72px;
  90. height: 83px;
  91. .top_one{
  92. background: #0058B2;
  93. border: 1px solid #007EFF;
  94. }
  95. .bottom_one{
  96. background: rgba(0,126,255,0.3);
  97. }
  98. .top_two{
  99. background: #00B285;
  100. border: 1px solid #00E6AC;
  101. }
  102. .bottom_two{
  103. background: rgba(45,179,145,0.3);
  104. }
  105. .top_three{
  106. background: #0094B2;
  107. border: 1px solid #00D5FF;
  108. }
  109. .bottom_three{
  110. background: rgba(0,148,178,0.3);
  111. }
  112. .top_four{
  113. background: rgba(203,203,0,0.5);
  114. border: 1px solid #BFBF00;
  115. }
  116. .bottom_four{
  117. background: rgba(255,255,0,0.3);
  118. }
  119. .top_five{
  120. background: rgba(217,126,0,0.5);
  121. border: 1px solid #D97E00;
  122. }
  123. .bottom_five{
  124. background: rgba(217,126,0,0.3);
  125. }
  126. .top{
  127. width: 72px;
  128. height: 24px;
  129. font-family: Microsoft YaHei;
  130. font-weight: bold;
  131. font-size: 13px;
  132. color: #FFFFFF;
  133. box-sizing: border-box;
  134. }
  135. .bottom{
  136. width: 72px;
  137. height: 63px;
  138. .bottom_top{
  139. height: 50%;
  140. font-family: YouSheBiaoTiHei;
  141. font-weight: bold;
  142. font-size: 16px;
  143. color: #FFFFFF;
  144. }
  145. .bottom_bottom{
  146. font-family: Microsoft YaHei;
  147. font-weight: 400;
  148. font-size: 12px;
  149. color: #FFFFFF;
  150. }
  151. }
  152. }
  153. }
  154. }
  155. </style>