Commit 1e65b2219d0e7ae2986d8a5d926810a513706762

Authored by xingyu4j
1 parent 91113eac

perf

yudao-ui-admin-vue3/src/views/Home/Index.vue
... ... @@ -6,12 +6,11 @@ import { CountTo } from '@/components/CountTo'
6 6 import { formatTime } from '@/utils'
7 7 import { Echart } from '@/components/Echart'
8 8 import { EChartsOption } from 'echarts'
9   -import { radarOption } from './echarts-data'
10 9 import { Highlight } from '@/components/Highlight'
11 10 import type { WorkplaceTotal, Project, Notice, Shortcut } from './types'
12 11 import { set } from 'lodash-es'
13 12 import { useCache } from '@/hooks/web/useCache'
14   -import { pieOptions, barOptions, lineOptions } from './echarts-data'
  13 +import { pieOptions, barOptions } from './echarts-data'
15 14  
16 15 const { t } = useI18n()
17 16 const { wsCache } = useCache()
... ... @@ -156,44 +155,6 @@ const getShortcut = async () => {
156 155 shortcut = Object.assign(shortcut, data)
157 156 }
158 157  
159   -// 获取指数
160   -let radarOptionData = reactive<EChartsOption>(radarOption) as EChartsOption
161   -
162   -const getRadar = async () => {
163   - const data = [
164   - { name: 'workplace.quote', max: 65, personal: 42, team: 50 },
165   - { name: 'workplace.contribution', max: 160, personal: 30, team: 140 },
166   - { name: 'workplace.hot', max: 300, personal: 20, team: 28 },
167   - { name: 'workplace.yield', max: 130, personal: 35, team: 35 },
168   - { name: 'workplace.follow', max: 100, personal: 80, team: 90 }
169   - ]
170   - set(
171   - radarOptionData,
172   - 'radar.indicator',
173   - data.map((v) => {
174   - return {
175   - name: t(v.name),
176   - max: v.max
177   - }
178   - })
179   - )
180   - set(radarOptionData, 'series', [
181   - {
182   - name: '指数',
183   - type: 'radar',
184   - data: [
185   - {
186   - value: data.map((v) => v.personal),
187   - name: t('workplace.personal')
188   - },
189   - {
190   - value: data.map((v) => v.team),
191   - name: t('workplace.team')
192   - }
193   - ]
194   - }
195   - ])
196   -}
197 158 // 用户来源
198 159 const getUserAccessSource = async () => {
199 160 const data = [
... ... @@ -242,60 +203,14 @@ const getWeeklyUserActivity = async () =&gt; {
242 203 ])
243 204 }
244 205  
245   -const lineOptionsData = reactive<EChartsOption>(lineOptions) as EChartsOption
246   -
247   -// 每月销售总额
248   -const getMonthlySales = async () => {
249   - const data = [
250   - { estimate: 100, actual: 120, name: 'analysis.january' },
251   - { estimate: 120, actual: 82, name: 'analysis.february' },
252   - { estimate: 161, actual: 91, name: 'analysis.march' },
253   - { estimate: 134, actual: 154, name: 'analysis.april' },
254   - { estimate: 105, actual: 162, name: 'analysis.may' },
255   - { estimate: 160, actual: 140, name: 'analysis.june' },
256   - { estimate: 165, actual: 145, name: 'analysis.july' },
257   - { estimate: 114, actual: 250, name: 'analysis.august' },
258   - { estimate: 163, actual: 134, name: 'analysis.september' },
259   - { estimate: 185, actual: 56, name: 'analysis.october' },
260   - { estimate: 118, actual: 99, name: 'analysis.november' },
261   - { estimate: 123, actual: 123, name: 'analysis.december' }
262   - ]
263   - set(
264   - lineOptionsData,
265   - 'xAxis.data',
266   - data.map((v) => t(v.name))
267   - )
268   - set(lineOptionsData, 'series', [
269   - {
270   - name: t('analysis.estimate'),
271   - smooth: true,
272   - type: 'line',
273   - data: data.map((v) => v.estimate),
274   - animationDuration: 2800,
275   - animationEasing: 'cubicInOut'
276   - },
277   - {
278   - name: t('analysis.actual'),
279   - smooth: true,
280   - type: 'line',
281   - itemStyle: {},
282   - data: data.map((v) => v.actual),
283   - animationDuration: 2800,
284   - animationEasing: 'quadraticOut'
285   - }
286   - ])
287   -}
288   -
289 206 const getAllApi = async () => {
290 207 await Promise.all([
291 208 getCount(),
292 209 getProject(),
293 210 getNotice(),
294 211 getShortcut(),
295   - getRadar(),
296 212 getUserAccessSource(),
297   - getWeeklyUserActivity(),
298   - getMonthlySales()
  213 + getWeeklyUserActivity()
299 214 ])
300 215 loading.value = false
301 216 }
... ... @@ -359,11 +274,11 @@ getAllApi()
359 274 </el-card>
360 275 </div>
361 276  
362   - <el-row class="mt-10px" :gutter="20" justify="space-between">
363   - <el-col :xl="16" :lg="16" :md="24" :sm="24" :xs="24" class="mb-20px">
  277 + <el-row class="mt-5px" :gutter="20" justify="space-between">
  278 + <el-col :xl="16" :lg="16" :md="24" :sm="24" :xs="24" class="mb-10px">
