From fbe3c8e6bc44f8ac613517df05432f620bdfbf31 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期五, 22 五月 2026 16:39:13 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_NEW_pro' into dev_鹤壁_强信宇_pro
---
src/views/reportAnalysis/financialAnalysis/components/center-top.vue | 79 ++++++++++++++++++++++++---------------
1 files changed, 49 insertions(+), 30 deletions(-)
diff --git a/src/views/reportAnalysis/financialAnalysis/components/center-top.vue b/src/views/reportAnalysis/financialAnalysis/components/center-top.vue
index 85f4928..becb376 100644
--- a/src/views/reportAnalysis/financialAnalysis/components/center-top.vue
+++ b/src/views/reportAnalysis/financialAnalysis/components/center-top.vue
@@ -112,50 +112,69 @@
profitRate: { value: 0, trend: 0 },
})
-const fetchMonthlyIncome = async () => {
- const res = await getMonthlyIncome()
- const data = res?.data || {}
+const toNumber = (val) => {
+ const num = Number(val)
+ return Number.isFinite(num) ? num : 0
+}
- income.value.amount = data.monthlyIncome ?? 0
- const collectionRate = Number(data.collectionRate ?? 0)
- const overdueRate = Number(data.overdueRate ?? 0)
- income.value.repayRate = {
- value: collectionRate,
- trend: collectionRate >= 0 ? 1 : -1,
- }
- income.value.overdueCount = data.overdueNum ?? 0
- income.value.overdueRate = {
- value: overdueRate,
- trend: overdueRate >= 0 ? 1 : -1,
+const fetchMonthlyIncome = async () => {
+ try {
+ const res = await getMonthlyIncome()
+ const data = res?.data || {}
+
+ income.value.amount = toNumber(data.monthlyIncome)
+ const collectionRate = toNumber(data.collectionRate)
+ const overdueRate = toNumber(data.overdueRate)
+ income.value.repayRate = {
+ value: collectionRate,
+ trend: collectionRate >= 0 ? 1 : -1,
+ }
+ income.value.overdueCount = toNumber(data.overdueNum)
+ income.value.overdueRate = {
+ value: overdueRate,
+ trend: overdueRate >= 0 ? 1 : -1,
+ }
+ } catch {
+ income.value.amount = 0
+ income.value.repayRate = { value: 0, trend: 0 }
+ income.value.overdueCount = 0
+ income.value.overdueRate = { value: 0, trend: 0 }
}
}
const fetchMonthlyExpenditure = async () => {
- const res = await getMonthlyExpenditure()
- const data = res?.data || {}
+ try {
+ const res = await getMonthlyExpenditure()
+ const data = res?.data || {}
- expense.value.amount = data.monthlyExpenditure ?? 0
- const paymentRate = Number(data.paymentRate ?? 0)
- expense.value.netProfit = {
- value: paymentRate,
- trend: paymentRate >= 0 ? 1 : -1,
- }
- expense.value.grossProfit = data.grossProfit ?? 0
+ expense.value.amount = toNumber(data.monthlyExpenditure)
+ const paymentRate = toNumber(data.paymentRate)
+ expense.value.netProfit = {
+ value: paymentRate,
+ trend: paymentRate >= 0 ? 1 : -1,
+ }
+ expense.value.grossProfit = toNumber(data.grossProfit)
- const profitMarginRate = Number(data.profitMarginRate ?? 0)
- expense.value.profitRate = {
- value: profitMarginRate,
- trend: profitMarginRate >= 0 ? 1 : -1,
+ const profitMarginRate = toNumber(data.profitMarginRate)
+ expense.value.profitRate = {
+ value: profitMarginRate,
+ trend: profitMarginRate >= 0 ? 1 : -1,
+ }
+ } catch {
+ expense.value.amount = 0
+ expense.value.netProfit = { value: 0, trend: 0 }
+ expense.value.grossProfit = 0
+ expense.value.profitRate = { value: 0, trend: 0 }
}
}
const isWanAmount = (val) => {
- const num = Number(val) || 0
+ const num = toNumber(val)
return Math.abs(num) >= 10000
}
const formatAmountWanNumber = (val) => {
- const num = Number(val) || 0
+ const num = toNumber(val)
if (Math.abs(num) >= 10000) {
return (num / 10000).toFixed(2)
}
@@ -163,7 +182,7 @@
}
const formatPercent = (val) => {
- const num = Number(val) || 0
+ const num = toNumber(val)
// 鐧惧垎姣斿睍绀哄缁堢敤缁濆鍊硷紝灏忔暟淇濈暀涓や綅
return `${Math.abs(num).toFixed(2)}%`
}
--
Gitblit v1.9.3