yanghao 5 дней назад
Родитель
Сommit
5c6ec07d91

+ 6 - 1
src/api/pms/fiveconstructiondailyreport/index.ts

@@ -16,6 +16,11 @@ export const FiveIotProjectDailyReportApi = {
 
   // 日报汇总统计卡片
   getIotProjectDailyReportSummary: async (params) => {
-    return await request.get({ url: 'pms/iot-five-daily-report/totalWorkload', params })
+    return await request.get({ url: '/pms/iot-five-daily-report/totalWorkload', params })
+  },
+
+  // 获取项目日报分页
+  getProjectDailyReportSummaryPage: async (params) => {
+    return await request.get({ url: '/pms/iot-five-daily-report/summaryStatistics', params })
   }
 }

+ 84 - 102
src/views/pms/fiveDailyReportSummary/index.vue

@@ -4,13 +4,13 @@ import CountTo from '@/components/count-to1.vue'
 import { FiveIotProjectDailyReportApi } from '@/api/pms/fiveconstructiondailyreport'
 import { rangeShortcuts } from '@/utils/formatTime'
 import { useDebounceFn } from '@vueuse/core'
-import ConstructionDailyReportTable from '../constructionDailyReport/components/ConstructionDailyReportTable.vue'
+import { useTableComponents } from '@/components/ZmTable/useTableComponents'
 
 defineOptions({ name: 'FiveDailyReportSummary' })
 
-const router = useRouter()
 const route = useRoute()
 const defaultDeptId = 388
