1
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 24s
Docker Build & Deploy / Deploy to Production (push) Successful in 6s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s

This commit is contained in:
2026-01-25 13:22:51 +08:00
parent 4ff99b62c8
commit 47e1ed3891

View File

@@ -1,4 +1,4 @@
<template> <template>
<div class="chart-analysis-container"> <div class="chart-analysis-container">
<!-- 仪表盘整体健康度 --> <!-- 仪表盘整体健康度 -->
<div class="gauges-row"> <div class="gauges-row">
@@ -191,7 +191,7 @@
<script setup> <script setup>
import { ref, onMounted, watch, nextTick, onUnmounted, computed } from 'vue' import { ref, onMounted, watch, nextTick, onUnmounted, computed } from 'vue'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import { BudgetCategory } from '@/constants/enums' import { BudgetCategory, BudgetPeriodType } from '@/constants/enums'
import { getCssVar } from '@/utils/theme' import { getCssVar } from '@/utils/theme'
import PopupContainer from '@/components/PopupContainer.vue' import PopupContainer from '@/components/PopupContainer.vue'
@@ -403,18 +403,26 @@ const updateVarianceChart = (chart, budgets) => {
const current = b.current || 0 const current = b.current || 0
const diff = current - limit const diff = current - limit
return { return {
name: b.name + (b.type === 2 ? ' (年)' : ''), name: b.name + (b.type === BudgetPeriodType.Year ? ' (年)' : ''),
value: diff, value: diff,
limit: limit, limit: limit,
current: current current: current,
type: b.type
} }
}) })
// Sort by absolute variance // 先月度再年度,各自按偏差绝对值排序
data.sort((a, b) => Math.abs(b.value) - Math.abs(a.value)) const monthlyData = data.filter(item => item.type === BudgetPeriodType.Month)
const annualData = data.filter(item => item.type === BudgetPeriodType.Year)
const categories = data.map(item => item.name) monthlyData.sort((a, b) => Math.abs(b.value) - Math.abs(a.value))
const values = data.map(item => item.value) annualData.sort((a, b) => Math.abs(b.value) - Math.abs(a.value))
// 确保月度在前,年度在后
const sortedData = [...annualData,...monthlyData]
const categories = sortedData.map(item => item.name)
const values = sortedData.map(item => item.value)
const maxVal = Math.max(...values.map(v => Math.abs(v))) || 1 const maxVal = Math.max(...values.map(v => Math.abs(v))) || 1
const textColor = getCssVar('--van-text-color') const textColor = getCssVar('--van-text-color')