123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <template>
- <div class="right_top">
- <div class="right_top-title flex">
- <div class="flex items-center">
- <img src="@/assets/img/home/title_arrow.png" alt="">
- 高频事件前50条
- </div>
- </div>
- <div class="scroll" v-loading="loading">
- <vue3-seamless-scroll :list="list" hover :singleHeight="100" v-if="list.length">
- <div class="scroll-item" v-for="(item,index) in list" :key="item.id">
- <span class="scroll-item-empty">{{ index }}</span>
- <span class="scroll-item-area">{{ item.areaName }}</span>
- <TextTooltip :content="item.title" className="scroll-item-title"></TextTooltip>
- <el-tooltip placement="top">
- <template #content> {{ item.title }}</template>
- <span class="scroll-item-hotspot">{{ item.hotspotName }}</span>
- </el-tooltip>
- <span class="scroll-item-num"> <CountUp :endVal="item.sumCount " :duration="2"/>次</span>
- </div>
- </vue3-seamless-scroll>
- <template v-else>
- <EmptyCom></EmptyCom>
- </template>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import {onMounted, ref, watch, defineAsyncComponent} from "vue";
- import {Vue3SeamlessScroll} from "vue3-seamless-scroll";
- import CountUp from "@/components/count-up";
- import {highFrequency} from "@/api/home";
- import dayjs from "dayjs";
- import EmptyCom from "@/components/empty-com";
- const TextTooltip = defineAsyncComponent(() => import('@/components/TextTooltip/index.vue'));
- const props = defineProps({
- dateArray: {
- type: Array,
- default: () => []
- }
- })
- const date = ref([]);
- watch(() => props.dateArray, (val: any) => {
- date.value = val;
- }, {immediate: true})
- watch(() => props.dateArray, (val: any) => {
- getData();
- })
- const list = ref<any>([]);
- const loading = ref(false);
- const getData = async () => {
- loading.value = true;
- try {
- const {result} = await highFrequency({
- StartDate: dayjs(date.value[0]).format('YYYY-MM-DD'),
- EndDate: dayjs(date.value[1]).format('YYYY-MM-DD')
- });
- list.value = result;
- // list.value = [...result,...result,...result,...result,...result];
- loading.value = false;
- } catch (e) {
- console.log(e);
- loading.value = false;
- }
- }
- onMounted(() => {
- getData();
- })
- </script>
- <style scoped lang="scss">
- .right_top {
- padding: 0 30px;
- font-size: 15px;
- &-title {
- font-size: 20px;
- color: #fff;
- justify-content: space-between;
- align-items: center;
- line-height: initial;
- }
- .scroll {
- height: 280px;
- overflow: hidden;
- margin-top: 10px;
- &-item {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- color: #D2D4D5;
- height: 30px;
- line-height: 25px;
- margin-bottom: 10px;
- border-left: transparent;
- &-empty {
- display: inline-block;
- width: 5px;
- color: transparent;
- }
- &-area {
- display: inline-block;
- background-color: #69BBF6;
- padding: 0 6px;
- color: #333;
- border-radius: 4px;
- white-space: nowrap;
- width: 75px;
- overflow: hidden;
- text-overflow: ellipsis;
- text-align: center;
- }
- &-title {
- width: 50%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- margin-left: 10px;
- line-height: initial;
- }
- &-hotspot {
- width: 30%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- flex: 1;
- }
- }
- }
- }
- .count-up-wrap {
- display: inline-block;
- }
- </style>
- <style lang="scss">
- .scroll-item-title {
- width: 50%;
- margin-left: 10px;
- line-height: initial;
- }
- .scroll-item-hotspot {
- width: 30%;
- flex: 1;
- }
- </style>
|