+const { ZmTable, ZmTableColumn } = useTableComponents()
 
 const summaryCards = [
   {
@@ -50,12 +50,19 @@ const summaryCards = [
   }
 ]
 
+const tableColumns = [
+  { prop: 'projectDeptName', label: '部门', minWidth: 180 },
+  { prop: 'cumulativeLiquidVolume', label: '注液量(方)', minWidth: 140 },
+  { prop: 'cumulativeMixSand', label: '加砂(方)', minWidth: 140 },
+  { prop: 'cumulativeWorkingLayers', label: '压裂(层)', minWidth: 140 },
+  { prop: 'totalDailyFuel', label: '油耗(L)', minWidth: 140 },
+  { prop: 'utilizationRate', label: '设备利用率(%)', minWidth: 150 }
+]
+
 const createDefaultQuery = () => ({
   pageNo: 1,
   pageSize: 10,
   deptId: defaultDeptId,
-  projectName: '',
-  wellName: '',
   createTime: [
     ...rangeShortcuts[1].value().map((item) => dayjs(item).format('YYYY-MM-DD HH:mm:ss'))
   ]
@@ -75,10 +82,31 @@ const cardStatistics = ref({
   utilizationRate: 0
 })
 
+const syncQueryFromRoute = () => {
+  const createTime = route.query.createTime
+
+  if (Array.isArray(createTime)) {
+    const values = createTime.filter((item) => typeof item === 'string')
+    if (values.length === 2) {
+      query.value.createTime = values
+    }
+  } else if (typeof createTime === 'string') {
+    const values = createTime.split(',').filter(Boolean)
+    if (values.length === 2) {
+      query.value.createTime = values
+    }
+  }
+}
+
 const loadList = useDebounceFn(async () => {
   loading.value = true
   try {
-    const data = await FiveIotProjectDailyReportApi.getIotProjectDailyReportPage(query.value)
+    const data = await FiveIotProjectDailyReportApi.getProjectDailyReportSummaryPage({
+      pageNo: query.value.pageNo,
+      pageSize: query.value.pageSize,
+      deptId: query.value.deptId,
+      createTime: query.value.createTime
+    })
     list.value = data?.list ?? []
     total.value = data?.total ?? 0
   } finally {
@@ -135,42 +163,19 @@ function handleCurrentChange(value) {
   loadList()
 }
 
-function openReport(row) {
-  if (!row.id) return
-
-  router.push({
-    name: 'ConstructionDailyReport',
-    query: {
-      id: row.id
-    }
-  })
-}
-
-function syncQueryFromRoute() {
-  const createTime = route.query.createTime
-
-  if (Array.isArray(createTime)) {
-    const values = createTime.filter((item) => typeof item === 'string')
-    if (values.length === 2) {
-      query.value.createTime = values
-    }
-  } else if (typeof createTime === 'string') {
-    const values = createTime.split(',').filter(Boolean)
-    if (values.length === 2) {
-      query.value.createTime = values
-    }
+function formatCellValue(row, prop) {
+  if (prop === 'utilizationRate') {
+    return row[prop] === null || row[prop] === undefined ? '-' : `${Number(row[prop]).toFixed(2)}%`
   }
+
+  const value = row[prop]
+  return value === null || value === undefined || value === '' ? '-' : value
 }
 
 syncQueryFromRoute()
 
 watch(
-  [
-    () => query.value.projectName,
-    () => query.value.wellName,
-    () => query.value.createTime?.[0],
-    () => query.value.createTime?.[1]
-  ],
+  () => [query.value.createTime?.[0], query.value.createTime?.[1]],
   () => handleQuery(),
   { immediate: true }
 )
@@ -227,22 +232,6 @@ watch(
       label-width="auto"
       class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow px-8 pt-4 pb-4 flex items-center flex-wrap min-w-0">
       <div class="flex items-center gap-2 flex-wrap">
-        <el-form-item label="项目">
-          <el-input
-            v-model="query.projectName"
-            placeholder="请输入项目名称"
-            clearable
-            @keyup.enter="handleQuery()"
-            class="!w-150px" />
-        </el-form-item>
-        <el-form-item label="任务">
-          <el-input
-            v-model="query.wellName"
-            placeholder="请输入生产任务"
-            clearable
-            @keyup.enter="handleQuery()"
-            class="!w-150px" />
-        </el-form-item>
         <el-form-item label="创建时间">
           <el-date-picker
             v-model="query.createTime"
@@ -252,7 +241,7 @@ watch(
             end-placeholder="结束日期"
             :shortcuts="rangeShortcuts"
             :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
-            class="!w-200px" />
+            class="!w-260px" />
         </el-form-item>
 
         <el-form-item>
@@ -271,18 +260,43 @@ watch(
         <h3 class="summary-content__title">{{ currentDeptName }}日报汇总</h3>
       </div>
 
-      <ConstructionDailyReportTable
-        :list="list"
-        :loading="loading"
-        :total="total"
-        :page-no="query.pageNo"
-        :page-size="query.pageSize"
-        @size-change="handleSizeChange"
-        @current-change="handleCurrentChange">
-        <template #action="{ row }">
-          <el-button link type="primary" @click="openReport(row)">查看日报</el-button>
-        </template>
-      </ConstructionDailyReportTable>
+      <div class="summary-table-wrap">
+        <el-auto-resizer class="absolute">
+          <template #default="{ width, height }">
+            <ZmTable
+              :data="list"
+              :loading="loading"
+              :width="width"
+              :height="height"
+              :max-height="height"
+              show-border>
+              <ZmTableColumn type="index" label="序号" :width="70" fixed="left" />
+              <ZmTableColumn
+                v-for="column in tableColumns"
+                :key="column.prop"
+                :prop="column.prop"
+                :label="column.label"
+                :min-width="column.minWidth"
+                show-overflow-tooltip
+                cover-formatter
+                :real-value="(row) => formatCellValue(row, column.prop)" />
+            </ZmTable>
+          </template>
+        </el-auto-resizer>
+      </div>
+
+      <div class="h-8 mt-2 flex items-center justify-end">
+        <el-pagination
+          v-show="total > 0"
+          :current-page="query.pageNo"
+          :page-size="query.pageSize"
+          :background="true"
+          :page-sizes="[10, 20, 30, 50, 100]"
+          :total="total"
+          layout="total, sizes, prev, pager, next, jumper"
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange" />
+      </div>
     </div>
   </div>
 </template>
@@ -355,28 +369,6 @@ watch(
   color: var(--el-text-color-placeholder);
 }
 
-.summary-query-form {
-  min-height: 62px;
-}
-
-.summary-query-fields {
-  min-width: 0;
-  display: flex;
-  flex: 1;
-  flex-wrap: wrap;
-  align-items: center;
-  gap: 16px 32px;
-}
-
-.summary-query-actions :deep(.el-form-item__content) {
-  flex-wrap: nowrap;
-  gap: 8px;
-}
-
-.summary-query-actions :deep(.el-button + .el-button) {
-  margin-left: 0;
-}
-
 .summary-content {
   background: #fff;
   border-radius: 12px;
@@ -401,6 +393,12 @@ watch(
   color: var(--el-text-color-primary);
 }
 
+.summary-table-wrap {
+  position: relative;
+  flex: 1;
+  min-height: 0;
+}
+
 @media (max-width: 1600px) {
   .summary-card__value {
     font-size: 24px;
@@ -408,11 +406,6 @@ watch(
 }
 
 @media (max-width: 1280px) {
-  .summary-query-form {
-    align-items: flex-start;
-    flex-wrap: wrap;
-  }
-
   .summary-card {
     gap: 10px;
     padding: 12px 14px;
@@ -434,15 +427,4 @@ watch(
     font-size: 20px;
   }
 }
-
-.summary-query-actions {
-  :deep(.el-form-item__content) {
-    flex-wrap: nowrap;
-    gap: 8px;
-  }
-
-  :deep(.el-button + .el-button) {
-    margin-left: 0;
-  }
-}
 </style>