Kaynağa Gözat

🦄 refactor: 瑞都日报汇总

Zimo 1 gün önce
ebeveyn
işleme
4da53a088d

+ 2 - 5
src/views/pms/iotrddailyreport/fillDailyReport.vue

@@ -14,7 +14,7 @@ defineOptions({ name: 'FillDailyReport' })
 // const { t } = useI18n()
 
 const router = useRouter()
-const route = useRoute()
+// const route = useRoute()
 
 // const message = useMessage()
 
@@ -36,10 +36,7 @@ interface Query {
 const initQuery: Query = {
   pageNo: 1,
   pageSize: 10,
-  deptId: route.query.deptId ? Number(route.query.deptId) : id,
-  createTime: route.query.createTime ? (route.query.createTime as string[]) : undefined,
-  wellName: route.query.wellName ? (route.query.wellName as string) : undefined,
-  taskId: route.query.taskId ? Number(route.query.taskId) : undefined
+  deptId: id
 }
 
 const query = ref<Query>({ ...initQuery })

+ 262 - 727
src/views/pms/iotrddailyreport/statistics.vue

@@ -1,782 +1,317 @@
-<template>
-  <el-row :gutter="20">
-    <el-col :span="4" :xs="24">
-      <ContentWrap class="h-1/1">
-        <DeptTree2 :deptId="rootDeptId" @node-click="handleDeptNodeClick" />
-      </ContentWrap>
-    </el-col>
-    <el-col :span="20" :xs="24">
-      <ContentWrap>
-        <!-- 搜索工作栏 -->
-        <el-form
-          class="-mb-15px"
-          :model="queryParams"
-          ref="queryFormRef"
-          :inline="true"
-          label-width="68px"
-        >
-          <el-form-item label="项目" prop="contractName">
-            <el-input
-              v-model="queryParams.contractName"
-              placeholder="请输入项目"
-              clearable
-              @keyup.enter="handleQuery"
-              class="!w-240px"
-            />
-          </el-form-item>
-          <el-form-item label="任务" prop="taskName">
-            <el-input
-              v-model="queryParams.taskName"
-              placeholder="请输入任务"
-              clearable
-              @keyup.enter="handleQuery"
-              class="!w-240px"
-            />
-          </el-form-item>
-          <el-form-item label="创建时间" prop="createTime">
-            <el-date-picker
-              v-model="queryParams.createTime"
-              value-format="YYYY-MM-DD HH:mm:ss"
-              type="daterange"
-              start-placeholder="开始日期"
-              end-placeholder="结束日期"
-              :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
-              class="!w-220px"
-              :shortcuts="rangeShortcuts"
-            />
-          </el-form-item>
-          <el-form-item>
-            <el-button @click="handleQuery">
-              <Icon icon="ep:search" class="mr-5px" /> 搜索
-            </el-button>
-            <el-button @click="resetQuery">
-              <Icon icon="ep:refresh" class="mr-5px" /> 重置
-            </el-button>
-            <el-button
-              type="primary"
-              plain
-              @click="openForm('create')"
-              v-hasPermi="['pms:iot-rd-daily-report:create']"
-            >
-              <Icon icon="ep:plus" class="mr-5px" /> 新增
-            </el-button>
-            <el-button type="success" plain @click="handleExport" :loading="exportLoading">
-              <Icon icon="ep:download" class="mr-5px" /> 导出
-            </el-button>
-          </el-form-item>
-        </el-form>
-      </ContentWrap>
-
-      <!-- 列表 -->
-      <ContentWrap ref="tableContainerRef">
-        <el-table
-          ref="tableRef"
-          v-loading="loading"
-          :data="list"
-          :stripe="true"
-          :style="{ width: '100%' }"
-          max-height="600"
-          show-overflow-tooltip
-          border
-        >
-          <el-table-column
-            label="施工状态"
-            align="center"
-            prop="rdStatus"
-            :width="columnWidths.rdStatus"
-          >
-            <template #default="scope">
-              <dict-tag :type="DICT_TYPE.PMS_PROJECT_RD_STATUS" :value="scope.row.rdStatus" />
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="施工周期(D)"
-            align="center"
-            prop="period"
-            :width="columnWidths.projectDeptName"
-          />
-          <el-table-column
-            label="任务开始日期"
-            align="center"
-            prop="taskStartDate"
-            :width="columnWidths.projectDeptName"
-          />
-          <el-table-column
-            label="项目部"
-            align="center"
-            prop="projectDeptName"
-            :width="columnWidths.projectDeptName"
-          />
-          <el-table-column
-            label="队伍"
-            align="center"
-            prop="deptName"
-            :width="columnWidths.deptName"
-          />
-
-          <el-table-column
-            label="井号"
-            align="center"
-            prop="wellName"
-            :width="columnWidths.wellName"
-          >
-            <template #default="scope">
-              <el-link
-                type="primary"
-                @click="handleWellNameClick(scope.row.taskId)"
-                :underline="false"
-              >
-                {{ scope.row.wellName }}
-              </el-link>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="工艺"
-            align="center"
-            prop="techniques"
-            :width="columnWidths.techniques"
-          />
-          <el-table-column
-            label="总工作量"
-            align="center"
-            prop="workloadDesign"
-            :width="columnWidths.workloadDesign"
-          />
-          <el-table-column
-            label="油耗(L)"
-            align="center"
-            prop="totalDailyFuel"
-            :width="columnWidths.totalDailyFuel"
-          />
-          <!-- 已完成工作量分组列 -->
-          <el-table-column label="已完成工作量" align="center">
-            <!-- 动态生成列 -->
-            <el-table-column
-              v-for="column in dynamicColumns"
-              :key="column"
-              :label="column"
-              :prop="column"
-              align="center"
-              min-width="120"
-            >
-              <template #default="scope">
-                {{ getWorkloadByUnit(scope.row.items, column) }}
-              </template>
-            </el-table-column>
-          </el-table-column>
-          <!-- <el-table-column label="非生产时间" align="center">
-            <el-table-column
-              label="工程质量"
-              align="center"
-              prop="accidentTime"
-              :min-width="80"
-              resizable
-            />
-            <el-table-column
-              label="设备故障"
-              align="center"
-              prop="repairTime"
-              :min-width="80"
-              resizable
-            />
-            <el-table-column
-              label="设备保养"
-              align="center"
-              prop="selfStopTime"
-              :min-width="80"
-              resizable
-            />
-            <el-table-column
-              label="技术受限"
-              align="center"
-              prop="complexityTime"
-              :min-width="80"
-              resizable
-            />
-            <el-table-column
-              label="生产配合"
-              align="center"
-              prop="relocationTime"
-              :min-width="80"
-              resizable
-            />
-            <el-table-column
-              label="生产组织"
-              align="center"
-              prop="rectificationTime"
-              :min-width="80"
-              resizable
-            />
-            <el-table-column
-              label="不可抗力"
-              align="center"
-              prop="waitingStopTime"
-              :min-width="80"
-              resizable
-            />
-            <el-table-column
-              label="待命"
-              align="center"
-              prop="winterBreakTime"
-              :min-width="80"
-              resizable
-            />
-            <el-table-column
-              label="甲方设计"
-              align="center"
-              prop="partyaDesign"
-              :min-width="80"
-              resizable
-            />
-            <el-table-column
-              label="甲方准备"
-              align="center"
-              prop="partyaPrepare"
-              :min-width="80"
-              resizable
-            />
-            <el-table-column
-              label="甲方资源"
-              align="center"
-              prop="partyaResource"
-              :min-width="80"
-              resizable
-            />
-            <el-table-column
-              label="其它非生产时间"
-              align="center"
-              prop="otherNptTime"
-              :min-width="120"
-              resizable
-            />
-          </el-table-column> -->
-          <el-table-column
-            label="非生产时效"
-            align="center"
-            prop="nonProductionRate"
-            :min-width="80"
-            resizable
-            :formatter="(row) => (Number(row.nonProductionRate ?? 0) * 100).toFixed(2) + '%'"
-          />
-          <el-table-column
-            label="甲方"
-            align="center"
-            prop="manufactureName"
-            :width="columnWidths.manufactureName"
-          />
-          <!--
-          <el-table-column label="操作" align="center" min-width="120px" fixed="right">
-            <template #default="scope">
-
-              <el-button
-                link
-                type="primary"
-                @click="openForm('update', scope.row.id)"
-                v-hasPermi="['pms:iot-rd-daily-report:update']"
-              >
-                编辑
-              </el-button>
-              <el-button
-                link
-                type="warning"
-                @click="handleApprove(scope.row.id)"
-                v-hasPermi="['pms:iot-rd-daily-report:update']"
-              >
-                审批
-              </el-button>
-            </template>
-          </el-table-column> -->
-        </el-table>
-        <!-- 分页 -->
-        <Pagination
-          :total="total"
-          v-model:page="queryParams.pageNo"
-          v-model:limit="queryParams.pageSize"
-          @pagination="handlePagination"
-        />
-      </ContentWrap>
-
-      <!-- 表单弹窗:添加/修改 -->
-      <IotRdDailyReportForm ref="formRef" @success="getList" />
-    </el-col>
-  </el-row>
-</template>
-
-<script setup lang="ts">
-import { dateFormatter } from '@/utils/formatTime'
-import { IotRdDailyReportApi, IotRdDailyReportVO } from '@/api/pms/iotrddailyreport'
+<script lang="ts" setup>
+import { IotRdDailyReportApi } from '@/api/pms/iotrddailyreport'
+import { useTableComponents } from '@/components/ZmTable/useTableComponents'
+import { useUserStore } from '@/store/modules/user'
+import { DICT_TYPE, getDictOptions } from '@/utils/dict'
+import { rangeShortcuts } from '@/utils/formatTime'
+import { useDebounceFn } from '@vueuse/core'
 import IotRdDailyReportForm from './IotRdDailyReportForm.vue'
-import { DICT_TYPE, getDictLabel } from '@/utils/dict'
-import { ref, reactive, onMounted, computed } from 'vue'
-import DeptTree2 from '@/views/pms/iotrhdailyreport/DeptTree2.vue'
-
-import dayjs from 'dayjs'
-import quarterOfYear from 'dayjs/plugin/quarterOfYear'
 import download from '@/utils/download'
 
-dayjs.extend(quarterOfYear)
+defineOptions({ name: 'IotRdDailyReport' })
+
+const { t } = useI18n()
+const router = useRouter()
+const message = useMessage()
+const userStore = useUserStore()
+const id = userStore.getUser.deptId
+const deptId = id
+
+interface Query {
+  deptId?: number
+  contractName?: string
+  taskName?: string
+  createTime?: string[]
+  wellName?: string
+  taskId?: number
+}
 
-const rangeShortcuts = [
-  {
-    text: '今天',
-    value: () => {
-      const today = dayjs()
-      return [today.startOf('day').toDate(), today.endOf('day').toDate()]
-    }
-  },
-  {
-    text: '昨天',
-    value: () => {
-      const yesterday = dayjs().subtract(1, 'day')
-      return [yesterday.startOf('day').toDate(), yesterday.endOf('day').toDate()]
-    }
-  },
-  {
-    text: '本周',
-    value: () => {
-      return [dayjs().startOf('week').toDate(), dayjs().endOf('week').toDate()]
-    }
-  },
-  {
-    text: '上周',
-    value: () => {
-      const lastWeek = dayjs().subtract(1, 'week')
-      return [lastWeek.startOf('week').toDate(), lastWeek.endOf('week').toDate()]
-    }
-  },
-  {
-    text: '本月',
-    value: () => {
-      return [dayjs().startOf('month').toDate(), dayjs().endOf('month').toDate()]
-    }
-  },
-  {
-    text: '上月',
-    value: () => {
-      const lastMonth = dayjs().subtract(1, 'month')
-      return [lastMonth.startOf('month').toDate(), lastMonth.endOf('month').toDate()]
-    }
-  },
-  {
-    text: '本季度',
-    value: () => {
-      return [dayjs().startOf('quarter').toDate(), dayjs().endOf('quarter').toDate()]
-    }
-  },
-  {
-    text: '上季度',
-    value: () => {
-      const lastQuarter = dayjs().subtract(1, 'quarter')
-      return [lastQuarter.startOf('quarter').toDate(), lastQuarter.endOf('quarter').toDate()]
-    }
-  },
-  {
-    text: '今年',
-    value: () => {
-      return [dayjs().startOf('year').toDate(), dayjs().endOf('year').toDate()]
-    }
-  },
-  {
-    text: '去年',
-    value: () => {
-      const lastYear = dayjs().subtract(1, 'year')
-      return [lastYear.startOf('year').toDate(), lastYear.endOf('year').toDate()]
-    }
-  },
-  {
-    text: '最近7天',
-    value: () => {
-      return [dayjs().subtract(6, 'day').toDate(), dayjs().toDate()]
-    }
-  },
-  {
-    text: '最近30天',
-    value: () => {
-      return [dayjs().subtract(29, 'day').toDate(), dayjs().toDate()]
-    }
-  },
-  {
-    text: '最近90天',
-    value: () => {
-      return [dayjs().subtract(89, 'day').toDate(), dayjs().toDate()]
-    }
-  },
-  {
-    text: '最近一年',
-    value: () => {
-      return [dayjs().subtract(1, 'year').toDate(), dayjs().toDate()]
-    }
-  }
-]
+const initQuery: Query = {
+  deptId: id
+}
 
-/** 瑞都日报 汇总统计 */
-defineOptions({ name: 'IotRdDailyReportStatistics' })
+const query = ref<Query>({ ...initQuery })
+
+const currentPage = ref(1)
+const pageSize = ref(10)
+
+interface ListItem {
+  rdStatus: string
+  period: string
+  taskStartDate: string
+  projectDeptName: string
+  deptName: string
+  wellName: string
+  taskId: number
+  items: any[]
+  techniques: string
+  workloadDesign: string
+  totalDailyFuel: string
+  nonProductionRate: number
+  manufactureName: string
+}
 
-const message = useMessage() // 消息弹窗
-const { t } = useI18n() // 国际化
-const { push } = useRouter() // 路由跳转
-const loading = ref(true) // 列表的加载中
-const total = ref(0) // 列表的总页数
-const queryParams = reactive({
-  pageNo: 1,
-  pageSize: 10,
-  deptId: undefined,
-  projectId: undefined,
-  contractName: undefined,
-  taskId: undefined,
-  taskName: undefined,
-  projectClassification: undefined,
-  techniqueIds: undefined,
-  deviceIds: undefined,
-  startTime: [],
-  endTime: [],
-  cumulativeWorkingWell: undefined,
-  cumulativeWorkingLayers: undefined,
-  dailyPumpTrips: undefined,
-  dailyToolsSand: undefined,
-  runCount: undefined,
-  bridgePlug: undefined,
-  waterVolume: undefined,
-  hourCount: undefined,
-  dailyFuel: undefined,
-  dailyPowerUsage: undefined,
-  productionTime: [],
-  nonProductionTime: [],
-  rdNptReason: undefined,
-  constructionStartDate: [],
-  constructionEndDate: [],
-  productionStatus: undefined,
-  externalRental: undefined,
-  nextPlan: undefined,
-  rdStatus: undefined,
-  malfunction: undefined,
-  faultDowntime: [],
-  personnel: undefined,
-  totalStaffNum: undefined,
-  leaveStaffNum: undefined,
-  extProperty: undefined,
-  sort: undefined,
-  remark: undefined,
-  status: undefined,
-  processInstanceId: undefined,
-  auditStatus: undefined,
-  createTime: []
-})
-const queryFormRef = ref() // 搜索的表单
-// 导出的加载中
+const allList = ref<ListItem[]>([])
+const total = ref(0)
+const loading = ref(false)
 
-const rootDeptId = ref(163)
+const pagedList = computed(() => {
+  const start = (currentPage.value - 1) * pageSize.value
+  const end = start + pageSize.value
+  return allList.value.slice(start, end)
+})
 
-// 响应式数据
-const allList = ref<IotRdDailyReportVO[]>([]) // 存储所有数据
-const list = ref<IotRdDailyReportVO[]>([]) // 存储当前页数据
+const loadList = useDebounceFn(async function () {
+  loading.value = true
+  try {
+    const data: any = await IotRdDailyReportApi.statistics(query.value)
 
-// 表格引用
-const tableRef = ref()
-// 表格容器引用
-const tableContainerRef = ref()
+    let rawList: ListItem[] = []
+    rawList = data
+    allList.value = rawList
+    total.value = rawList.length
+  } finally {
+    loading.value = false
+  }
+})
 
-// 计算属性:获取所有动态列(去重的unit)
 const dynamicColumns = computed(() => {
   const units = new Set()
-  list.value.forEach((item) => {
+  allList.value.forEach((item) => {
     item.items.forEach((subItem) => {
       if (subItem.unit) {
         units.add(subItem.unit)
       }
     })
   })
-  return Array.from(units)
+  return Array.from(units) as string[]
 })
 
-// 根据unit获取对应workload
-const getWorkloadByUnit = (items, unit) => {
+const getWorkloadByUnit = (items: any[], unit: string) => {
   if (!items || !Array.isArray(items)) return ''
   const targetItem = items.find((item) => item.unit === unit)
   return targetItem ? targetItem.workload : ''
 }
 
-// 列宽度配置
-const columnWidths = ref({
-  id: '80px',
-  rdStatus: '120px', // 施工状态列默认宽度
-  projectDeptName: '120px',
-  contractName: '120px',
-  deptName: '120px',
-  manufactureName: '200px',
-  wellName: '120px',
-  techniques: '120px',
-  workloadDesign: '120px',
-  totalDailyFuel: '120px',
-  operation: '120px'
-})
-
-// 计算文本宽度
-const getTextWidth = (text: string, fontSize = 14) => {
-  const span = document.createElement('span')
-  span.style.visibility = 'hidden'
-  span.style.position = 'absolute'
-  span.style.whiteSpace = 'nowrap'
-  span.style.fontSize = `${fontSize}px`
-  span.style.fontFamily = 'inherit'
-  span.innerText = text
-
-  document.body.appendChild(span)
-  const width = span.offsetWidth
-  document.body.removeChild(span)
-
-  return width
-}
-
-// 计算列宽度
-const calculateColumnWidths = () => {
-  const MIN_WIDTH = 80 // 最小列宽
-  const PADDING = 25 // 列内边距
-
-  // 确保表格容器存在
-  if (!tableContainerRef.value?.$el) return
-
-  const newWidths: Record<string, string> = {}
-
-  // 计算各列宽度的函数
-  const calculateColumnWidth = (key: string, label: string, getValue: Function) => {
-    const headerWidth = getTextWidth(label) + PADDING
-    let contentMaxWidth = MIN_WIDTH
-
-    // 计算内容最大宽度
-    list.value.forEach((row, index) => {
-      let text = ''
-      if (key === 'rdStatus') {
-        // 特殊处理字典列,这里简化处理,实际应该获取字典标签
-        text = String(row[key] || '')
-      } else if (key.includes('Date') || key === 'createTime') {
-        // 日期列使用格式化后的值
-        text = dateFormatter(null, null, row[key]) || ''
-      } else {
-        text = String(getValue ? getValue(row, index) : row[key] || '')
-      }
-
-      const textWidth = getTextWidth(text) + PADDING
-      if (textWidth > contentMaxWidth) contentMaxWidth = textWidth
-    })
-
-    // 取标题宽度和内容最大宽度的较大值
-    const finalWidth = Math.max(headerWidth, contentMaxWidth, MIN_WIDTH)
-    newWidths[key] = `${finalWidth}px`
-  }
-
-  // 计算施工状态列宽度(使用字典标签文本计算)
-  calculateColumnWidth('rdStatus', '施工状态', (row: any) => {
-    // 用字典标签(如"完工")而非原始编码(如"wg")计算宽度
-    return getDictLabel(DICT_TYPE.PMS_PROJECT_RD_STATUS, row.rdStatus) || row.rdStatus
-  })
-
-  // 计算各列宽度
-  calculateColumnWidth('projectDeptName', '项目部', (row: any) => row.projectDeptName)
-  calculateColumnWidth('deptName', '队伍', (row: any) => row.deptName)
-  calculateColumnWidth('manufactureName', '甲方', (row: any) => row.manufactureName)
-  calculateColumnWidth('wellName', '井号', (row: any) => row.wellName)
-  calculateColumnWidth('techniques', '工艺', (row: any) => row.techniques)
-  calculateColumnWidth('workloadDesign', '总工作量', (row: any) => row.workloadDesign)
-  calculateColumnWidth('totalDailyFuel', '油耗(L)', (row: any) => row.totalDailyFuel)
-
-  // 操作列固定宽度
-  newWidths.operation = '120px'
-  // id列固定宽度(虽然隐藏)
-  newWidths.id = '80px'
-
-  // 更新列宽配置
-  columnWidths.value = newWidths
-
-  // 触发表格重新布局
-  nextTick(() => {
-    tableRef.value?.doLayout()
-  })
-}
-
-/** 查询列表 */
-const getList = async () => {
-  loading.value = true
-  try {
-    const data = await IotRdDailyReportApi.statistics(queryParams)
-    // 存储所有数据
-    allList.value = data
-    // 计算总条数
-    total.value = data.length
-    // 执行前端分页
-    handleFrontendPagination()
-    // 获取数据后计算列宽
-    nextTick(() => {
-      calculateColumnWidths()
-    })
-  } finally {
-    loading.value = false
-  }
-}
-
-/** 井号点击操作 */
-const handleWellNameClick = (taskId: number) => {
-  if (!taskId) return
-
-  // 跳转到日报列表页面,传递井号参数
-  push({
-    name: 'IotRdDailyReport',
-    query: {
-      // wellName: wellName
-      taskId: taskId
-    }
-  })
-}
-
-// 响应式变量存储选中的部门
-const selectedDept = ref<{ id: number; name: string }>()
-/** 处理部门被点击 */
-const handleDeptNodeClick = async (row) => {
-  // 记录选中的部门信息
-  selectedDept.value = { id: row.id, name: row.name }
-  queryParams.deptId = row.id
-  await getList()
+function handleSizeChange(val: number) {
+  pageSize.value = val
+  currentPage.value = 1
 }
 
-/** 前端分页处理 */
-const handleFrontendPagination = () => {
-  const { pageNo, pageSize } = queryParams
-  const startIndex = (pageNo - 1) * pageSize
-  const endIndex = startIndex + pageSize
-
-  // 对全部数据进行分页切片
-  list.value = allList.value.slice(startIndex, endIndex)
+function handleCurrentChange(val: number) {
+  currentPage.value = val
 }
 
-/** 搜索按钮操作 */
-const handleQuery = () => {
-  queryParams.pageNo = 1
-  getList()
+// 搜索事件
+function handleQuery() {
+  currentPage.value = 1
+  loadList()
 }
 
-/** 重置按钮操作 */
-const resetQuery = () => {
-  queryFormRef.value.resetFields()
+function resetQuery() {
+  query.value = { ...initQuery }
   handleQuery()
 }
 
-/** 分页事件处理 */
-const handlePagination = (pagination: any) => {
-  queryParams.pageNo = pagination.page
-  queryParams.pageSize = pagination.limit
-  // 使用前端分页,不重新调用接口
-  handleFrontendPagination()
-}
+watch(
+  [
+    () => query.value.deptId,
+    () => query.value.contractName,
+    () => query.value.taskName,
+    () => query.value.createTime
+  ],
+  () => {
+    handleQuery()
+  },
+  { immediate: true }
+)
 
-/** 添加/修改操作 */
 const formRef = ref()
 const openForm = (type: string, id?: number) => {
   formRef.value.open(type, id)
 }
 
-/** 审批按钮操作 */
-const handleApprove = async (id: number) => {
-  try {
-    // 跳转到 FillDailyReportForm 页面,传递审批模式和ID
-    push({
-      name: 'FillDailyReportForm',
-      params: {
-        id: id.toString(),
-        mode: 'approval' // 添加审批模式标识
-      }
-    })
-  } catch (error) {
-    console.error('跳转审批页面失败:', error)
-  }
-}
-
-/** 删除按钮操作 */
-const handleDelete = async (id: number) => {
-  try {
-    // 删除的二次确认
-    await message.delConfirm()
-    // 发起删除
-    await IotRdDailyReportApi.deleteIotRdDailyReport(id)
-    message.success(t('common.delSuccess'))
-    // 刷新列表
-    await getList()
-  } catch {}
-}
-
 const exportLoading = ref(false)
-const handleExport = async () => {
-  const res = await IotRdDailyReportApi.exportIotRdDailyReport({
-    createTime: queryParams.createTime,
-    contractName: queryParams.contractName,
-    taskName: queryParams.taskName,
-    // pageNo: queryParams.pageNo,
-    // pageSize: queryParams.pageSize,
-    deptId: queryParams.deptId
-  })
 
-  download.excel(res, '瑞都日报汇总.xlsx')
-}
+async function handleExport() {
+  try {
+    await message.exportConfirm()
 
-// 声明 ResizeObserver 实例
-let resizeObserver: ResizeObserver | null = null
+    exportLoading.value = true
+    const res = await IotRdDailyReportApi.exportIotRdDailyReport(query.value)
 
-/** 初始化 **/
-onMounted(() => {
-  getList()
-  // 创建 ResizeObserver 监听表格容器尺寸变化
-  if (tableContainerRef.value?.$el) {
-    resizeObserver = new ResizeObserver(() => {
-      // 使用防抖避免频繁触发
-      clearTimeout((window as any).resizeTimer)
-      ;(window as any).resizeTimer = setTimeout(() => {
-        calculateColumnWidths()
-      }, 100)
-    })
-    resizeObserver.observe(tableContainerRef.value.$el)
+    download.excel(res, '瑞都日报汇总.xlsx')
+  } finally {
+    exportLoading.value = false
   }
-})
+}
 
-onUnmounted(() => {
-  // 清除 ResizeObserver
-  if (resizeObserver && tableContainerRef.value?.$el) {
-    resizeObserver.unobserve(tableContainerRef.value.$el)
-    resizeObserver = null
-  }
+const { ZmTable, ZmTableColumn } = useTableComponents<ListItem>()
 
-  // 清除定时器
-  if ((window as any).resizeTimer) {
-    clearTimeout((window as any).resizeTimer)
-  }
-})
+function realValue(type: any, value: string) {
+  const option = getDictOptions(type).find((item) => item.value === value)
+  return option?.label || value
+}
 
-// 监听查询参数变化,实现前端分页
-watch([() => queryParams.pageNo, () => queryParams.pageSize], () => {
-  handleFrontendPagination()
-})
+function handleWellNameClick(taskId: number) {
+  if (!taskId) return
 
-// 监听列表数据变化重新计算列宽
-watch(
-  list,
-  () => {
-    nextTick(calculateColumnWidths)
-  },
-  { deep: true }
-)
+  router.push({
+    name: 'IotRdDailyReport',
+    query: {
+      taskId: taskId
+    }
+  })
+}
 </script>
 
-<style scoped>
-/* 确保表格单元格内容不换行 */
-:deep(.el-table .cell) {
-  white-space: nowrap;
-}
+<template>
+  <div
+    class="grid grid-cols-[15%_1fr] grid-rows-[62px_1fr] gap-4 h-[calc(100vh-20px-var(--top-tool-height)-var(--tags-view-height)-var(--app-footer-height))]"
+  >
+    <div class="p-4 bg-white dark:bg-[#1d1e1f] shadow rounded-lg row-span-2">
+      <DeptTreeSelect :top-id="163" :deptId="deptId" v-model="query.deptId" :show-title="false" />
+    </div>
+    <el-form
+      size="default"
+      class="bg-white dark:bg-[#1d1e1f] rounded-lg shadow px-8 gap-8 flex items-center justify-between"
+    >
+      <div class="flex items-center gap-8">
+        <el-form-item label="项目">
+          <el-input
+            v-model="query.contractName"
+            placeholder="请输入项目"
+            clearable
+            @keyup.enter="handleQuery()"
+            class="!w-240px"
+          />
+        </el-form-item>
+        <el-form-item label="任务">
+          <el-input
+            v-model="query.taskName"
+            placeholder="请输入任务"
+            clearable
+            @keyup.enter="handleQuery()"
+            class="!w-240px"
+          />
+        </el-form-item>
+        <el-form-item label="创建时间" prop="createTime">
+          <el-date-picker
+            v-model="query.createTime"
+            value-format="YYYY-MM-DD HH:mm:ss"
+            type="daterange"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
+            class="!w-220px"
+            :shortcuts="rangeShortcuts"
+          />
+        </el-form-item>
+      </div>
+      <el-form-item>
+        <el-button type="primary" @click="handleQuery()">
+          <Icon icon="ep:search" class="mr-5px" /> 搜索
+        </el-button>
+        <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" />重置</el-button>
+        <el-button
+          type="primary"
+          plain
+          @click="openForm('create')"
+          v-hasPermi="['pms:iot-rd-daily-report:create']"
+        >
+          <Icon icon="ep:plus" class="mr-5px" /> 新增
+        </el-button>
+        <el-button type="success" plain @click="handleExport" :loading="exportLoading">
+          <Icon icon="ep:download" class="mr-5px" /> 导出
+        </el-button>
+      </el-form-item>
+    </el-form>
+    <div class="bg-white dark:bg-[#1d1e1f] shadow rounded-lg flex flex-col p-4">
+      <div class="flex-1 relative">
+        <el-auto-resizer class="absolute">
+          <template #default="{ width, height }">
+            <zm-table
+              :data="pagedList"
+              :loading="loading"
+              :width="width"
+              :max-height="height"
+              :height="height"
+              show-border
+            >
+              <zm-table-column
+                prop="rdStatus"
+                :label="t('project.status')"
+                :real-value="
+                  (row: ListItem) => realValue(DICT_TYPE.PMS_PROJECT_RD_STATUS, row.rdStatus ?? '')
+                "
+              >
+                <template #default="scope">
+                  <dict-tag
+                    :type="DICT_TYPE.PMS_PROJECT_RD_STATUS"
+                    :value="scope.row.rdStatus ?? ''"
+                  />
+                </template>
+              </zm-table-column>
+              <zm-table-column prop="period" label="施工周期(D)" />
+              <zm-table-column prop="taskStartDate" label="任务开始日期" />
+              <zm-table-column prop="projectDeptName" label="项目部" />
+              <zm-table-column prop="deptName" label="队伍" />
+              <zm-table-column prop="wellName" label="井号">
+                <template #default="scope">
+                  <el-link
+                    type="primary"
+                    @click="handleWellNameClick(scope.row.taskId)"
+                    underline="never"
+                  >
+                    {{ scope.row.wellName }}
+                  </el-link>
+                </template>
+              </zm-table-column>
+              <zm-table-column prop="techniques" label="工艺" />
+              <zm-table-column prop="workloadDesign" label="总工作量" />
+              <zm-table-column prop="totalDailyFuel" label="油耗(L)" />
+              <zm-table-column label="已完成工作量">
+                <template v-for="(column, index) in dynamicColumns" :key="index">
+                  <zm-table-column :prop="column" :label="column">
+                    <template #default="scope">
+                      {{ getWorkloadByUnit(scope.row.items, column) }}
+                    </template>
+                  </zm-table-column>
+                </template>
+              </zm-table-column>
+              <zm-table-column
+                prop="nonProductionRate"
+                label="非生产时效"
+                cover-formatter
+                :real-value="(row) => (Number(row.nonProductionRate ?? 0) * 100).toFixed(2) + '%'"
+              />
+              <zm-table-column prop="manufactureName" label="甲方" />
+            </zm-table>
+          </template>
+        </el-auto-resizer>
+      </div>
+      <div class="h-10 mt-4 flex items-center justify-end">
+        <el-pagination
+          size="default"
+          v-show="total > 0"
+          v-model:current-page="currentPage"
+          v-model:page-size="pageSize"
+          :background="true"
+          :page-sizes="[12, 20, 30, 50, 100]"
+          :total="total"
+          layout="total, sizes, prev, pager, next, jumper"
+          @size-change="handleSizeChange"
+          @current-change="handleCurrentChange"
+        />
+      </div>
+    </div>
+  </div>
 
-/* 确保表格列标题不换行 */
-:deep(.el-table th > .cell) {
-  white-space: nowrap;
-}
+  <IotRdDailyReportForm ref="formRef" @success="loadList" />
+</template>
 
-/* 调整表格最小宽度,确保内容完全显示 */
-:deep(.el-table) {
-  min-width: 100%;
+<style scoped>
+:deep(.el-form-item) {
+  margin-bottom: 0;
 }
 </style>

+ 782 - 0
src/views/pms/iotrddailyreport/statistics1.vue

@@ -0,0 +1,782 @@
+<template>
+  <el-row :gutter="20">
+    <el-col :span="4" :xs="24">
+      <ContentWrap class="h-1/1">
+        <DeptTree2 :deptId="rootDeptId" @node-click="handleDeptNodeClick" />
+      </ContentWrap>
+    </el-col>
+    <el-col :span="20" :xs="24">
+      <ContentWrap>
+        <!-- 搜索工作栏 -->
+        <el-form
+          class="-mb-15px"
+          :model="queryParams"
+          ref="queryFormRef"
+          :inline="true"
+          label-width="68px"
+        >
+          <el-form-item label="项目" prop="contractName">
+            <el-input
+              v-model="queryParams.contractName"
+              placeholder="请输入项目"
+              clearable
+              @keyup.enter="handleQuery"
+              class="!w-240px"
+            />
+          </el-form-item>
+          <el-form-item label="任务" prop="taskName">
+            <el-input
+              v-model="queryParams.taskName"
+              placeholder="请输入任务"
+              clearable
+              @keyup.enter="handleQuery"
+              class="!w-240px"
+            />
+          </el-form-item>
+          <el-form-item label="创建时间" prop="createTime">
+            <el-date-picker
+              v-model="queryParams.createTime"
+              value-format="YYYY-MM-DD HH:mm:ss"
+              type="daterange"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
+              class="!w-220px"
+              :shortcuts="rangeShortcuts"
+            />
+          </el-form-item>
+          <el-form-item>
+            <el-button @click="handleQuery">
+              <Icon icon="ep:search" class="mr-5px" /> 搜索
+            </el-button>
+            <el-button @click="resetQuery">
+              <Icon icon="ep:refresh" class="mr-5px" /> 重置
+            </el-button>
+            <el-button
+              type="primary"
+              plain
+              @click="openForm('create')"
+              v-hasPermi="['pms:iot-rd-daily-report:create']"
+            >
+              <Icon icon="ep:plus" class="mr-5px" /> 新增
+            </el-button>
+            <el-button type="success" plain @click="handleExport" :loading="exportLoading">
+              <Icon icon="ep:download" class="mr-5px" /> 导出
+            </el-button>
+          </el-form-item>
+        </el-form>
+      </ContentWrap>
+
+      <!-- 列表 -->
+      <ContentWrap ref="tableContainerRef">
+        <el-table
+          ref="tableRef"
+          v-loading="loading"
+          :data="list"
+          :stripe="true"
+          :style="{ width: '100%' }"
+          max-height="600"
+          show-overflow-tooltip
+          border
+        >
+          <el-table-column
+            label="施工状态"
+            align="center"
+            prop="rdStatus"
+            :width="columnWidths.rdStatus"
+          >
+            <template #default="scope">
+              <dict-tag :type="DICT_TYPE.PMS_PROJECT_RD_STATUS" :value="scope.row.rdStatus" />
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="施工周期(D)"
+            align="center"
+            prop="period"
+            :width="columnWidths.projectDeptName"
+          />
+          <el-table-column
+            label="任务开始日期"
+            align="center"
+            prop="taskStartDate"
+            :width="columnWidths.projectDeptName"
+          />
+          <el-table-column
+            label="项目部"
+            align="center"
+            prop="projectDeptName"
+            :width="columnWidths.projectDeptName"
+          />
+          <el-table-column
+            label="队伍"
+            align="center"
+            prop="deptName"
+            :width="columnWidths.deptName"
+          />
+
+          <el-table-column
+            label="井号"
+            align="center"
+            prop="wellName"
+            :width="columnWidths.wellName"
+          >
+            <template #default="scope">
+              <el-link
+                type="primary"
+                @click="handleWellNameClick(scope.row.taskId)"
+                :underline="false"
+              >
+                {{ scope.row.wellName }}
+              </el-link>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="工艺"
+            align="center"
+            prop="techniques"
+            :width="columnWidths.techniques"
+          />
+          <el-table-column
+            label="总工作量"
+            align="center"
+            prop="workloadDesign"
+            :width="columnWidths.workloadDesign"
+          />
+          <el-table-column
+            label="油耗(L)"
+            align="center"
+            prop="totalDailyFuel"
+            :width="columnWidths.totalDailyFuel"
+          />
+          <!-- 已完成工作量分组列 -->
+          <el-table-column label="已完成工作量" align="center">
+            <!-- 动态生成列 -->
+            <el-table-column
+              v-for="column in dynamicColumns"
+              :key="column"
+              :label="column"
+              :prop="column"
+              align="center"
+              min-width="120"
+            >
+              <template #default="scope">
+                {{ getWorkloadByUnit(scope.row.items, column) }}
+              </template>
+            </el-table-column>
+          </el-table-column>
+          <!-- <el-table-column label="非生产时间" align="center">
+            <el-table-column
+              label="工程质量"
+              align="center"
+              prop="accidentTime"
+              :min-width="80"
+              resizable
+            />
+            <el-table-column
+              label="设备故障"
+              align="center"
+              prop="repairTime"
+              :min-width="80"
+              resizable
+            />
+            <el-table-column
+              label="设备保养"
+              align="center"
+              prop="selfStopTime"
+              :min-width="80"
+              resizable
+            />
+            <el-table-column
+              label="技术受限"
+              align="center"
+              prop="complexityTime"
+              :min-width="80"
+              resizable
+            />
+            <el-table-column
+              label="生产配合"
+              align="center"
+              prop="relocationTime"
+              :min-width="80"
+              resizable
+            />
+            <el-table-column
+              label="生产组织"
+              align="center"
+              prop="rectificationTime"
+              :min-width="80"
+              resizable
+            />
+            <el-table-column
+              label="不可抗力"
+              align="center"
+              prop="waitingStopTime"
+              :min-width="80"
+              resizable
+            />
+            <el-table-column
+              label="待命"
+              align="center"
+              prop="winterBreakTime"
+              :min-width="80"
+              resizable
+            />
+            <el-table-column
+              label="甲方设计"
+              align="center"
+              prop="partyaDesign"
+              :min-width="80"
+              resizable
+            />
+            <el-table-column
+              label="甲方准备"
+              align="center"
+              prop="partyaPrepare"
+              :min-width="80"
+              resizable
+            />
+            <el-table-column
+              label="甲方资源"
+              align="center"
+              prop="partyaResource"
+              :min-width="80"
+              resizable
+            />
+            <el-table-column
+              label="其它非生产时间"
+              align="center"
+              prop="otherNptTime"
+              :min-width="120"
+              resizable
+            />
+          </el-table-column> -->
+          <el-table-column
+            label="非生产时效"
+            align="center"
+            prop="nonProductionRate"
+            :min-width="80"
+            resizable
+            :formatter="(row) => (Number(row.nonProductionRate ?? 0) * 100).toFixed(2) + '%'"
+          />
+          <el-table-column
+            label="甲方"
+            align="center"
+            prop="manufactureName"
+            :width="columnWidths.manufactureName"
+          />
+          <!--
+          <el-table-column label="操作" align="center" min-width="120px" fixed="right">
+            <template #default="scope">
+
+              <el-button
+                link
+                type="primary"
+                @click="openForm('update', scope.row.id)"
+                v-hasPermi="['pms:iot-rd-daily-report:update']"
+              >
+                编辑
+              </el-button>
+              <el-button
+                link
+                type="warning"
+                @click="handleApprove(scope.row.id)"
+                v-hasPermi="['pms:iot-rd-daily-report:update']"
+              >
+                审批
+              </el-button>
+            </template>
+          </el-table-column> -->
+        </el-table>
+        <!-- 分页 -->
+        <Pagination
+          :total="total"
+          v-model:page="queryParams.pageNo"
+          v-model:limit="queryParams.pageSize"
+          @pagination="handlePagination"
+        />
+      </ContentWrap>
+
+      <!-- 表单弹窗:添加/修改 -->
+      <IotRdDailyReportForm ref="formRef" @success="getList" />
+    </el-col>
+  </el-row>
+</template>
+
+<script setup lang="ts">
+import { dateFormatter } from '@/utils/formatTime'
+import { IotRdDailyReportApi, IotRdDailyReportVO } from '@/api/pms/iotrddailyreport'
+import IotRdDailyReportForm from './IotRdDailyReportForm.vue'
+import { DICT_TYPE, getDictLabel } from '@/utils/dict'
+import { ref, reactive, onMounted, computed } from 'vue'
+import DeptTree2 from '@/views/pms/iotrhdailyreport/DeptTree2.vue'
+
+import dayjs from 'dayjs'
+import quarterOfYear from 'dayjs/plugin/quarterOfYear'
+import download from '@/utils/download'
+
+dayjs.extend(quarterOfYear)
+
+const rangeShortcuts = [
+  {
+    text: '今天',
+    value: () => {
+      const today = dayjs()
+      return [today.startOf('day').toDate(), today.endOf('day').toDate()]
+    }
+  },
+  {
+    text: '昨天',
+    value: () => {
+      const yesterday = dayjs().subtract(1, 'day')
+      return [yesterday.startOf('day').toDate(), yesterday.endOf('day').toDate()]
+    }
+  },
+  {
+    text: '本周',
+    value: () => {
+      return [dayjs().startOf('week').toDate(), dayjs().endOf('week').toDate()]
+    }
+  },
+  {
+    text: '上周',
+    value: () => {
+      const lastWeek = dayjs().subtract(1, 'week')
+      return [lastWeek.startOf('week').toDate(), lastWeek.endOf('week').toDate()]
+    }
+  },
+  {
+    text: '本月',
+    value: () => {
+      return [dayjs().startOf('month').toDate(), dayjs().endOf('month').toDate()]
+    }
+  },
+  {
+    text: '上月',
+    value: () => {
+      const lastMonth = dayjs().subtract(1, 'month')
+      return [lastMonth.startOf('month').toDate(), lastMonth.endOf('month').toDate()]
+    }
+  },
+  {
+    text: '本季度',
+    value: () => {
+      return [dayjs().startOf('quarter').toDate(), dayjs().endOf('quarter').toDate()]
+    }
+  },
+  {
+    text: '上季度',
+    value: () => {
+      const lastQuarter = dayjs().subtract(1, 'quarter')
+      return [lastQuarter.startOf('quarter').toDate(), lastQuarter.endOf('quarter').toDate()]
+    }
+  },
+  {
+    text: '今年',
+    value: () => {
+      return [dayjs().startOf('year').toDate(), dayjs().endOf('year').toDate()]
+    }
+  },
+  {
+    text: '去年',
+    value: () => {
+      const lastYear = dayjs().subtract(1, 'year')
+      return [lastYear.startOf('year').toDate(), lastYear.endOf('year').toDate()]
+    }
+  },
+  {
+    text: '最近7天',
+    value: () => {
+      return [dayjs().subtract(6, 'day').toDate(), dayjs().toDate()]
+    }
+  },
+  {
+    text: '最近30天',
+    value: () => {
+      return [dayjs().subtract(29, 'day').toDate(), dayjs().toDate()]
+    }
+  },
+  {
+    text: '最近90天',
+    value: () => {
+      return [dayjs().subtract(89, 'day').toDate(), dayjs().toDate()]
+    }
+  },
+  {
+    text: '最近一年',
+    value: () => {
+      return [dayjs().subtract(1, 'year').toDate(), dayjs().toDate()]
+    }
+  }
+]
+
+/** 瑞都日报 汇总统计 */
+defineOptions({ name: 'IotRdDailyReportStatistics' })
+
+const message = useMessage() // 消息弹窗
+const { t } = useI18n() // 国际化
+const { push } = useRouter() // 路由跳转
+const loading = ref(true) // 列表的加载中
+const total = ref(0) // 列表的总页数
+const queryParams = reactive({
+  pageNo: 1,
+  pageSize: 10,
+  deptId: undefined,
+  projectId: undefined,
+  contractName: undefined,
+  taskId: undefined,
+  taskName: undefined,
+  projectClassification: undefined,
+  techniqueIds: undefined,
+  deviceIds: undefined,
+  startTime: [],
+  endTime: [],
+  cumulativeWorkingWell: undefined,
+  cumulativeWorkingLayers: undefined,
+  dailyPumpTrips: undefined,
+  dailyToolsSand: undefined,
+  runCount: undefined,
+  bridgePlug: undefined,
+  waterVolume: undefined,
+  hourCount: undefined,
+  dailyFuel: undefined,
+  dailyPowerUsage: undefined,
+  productionTime: [],
+  nonProductionTime: [],
+  rdNptReason: undefined,
+  constructionStartDate: [],
+  constructionEndDate: [],
+  productionStatus: undefined,
+  externalRental: undefined,
+  nextPlan: undefined,
+  rdStatus: undefined,
+  malfunction: undefined,
+  faultDowntime: [],
+  personnel: undefined,
+  totalStaffNum: undefined,
+  leaveStaffNum: undefined,
+  extProperty: undefined,
+  sort: undefined,
+  remark: undefined,
+  status: undefined,
+  processInstanceId: undefined,
+  auditStatus: undefined,
+  createTime: []
+})
+const queryFormRef = ref() // 搜索的表单
+// 导出的加载中
+
+const rootDeptId = ref(163)
+
+// 响应式数据
+const allList = ref<IotRdDailyReportVO[]>([]) // 存储所有数据
+const list = ref<IotRdDailyReportVO[]>([]) // 存储当前页数据
+
+// 表格引用
+const tableRef = ref()
+// 表格容器引用
+const tableContainerRef = ref()
+
+// 计算属性:获取所有动态列(去重的unit)
+const dynamicColumns = computed(() => {
+  const units = new Set()
+  list.value.forEach((item) => {
+    item.items.forEach((subItem) => {
+      if (subItem.unit) {
+        units.add(subItem.unit)
+      }
+    })
+  })
+  return Array.from(units)
+})
+
+// 根据unit获取对应workload
+const getWorkloadByUnit = (items, unit) => {
+  if (!items || !Array.isArray(items)) return ''
+  const targetItem = items.find((item) => item.unit === unit)
+  return targetItem ? targetItem.workload : ''
+}
+
+// 列宽度配置
+const columnWidths = ref({
+  id: '80px',
+  rdStatus: '120px', // 施工状态列默认宽度
+  projectDeptName: '120px',
+  contractName: '120px',
+  deptName: '120px',
+  manufactureName: '200px',
+  wellName: '120px',
+  techniques: '120px',
+  workloadDesign: '120px',
+  totalDailyFuel: '120px',
+  operation: '120px'
+})
+
+// 计算文本宽度
+const getTextWidth = (text: string, fontSize = 14) => {
+  const span = document.createElement('span')
+  span.style.visibility = 'hidden'
+  span.style.position = 'absolute'
+  span.style.whiteSpace = 'nowrap'
+  span.style.fontSize = `${fontSize}px`
+  span.style.fontFamily = 'inherit'
+  span.innerText = text
+
+  document.body.appendChild(span)
+  const width = span.offsetWidth
+  document.body.removeChild(span)
+
+  return width
+}
+
+// 计算列宽度
+const calculateColumnWidths = () => {
+  const MIN_WIDTH = 80 // 最小列宽
+  const PADDING = 25 // 列内边距
+
+  // 确保表格容器存在
+  if (!tableContainerRef.value?.$el) return
+
+  const newWidths: Record<string, string> = {}
+
+  // 计算各列宽度的函数
+  const calculateColumnWidth = (key: string, label: string, getValue: Function) => {
+    const headerWidth = getTextWidth(label) + PADDING
+    let contentMaxWidth = MIN_WIDTH
+
+    // 计算内容最大宽度
+    list.value.forEach((row, index) => {
+      let text = ''
+      if (key === 'rdStatus') {
+        // 特殊处理字典列,这里简化处理,实际应该获取字典标签
+        text = String(row[key] || '')
+      } else if (key.includes('Date') || key === 'createTime') {
+        // 日期列使用格式化后的值
+        text = dateFormatter(null, null, row[key]) || ''
+      } else {
+        text = String(getValue ? getValue(row, index) : row[key] || '')
+      }
+
+      const textWidth = getTextWidth(text) + PADDING
+      if (textWidth > contentMaxWidth) contentMaxWidth = textWidth
+    })
+
+    // 取标题宽度和内容最大宽度的较大值
+    const finalWidth = Math.max(headerWidth, contentMaxWidth, MIN_WIDTH)
+    newWidths[key] = `${finalWidth}px`
+  }
+
+  // 计算施工状态列宽度(使用字典标签文本计算)
+  calculateColumnWidth('rdStatus', '施工状态', (row: any) => {
+    // 用字典标签(如"完工")而非原始编码(如"wg")计算宽度
+    return getDictLabel(DICT_TYPE.PMS_PROJECT_RD_STATUS, row.rdStatus) || row.rdStatus
+  })
+
+  // 计算各列宽度
+  calculateColumnWidth('projectDeptName', '项目部', (row: any) => row.projectDeptName)
+  calculateColumnWidth('deptName', '队伍', (row: any) => row.deptName)
+  calculateColumnWidth('manufactureName', '甲方', (row: any) => row.manufactureName)
+  calculateColumnWidth('wellName', '井号', (row: any) => row.wellName)
+  calculateColumnWidth('techniques', '工艺', (row: any) => row.techniques)
+  calculateColumnWidth('workloadDesign', '总工作量', (row: any) => row.workloadDesign)
+  calculateColumnWidth('totalDailyFuel', '油耗(L)', (row: any) => row.totalDailyFuel)
+
+  // 操作列固定宽度
+  newWidths.operation = '120px'
+  // id列固定宽度(虽然隐藏)
+  newWidths.id = '80px'
+
+  // 更新列宽配置
+  columnWidths.value = newWidths
+
+  // 触发表格重新布局
+  nextTick(() => {
+    tableRef.value?.doLayout()
+  })
+}
+
+/** 查询列表 */
+const getList = async () => {
+  loading.value = true
+  try {
+    const data = await IotRdDailyReportApi.statistics(queryParams)
+    // 存储所有数据
+    allList.value = data
+    // 计算总条数
+    total.value = data.length
+    // 执行前端分页
+    handleFrontendPagination()
+    // 获取数据后计算列宽
+    nextTick(() => {
+      calculateColumnWidths()
+    })
+  } finally {
+    loading.value = false
+  }
+}
+
+/** 井号点击操作 */
+const handleWellNameClick = (taskId: number) => {
+  if (!taskId) return
+
+  // 跳转到日报列表页面,传递井号参数
+  push({
+    name: 'IotRdDailyReport',
+    query: {
+      // wellName: wellName
+      taskId: taskId
+    }
+  })
+}
+
+// 响应式变量存储选中的部门
+const selectedDept = ref<{ id: number; name: string }>()
+/** 处理部门被点击 */
+const handleDeptNodeClick = async (row) => {
+  // 记录选中的部门信息
+  selectedDept.value = { id: row.id, name: row.name }
+  queryParams.deptId = row.id
+  await getList()
+}
+
+/** 前端分页处理 */
+const handleFrontendPagination = () => {
+  const { pageNo, pageSize } = queryParams
+  const startIndex = (pageNo - 1) * pageSize
+  const endIndex = startIndex + pageSize
+
+  // 对全部数据进行分页切片
+  list.value = allList.value.slice(startIndex, endIndex)
+}
+
+/** 搜索按钮操作 */
+const handleQuery = () => {
+  queryParams.pageNo = 1
+  getList()
+}
+
+/** 重置按钮操作 */
+const resetQuery = () => {
+  queryFormRef.value.resetFields()
+  handleQuery()
+}
+
+/** 分页事件处理 */
+const handlePagination = (pagination: any) => {
+  queryParams.pageNo = pagination.page
+  queryParams.pageSize = pagination.limit
+  // 使用前端分页,不重新调用接口
+  handleFrontendPagination()
+}
+
+/** 添加/修改操作 */
+const formRef = ref()
+const openForm = (type: string, id?: number) => {
+  formRef.value.open(type, id)
+}
+
+/** 审批按钮操作 */
+const handleApprove = async (id: number) => {
+  try {
+    // 跳转到 FillDailyReportForm 页面,传递审批模式和ID
+    push({
+      name: 'FillDailyReportForm',
+      params: {
+        id: id.toString(),
+        mode: 'approval' // 添加审批模式标识
+      }
+    })
+  } catch (error) {
+    console.error('跳转审批页面失败:', error)
+  }
+}
+
+/** 删除按钮操作 */
+const handleDelete = async (id: number) => {
+  try {
+    // 删除的二次确认
+    await message.delConfirm()
+    // 发起删除
+    await IotRdDailyReportApi.deleteIotRdDailyReport(id)
+    message.success(t('common.delSuccess'))
+    // 刷新列表
+    await getList()
+  } catch {}
+}
+
+const exportLoading = ref(false)
+const handleExport = async () => {
+  const res = await IotRdDailyReportApi.exportIotRdDailyReport({
+    createTime: queryParams.createTime,
+    contractName: queryParams.contractName,
+    taskName: queryParams.taskName,
+    // pageNo: queryParams.pageNo,
+    // pageSize: queryParams.pageSize,
+    deptId: queryParams.deptId
+  })
+
+  download.excel(res, '瑞都日报汇总.xlsx')
+}
+
+// 声明 ResizeObserver 实例
+let resizeObserver: ResizeObserver | null = null
+
+/** 初始化 **/
+onMounted(() => {
+  getList()
+  // 创建 ResizeObserver 监听表格容器尺寸变化
+  if (tableContainerRef.value?.$el) {
+    resizeObserver = new ResizeObserver(() => {
+      // 使用防抖避免频繁触发
+      clearTimeout((window as any).resizeTimer)
+      ;(window as any).resizeTimer = setTimeout(() => {
+        calculateColumnWidths()
+      }, 100)
+    })
+    resizeObserver.observe(tableContainerRef.value.$el)
+  }
+})
+
+onUnmounted(() => {
+  // 清除 ResizeObserver
+  if (resizeObserver && tableContainerRef.value?.$el) {
+    resizeObserver.unobserve(tableContainerRef.value.$el)
+    resizeObserver = null
+  }
+
+  // 清除定时器
+  if ((window as any).resizeTimer) {
+    clearTimeout((window as any).resizeTimer)
+  }
+})
+
+// 监听查询参数变化,实现前端分页
+watch([() => queryParams.pageNo, () => queryParams.pageSize], () => {
+  handleFrontendPagination()
+})
+
+// 监听列表数据变化重新计算列宽
+watch(
+  list,
+  () => {
+    nextTick(calculateColumnWidths)
+  },
+  { deep: true }
+)
+</script>
+
+<style scoped>
+/* 确保表格单元格内容不换行 */
+:deep(.el-table .cell) {
+  white-space: nowrap;
+}
+
+/* 确保表格列标题不换行 */
+:deep(.el-table th > .cell) {
+  white-space: nowrap;
+}
+
+/* 调整表格最小宽度,确保内容完全显示 */
+:deep(.el-table) {
+  min-width: 100%;
+}
+</style>