This commit is contained in:
tcy
2025-08-22 19:01:55 +08:00
parent 26e1493aa7
commit 8f9b042941
7 changed files with 106 additions and 124 deletions

View File

@ -2,41 +2,34 @@
<div class="leftPage">
<div class="kpi_box">
<TitleComponent :title="'支付KPI'" style="margin-bottom: 20px" />
<ProgressComponent
title="应收账款"
:value="formatCurrency(incomeData.planAmount)"
<ProgressComponent title="应收账款" :value="formatCurrency(incomeData.planAmount)"
:percentageChange="getPercentageChange(incomeData.planAmount, incomeData.actualAmount)"
:progressPercentage="getProgressPercentage(incomeData.planAmount, incomeData.actualAmount)"
progressColor="rgba(255, 77, 79, 1)"
/>
<ProgressComponent
title="应付账款"
:value="formatCurrency(expensesData.planAmount)"
progressColor="rgba(255, 77, 79, 1)" />
<ProgressComponent title="应付账款" :value="formatCurrency(expensesData.planAmount)"
:percentageChange="getPercentageChange(expensesData.planAmount, expensesData.actualAmount)"
:progressPercentage="getProgressPercentage(expensesData.planAmount, expensesData.actualAmount)"
progressColor="rgba(29, 214, 255, 1)"
/>
<ProgressComponent
title="本月付款"
:value="formatCurrency(expensesData.actualAmount)"
progressColor="rgba(29, 214, 255, 1)" />
<ProgressComponent title="本月付款" :value="formatCurrency(expensesData.actualAmount)"
:percentageChange="getPercentageChange(expensesData.planAmount, expensesData.actualAmount)"
:progressPercentage="getProgressPercentage(expensesData.planAmount, expensesData.actualAmount)"
progressColor="rgba(0, 227, 150, 1)"
/>
<ProgressComponent
title="本月收款"
:value="formatCurrency(incomeData.actualAmount)"
progressColor="rgba(0, 227, 150, 1)" />
<ProgressComponent title="本月收款" :value="formatCurrency(incomeData.actualAmount)"
:percentageChange="getPercentageChange(incomeData.planAmount, incomeData.actualAmount)"
:progressPercentage="getProgressPercentage(incomeData.planAmount, incomeData.actualAmount)"
progressColor="rgba(255, 147, 42, 1)"
/>
progressColor="rgba(255, 147, 42, 1)" />
</div>
<div class="contract_box">
<div style="height: 60px;">
<TitleComponent :title="'收支合同分析'" style="margin-bottom: 20px" />
</div>
<!-- 切换按钮 -->
<TitleComponent :title="'收支合同分析'" style="margin-bottom: 20px" />
<div style="margin-bottom: 10px; text-align: center">
<button @click="switchChart('income')" :style="activeChart === 'income' ? activeBtnStyle : defaultBtnStyle">收入合同</button>
<button @click="switchChart('expenses')" :style="activeChart === 'expenses' ? activeBtnStyle : defaultBtnStyle" style="margin-left: 15px">
<button @click="switchChart('income')"
:style="activeChart === 'income' ? activeBtnStyle : defaultBtnStyle">收入合同</button>
<button @click="switchChart('expenses')" :style="activeChart === 'expenses' ? activeBtnStyle : defaultBtnStyle"
style="margin-left: 15px">
支出合同
</button>
</div>
@ -56,7 +49,7 @@ import EchartBox from '@/components/EchartBox/index.vue';
import { incomePay, expensesPay, incomeAnalyze, expensesAnalyze } from '@/api/largeScreen/index';
// 初始化数据容器
const incomeData = ref({ planAmount: '0.00', actualAmount: '0.00' }); // 收入相关数据(应收/收款)
const incomeData = ref({ planAmount: '0.00', actualAmount: '0.00' }); // 收入相关数据(应收/收款)
const expensesData = ref({ planAmount: '0.00', actualAmount: '0.00' }); // 支出相关数据(应付/付款)
const pieOption = ref({}); // 环形图配置
const activeChart = ref('income'); // 当前激活的图表类型income-收入合同expenses-支出合同
@ -202,8 +195,8 @@ const generatePieOption = (data) => {
{
name: '合同数量',
type: 'pie',
radius: ['45%', '65%'],
center: ['50%', '60%'],
radius: ['30%', '60%'],
center: ['50%', '80%'],
data: [], // 空数据,避免显示圆环
itemStyle: { borderColor: '#000', borderWidth: 1 },
// 中心显示“加载中”提示
@ -309,18 +302,21 @@ onMounted(async () => {
.leftPage {
width: 100%;
height: 100%;
.kpi_box {
margin-bottom: 10px;
}
.contract_box {
height: 35vh;
height: 33vh;
display: flex;
flex-direction: column; // 按钮区和图表区垂直排列
}
.chart-container {
flex: 1; // 占满剩余高度,确保图表容器足够大
min-height: 200px; // 最小高度,避免容器过矮
height: 28vh;
}
.kpi_box,
.contract_box {
padding: 10px;