ソースを参照

feat: 增加气电比预警提示与表格高亮

- 在瑞恒日报页面底部新增气电比计算结果预警提示
- 设置气电比大于 15 时触发橙色预警
- 在表格气电比列中增加对应的文字变色与加粗展示
Zimo 21 時間 前
コミット
1d9db8cff3

+ 7 - 1
src/views/pms/iotrhdailyreport/index.vue

@@ -399,13 +399,19 @@ const openUnfilledDialog = () => {
       is-index
       @current-change="handleCurrentChange"
       @size-change="handleSizeChange" />
-    <div class="p-2 bg-white dark:bg-[#1d1e1f] rounded-lg shadow">
+    <div class="p-2 bg-white dark:bg-[#1d1e1f] rounded-lg shadow flex flex-col gap-2">
       <el-alert
         class="h-8!"
         title="运行时效=当日注气量/产能&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;超过120%红色预警"
         type="error"
         show-icon
         :closable="false" />
+      <el-alert
+        class="h-8!"
+        title="气电比计算结果大于15橙色预警"
+        type="warning"
+        show-icon
+        :closable="false" />
     </div>
   </div>
 

+ 29 - 20
src/views/pms/iotrhdailyreport/rh-table.vue

@@ -85,6 +85,8 @@ const { list, loading, total, pageNo, pageSize, showAction, isIndex } = toRefs(p
 
 const { ZmTable, ZmTableColumn } = useTableComponents<ListItem>()
 
+const GAS_ELECTRICITY_RATIO_WARNING_THRESHOLD = 15
+
 function percentageFormatter(row: ListItem) {
   const capacity = Number(row?.capacity)
   const dailyGasInjection = Number(row?.dailyGasInjection)
@@ -107,6 +109,12 @@ function unitformatter(
   return (value / 10000).toFixed(4)
 }
 
+const isGasElectricityRatioWarning = (value: unknown) => {
+  const ratio = Number(value)
+
+  return Number.isFinite(ratio) && ratio > GAS_ELECTRICITY_RATIO_WARNING_THRESHOLD
+}
+
 const cellStyle = ({ row, column }: { row: any; column: any }) => {
   if (column.property === 'transitTime') {
     const capacity = Number(row?.capacity)
@@ -122,6 +130,17 @@ const cellStyle = ({ row, column }: { row: any; column: any }) => {
       }
     }
   }
+
+  if (
+    column.property === 'gasElectricityRatio' &&
+    isGasElectricityRatioWarning(row?.gasElectricityRatio)
+  ) {
+    return {
+      color: 'var(--el-color-warning)',
+      fontWeight: 'bold'
+    }
+  }
+
   return {}
 }
 
@@ -146,22 +165,19 @@ function handleCurrentChange(val: number) {
             :max-height="height"
             :height="height"
             show-border
-            :cell-style="cellStyle"
-          >
+            :cell-style="cellStyle">
             <zm-table-column
               v-if="isIndex"
               type="index"
               :label="t('monitor.serial')"
               :width="60"
-              fixed="left"
-            />
+              fixed="left" />
             <zm-table-column
               label="日期"
               prop="createTime"
               fixed="left"
               cover-formatter
-              :real-value="(row: ListItem) => dayjs(row.createTime).format('YYYY-MM-DD')"
-            />
+              :real-value="(row: ListItem) => dayjs(row.createTime).format('YYYY-MM-DD')" />
             <zm-table-column label="施工队伍" prop="deptName" fixed="left" />
             <zm-table-column label="任务" prop="taskName" fixed="left" />
             <zm-table-column
@@ -171,13 +187,11 @@ function handleCurrentChange(val: number) {
               :real-value="
                 (row: ListItem) =>
                   realValue(DICT_TYPE.PMS_PROJECT_TASK_SCHEDULE, row.constructionStatus ?? '')
-              "
-            >
+              ">
               <template #default="scope">
                 <dict-tag
                   :type="DICT_TYPE.PMS_PROJECT_TASK_SCHEDULE"
-                  :value="scope.row.constructionStatus ?? ''"
-                />
+                  :value="scope.row.constructionStatus ?? ''" />
               </template>
             </zm-table-column>
             <zm-table-column prop="auditStatus" label="审批状态" v-if="!isIndex">
@@ -204,15 +218,13 @@ function handleCurrentChange(val: number) {
               label="运行时效"
               prop="transitTime"
               cover-formatter
-              :real-value="percentageFormatter"
-            />
+              :real-value="percentageFormatter" />
             <zm-table-column label="当日">
               <zm-table-column
                 label="注气量(万方)"
                 prop="dailyGasInjection"
                 cover-formatter
-                :real-value="unitformatter"
-              />
+                :real-value="unitformatter" />
               <zm-table-column label="注水量(方)" prop="dailyWaterInjection" />
               <zm-table-column label="注气时间(H)" prop="dailyInjectGasTime" />
               <zm-table-column label="注水时间(H)" prop="dailyInjectWaterTime" />
@@ -224,8 +236,7 @@ function handleCurrentChange(val: number) {
               prop="nonProductionRate"
               label="非生产时效"
               cover-formatter
-              :real-value="(row) => (Number(row.nonProductionRate ?? 0) * 100).toFixed(2) + '%'"
-            />
+              :real-value="(row) => (Number(row.nonProductionRate ?? 0) * 100).toFixed(2) + '%'" />
             <zm-table-column label="非生产时间">
               <zm-table-column prop="accidentTime" label="工程质量" />
               <zm-table-column prop="repairTime" label="设备故障" />
@@ -265,8 +276,7 @@ function handleCurrentChange(val: number) {
               label="产能(万方)"
               cover-formatter
               :action="!showAction"
-              :real-value="unitformatter"
-            />
+              :real-value="unitformatter" />
 
             <zm-table-column label="操作" :width="120" fixed="right" action v-if="showAction">
               <template #default="scope">
@@ -288,8 +298,7 @@ function handleCurrentChange(val: number) {
         :total="total"
         layout="total, sizes, prev, pager, next, jumper"
         @size-change="handleSizeChange"
-        @current-change="handleCurrentChange"
-      />
+        @current-change="handleCurrentChange" />
     </div>
   </div>
 </template>