right-top.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div class="right_top">
  3. <div class="right_top-title flex">
  4. <div class="flex items-center">
  5. <img src="@/assets/img/home/title_arrow.png" alt="">
  6. 高频事件前50条
  7. </div>
  8. </div>
  9. <div class="scroll" v-loading="loading">
  10. <vue3-seamless-scroll :list="list" hover :singleHeight="100" v-if="list.length">
  11. <div class="scroll-item" v-for="(item,index) in list" :key="item.id">
  12. <span class="scroll-item-empty">{{ index }}</span>
  13. <span class="scroll-item-area">{{ item.areaName }}</span>
  14. <TextTooltip :content="item.title" className="scroll-item-title"></TextTooltip>
  15. <el-tooltip placement="top">
  16. <template #content> {{ item.title }}</template>
  17. <span class="scroll-item-hotspot">{{ item.hotspotName }}</span>
  18. </el-tooltip>
  19. <span class="scroll-item-num"> <CountUp :endVal="item.sumCount " :duration="2"/>次</span>
  20. </div>
  21. </vue3-seamless-scroll>
  22. <template v-else>
  23. <EmptyCom></EmptyCom>
  24. </template>
  25. </div>
  26. </div>
  27. </template>
  28. <script setup lang="ts">
  29. import {onMounted, ref, watch, defineAsyncComponent} from "vue";
  30. import {Vue3SeamlessScroll} from "vue3-seamless-scroll";
  31. import CountUp from "@/components/count-up";
  32. import {highFrequency} from "@/api/home";
  33. import dayjs from "dayjs";
  34. import EmptyCom from "@/components/empty-com";
  35. const TextTooltip = defineAsyncComponent(() => import('@/components/TextTooltip/index.vue'));
  36. const props = defineProps({
  37. dateArray: {
  38. type: Array,
  39. default: () => []
  40. }
  41. })
  42. const date = ref([]);
  43. watch(() => props.dateArray, (val: any) => {
  44. date.value = val;
  45. }, {immediate: true})
  46. watch(() => props.dateArray, (val: any) => {
  47. getData();
  48. })
  49. const list = ref<any>([]);
  50. const loading = ref(false);
  51. const getData = async () => {
  52. loading.value = true;
  53. try {
  54. const {result} = await highFrequency({
  55. StartDate: dayjs(date.value[0]).format('YYYY-MM-DD'),
  56. EndDate: dayjs(date.value[1]).format('YYYY-MM-DD')
  57. });
  58. list.value = result;
  59. // list.value = [...result,...result,...result,...result,...result];
  60. loading.value = false;
  61. } catch (e) {
  62. console.log(e);
  63. loading.value = false;
  64. }
  65. }
  66. onMounted(() => {
  67. getData();
  68. })
  69. </script>
  70. <style scoped lang="scss">
  71. .right_top {
  72. padding: 0 30px;
  73. font-size: 15px;
  74. &-title {
  75. font-size: 20px;
  76. color: #fff;
  77. justify-content: space-between;
  78. align-items: center;
  79. line-height: initial;
  80. }
  81. .scroll {
  82. height: 280px;
  83. overflow: hidden;
  84. margin-top: 10px;
  85. &-item {
  86. width: 100%;
  87. display: flex;
  88. justify-content: space-between;
  89. align-items: center;
  90. color: #D2D4D5;
  91. height: 30px;
  92. line-height: 25px;
  93. margin-bottom: 10px;
  94. border-left: transparent;
  95. &-empty {
  96. display: inline-block;
  97. width: 5px;
  98. color: transparent;
  99. }
  100. &-area {
  101. display: inline-block;
  102. background-color: #69BBF6;
  103. padding: 0 6px;
  104. color: #333;
  105. border-radius: 4px;
  106. white-space: nowrap;
  107. width: 75px;
  108. overflow: hidden;
  109. text-overflow: ellipsis;
  110. text-align: center;
  111. }
  112. &-title {
  113. width: 50%;
  114. overflow: hidden;
  115. text-overflow: ellipsis;
  116. white-space: nowrap;
  117. margin-left: 10px;
  118. line-height: initial;
  119. }
  120. &-hotspot {
  121. width: 30%;
  122. overflow: hidden;
  123. text-overflow: ellipsis;
  124. white-space: nowrap;
  125. flex: 1;
  126. }
  127. }
  128. }
  129. }
  130. .count-up-wrap {
  131. display: inline-block;
  132. }
  133. </style>
  134. <style lang="scss">
  135. .scroll-item-title {
  136. width: 50%;
  137. margin-left: 10px;
  138. line-height: initial;
  139. }
  140. .scroll-item-hotspot {
  141. width: 30%;
  142. flex: 1;
  143. }
  144. </style>