From 1e65b2219d0e7ae2986d8a5d926810a513706762 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Thu, 17 Nov 2022 17:32:50 +0800 Subject: [PATCH] perf --- yudao-ui-admin-vue3/src/views/Home/Index.vue | 132 +++---------------- 1 file changed, 17 insertions(+), 115 deletions(-) diff --git a/yudao-ui-admin-vue3/src/views/Home/Index.vue b/yudao-ui-admin-vue3/src/views/Home/Index.vue index db371fb03..7e0ba26d9 100644 --- a/yudao-ui-admin-vue3/src/views/Home/Index.vue +++ b/yudao-ui-admin-vue3/src/views/Home/Index.vue @@ -6,12 +6,11 @@ import { CountTo } from '@/components/CountTo' import { formatTime } from '@/utils' import { Echart } from '@/components/Echart' import { EChartsOption } from 'echarts' -import { radarOption } from './echarts-data' import { Highlight } from '@/components/Highlight' import type { WorkplaceTotal, Project, Notice, Shortcut } from './types' import { set } from 'lodash-es' import { useCache } from '@/hooks/web/useCache' -import { pieOptions, barOptions, lineOptions } from './echarts-data' +import { pieOptions, barOptions } from './echarts-data' const { t } = useI18n() const { wsCache } = useCache() @@ -156,44 +155,6 @@ const getShortcut = async () => { shortcut = Object.assign(shortcut, data) } -// 获取指数 -let radarOptionData = reactive(radarOption) as EChartsOption - -const getRadar = async () => { - const data = [ - { name: 'workplace.quote', max: 65, personal: 42, team: 50 }, - { name: 'workplace.contribution', max: 160, personal: 30, team: 140 }, - { name: 'workplace.hot', max: 300, personal: 20, team: 28 }, - { name: 'workplace.yield', max: 130, personal: 35, team: 35 }, - { name: 'workplace.follow', max: 100, personal: 80, team: 90 } - ] - set( - radarOptionData, - 'radar.indicator', - data.map((v) => { - return { - name: t(v.name), - max: v.max - } - }) - ) - set(radarOptionData, 'series', [ - { - name: '指数', - type: 'radar', - data: [ - { - value: data.map((v) => v.personal), - name: t('workplace.personal') - }, - { - value: data.map((v) => v.team), - name: t('workplace.team') - } - ] - } - ]) -} // 用户来源 const getUserAccessSource = async () => { const data = [ @@ -242,60 +203,14 @@ const getWeeklyUserActivity = async () => { ]) } -const lineOptionsData = reactive(lineOptions) as EChartsOption - -// 每月销售总额 -const getMonthlySales = async () => { - const data = [ - { estimate: 100, actual: 120, name: 'analysis.january' }, - { estimate: 120, actual: 82, name: 'analysis.february' }, - { estimate: 161, actual: 91, name: 'analysis.march' }, - { estimate: 134, actual: 154, name: 'analysis.april' }, - { estimate: 105, actual: 162, name: 'analysis.may' }, - { estimate: 160, actual: 140, name: 'analysis.june' }, - { estimate: 165, actual: 145, name: 'analysis.july' }, - { estimate: 114, actual: 250, name: 'analysis.august' }, - { estimate: 163, actual: 134, name: 'analysis.september' }, - { estimate: 185, actual: 56, name: 'analysis.october' }, - { estimate: 118, actual: 99, name: 'analysis.november' }, - { estimate: 123, actual: 123, name: 'analysis.december' } - ] - set( - lineOptionsData, - 'xAxis.data', - data.map((v) => t(v.name)) - ) - set(lineOptionsData, 'series', [ - { - name: t('analysis.estimate'), - smooth: true, - type: 'line', - data: data.map((v) => v.estimate), - animationDuration: 2800, - animationEasing: 'cubicInOut' - }, - { - name: t('analysis.actual'), - smooth: true, - type: 'line', - itemStyle: {}, - data: data.map((v) => v.actual), - animationDuration: 2800, - animationEasing: 'quadraticOut' - } - ]) -} - const getAllApi = async () => { await Promise.all([ getCount(), getProject(), getNotice(), getShortcut(), - getRadar(), getUserAccessSource(), - getWeeklyUserActivity(), - getMonthlySales() + getWeeklyUserActivity() ]) loading.value = false } @@ -359,11 +274,11 @@ getAllApi() - - + +