364 279 <el-card shadow="never">
365 280 <template #header>
366   - <div class="flex justify-between">
  281 + <div class="flex justify-between h-3">
367 282 <span>{{ t('workplace.project') }}</span>
368 283 <el-link type="primary" :underline="false">{{ t('workplace.more') }}</el-link>
369 284 </div>
... ... @@ -375,7 +290,7 @@ getAllApi()
375 290 :key="`card-${index}`"
376 291 :xl="8"
377 292 :lg="8"
378   - :md="12"
  293 + :md="8"
379 294 :sm="24"
380 295 :xs="24"
381 296 >
... ... @@ -395,27 +310,20 @@ getAllApi()
395 310 </el-skeleton>
396 311 </el-card>
397 312  
398   - <el-card shadow="never" class="mt-10px">
  313 + <el-card shadow="never" class="mt-5px">
399 314 <el-skeleton :loading="loading" animated>
400 315 <el-row :gutter="20" justify="space-between">
401 316 <el-col :xl="10" :lg="10" :md="24" :sm="24" :xs="24">
402   - <el-card shadow="hover" class="mb-20px">
  317 + <el-card shadow="hover" class="mb-10px">
403 318 <el-skeleton :loading="loading" animated>
404   - <Echart :options="pieOptionsData" :height="300" />
  319 + <Echart :options="pieOptionsData" :height="280" />
405 320 </el-skeleton>
406 321 </el-card>
407 322 </el-col>
408 323 <el-col :xl="14" :lg="14" :md="24" :sm="24" :xs="24">
409   - <el-card shadow="hover" class="mb-20px">
  324 + <el-card shadow="hover" class="mb-10px">
410 325 <el-skeleton :loading="loading" animated>
411   - <Echart :options="barOptionsData" :height="300" />
412   - </el-skeleton>
413   - </el-card>
414   - </el-col>
415   - <el-col :span="24">
416   - <el-card shadow="hover" class="mb-20px">
417   - <el-skeleton :loading="loading" animated :rows="4">
418   - <Echart :options="lineOptionsData" :height="350" />
  326 + <Echart :options="barOptionsData" :height="280" />
419 327 </el-skeleton>
420 328 </el-card>
421 329 </el-col>
... ... @@ -423,14 +331,16 @@ getAllApi()
423 331 </el-skeleton>
424 332 </el-card>
425 333 </el-col>
426   - <el-col :xl="8" :lg="8" :md="24" :sm="24" :xs="24" class="mb-20px">
  334 + <el-col :xl="8" :lg="8" :md="24" :sm="24" :xs="24" class="mb-10px">
427 335 <el-card shadow="never">
428 336 <template #header>
429   - <span>{{ t('workplace.shortcutOperation') }}</span>
  337 + <div class="flex justify-between h-3">
  338 + <span>{{ t('workplace.shortcutOperation') }}</span>
  339 + </div>
430 340 </template>
431 341 <el-skeleton :loading="loading" animated>
432 342 <el-row>
433   - <el-col v-for="item in shortcut" :key="`team-${item.name}`" :span="8" class="mb-20px">
  343 + <el-col v-for="item in shortcut" :key="`team-${item.name}`" :span="8" class="mb-10px">
434 344 <div class="flex items-center">
435 345 <Icon :icon="item.icon" class="mr-10px" />
436 346 <el-link type="default" :underline="false" :href="item.url">
... ... @@ -443,7 +353,7 @@ getAllApi()
443 353 </el-card>
444 354 <el-card shadow="never" class="mt-10px">
445 355 <template #header>
446   - <div class="flex justify-between">
  356 + <div class="flex justify-between h-3">
447 357 <span>{{ t('workplace.notice') }}</span>
448 358 <el-link type="primary" :underline="false">{{ t('workplace.more') }}</el-link>
449 359 </div>
... ... @@ -467,14 +377,6 @@ getAllApi()
467 377 </div>
468 378 </el-skeleton>
469 379 </el-card>
470   - <el-card shadow="never" class="mt-10px">
471   - <template #header>
472   - <span>{{ t('workplace.index') }}</span>
473   - </template>
474   - <el-skeleton :loading="loading" animated>
475   - <Echart :options="radarOptionData" :height="400" />
476   - </el-skeleton>
477   - </el-card>
478 380 </el-col>
479 381 </el-row>
480 382 </template>
... ...