|
@@ -272,8 +272,8 @@ export default {
|
|
|
this.resourceData = res.data
|
|
|
this.resourceData.cd = 5 - this.resourceData.totalCarNum.toString().length
|
|
|
this.resourceData.totalCarNum = this.resourceData.totalCarNum.toString().padStart(5, '0');
|
|
|
- this.resourceData.percentageLack = Math.round(((this.resourceData.totalCarNum - this.resourceData.establishmentsCarNum) / this.resourceData.totalCarNum) * 100);
|
|
|
- this.resourceData.percentagePosess = Math.round((this.resourceData.establishmentsCarNum / this.resourceData.totalCarNum) * 100);
|
|
|
+ this.resourceData.percentageLack = (this.resourceData.totalCarNum !== 0) ? Math.round(((this.resourceData.totalCarNum - this.resourceData.establishmentsCarNum) / this.resourceData.totalCarNum) * 100) : 0;
|
|
|
+ this.resourceData.percentagePosess = (this.resourceData.totalCarNum !== 0) ? Math.round((this.resourceData.establishmentsCarNum / this.resourceData.totalCarNum) * 100) : 0;
|
|
|
this.carTypeNum = [
|
|
|
{
|
|
|
type: "商务车",
|
|
@@ -323,8 +323,8 @@ export default {
|
|
|
getMonitor(this.appOrg).then(res => {
|
|
|
if (Number(res.code) === 200) {
|
|
|
this.monitorData = res.data
|
|
|
- this.monitorData.percentageInstall = Math.round((this.monitorData.terminalInstall / this.monitorData.terminalTotal) * 100);
|
|
|
- this.monitorData.percentageOnline = Math.round((this.monitorData.terminalOnline / this.monitorData.terminalTotal) * 100);
|
|
|
+ this.monitorData.percentageInstall = (this.monitorData.terminalTotal !== 0) ? Math.round((this.monitorData.terminalInstall / this.monitorData.terminalTotal) * 100) : 0;
|
|
|
+ this.monitorData.percentageOnline = (this.monitorData.terminalTotal !== 0) ? Math.round((this.monitorData.terminalOnline / this.monitorData.terminalTotal) * 100) : 0;
|
|
|
}
|
|
|
})
|
|
|
},
|