rpList.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <div class="rainfall-partition">
  3. <div v-for="(value, key) in dataObj" class="rp-list" @click="upSwitch(key, value)">
  4. <div class="rp-title">
  5. <div>
  6. {{ key }}
  7. </div>
  8. <div><span v-if="value.rain * 1 !== 0">{{ value.rain }}mm</span><span v-else>暂无降雨</span></div>
  9. </div>
  10. <div class="rp-box">
  11. <div>
  12. <progressBar :width="(value.rain / maxBox) * 100 ? (value.rain / maxBox) * 100 : 0" :iconType="3"
  13. :backgroundColorBox="'rgba(255, 255, 255, 0.1)'"
  14. :backgroundColorInner="'linear-gradient(270deg, #06C7ED 0%, rgba(55,145,255,0.76) 100%)'" />
  15. </div>
  16. </div>
  17. </div>
  18. </div>
  19. </template>
  20. <script lang="ts" setup>
  21. import progressBar from '../../../components/progressBar/index.vue';
  22. import { defineEmits } from 'vue';
  23. import { any, number } from 'vue-types';
  24. const emit = defineEmits(['alertSome']);
  25. function upSwitch(key, value) {
  26. emit('subIsSwitch');
  27. if (key) {
  28. let obj = {};
  29. obj.value = value;
  30. obj.key = key;
  31. emit('activeRainfallData', obj);
  32. }
  33. }
  34. const props = defineProps({
  35. dataObj: { type: Object, default: {} },
  36. maxBox: { type: any, default: 0 },
  37. });
  38. </script>
  39. <style lang="less" scoped>
  40. .rainfall-partition {
  41. // height: 24vh;
  42. height: 210px;
  43. overflow-y: auto;
  44. // margin: 0 10px;
  45. padding-bottom: 5px
  46. }
  47. .rp-list {
  48. margin-top: 7px;
  49. cursor: pointer;
  50. }
  51. .rp-title {
  52. color: rgba(255, 255, 255, 0.87);
  53. font-size: 14px;
  54. display: flex;
  55. justify-content: space-between;
  56. padding: 0 10px;
  57. }
  58. .rp-box {
  59. display: flex;
  60. justify-content: space-between;
  61. margin-top: 10px;
  62. margin-left: 10px;
  63. color: #fff;
  64. div:nth-child(1) {
  65. width: 310px;
  66. }
  67. div:nth-child(2) {
  68. margin-top: -8px;
  69. color: #ffffff;
  70. font-size: 16px;
  71. margin-right: 10px;
  72. }
  73. }
  74. </style>