Bladeren bron

pms 保养查询 运行记录模板包含多个累计 时长 公里数 属性 调整计算下次保养时长/公里数 逻辑

zhangcl 1 maand geleden
bovenliggende
commit
7734c89959
1 gewijzigde bestanden met toevoegingen van 4 en 2 verwijderingen
  1. 4 2
      src/views/pms/iotmainworkorder/DeviceAlarmBomList.vue

+ 4 - 2
src/views/pms/iotmainworkorder/DeviceAlarmBomList.vue

@@ -200,8 +200,9 @@ const handleClose = () => {
 // 计算 距离下次保养运行时长 H
 const calculateTimePeriod = (item: IotMaintenanceBomVO) => {
   if (item.runningTimeRule === 0) {
+    const totalRunVal = item.totalRunTime ?? item.tempTotalRunTime;
     const next = Number(item.nextRunningTime) || 0;
-    const totalRun = Number(item.totalRunTime) || 0;
+    const totalRun = totalRunVal != null ? Number(totalRunVal) : 0;
     const lastRun = Number(item.lastRunningTime) || 0;
     const result = next - (totalRun - lastRun);
     return Number(result.toFixed(2));
@@ -214,8 +215,9 @@ const calculateTimePeriod = (item: IotMaintenanceBomVO) => {
 // 计算 距离下次保养公里数 KM
 const calculateKiloPeriod = (item: IotMaintenanceBomVO) => {
   if (item.mileageRule === 0) {
+    const totalRunVal = item.totalMileage ?? item.tempTotalMileage;
     const next = Number(item.nextRunningKilometers) || 0;
-    const totalRun = Number(item.totalMileage) || 0;
+    const totalRun = totalRunVal != null ? Number(totalRunVal) : 0;
     const lastRun = Number(item.lastRunningKilometers) || 0;
     const result = next - (totalRun - lastRun);
     return Number(result.toFixed(2));