From b2c99eab5d1377df553c52aee0cddc7c09ea8d6a Mon Sep 17 00:00:00 2001 From: TiaStars Date: Mon, 6 Jan 2025 17:03:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E5=8F=B0=E8=BF=91=E4=B8=89?= =?UTF-8?q?=E5=B9=B4=E8=B5=84=E9=87=91=E6=8B=A8=E4=BB=98=E6=83=85=E5=86=B5?= =?UTF-8?q?bugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/BJinsannianzijin/index.vue | 86 +++++++++++-------- 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/src/views/workbenchPro/components/BJinsannianzijin/index.vue b/src/views/workbenchPro/components/BJinsannianzijin/index.vue index bf47bc9..415c948 100644 --- a/src/views/workbenchPro/components/BJinsannianzijin/index.vue +++ b/src/views/workbenchPro/components/BJinsannianzijin/index.vue @@ -12,15 +12,15 @@
资金预算 -
{{ obj.fundBudget }} 万元
+
{{ obj.fundBudget ? obj.fundBudget : 0 }} 万元
追加预算 -
{{ obj.additionBudget }} 万元
+
{{ obj.additionBudget ? obj.additionBudget : 0 }} 万元
-
拨付资金 {{ obj.appropriationFund }}万元 (执行率 {{ obj.implementationRate }}% )
+
拨付资金 {{ obj.appropriationFund ? obj.appropriationFund : 0 }}万元 (执行率 {{ obj.implementationRate ? obj.implementationRate : 0 }}% )
@@ -34,15 +34,15 @@
资金预算 -
{{ objTwo.fundBudget }} 万元
+
{{ objTwo.fundBudget ? objTwo.fundBudget : 0 }} 万元
追加预算 -
{{ objTwo.additionBudget }} 万元
+
{{ objTwo.additionBudget ? objTwo.additionBudget : 0 }} 万元
-
拨付资金 {{ objTwo.appropriationFund }}万元 (执行率 {{ objTwo.implementationRate }}% )
+
拨付资金 {{ objTwo.appropriationFund ? objTwo.appropriationFund : 0 }}万元 (执行率 {{ objTwo.implementationRate ? objTwo.implementationRate : 0 }}% )
@@ -237,40 +237,50 @@ export default { ] }; threeYearsFund(Year).then(res=>{ - res.data.map(item=>{ - if(item.serviceType == "1") { - this.obj = item; - option.series[0].data[0].value = item.implementationRate - // 资金预算 fundBudget 追加预算 additionBudget - if(item.fundBudget <= 0) { - let color = [ [0, '#00AEFF'], [1, '#FFA42B ']] // 第二个颜色 - option.series[0].axisLine.lineStyle.color = color - } else if(item.additionBudget <= 0) { - let color = [ [1, '#00AEFF'], [1, '#FFA42B ']] // 第二个颜色 - option.series[0].axisLine.lineStyle.color = color - } else { - let count = item.fundBudget + item.additionBudget; - const percentage = (item.fundBudget / count); - let color = [ [Number(percentage.toFixed(1)), '#00AEFF'], [Number(percentage.toFixed(1)) + 0.03, '#F5F8FA'], [1, '#FFA42B ']] - option.series[0].axisLine.lineStyle.color = color; - } - } else { - this.objTwo = item; - optionTwo.series[0].data[0].value = item.implementationRate - if(item.fundBudget <= 0) { - let color = [ [0, '#00AEFF'], [1, '#FFA42B ']] // 第二个颜色 - optionTwo.series[0].axisLine.lineStyle.color = color - } else if(item.additionBudget <= 0) { - let color = [ [1, '#00AEFF'], [1, '#FFA42B ']] // 第二个颜色 - optionTwo.series[0].axisLine.lineStyle.color = color + if(res.data.length == 0) { + let color = [ [1, '#00AEFF']] // 第二个颜色 + option.series[0].axisLine.lineStyle.color = color + optionTwo.series[0].axisLine.lineStyle.color = color + option.series[0].data[0].value = 0 + optionTwo.series[0].data[0].value = 0 + this.obj = {} + this.objTwo = {} + } else { + res.data.map(item=>{ + if(item.serviceType == "1") { + this.obj = item; + option.series[0].data[0].value = item.implementationRate + // 资金预算 fundBudget 追加预算 additionBudget + if(item.fundBudget <= 0) { + let color = [ [0, '#00AEFF'], [1, '#FFA42B ']] // 第二个颜色 + option.series[0].axisLine.lineStyle.color = color + } else if(item.additionBudget <= 0) { + let color = [ [1, '#00AEFF'], [1, '#FFA42B ']] // 第二个颜色 + option.series[0].axisLine.lineStyle.color = color + } else { + let count = item.fundBudget + item.additionBudget; + const percentage = (item.fundBudget / count); + let color = [ [Number(percentage.toFixed(1)), '#00AEFF'], [Number(percentage.toFixed(1)) + 0.03, '#F5F8FA'], [1, '#FFA42B ']] + option.series[0].axisLine.lineStyle.color = color; + } } else { - let count = item.fundBudget + item.additionBudget; - const percentage = (item.fundBudget / count); - let color = [ [Number(percentage.toFixed(1)), '#00AEFF'], [Number(percentage.toFixed(1)) + 0.03, '#F5F8FA'], [1, '#FFA42B ']] - optionTwo.series[0].axisLine.lineStyle.color = color; + this.objTwo = item; + optionTwo.series[0].data[0].value = item.implementationRate + if(item.fundBudget <= 0) { + let color = [ [0, '#00AEFF'], [1, '#FFA42B ']] // 第二个颜色 + optionTwo.series[0].axisLine.lineStyle.color = color + } else if(item.additionBudget <= 0) { + let color = [ [1, '#00AEFF'], [1, '#FFA42B ']] // 第二个颜色 + optionTwo.series[0].axisLine.lineStyle.color = color + } else { + let count = item.fundBudget + item.additionBudget; + const percentage = (item.fundBudget / count); + let color = [ [Number(percentage.toFixed(1)), '#00AEFF'], [Number(percentage.toFixed(1)) + 0.03, '#F5F8FA'], [1, '#FFA42B ']] + optionTwo.series[0].axisLine.lineStyle.color = color; + } } - } - }) + }) + } this.chart.setOption(option) this.chartTwo.setOption(optionTwo) })