fix:控制台NAN问题处理

This commit is contained in:
shijing 2025-08-20 15:56:00 +08:00
parent d721d1a9d9
commit a6ef32997a
3 changed files with 37 additions and 46 deletions

View File

@ -583,7 +583,7 @@ export default {
list.forEach((item) => { list.forEach((item) => {
for (let i = 0; i < this.weekDateList.length; i++) { for (let i = 0; i < this.weekDateList.length; i++) {
if (item. == that.weekDateList[i]) { if (item. == that.weekDateList[i]) {
saleOutdept6[i] = item.交付; saleOutdept6[i] = item.;
} }
} }
}); });

View File

@ -286,13 +286,13 @@ export default {
that.$API.bi.dataset.exec.req('saleOutDay', obj6).then((res6) => { that.$API.bi.dataset.exec.req('saleOutDay', obj6).then((res6) => {
let list6 = res6.data2.ds0; let list6 = res6.data2.ds0;
if (list6.length > 0) { if (list6.length > 0) {
this.dayPayNum6 = list6[0].交付; this.dayPayNum6 = list6[0].;
} }
//6 //6
that.$API.bi.dataset.exec.req('saleOutDay', obj06).then((res06) => { that.$API.bi.dataset.exec.req('saleOutDay', obj06).then((res06) => {
let list06 = res06.data2.ds0; let list06 = res06.data2.ds0;
if (list06.length > 0) { if (list06.length > 0) {
this.tongbi06 = Math.round((this.dayPayNum6 - list06[0].交付) / list06[0].交付* 100); this.tongbi06 = Math.round((this.dayPayNum6 - list06[0].) / list06[0]. * 100);
} }
}); });
}); });

View File

@ -669,12 +669,12 @@ export default {
} }
} }
if (beforData7 !== 0) { if (beforData7 !== 0) {
this.tongbi7 = Math.round( that.tongbi7 = Math.round(
((this.dayPassNum7 - beforData7) / beforData7) * ((that.dayPassNum7 - beforData7) / beforData7) *
100 100
); );
} else { } else {
this.tongbi7 = this.dayPassNum7; that.tongbi7 = that.dayPassNum7;
} }
}); });
}); });
@ -705,57 +705,48 @@ export default {
} }
} }
if (beforData10 !== 0) { if (beforData10 !== 0) {
this.tongbi10 = Math.round( that.tongbi10 = Math.round(((that.dayPassNum10 - beforData10) /beforData10) *100);
((this.dayPassNum10 - beforData10) /
beforData10) *
100
);
} else { } else {
this.tongbi7 = this.dayPassNum7; that.tongbi7 = that.dayPassNum7;
} }
}); });
}); });
//6 //6
this.dayPayNum6 = 0; that.dayPayNum6 = 0;
that.$API.bi.dataset.exec.req("saleOutDay", obj6).then((res6) => { that.$API.bi.dataset.exec.req("saleOutDay", obj6).then((res6) => {
if (res6.data2.ds0) { if (res6.data2.ds0) {
let list6 = res6.data2.ds0; let list6 = res6.data2.ds0;
if (list6.length > 0) { if (list6.length > 0) {
list6.forEach((item6) => { list6.forEach((item6) => {
this.dayPayNum6 += item6.交付; that.dayPayNum6 += item6.;
}); });
} }
} }
let beforData6 = 0; let beforData6 = 0;
//6 //6
that.$API.bi.dataset.exec that.$API.bi.dataset.exec.req("saleOutDay", obj06).then((res06) => {
.req("saleOutDay", obj06) if (res06.data2.ds0) {
.then((res06) => { let list06 = res06.data2.ds0;
if (res06.data2.ds0) { if (list06.length > 0) {
let list06 = res06.data2.ds0; list06.forEach((item06) => {
if (list06.length > 0) { beforData6 += item06.数量;
list06.forEach((item06) => { });
beforData6 += item06.交付数;
});
}
} }
if (beforData6 !== 0) { }
this.tongbi06 = Math.round( if (beforData6 !== 0) {
((this.dayPassNum6 - beforData6) / beforData6) * that.tongbi06 = Math.round(((that.dayPayNum6 - beforData6) / beforData6) *100);
100 } else {
); that.tongbi06 = that.dayPayNum6;
} else { }
this.tongbi06 = this.dayPassNum6; });
}
});
}); });
}, },
//&---6710 //&---6710
getMonthData() { getMonthData() {
let that = this; let that = this;
this.monthPayNum6 = 0; that.monthPayNum6 = 0;
this.monthPassRate7 = 0; that.monthPassRate7 = 0;
this.monthPassRate10 = 0; that.monthPassRate10 = 0;
let start_date = that.year_s + "-" + that.month_s + "-01"; let start_date = that.year_s + "-" + that.month_s + "-01";
let end_date = that.year_s + "-" + that.month_s + "-" + that.day_s; let end_date = that.year_s + "-" + that.month_s + "-" + that.day_s;
let obj6 = { let obj6 = {
@ -802,11 +793,11 @@ export default {
rate = (sum_ok / sum_real) * 100; rate = (sum_ok / sum_real) * 100;
} }
} }
this.monthPassRate7 = Math.round(rate); that.monthPassRate7 = Math.round(rate);
}); });
//10 //10
that.$API.bi.dataset.exec.req("lineMonth", obj10).then((res10) => { that.$API.bi.dataset.exec.req("lineMonth", obj10).then((res10) => {
this.monthPassRate10 = 0; that.monthPassRate10 = 0;
let sum_ok_10 = 0, let sum_ok_10 = 0,
sum_real_10 = 0, sum_real_10 = 0,
rate_10 = 0; rate_10 = 0;
@ -820,7 +811,7 @@ export default {
rate_10 = (sum_ok_10 / sum_real_10) * 100; rate_10 = (sum_ok_10 / sum_real_10) * 100;
} }
} }
this.monthPassRate10 = Math.round(rate_10); that.monthPassRate10 = Math.round(rate_10);
}); });
//6 //6
that.$API.bi.dataset.exec.req("saleOutMonth", obj6).then((res6) => { that.$API.bi.dataset.exec.req("saleOutMonth", obj6).then((res6) => {
@ -833,7 +824,7 @@ export default {
}); });
} }
} }
this.monthPayNum6 = sum6; that.monthPayNum6 = sum6;
}); });
}, },
getProductStatistic() { getProductStatistic() {
@ -844,7 +835,7 @@ export default {
query: { query: {
start_date: start_date, start_date: start_date,
end_date: end_date, end_date: end_date,
dept_name: this.deptName, dept_name: that.deptName,
group_bys_material: "", group_bys_material: "",
order_bys_material: "", order_bys_material: "",
select_cols_material: "", select_cols_material: "",
@ -871,14 +862,14 @@ export default {
} }
} }
} }
this.hgNumber = ((hgNumber / xAxisData.length) *100).toFixed(2); that.hgNumber = ((hgNumber / xAxisData.length) *100).toFixed(2);
this.chartData = chartData; that.chartData = chartData;
this.option.xAxis.data = xAxisData; that.option.xAxis.data = xAxisData;
this.option.series.data = chartData; that.option.series.data = chartData;
// //
var dom = document.getElementById("barCharts"); var dom = document.getElementById("barCharts");
var myChart = echarts.init(dom); var myChart = echarts.init(dom);
myChart.setOption(this.option, true); myChart.setOption(that.option, true);
}); });
}, },
deptNameChange() { deptNameChange() {