修改同环比计算公式

dev201310
jinna 2 years ago
parent ca065cee6b
commit e3851e9de4
  1. 10
      common/util.js
  2. 8
      pages/highWay/runData/form.vue
  3. 2
      pages/metro/subwayPage/form.vue

@ -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;
}
// 是否是闰年

@ -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;
}
// }
},

@ -129,7 +129,7 @@
"reportDate" : "",
"statPeriod" : "",
"carTimes" : "",
"carTimesMom " : "",
"carTimesMom" : "",
"carTimesYoy" : "",
"remarks":""
}, //form

Loading…
Cancel
Save