Explorar el Código

pms 瑞恒日报 搬迁安装天数

zhangcl hace 2 semanas
padre
commit
fdef445bdc
Se han modificado 1 ficheros con 17 adiciones y 2 borrados
  1. 17 2
      src/views/pms/iotrhdailyreport/index.vue

+ 17 - 2
src/views/pms/iotrhdailyreport/index.vue

@@ -140,7 +140,7 @@
                 <dict-tag :type="DICT_TYPE.PMS_PROJECT_TASK_SCHEDULE" :value="scope.row.constructionStatus" />
               </template>
             </el-table-column>
-            <el-table-column label="搬迁安装天数" align="center" prop="relocationDays" :width="columnWidths.relocationDays"/>
+            <el-table-column label="搬迁安装天数" align="center" prop="relocationDays" :width="columnWidths.relocationDays" :formatter="relocationDaysFormatter"/>
             <el-table-column label="设计注气量(万方)" align="center" prop="designInjection" :width="columnWidths.designInjection"/>
             <el-table-column label="运行时效" align="center" prop="transitTime" :width="columnWidths.transitTime" :formatter="percentageFormatter"/>
             <el-table-column label="当日注气量(万方)" align="center" prop="dailyGasInjection"
@@ -460,6 +460,15 @@ const getList = async () => {
   }
 }
 
+// 搬迁安装天数格式化函数
+const relocationDaysFormatter = (row: any, column: any, cellValue: any, index: number) => {
+  if (cellValue === null || cellValue === undefined || cellValue === '') return '';
+
+  const value = parseFloat(cellValue);
+  // 如果值为负数,显示0,否则显示原值
+  return value < 0 ? '0' : String(value);
+};
+
 // 注气量格式化函数(单位转换:方 -> 万方)
 const gasInjectionFormatter = (row: any, column: any, cellValue: any, index: number) => {
   if (cellValue === null || cellValue === undefined || cellValue === '') return '';
@@ -577,7 +586,13 @@ const calculateColumnWidths = () => {
     // 这里可以获取字典标签,简化处理使用值本身
     return String(row.constructionStatus || '');
   });
-  calculateColumnMinWidth('relocationDays', '搬迁安装天数', (row: any) => row.relocationDays);
+  // 修改搬迁安装天数的宽度计算,使用格式化后的值
+  calculateColumnMinWidth('relocationDays', '搬迁安装天数', (row: any) => {
+    const value = row.relocationDays;
+    if (value === null || value === undefined || value === '') return '';
+    const numValue = parseFloat(value);
+    return numValue < 0 ? '0' : String(numValue);
+  });
   calculateColumnMinWidth('designInjection', '设计注气量(万方)', (row: any) => row.designInjection);
   calculateColumnMinWidth('transitTime', '运行时效', (row: any) => row.transitTime);
   calculateColumnMinWidth('dailyGasInjection', '当日注气量(万方)', (row: any) => row.dailyGasInjection);