Bladeren bron

pms 瑞恒日报 累计工作量 统计

zhangcl 2 weken geleden
bovenliggende
commit
924f0c668e
2 gewijzigde bestanden met toevoegingen van 63 en 3 verwijderingen
  1. 5 0
      src/api/pms/iotrhdailyreport/index.ts
  2. 58 3
      src/views/pms/iotrhdailyreport/index.vue

+ 5 - 0
src/api/pms/iotrhdailyreport/index.ts

@@ -42,6 +42,11 @@ export const IotRhDailyReportApi = {
     return await request.get({ url: `/pms/iot-rh-daily-report/page`, params })
   },
 
+  // 累计工作量统计
+  totalWorkload: async (params: any) => {
+    return await request.get({ url: `/pms/iot-rh-daily-report/totalWorkload`, params })
+  },
+
   // 按照日期查询瑞恒日报统计数据 已填报 未填报 数量
   rhDailyReportStatistics: async (params: any) => {
     return await request.get({ url: `/pms/iot-rh-daily-report/rhDailyReportStatistics`, params })

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

@@ -68,7 +68,7 @@
         </el-form>
       </ContentWrap>
 
-      <!-- 新增数据统计区域 -->
+      <!-- 数据统计区域 -->
       <ContentWrap class="mb-15px">
         <div class="statistics-container">
           <div class="stat-item" :style="{ color: totalColor }">
@@ -89,6 +89,14 @@
               {{ statistics.unFilled || '-' }}
             </span>
           </div>
+          <div class="stat-item" :style="{ color: '#0099CC' }">
+            <span>累计注水量(方):</span>
+            <span>{{ statistics.totalWaterInjection || '-' }}</span>
+          </div>
+          <div class="stat-item" :style="{ color: '#FF9900' }">
+            <span>累计注气量(万方):</span>
+            <span>{{ statistics.totalGasInjection || '-' }}</span>
+          </div>
         </div>
       </ContentWrap>
 
@@ -291,8 +299,11 @@ const rootDeptId = ref(157)
 const statistics = ref({
   total: '-',
   filled: '-',
-  unFilled: '-'
+  unFilled: '-',
+  totalWaterInjection: '-', // 新增累计注水量
+  totalGasInjection: '-'    // 新增累计注气量
 })
+
 const totalColor = '#00DD99'
 const filledColor = '#0055BB'
 const unFilledColor = '#FF5500'
@@ -302,6 +313,12 @@ const tableRef = ref()
 // 表格容器引用
 const tableContainerRef = ref()
 
+// 工作量统计相关变量
+const workloadStatistics = ref({
+  totalWaterInjection: '-',
+  totalGasInjection: '-'
+})
+
 // 列宽度配置
 const columnWidths = ref({
   deptName: '120px',
@@ -431,6 +448,9 @@ const getList = async () => {
     // 获取统计数据
     await getStatistics()
 
+    // 获取工作量统计数据
+    await getWorkloadStatistics()
+
     // 获取数据后计算列宽
     nextTick(() => {
       calculateColumnWidths();
@@ -617,6 +637,33 @@ const calculateColumnWidths = () => {
   });
 };
 
+// 获取工作量统计数据的方法
+const getWorkloadStatistics = async () => {
+  // 重置工作量统计数据
+  statistics.value.totalWaterInjection = '-'
+  statistics.value.totalGasInjection = '-'
+
+  try {
+    const res = await IotRhDailyReportApi.totalWorkload(queryParams)
+
+    // 处理工作量统计数据
+    if (res) {
+      // 累计注水量直接显示,单位:方
+      statistics.value.totalWaterInjection = res.totalWaterInjection || '-'
+
+      // 累计注气量需要转换:方 -> 万方 (除以10000)
+      if (res.totalGasInjection) {
+        const gasInjection = parseFloat(res.totalGasInjection)
+        statistics.value.totalGasInjection = (gasInjection / 10000).toFixed(2)
+      } else {
+        statistics.value.totalGasInjection = '-'
+      }
+    }
+  } catch (error) {
+    console.error('获取工作量统计数据失败', error)
+  }
+}
+
 /** 搜索按钮操作 */
 const handleQuery = () => {
   queryParams.pageNo = 1
@@ -628,6 +675,8 @@ const resetQuery = () => {
   queryFormRef.value.resetFields()
   // 重置后需要重新获取统计数据
   getStatistics()
+  // 重新获取工作量统计数据
+  getWorkloadStatistics()
   handleQuery()
 }
 
@@ -828,7 +877,7 @@ watch(list, () => {
 .statistics-container {
   display: flex;
   justify-content: space-around;
-  padding: 15px 0;
+  padding: 10px 0;
 }
 
 .stat-item {
@@ -836,5 +885,11 @@ watch(list, () => {
   text-align: center;
   font-size: 16px;
   font-weight: 500;
+  min-width: 0; /* 防止内容溢出 */
+}
+
+/* 确保统计项内容不换行 */
+.stat-item span {
+  white-space: nowrap;
 }
 </style>