From e3851e9de46de09e2175f7805b79ced42e79fe38 Mon Sep 17 00:00:00 2001 From: jinna Date: Mon, 18 Mar 2024 16:59:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8C=E7=8E=AF=E6=AF=94?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E5=85=AC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/util.js | 10 ++++++---- pages/highWay/runData/form.vue | 8 ++++---- pages/metro/subwayPage/form.vue | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/common/util.js b/common/util.js index 141243b..d8a5074 100644 --- a/common/util.js +++ b/common/util.js @@ -103,13 +103,15 @@ function getDay(d, num) { // 计算环比 function calcMom(cur, data) { - // console.log(cur,"环比==========",data); - return !checkNotEmpty(cur) || !checkNotEmpty(data) ? '' : data === 0 && parseInt(cur) === 0 ? 0 : data === 0 && parseInt(cur) > 0 ? 100 : (parseInt(cur) - data) / data * 100; + console.log(cur,"环比==========",data); + console.log('cur ===>',!checkNotEmpty(cur),'data ===>',!checkNotEmpty(data)) + console.log('checkNotEmpty ===>',!checkNotEmpty(cur) || !checkNotEmpty(data) ? '12' : '1212') + return !checkNotEmpty(cur) || !checkNotEmpty(data) ? null : data === 0 && parseInt(cur) === 0 ? null : data === 0 && parseInt(cur) > 0 ? 100 : (parseInt(cur) - data) / data * 100; } // 计算同比 function calcYoy(cur, data) { - // console.log(cur,"同比==========",data); - return !checkNotEmpty(cur) || !checkNotEmpty(data) ? '' : data === 0 && parseInt(cur) === 0 ? 0 : data === 0 && parseInt(cur) > 0 ? 100 : (parseInt(cur) - data) / data * 100; + console.log(cur,"同比==========",data); + return !checkNotEmpty(cur) || !checkNotEmpty(data) ? null : data === 0 && parseInt(cur) === 0 ? null : data === 0 && parseInt(cur) > 0 ? 100 : (parseInt(cur) - data) / data * 100; } // 是否是闰年 diff --git a/pages/highWay/runData/form.vue b/pages/highWay/runData/form.vue index ed9715b..feb037b 100644 --- a/pages/highWay/runData/form.vue +++ b/pages/highWay/runData/form.vue @@ -449,8 +449,8 @@ this.form.highwaySubDataList[index].exitVehicleCountMom = this.$calcMom(this.form.highwaySubDataList[index].exitVehicleCount,obj.exitVehicleCount); } else { - this.form.highwaySubDataList[index].entranceVehicleCountMom = ''; - this.form.highwaySubDataList[index].exitVehicleCountMom = ''; + this.form.highwaySubDataList[index].entranceVehicleCountMom = null; + this.form.highwaySubDataList[index].exitVehicleCountMom = null; } if (idx2 > -1) { //同比 @@ -462,8 +462,8 @@ this.form.highwaySubDataList[index].exitVehicleCountYoy = this.$calcYoy(this.form .highwaySubDataList[index].exitVehicleCount, obj.exitVehicleCount); } else { - this.form.highwaySubDataList[index].entranceVehicleCountYoy = ''; - this.form.highwaySubDataList[index].exitVehicleCountYoy = ''; + this.form.highwaySubDataList[index].entranceVehicleCountYoy = null; + this.form.highwaySubDataList[index].exitVehicleCountYoy = null; } // } }, diff --git a/pages/metro/subwayPage/form.vue b/pages/metro/subwayPage/form.vue index dcebf3c..d94d23e 100644 --- a/pages/metro/subwayPage/form.vue +++ b/pages/metro/subwayPage/form.vue @@ -129,7 +129,7 @@ "reportDate" : "", "statPeriod" : "", "carTimes" : "", - "carTimesMom " : "", + "carTimesMom" : "", "carTimesYoy" : "", "remarks":"" }, //登录form