Quellcode durchsuchen

bug 修复生产运用会议设备利用率计算 0 边界情况

Zimo vor 6 Tagen
Ursprung
Commit
3258696a1a

+ 9 - 6
src/views/pms/operation-meeting/components/meeting-detail-drawer.vue

@@ -297,10 +297,13 @@ const updateEquipmentUtilizationExtProperty = () => {
   const constructionCount = parseNumberValue(constructionItem.actualValue)
   const operatingCount = parseNumberValue(operatingItem.actualValue)
 
-  utilizationItem.actualValue =
-    constructionCount === undefined || operatingCount === undefined || operatingCount === 0
-      ? undefined
-      : Number(((constructionCount / operatingCount) * 100).toFixed(2))
+  if (constructionCount === undefined || operatingCount === undefined) {
+    utilizationItem.actualValue = undefined
+  } else if (operatingCount === 0) {
+    utilizationItem.actualValue = 0
+  } else {
+    utilizationItem.actualValue = Number(((constructionCount / operatingCount) * 100).toFixed(2))
+  }
 
   nextTick(() => detailFormRef.value?.clearValidate(getExtPropertyProp(utilizationItem)))
 }
@@ -570,7 +573,7 @@ onMounted(() => {
             :rules="getExtPropertyRules(item)">
             <el-input-number
               v-if="isDoubleExtProperty(item)"
-              v-model="item.actualValue"
+              v-model="item.actualValue as any"
               class="w-full!"
               :controls="false"
               :disabled="isReadonly || isEquipmentUtilizationExtProperty(item)"
@@ -646,7 +649,7 @@ onMounted(() => {
             :rules="getExtPropertyRules(item)">
             <el-input-number
               v-if="isDoubleExtProperty(item)"
-              v-model="item.actualValue"
+              v-model="item.actualValue as any"
               class="w-full!"
               :controls="false"
               :disabled="isReadonly"