Эх сурвалжийг харах

🦄 refactor(瑞恒日报): 调整平均时效计算

Zimo 1 өдөр өмнө
parent
commit
190b5ca36b

+ 10 - 1
src/views/pms/iotrhdailyreport/approval.vue

@@ -118,7 +118,16 @@ const columns = ref<Column[]>([
     label: '运行时效',
     prop: 'transitTime',
     'min-width': '120px',
-    formatter: (row: List) => (row.transitTime * 100).toFixed(2) + '%'
+    formatter: (row: List) => {
+      const capacity = Number(row?.capacity)
+      const dailyGasInjection = Number(row?.dailyGasInjection)
+
+      if (!capacity || !dailyGasInjection) {
+        return '0.00%'
+      }
+
+      return ((dailyGasInjection / capacity) * 100).toFixed(2) + '%'
+    }
   },
   {
     label: '当日',

+ 10 - 1
src/views/pms/iotrhdailyreport/fill.vue

@@ -118,7 +118,16 @@ const columns = ref<Column[]>([
     label: '运行时效',
     prop: 'transitTime',
     'min-width': '120px',
-    formatter: (row: List) => (row.transitTime * 100).toFixed(2) + '%'
+    formatter: (row: List) => {
+      const capacity = Number(row?.capacity)
+      const dailyGasInjection = Number(row?.dailyGasInjection)
+
+      if (!capacity || !dailyGasInjection) {
+        return '0.00%'
+      }
+
+      return ((dailyGasInjection / capacity) * 100).toFixed(2) + '%'
+    }
   },
   {
     label: '当日',

+ 12 - 3
src/views/pms/iotrhdailyreport/index.vue

@@ -710,9 +710,18 @@ const formatDesignWellStruct = (text: string | null | undefined) => {
 
 // 百分比格式化函数
 const percentageFormatter = (row: any, column: any, cellValue: any, index: number | null) => {
-  if (cellValue === null || cellValue === undefined) return ''
-  // 将小数转换为百分比,保留两位小数
-  return `${(parseFloat(cellValue) * 100).toFixed(2)}%`
+  const capacity = Number(row?.capacity)
+  const dailyGasInjection = Number(row?.dailyGasInjection)
+
+  if (!capacity || !dailyGasInjection) {
+    return '0.00%'
+  }
+
+  return ((dailyGasInjection / capacity) * 100).toFixed(2) + '%'
+
+  // if (cellValue === null || cellValue === undefined) return ''
+  // // 将小数转换为百分比,保留两位小数
+  // return `${(parseFloat(cellValue) * 100).toFixed(2)}%`
 }
 
 // 添加打开未填报弹窗的方法