Explorar o código

Merge branch 'refactor/dailyreport-style'

Zimo hai 10 horas
pai
achega
a3d86d9b86

+ 28 - 20
src/components/DeptTreeSelect/index.vue

@@ -34,11 +34,8 @@ const props = defineProps({
 const emits = defineEmits(['update:modelValue', 'node-click'])
 
 const deptName = ref('')
-
 const deptList = ref<Tree[]>([])
-
 const treeRef = ref<InstanceType<typeof ElTree>>()
-
 const expandedKeys = ref<number[]>([])
 
 const sortTreeBySort = (treeNodes: Tree[]) => {
@@ -61,30 +58,49 @@ const loadTree = async () => {
   try {
     let id = props.deptId
 
+    // 1. 校验 ID 范围逻辑 (保持原有逻辑:确保 deptId 在 topId 范围内)
     if (id !== props.topId) {
       const depts = await DeptApi.specifiedSimpleDepts(props.topId)
-
       const self = depts.find((item) => item.id === props.deptId)
-
       if (depts.length && !self) {
         id = props.topId
       }
     }
 
+    // 2. 获取最终 ID 对应的部门列表
+    const res = await DeptApi.specifiedSimpleDepts(id)
+
+    // 3. 处理 modelValue 的赋值逻辑 (关键修改点)
     if (props.initSelect) {
-      emits('update:modelValue', id)
+      // 检查传入的 modelValue 是否存在于当前加载的树数据中
+      const isModelValueValid = props.modelValue && res.some((item) => item.id === props.modelValue)
+
+      if (isModelValueValid) {
+        // A. 如果传入了值,且该值在当前树结构中,不做修改,保留原值
+        // 这里不需要 emit,因为值没变
+      } else {
+        // B. 如果没有传入值,或者传入的值不在当前树结构中,强制选中根节点
+        emits('update:modelValue', id)
+      }
     }
 
-    const res = await DeptApi.specifiedSimpleDepts(id)
+    // 4. 生成树结构
     deptList.value = sortTreeBySort(handleTree(res))
 
-    // 加载完成后,如果有选中值,尝试高亮并展开
+    // 5. 界面交互:高亮并展开
     nextTick(() => {
-      if (props.modelValue && treeRef.value) {
-        treeRef.value.setCurrentKey(props.modelValue)
-        expandedKeys.value = [props.modelValue] // 默认展开选中的节点
+      // 优先使用 props.modelValue (如果刚才触发了 update,父组件可能还没传回来,所以这里取 props.modelValue 或者 id)
+      // 但为了稳妥,我们再次检查逻辑
+      const targetKey = props.modelValue ? props.modelValue : props.initSelect ? id : null
+
+      if (targetKey && treeRef.value) {
+        treeRef.value.setCurrentKey(targetKey)
+        // 确保该节点被展开
+        if (!expandedKeys.value.includes(targetKey)) {
+          expandedKeys.value.push(targetKey)
+        }
       } else if (deptList.value.length > 0) {
-        // 默认展开第一级
+        // 如果没有选中项,默认展开第一级
         expandedKeys.value = deptList.value.map((item) => item.id)
       }
     })
@@ -94,19 +110,15 @@ const loadTree = async () => {
 }
 
 const handleNodeClick = (data: Tree) => {
-  // 1. 更新 v-model
   emits('update:modelValue', data.id)
-  // 2. 抛出点击事件供父组件其他用途
   emits('node-click', data)
 }
 
-/** 筛选节点逻辑 */
 const filterNode = (value: string, data: Tree) => {
   if (!value) return true
   return data.name.includes(value)
 }
 
-/** 监听输入框进行过滤 */
 watch(deptName, (val) => {
   treeRef.value?.filter(val)
 })
@@ -124,9 +136,7 @@ watch(
   () => props.modelValue,
   (newVal) => {
     if (newVal && treeRef.value) {
-      // 设置高亮
       treeRef.value.setCurrentKey(newVal)
-      // 自动展开该节点 (将新ID加入展开数组)
       if (!expandedKeys.value.includes(newVal)) {
         expandedKeys.value.push(newVal)
       }
@@ -135,9 +145,7 @@ watch(
   { immediate: true }
 )
 
-/** 初始化 */
 onMounted(() => {
-  console.log('props :>> ', props)
   loadTree()
 })
 </script>

+ 8 - 5
src/components/ZmTable/ZmTableColumn.vue

@@ -1,5 +1,5 @@
 <script lang="ts" setup generic="T">
-import type { TableColumnCtx } from 'element-plus'
+import { type TableColumnCtx } from 'element-plus'
 import { computed, useAttrs, inject, ref } from 'vue'
 import { Filter } from '@element-plus/icons-vue'
 import { SortOrder, TableContextKey } from './token'
@@ -10,6 +10,7 @@ interface Props extends /* @vue-ignore */ Partial<Omit<TableColumnCtx<T>, 'prop'
   zmFilterable?: boolean
   filterModelValue?: any
   realValue?: (value: any) => any
+  coverFormatter?: boolean
 }
 
 const emits = defineEmits(['update:filterModelValue'])
@@ -27,7 +28,8 @@ const tableContext = inject(TableContextKey, {
 const defaultOptions = ref<Partial<Props>>({
   align: 'center',
   resizable: true,
-  showOverflowTooltip: true
+  showOverflowTooltip: true,
+  coverFormatter: false
 })
 
 const bindProps = computed(() => {
@@ -42,7 +44,8 @@ const bindProps = computed(() => {
     ...props,
     prop: props.prop,
     align: resolvedAlign,
-    className: (props.className ?? '') + ' ' + props.prop
+    className: (props.className ?? '') + ' ' + props.prop,
+    formatter: props.coverFormatter ? props.realValue : props.formatter
   }
 })
 
@@ -108,7 +111,7 @@ const calculativeWidth = () => {
     .map((item) => props.realValue?.(item[props.prop]) || item[props.prop])
     .filter(Boolean)
 
-  let labelWidth = getTextWidth(bindProps.value.label || '') + 38
+  let labelWidth = getTextWidth(bindProps.value.label || '') + 34
 
   if (props.zmFilterable || props.zmSortable) {
     labelWidth += 8
@@ -118,7 +121,7 @@ const calculativeWidth = () => {
   if (props.zmSortable) labelWidth += 22
 
   const maxWidth = Math.min(
-    Math.max(...values.map((value) => getTextWidth(value) + 38), labelWidth),
+    Math.max(...values.map((value) => getTextWidth(value) + 34), labelWidth),
     360
   )
 

+ 41 - 12
src/components/ZmTable/index.vue

@@ -9,6 +9,7 @@ interface Props extends /* @vue-ignore */ Partial<Omit<TableProps<T>, 'data'>> {
   sortingFields?: SortField[]
   sortFn?: (prop: string, order: SortOrder | null) => void
   customClass?: boolean
+  showBorder?: boolean
 }
 
 const props = defineProps<Props>()
@@ -26,8 +27,12 @@ const defaultOptions: Partial<Props> = {
   border: true,
   highlightCurrentRow: true,
   showOverflowTooltip: true,
-  scrollbarAlwaysOn: false,
-  customClass: false
+  scrollbarAlwaysOn: true,
+  showBorder: false,
+  customClass: false,
+  tooltipOptions: {
+    popperClass: 'max-w-180'
+  }
 }
 
 const bindProps = computed(() => {
@@ -90,7 +95,7 @@ defineExpose({
   <el-table
     ref="tableRef"
     v-loading="loading"
-    :class="{ 'zm-table': !customClass }"
+    :class="{ 'zm-table': !customClass, 'show-border': showBorder }"
     v-bind="bindProps"
     :data="data"
   >
@@ -122,33 +127,36 @@ defineExpose({
 
   .el-table__cell {
     height: 52px;
-    border: none !important;
+
+    &:last-child {
+      border-right: none !important;
+    }
   }
 
   .el-table__header {
-    overflow: hidden;
     border-bottom-right-radius: 8px;
     border-bottom-left-radius: 8px;
 
     .el-table__cell {
       background: var(--el-fill-color-light) !important;
 
-      .cell {
-        border-right: var(--el-table-border);
-        border-color: var(--el-table-header-text-color);
-      }
-
       &:last-child {
         .cell {
           border-right: none;
         }
       }
+
+      &:first-child {
+        border-bottom-left-radius: 8px;
+      }
+
+      &:last-child {
+        border-bottom-right-radius: 8px;
+      }
     }
   }
 
   .el-table__body-wrapper {
-    margin-top: 6px;
-
     .el-table__cell {
       &:last-child {
         border-top-right-radius: 8px;
@@ -161,6 +169,27 @@ defineExpose({
       }
     }
   }
+}
+
+.zm-table:not(.show-border) {
+  .el-table__cell {
+    border: none !important;
+  }
+
+  .el-table__header {
+    .el-table__cell {
+      .cell {
+        border-right: var(--el-table-border);
+        border-color: var(--el-table-header-text-color);
+      }
+
+      &:last-child {
+        .cell {
+          border-right: none;
+        }
+      }
+    }
+  }
 
   .el-table__row {
     &:last-child {

+ 327 - 501
src/views/pms/iotrddailyreport/fillDailyReport.vue

@@ -1,544 +1,370 @@
-<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>
-        <el-table
-          v-loading="loading"
-          :data="list"
-          :stripe="true"
-          :style="{ width: '100%' }"
-          max-height="600"
-          show-overflow-tooltip
-          border
-        >
-          <el-table-column label="操作" align="center" min-width="120px">
-            <template #default="scope">
-              <el-button
-                link
-                type="primary"
-                @click="openForm('fill', scope.row.id)"
-                v-hasPermi="['pms:iot-rd-daily-report:update']"
-                v-if="scope.row.status === 0"
-              >
-                填报
-              </el-button>
-              <el-button
-                link
-                type="success"
-                @click="handleDetail(scope.row.id)"
-                v-hasPermi="['pms:iot-rd-daily-report:query']"
-              >
-                查看
-              </el-button>
-              <el-button
-                link
-                :type="
-                  scope.row.nonProductFlag || scope.row.processInstanceId === '2'
-                    ? 'success'
-                    : 'warning'
-                "
-                @click="openForm('fill', scope.row.id, 'true')"
-                v-hasPermi="['pms:iot-rd-daily-report:non-productive']"
-                v-if="scope.row.auditStatus === 20"
-              >
-                时效
-              </el-button>
-            </template>
-          </el-table-column>
-          <el-table-column
-            label="创建时间"
-            align="center"
-            prop="createTime"
-            :formatter="dateFormatter2"
-            width="180px"
-          />
-          <el-table-column label="日报状态" align="center" prop="status">
-            <template #default="scope">
-              <dict-tag :type="DICT_TYPE.OPERATION_FILL_ORDER_STATUS" :value="scope.row.status" />
-            </template>
-          </el-table-column>
-          <el-table-column label="审批状态" align="center" prop="auditStatus" :min-width="84">
-            <template #default="scope">
-              <el-tag v-if="scope.row.auditStatus === 0" type="info">
-                {{ '待提交' }}
-              </el-tag>
-              <el-tag v-else-if="scope.row.auditStatus === 10">
-                {{ '待审批' }}
-              </el-tag>
-              <el-tag v-else-if="scope.row.auditStatus === 20" type="success">
-                {{ '审批通过' }}
-              </el-tag>
-              <el-tag v-else-if="scope.row.auditStatus === 30" type="danger">
-                {{ '审批拒绝' }}
-              </el-tag>
-            </template>
-          </el-table-column>
-          <el-table-column label="施工队伍" align="center" prop="deptName" />
-          <el-table-column label="项目" align="center" prop="contractName" />
-          <el-table-column label="任务" align="center" prop="taskName" />
-          <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="110"
-              resizable
-            />
-          </el-table-column>
-          <el-table-column
-            label="其他非生产时间原因"
-            align="center"
-            prop="otherNptReason"
-            :min-width="140"
-            resizable
-          />
-          <!-- <el-table-column
-            label="非生产时间填写"
-            align="center"
-            prop="nonProductFlag"
-            :min-width="110"
-          >
-            <template #default="scope">
-              <el-tag
-                :type="
-                  scope.row.nonProductFlag || scope.row.processInstanceId === '2'
-                    ? 'success'
-                    : 'danger'
-                "
-              >
-                {{
-                  scope.row.nonProductFlag || scope.row.processInstanceId === '2'
-                    ? '已填写'
-                    : '未填写'
-                }}
-              </el-tag>
-            </template>
-          </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="responsiblePersonNames" />
-          <el-table-column label="填报人" align="center" prop="submitterNames" />
-          <!--
-          <el-table-column label="项目类别(钻井 修井 注氮 酸化压裂... )" align="center" prop="projectClassification" /> -->
-          <!--
-          <el-table-column label="时间节点-结束" align="center" prop="endTime" />
-          <el-table-column
-            label="施工开始日期"
-            align="center"
-            prop="constructionStartDate"
-            :formatter="dateFormatter"
-            width="180px"
-          />
-          <el-table-column
-            label="施工结束日期"
-            align="center"
-            prop="constructionEndDate"
-            :formatter="dateFormatter"
-            width="180px"
-          /> -->
-        </el-table>
-        <!-- 分页 -->
-        <Pagination
-          :total="total"
-          v-model:page="queryParams.pageNo"
-          v-model:limit="queryParams.pageSize"
-          @pagination="getList"
-        />
-      </ContentWrap>
-    </el-col>
-  </el-row>
-
-  <!-- 表单弹窗:添加/修改
-  <IotRdDailyReportForm ref="formRef" @success="getList" /> -->
-</template>
+<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 dayjs from 'dayjs'
+// import download from '@/utils/download'
 
-<script setup lang="ts">
-import { dateFormatter2 } from '@/utils/formatTime'
-import { IotRdDailyReportApi, IotRdDailyReportVO } from '@/api/pms/iotrddailyreport'
-import { DICT_TYPE } from '@/utils/dict'
-import DeptTree2 from '@/views/pms/iotrhdailyreport/DeptTree2.vue'
+defineOptions({ name: 'FillDailyReport' })
 
-import dayjs from 'dayjs'
-import quarterOfYear from 'dayjs/plugin/quarterOfYear'
+// const { t } = useI18n()
 
-dayjs.extend(quarterOfYear)
+const router = useRouter()
+// const route = useRoute()
 
-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 message = useMessage()
 
-/** 瑞都日报 填报 列表 */
-defineOptions({ name: 'FillDailyReport' })
+const id = useUserStore().getUser.deptId
 
-const message = useMessage() // 消息弹窗
-const { t } = useI18n() // 国际化
-const { push } = useRouter() // 路由跳转
-const loading = ref(true) // 列表的加载中
-const list = ref<IotRdDailyReportVO[]>([]) // 列表的数据
-const total = ref(0) // 列表的总页数
+const deptId = id
 
-const rootDeptId = ref(163)
+interface Query {
+  deptId?: number
+  contractName?: string
+  taskName?: string
+  createTime?: string[]
+  wellName?: string
+  taskId?: number
+  pageNo: number
+  pageSize: number
+}
 
-const queryParams = reactive({
+const initQuery: Query = {
   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() // 搜索的表单
+  deptId: id
+}
+
+const query = ref<Query>({ ...initQuery })
+
+interface ListItem {
+  createTime: string
+  status: string
+  auditStatus: number
+  deptName: string
+  contractName: string
+  taskName: string
+  nonProductionRate: number
+  accidentTime: number
+  repairTime: number
+  selfStopTime: number
+  complexityTime: number
+  relocationTime: number
+  rectificationTime: number
+  waitingStopTime: number
+  winterBreakTime: number
+  partyaDesign: number
+  partyaPrepare: number
+  partyaResource: number
+  otherNptTime: number
+  otherNptReason: string
+  responsiblePersonNames: string
+  submitterNames: string
+  nonProductFlag: boolean
+}
+
+const list = ref<ListItem[]>([])
+const total = ref(0)
+
+const loading = ref(false)
 
-/** 查询列表 */
-const getList = async () => {
+const loadList = useDebounceFn(async function () {
   loading.value = true
   try {
-    const data = await IotRdDailyReportApi.getIotRdDailyReportPage(queryParams)
+    const data = await IotRdDailyReportApi.getIotRdDailyReportPage(query.value)
     list.value = data.list
     total.value = data.total
   } finally {
     loading.value = false
   }
+})
+
+function handleSizeChange(val: number) {
+  query.value.pageSize = val
+  handleQuery()
 }
 
-// 响应式变量存储选中的部门
-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 handleCurrentChange(val: number) {
+  query.value.pageNo = val
+  loadList()
 }
 
-/** 搜索按钮操作 */
-const handleQuery = () => {
-  queryParams.pageNo = 1
-  getList()
+function handleQuery(setPage = true) {
+  if (setPage) {
+    query.value.pageNo = 1
+  }
+  loadList()
 }
 
-/** 重置按钮操作 */
-const resetQuery = () => {
-  queryFormRef.value.resetFields()
+function resetQuery() {
+  query.value = { ...initQuery }
+
   handleQuery()
 }
 
-/** 添加/修改操作 */
-const formRef = ref()
-const openForm = (type: string, id?: number, istime: string = 'false') => {
-  push({ name: 'FillDailyReportForm', params: { id: id, mode: 'fill' }, query: { istime: istime } })
+watch(
+  [
+    () => query.value.deptId,
+    () => query.value.contractName,
+    () => query.value.taskName,
+    () => query.value.createTime
+  ],
+  () => {
+    handleQuery()
+  },
+  { immediate: true }
+)
+
+const openForm = (_type: string, id?: number, istime: string = 'false') => {
+  router.push({
+    name: 'FillDailyReportForm',
+    params: { id: id, mode: 'fill' },
+    query: { istime: istime }
+  })
 }
 
-/** 删除按钮操作 */
-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)
+
+// async function handleExport() {
+//   try {
+//     await message.exportConfirm()
+
+//     exportLoading.value = true
+//     const res = await IotRdDailyReportApi.exportIotRdDailyReportDetails(query.value)
+
+//     download.excel(res, '瑞都日报明细.xlsx')
+//   } finally {
+//     exportLoading.value = false
+//   }
+// }
+
+const { ZmTable, ZmTableColumn } = useTableComponents<ListItem>()
+
+function formCreateTime(row: ListItem) {
+  return dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss')
+}
+
+function realValue(type: any, value: string) {
+  const option = getDictOptions(type).find((item) => item.value === value)
+  return option?.label || value
 }
 
-/** 查看日报详情 */
-const handleDetail = async (id: number) => {
+function handleDetail(id: number) {
   try {
-    // 跳转到 FillDailyReportForm 页面,传递审批模式和ID
-    push({
+    router.push({
       name: 'FillDailyReportForm',
       params: {
         id: id.toString(),
-        mode: 'detail' // 添加详情模式标识
+        mode: 'detail'
       }
     })
   } catch (error) {
     console.error('跳转详情页面失败:', error)
   }
 }
+</script>
 
-const exportLoading = ref(false)
-const handleExport = async () => {}
+<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="list"
+              :loading="loading"
+              :width="width"
+              :max-height="height"
+              :height="height"
+              show-border
+            >
+              <zm-table-column label="操作" width="120" fixed="right">
+                <template #default="scope">
+                  <el-button
+                    link
+                    type="primary"
+                    @click="openForm('fill', scope.row.id)"
+                    v-hasPermi="['pms:iot-rd-daily-report:update']"
+                    v-if="scope.row.status === 0"
+                  >
+                    填报
+                  </el-button>
+                  <el-button
+                    link
+                    type="success"
+                    @click="handleDetail(scope.row.id)"
+                    v-hasPermi="['pms:iot-rd-daily-report:query']"
+                  >
+                    查看
+                  </el-button>
+                  <el-button
+                    link
+                    :type="
+                      scope.row.nonProductFlag || scope.row.processInstanceId === '2'
+                        ? 'success'
+                        : 'warning'
+                    "
+                    @click="openForm('fill', scope.row.id, 'true')"
+                    v-hasPermi="['pms:iot-rd-daily-report:non-productive']"
+                    v-if="scope.row.auditStatus === 20"
+                  >
+                    时效
+                  </el-button>
+                </template>
+              </zm-table-column>
+              <zm-table-column
+                prop="createTime"
+                label="创建时间"
+                cover-formatter
+                :real-value="formCreateTime"
+              />
+              <zm-table-column
+                prop="status"
+                label="日报状态"
+                cover-formatter
+                :real-value="
+                  (row: ListItem) =>
+                    realValue(DICT_TYPE.OPERATION_FILL_ORDER_STATUS, row.status ?? '')
+                "
+              >
+                <template #default="scope">
+                  <dict-tag
+                    :type="DICT_TYPE.OPERATION_FILL_ORDER_STATUS"
+                    :value="scope.row.status"
+                  />
+                </template>
+              </zm-table-column>
+              <zm-table-column prop="auditStatus" label="审批状态">
+                <template #default="scope">
+                  <el-tag v-if="scope.row.auditStatus === 0" type="info">
+                    {{ '待提交' }}
+                  </el-tag>
+                  <el-tag v-else-if="scope.row.auditStatus === 10">
+                    {{ '待审批' }}
+                  </el-tag>
+                  <el-tag v-else-if="scope.row.auditStatus === 20" type="success">
+                    {{ '审批通过' }}
+                  </el-tag>
+                  <el-tag v-else-if="scope.row.auditStatus === 30" type="danger">
+                    {{ '审批拒绝' }}
+                  </el-tag>
+                </template>
+              </zm-table-column>
+              <zm-table-column prop="deptName" label="施工队伍" />
+              <zm-table-column prop="contractName" label="项目" />
+              <zm-table-column prop="taskName" label="任务" />
+              <zm-table-column
+                prop="nonProductionRate"
+                label="非生产时效"
+                cover-formatter
+                :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="设备故障" />
+                <zm-table-column prop="selfStopTime" label="设备保养" />
+                <zm-table-column prop="complexityTime" label="技术受限" />
+                <zm-table-column prop="relocationTime" label="生产配合" />
+                <zm-table-column prop="rectificationTime" label="生产组织" />
+                <zm-table-column prop="waitingStopTime" label="不可抗力" />
+                <zm-table-column prop="winterBreakTime" label="待命" />
+                <zm-table-column prop="partyaDesign" label="甲方设计" />
+                <zm-table-column prop="partyaPrepare" label="甲方准备" />
+                <zm-table-column prop="partyaResource" label="甲方资源" />
+                <zm-table-column prop="otherNptTime" label="其它非生产时间" />
+              </zm-table-column>
+              <zm-table-column prop="otherNptReason" label="其他非生产时间原因" />
+              <zm-table-column prop="responsiblePersonNames" label="带班干部" />
+              <zm-table-column prop="submitterNames" 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="query.pageNo"
+          v-model: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>
 
-/** 初始化 **/
-onMounted(() => {
-  getList()
-})
-</script>
+  <IotRdDailyReportForm ref="formRef" @success="loadList" />
+</template>
+
+<style scoped>
+:deep(.el-form-item) {
+  margin-bottom: 0;
+}
+</style>

+ 544 - 0
src/views/pms/iotrddailyreport/fillDailyReport1.vue

@@ -0,0 +1,544 @@
+<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>
+        <el-table
+          v-loading="loading"
+          :data="list"
+          :stripe="true"
+          :style="{ width: '100%' }"
+          max-height="600"
+          show-overflow-tooltip
+          border
+        >
+          <el-table-column label="操作" align="center" min-width="120px">
+            <template #default="scope">
+              <el-button
+                link
+                type="primary"
+                @click="openForm('fill', scope.row.id)"
+                v-hasPermi="['pms:iot-rd-daily-report:update']"
+                v-if="scope.row.status === 0"
+              >
+                填报
+              </el-button>
+              <el-button
+                link
+                type="success"
+                @click="handleDetail(scope.row.id)"
+                v-hasPermi="['pms:iot-rd-daily-report:query']"
+              >
+                查看
+              </el-button>
+              <el-button
+                link
+                :type="
+                  scope.row.nonProductFlag || scope.row.processInstanceId === '2'
+                    ? 'success'
+                    : 'warning'
+                "
+                @click="openForm('fill', scope.row.id, 'true')"
+                v-hasPermi="['pms:iot-rd-daily-report:non-productive']"
+                v-if="scope.row.auditStatus === 20"
+              >
+                时效
+              </el-button>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="创建时间"
+            align="center"
+            prop="createTime"
+            :formatter="dateFormatter2"
+            width="180px"
+          />
+          <el-table-column label="日报状态" align="center" prop="status">
+            <template #default="scope">
+              <dict-tag :type="DICT_TYPE.OPERATION_FILL_ORDER_STATUS" :value="scope.row.status" />
+            </template>
+          </el-table-column>
+          <el-table-column label="审批状态" align="center" prop="auditStatus" :min-width="84">
+            <template #default="scope">
+              <el-tag v-if="scope.row.auditStatus === 0" type="info">
+                {{ '待提交' }}
+              </el-tag>
+              <el-tag v-else-if="scope.row.auditStatus === 10">
+                {{ '待审批' }}
+              </el-tag>
+              <el-tag v-else-if="scope.row.auditStatus === 20" type="success">
+                {{ '审批通过' }}
+              </el-tag>
+              <el-tag v-else-if="scope.row.auditStatus === 30" type="danger">
+                {{ '审批拒绝' }}
+              </el-tag>
+            </template>
+          </el-table-column>
+          <el-table-column label="施工队伍" align="center" prop="deptName" />
+          <el-table-column label="项目" align="center" prop="contractName" />
+          <el-table-column label="任务" align="center" prop="taskName" />
+          <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="110"
+              resizable
+            />
+          </el-table-column>
+          <el-table-column
+            label="其他非生产时间原因"
+            align="center"
+            prop="otherNptReason"
+            :min-width="140"
+            resizable
+          />
+          <!-- <el-table-column
+            label="非生产时间填写"
+            align="center"
+            prop="nonProductFlag"
+            :min-width="110"
+          >
+            <template #default="scope">
+              <el-tag
+                :type="
+                  scope.row.nonProductFlag || scope.row.processInstanceId === '2'
+                    ? 'success'
+                    : 'danger'
+                "
+              >
+                {{
+                  scope.row.nonProductFlag || scope.row.processInstanceId === '2'
+                    ? '已填写'
+                    : '未填写'
+                }}
+              </el-tag>
+            </template>
+          </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="responsiblePersonNames" />
+          <el-table-column label="填报人" align="center" prop="submitterNames" />
+          <!--
+          <el-table-column label="项目类别(钻井 修井 注氮 酸化压裂... )" align="center" prop="projectClassification" /> -->
+          <!--
+          <el-table-column label="时间节点-结束" align="center" prop="endTime" />
+          <el-table-column
+            label="施工开始日期"
+            align="center"
+            prop="constructionStartDate"
+            :formatter="dateFormatter"
+            width="180px"
+          />
+          <el-table-column
+            label="施工结束日期"
+            align="center"
+            prop="constructionEndDate"
+            :formatter="dateFormatter"
+            width="180px"
+          /> -->
+        </el-table>
+        <!-- 分页 -->
+        <Pagination
+          :total="total"
+          v-model:page="queryParams.pageNo"
+          v-model:limit="queryParams.pageSize"
+          @pagination="getList"
+        />
+      </ContentWrap>
+    </el-col>
+  </el-row>
+
+  <!-- 表单弹窗:添加/修改
+  <IotRdDailyReportForm ref="formRef" @success="getList" /> -->
+</template>
+
+<script setup lang="ts">
+import { dateFormatter2 } from '@/utils/formatTime'
+import { IotRdDailyReportApi, IotRdDailyReportVO } from '@/api/pms/iotrddailyreport'
+import { DICT_TYPE } from '@/utils/dict'
+import DeptTree2 from '@/views/pms/iotrhdailyreport/DeptTree2.vue'
+
+import dayjs from 'dayjs'
+import quarterOfYear from 'dayjs/plugin/quarterOfYear'
+
+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: 'FillDailyReport' })
+
+const message = useMessage() // 消息弹窗
+const { t } = useI18n() // 国际化
+const { push } = useRouter() // 路由跳转
+const loading = ref(true) // 列表的加载中
+const list = ref<IotRdDailyReportVO[]>([]) // 列表的数据
+const total = ref(0) // 列表的总页数
+
+const rootDeptId = ref(163)
+
+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 getList = async () => {
+  loading.value = true
+  try {
+    const data = await IotRdDailyReportApi.getIotRdDailyReportPage(queryParams)
+    list.value = data.list
+    total.value = data.total
+  } finally {
+    loading.value = false
+  }
+}
+
+// 响应式变量存储选中的部门
+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 handleQuery = () => {
+  queryParams.pageNo = 1
+  getList()
+}
+
+/** 重置按钮操作 */
+const resetQuery = () => {
+  queryFormRef.value.resetFields()
+  handleQuery()
+}
+
+/** 添加/修改操作 */
+const formRef = ref()
+const openForm = (type: string, id?: number, istime: string = 'false') => {
+  push({ name: 'FillDailyReportForm', params: { id: id, mode: 'fill' }, query: { istime: istime } })
+}
+
+/** 删除按钮操作 */
+const handleDelete = async (id: number) => {
+  try {
+    // 删除的二次确认
+    await message.delConfirm()
+    // 发起删除
+    await IotRdDailyReportApi.deleteIotRdDailyReport(id)
+    message.success(t('common.delSuccess'))
+    // 刷新列表
+    await getList()
+  } catch {}
+}
+
+/** 查看日报详情 */
+const handleDetail = async (id: number) => {
+  try {
+    // 跳转到 FillDailyReportForm 页面,传递审批模式和ID
+    push({
+      name: 'FillDailyReportForm',
+      params: {
+        id: id.toString(),
+        mode: 'detail' // 添加详情模式标识
+      }
+    })
+  } catch (error) {
+    console.error('跳转详情页面失败:', error)
+  }
+}
+
+const exportLoading = ref(false)
+const handleExport = async () => {}
+
+/** 初始化 **/
+onMounted(() => {
+  getList()
+})
+</script>

+ 353 - 947
src/views/pms/iotrddailyreport/index.vue

@@ -1,851 +1,178 @@
-<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="createTime"
-            :formatter="dateFormatter2"
-            :min-width="columnWidths.createTime.width"
-            resizable
-          />
-          <el-table-column
-            label="施工队伍"
-            align="center"
-            prop="deptName"
-            :min-width="columnWidths.deptName.width"
-            resizable
-          />
-
-          <el-table-column
-            label="任务"
-            align="center"
-            prop="taskName"
-            :min-width="columnWidths.taskName.width"
-            resizable
-          />
-
-          <el-table-column
-            :label="t('project.status')"
-            align="center"
-            prop="rdStatus"
-            :min-width="columnWidths.rdStatus.width"
-            resizable
-          >
-            <template #default="scope">
-              <dict-tag :type="DICT_TYPE.PMS_PROJECT_RD_STATUS" :value="scope.row.rdStatus" />
-            </template>
-          </el-table-column>
-
-          <el-table-column
-            label="当日生产动态"
-            align="center"
-            prop="productionStatus"
-            :min-width="columnWidths.productionStatus.width"
-            resizable
-          />
-          <el-table-column
-            label="下步工作计划"
-            align="center"
-            prop="nextPlan"
-            :min-width="columnWidths.nextPlan.width"
-            fixed-width
-          />
-
-          <!--
-          <el-table-column label="项目类别(钻井 修井 注氮 酸化压裂... )" align="center" prop="projectClassification" />
-          <el-table-column label="施工工艺" align="center" prop="techniqueIds" /> -->
-          <!--
-          <el-table-column label="施工设备" align="center" prop="deviceIds" /> -->
-          <!--
-          <el-table-column label="时间节点-结束" align="center" prop="endTime" /> -->
-          <el-table-column align="center" label="当日">
-            <el-table-column
-              label="施工井"
-              align="center"
-              prop="cumulativeWorkingWell"
-              :min-width="columnWidths.cumulativeWorkingWell.width"
-              resizable
-            />
-            <el-table-column
-              label="施工层"
-              align="center"
-              prop="cumulativeWorkingLayers"
-              :min-width="columnWidths.cumulativeWorkingLayers.width"
-              resizable
-            />
-            <el-table-column
-              label="泵车台次"
-              align="center"
-              prop="dailyPumpTrips"
-              :min-width="columnWidths.dailyPumpTrips.width"
-              resizable
-            />
-            <el-table-column
-              label="仪表/混砂"
-              align="center"
-              prop="dailyToolsSand"
-              :min-width="columnWidths.dailyToolsSand.width"
-              resizable
-            />
-          </el-table-column>
-          <el-table-column
-            label="趟数"
-            align="center"
-            prop="runCount"
-            :min-width="columnWidths.runCount.width"
-            resizable
-          />
-          <el-table-column
-            label="桥塞"
-            align="center"
-            prop="bridgePlug"
-            :min-width="columnWidths.bridgePlug.width"
-            resizable
-          />
-          <el-table-column
-            label="水方量"
-            align="center"
-            prop="waterVolume"
-            :min-width="columnWidths.waterVolume.width"
-            resizable
-          />
-          <el-table-column
-            label="时间H"
-            align="center"
-            prop="hourCount"
-            :min-width="columnWidths.hourCount.width"
-            resizable
-          />
-          <el-table-column
-            label="油耗(L)"
-            align="center"
-            prop="dailyFuel"
-            :min-width="columnWidths.dailyFuel.width"
-            resizable
-          />
-
-          <el-table-column
-            label="外租设备"
-            align="center"
-            prop="externalRental"
-            :min-width="columnWidths.externalRental.width"
-            resizable
-          />
-          <el-table-column
-            label="故障情况"
-            align="center"
-            prop="malfunction"
-            :min-width="columnWidths.malfunction.width"
-            resizable
-          />
-          <el-table-column
-            label="故障误工H"
-            align="center"
-            prop="faultDowntime"
-            :min-width="columnWidths.faultDowntime.width"
-            resizable
-          />
-          <el-table-column label="非生产时间" align="center">
-            <el-table-column
-              label="工程质量"
-              align="center"
-              prop="accidentTime"
-              :min-width="columnWidths.accidentTime.width"
-              resizable
-            />
-            <el-table-column
-              label="设备故障"
-              align="center"
-              prop="repairTime"
-              :min-width="columnWidths.repairTime.width"
-              resizable
-            />
-            <el-table-column
-              label="设备保养"
-              align="center"
-              prop="selfStopTime"
-              :min-width="columnWidths.selfStopTime.width"
-              resizable
-            />
-            <el-table-column
-              label="技术受限"
-              align="center"
-              prop="complexityTime"
-              :min-width="columnWidths.complexityTime.width"
-              resizable
-            />
-            <el-table-column
-              label="生产配合"
-              align="center"
-              prop="relocationTime"
-              :min-width="columnWidths.relocationTime.width"
-              resizable
-            />
-            <el-table-column
-              label="生产组织"
-              align="center"
-              prop="rectificationTime"
-              :min-width="columnWidths.rectificationTime.width"
-              resizable
-            />
-            <el-table-column
-              label="不可抗力"
-              align="center"
-              prop="waitingStopTime"
-              :min-width="columnWidths.waitingStopTime.width"
-              resizable
-            />
-            <el-table-column
-              label="待命"
-              align="center"
-              prop="winterBreakTime"
-              :min-width="columnWidths.winterBreakTime.width"
-              resizable
-            />
-            <el-table-column
-              label="甲方设计"
-              align="center"
-              prop="partyaDesign"
-              :min-width="columnWidths.partyaDesign.width"
-              resizable
-            />
-            <el-table-column
-              label="甲方准备"
-              align="center"
-              prop="partyaPrepare"
-              :min-width="columnWidths.partyaPrepare.width"
-              resizable
-            />
-            <el-table-column
-              label="甲方资源"
-              align="center"
-              prop="partyaResource"
-              :min-width="columnWidths.partyaResource.width"
-              resizable
-            />
-            <el-table-column
-              label="其它非生产时间"
-              align="center"
-              prop="otherNptTime"
-              :min-width="columnWidths.otherNptTime.width"
-              resizable
-            />
-          </el-table-column>
-          <el-table-column
-            label="其他非生产时间原因"
-            align="center"
-            prop="otherNptReason"
-            :min-width="columnWidths.otherNptReason.width"
-            resizable
-          />
-          <el-table-column
-            label="非生产时间填写"
-            align="center"
-            prop="nonProductFlag"
-            :min-width="110"
-          >
-            <template #default="scope">
-              <el-tag
-                :type="
-                  scope.row.nonProductFlag || scope.row.processInstanceId === '2'
-                    ? 'success'
-                    : 'danger'
-                "
-              >
-                {{
-                  scope.row.nonProductFlag || scope.row.processInstanceId === '2'
-                    ? '已填写'
-                    : '未填写'
-                }}
-              </el-tag>
-            </template>
-          </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="contractName"
-            :min-width="columnWidths.contractName.width"
-            resizable
-          />
-          <el-table-column
-            label="时间节点"
-            align="center"
-            prop="timeRange"
-            :min-width="columnWidths.timeRange.width"
-            resizable
-          />
-          <el-table-column label="审批状态" align="center" prop="auditStatus" :min-width="84">
-            <template #default="scope">
-              <el-tag v-if="scope.row.auditStatus === 0" type="info">
-                {{ '待提交' }}
-              </el-tag>
-              <el-tag v-else-if="scope.row.auditStatus === 10">
-                {{ '待审批' }}
-              </el-tag>
-              <el-tag v-else-if="scope.row.auditStatus === 20" type="success">
-                {{ '审批通过' }}
-              </el-tag>
-              <el-tag v-else-if="scope.row.auditStatus === 30" type="danger">
-                {{ '审批拒绝' }}
-              </el-tag>
-            </template>
-          </el-table-column>
-
-          <el-table-column label="操作" align="center" min-width="120px" fixed="right">
-            <template #default="scope">
-              <el-button
-                link
-                type="success"
-                @click="handleDetail(scope.row.id)"
-                v-hasPermi="['pms:iot-rd-daily-report:query']"
-              >
-                查看
-              </el-button>
-              <el-button
-                link
-                type="warning"
-                @click="handleApprove(scope.row.id)"
-                v-hasPermi="['pms:iot-rd-daily-report:update']"
-                v-if="scope.row.auditStatus === 10"
-              >
-                审批
-              </el-button>
-            </template>
-          </el-table-column>
-        </el-table>
-        <!-- 分页 -->
-        <Pagination
-          :total="total"
-          v-model:page="queryParams.pageNo"
-          v-model:limit="queryParams.pageSize"
-          @pagination="getList"
-        />
-      </ContentWrap>
-
-      <!-- 表单弹窗:添加/修改 -->
-      <IotRdDailyReportForm ref="formRef" @success="getList" />
-    </el-col>
-  </el-row>
-</template>
-
-<script setup lang="ts">
-import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
-import { IotRdDailyReportApi, IotRdDailyReportVO } from '@/api/pms/iotrddailyreport'
-import IotRdDailyReportForm from './IotRdDailyReportForm.vue'
-import { DICT_TYPE } from '@/utils/dict'
-import { useRoute } from 'vue-router'
-import DeptTree2 from '@/views/pms/iotrhdailyreport/DeptTree2.vue'
+<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 dayjs from 'dayjs'
-import quarterOfYear from 'dayjs/plugin/quarterOfYear'
 import download from '@/utils/download'
 
-dayjs.extend(quarterOfYear)
+defineOptions({ name: 'IotRdDailyReport' })
 
-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 { t } = useI18n()
 
-/** 瑞都日报 列表 */
-defineOptions({ name: 'IotRdDailyReport' })
+const router = useRouter()
+const route = useRoute()
 
-const message = useMessage() // 消息弹窗
-const { t } = useI18n() // 国际化
-const { push } = useRouter() // 路由跳转
-const loading = ref(true) // 列表的加载中
-const list = ref<IotRdDailyReportVO[]>([]) // 列表的数据
-const total = ref(0) // 列表的总页数
+const message = useMessage()
 
-const route = useRoute() // 路由信息
+const id = useUserStore().getUser.deptId
+
+const deptId = id
+
+interface Query {
+  deptId?: number
+  contractName?: string
+  taskName?: string
+  createTime?: string[]
+  wellName?: string
+  taskId?: number
+  pageNo: number
+  pageSize: number
+}
 
-const queryParams = reactive({
+const initQuery: Query = {
   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() // 搜索的表单
+  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
+}
 
-const rootDeptId = ref(163)
+const query = ref<Query>({ ...initQuery })
+
+interface ListItem {
+  createTime: string
+  deptName: string
+  taskName: string
+  rdStatus: string
+  productionStatus: string
+  nextPlan: string
+  cumulativeWorkingWell: number
+  cumulativeWorkingLayers: number
+  dailyPumpTrips: number
+  dailyToolsSand: number
+  runCount: number
+  bridgePlug: number
+  waterVolume: number
+  hourCount: number
+  dailyFuel: number
+  externalRental: string
+  malfunction: string
+  faultDowntime: number
+  accidentTime: number
+  repairTime: number
+  selfStopTime: number
+  complexityTime: number
+  relocationTime: number
+  rectificationTime: number
+  waitingStopTime: number
+  winterBreakTime: number
+  partyaDesign: number
+  partyaPrepare: number
+  partyaResource: number
+  otherNptTime: number
+  otherNptReason: string
+  nonProductFlag: boolean
+  nonProductionRate: number
+  contractName: string
+  timeRange: string
+  auditStatus: number
+}
 
-// 表格引用
-const tableRef = ref()
-// 表格容器引用
-const tableContainerRef = ref()
+const list = ref<ListItem[]>([])
+const total = ref(0)
 
-const columnWidths = ref<
-  Record<
-    string,
-    { label: string; prop: string; width: string; fn?: (row: IotRdDailyReportVO) => string }
-  >
->({
-  createTime: {
-    label: '创建时间',
-    prop: 'createTime',
-    width: '120px',
-    fn: (row: IotRdDailyReportVO) => dateFormatter(null, null, row.createTime)
-  },
-  deptName: {
-    label: '施工队伍',
-    prop: 'deptName',
-    width: '120px'
-  },
-  contractName: {
-    label: '项目',
-    prop: 'contractName',
-    width: '120px'
-  },
-  taskName: {
-    label: '任务',
-    prop: 'taskName',
-    width: '120px'
-  },
-  timeRange: {
-    label: '时间节点',
-    prop: 'timeRange',
-    width: '120px'
-  },
-  rdStatus: {
-    label: '施工状态',
-    prop: 'rdStatus',
-    width: '120px'
-  },
-  cumulativeWorkingWell: {
-    label: '施工井',
-    prop: 'cumulativeWorkingWell',
-    width: '120px'
-  },
-  cumulativeWorkingLayers: {
-    label: '施工层',
-    prop: 'cumulativeWorkingLayers',
-    width: '120px'
-  },
-  dailyPumpTrips: {
-    label: '泵车台次',
-    prop: 'dailyPumpTrips',
-    width: '120px'
-  },
-  dailyToolsSand: {
-    label: '仪表/混砂',
-    prop: 'dailyToolsSand',
-    width: '120px'
-  },
-  runCount: {
-    label: '趟数',
-    prop: 'runCount',
-    width: '120px'
-  },
-  bridgePlug: {
-    label: '桥塞',
-    prop: 'bridgePlug',
-    width: '120px'
-  },
-  waterVolume: {
-    label: '水方量',
-    prop: 'waterVolume',
-    width: '120px'
-  },
-  hourCount: {
-    label: '时间H',
-    prop: 'hourCount',
-    width: '120px'
-  },
-  dailyFuel: {
-    label: '油耗(L)',
-    prop: 'dailyFuel',
-    width: '120px'
-  },
-  productionStatus: {
-    label: '当日生产动态',
-    prop: 'productionStatus',
-    width: '120px'
-  },
-  nextPlan: {
-    label: '下步工作计划',
-    prop: 'nextPlan',
-    width: '120px'
-  },
-  externalRental: {
-    label: '外租设备',
-    prop: 'externalRental',
-    width: '120px'
-  },
-  malfunction: {
-    label: '故障情况',
-    prop: 'malfunction',
-    width: '120px'
-  },
-  faultDowntime: {
-    label: '故障误工H',
-    prop: 'faultDowntime',
-    width: '120px'
-  },
-  accidentTime: {
-    label: '工程质量',
-    prop: 'accidentTime',
-    width: '120px'
-  },
-  repairTime: {
-    label: '设备故障',
-    prop: 'repairTime',
-    width: '120px'
-  },
-  selfStopTime: {
-    label: '设备保养',
-    prop: 'selfStopTime',
-    width: '120px'
-  },
-  complexityTime: {
-    label: '技术受限',
-    prop: 'complexityTime',
-    width: '120px'
-  },
-  relocationTime: {
-    label: '生产配合',
-    prop: 'relocationTime',
-    width: '120px'
-  },
-  rectificationTime: {
-    label: '生产组织',
-    prop: 'rectificationTime',
-    width: '120px'
-  },
-  waitingStopTime: {
-    label: '不可抗力',
-    prop: 'waitingStopTime',
-    width: '120px'
-  },
-  winterBreakTime: {
-    label: '待命',
-    prop: 'winterBreakTime',
-    width: '120px'
-  },
-  partyaDesign: {
-    label: '甲方设计',
-    prop: 'partyaDesign',
-    width: '120px'
-  },
-  partyaPrepare: {
-    label: '甲方资源',
-    prop: 'partyaPrepare',
-    width: '120px'
-  },
-  partyaResource: {
-    label: '甲方准备',
-    prop: 'partyaResource',
-    width: '120px'
-  },
-  otherNptTime: {
-    label: '其它非生产时间',
-    prop: 'otherNptTime',
-    width: '120px'
-  },
-  otherNptReason: {
-    label: '其他非生产时间原因',
-    prop: 'otherNptReason',
-    width: '120px'
-  }
-})
-
-// 计算文本宽度
-const getTextWidth = (text: string, fontSize = 12) => {
-  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 = 'PingFang SC'
-  span.innerText = text
-
-  document.body.appendChild(span)
-  const width = span.offsetWidth
-  document.body.removeChild(span)
-
-  return width
-}
+const loading = ref(false)
 
-const calculateColumnWidths = useDebounceFn(() => {
-  if (!tableContainerRef.value?.$el) return
-  Object.values(columnWidths.value).forEach(({ fn, prop, label, width }) => {
-    width =
-      Math.min(
-        ...[
-          Math.max(
-            ...[
-              getTextWidth(label),
-              ...list.value.map((v) => {
-                return getTextWidth(fn ? fn(v) : v[prop])
-              })
-            ]
-          ) + (label === '施工状态' ? 35 : 20),
-          200
-        ]
-      ) + 'px'
-
-    console.log('width :>> ', width)
-
-    columnWidths.value[prop].width = width
-  })
-}, 1000)
-
-/** 查询列表 */
-const getList = async () => {
+const loadList = useDebounceFn(async function () {
   loading.value = true
   try {
-    const data = await IotRdDailyReportApi.getIotRdDailyReportPage(queryParams)
+    const data = await IotRdDailyReportApi.getIotRdDailyReportPage(query.value)
     list.value = data.list
     total.value = data.total
-    // 获取数据后计算列宽
-    nextTick(() => {
-      calculateColumnWidths()
-    })
   } finally {
     loading.value = false
   }
+})
+
+function handleSizeChange(val: number) {
+  query.value.pageSize = val
+  handleQuery()
 }
 
-/** 搜索按钮操作 */
-const handleQuery = () => {
-  queryParams.pageNo = 1
-  getList()
+function handleCurrentChange(val: number) {
+  query.value.pageNo = val
+  loadList()
 }
 
-/** 重置按钮操作 */
-const resetQuery = () => {
-  queryFormRef.value.resetFields()
+function handleQuery(setPage = true) {
+  if (setPage) {
+    query.value.pageNo = 1
+  }
+  loadList()
+}
+
+function resetQuery() {
+  query.value = { ...initQuery }
+
   handleQuery()
 }
 
-/** 添加/修改操作 */
+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 handleDetail = async (id: number) => {
+const exportLoading = ref(false)
+
+async function handleExport() {
   try {
-    // 跳转到 FillDailyReportForm 页面,传递审批模式和ID
-    push({
+    await message.exportConfirm()
+
+    exportLoading.value = true
+    const res = await IotRdDailyReportApi.exportIotRdDailyReportDetails(query.value)
+
+    download.excel(res, '瑞都日报明细.xlsx')
+  } finally {
+    exportLoading.value = false
+  }
+}
+
+const { ZmTable, ZmTableColumn } = useTableComponents<ListItem>()
+
+function formCreateTime(row: ListItem) {
+  return dayjs(row.createTime).format('YYYY-MM-DD HH:mm:ss')
+}
+
+function realValue(type: any, value: string) {
+  const option = getDictOptions(type).find((item) => item.value === value)
+  return option?.label || value
+}
+
+function handleDetail(id: number) {
+  try {
+    router.push({
       name: 'FillDailyReportForm',
       params: {
         id: id.toString(),
-        mode: 'detail' // 添加详情模式标识
+        mode: 'detail'
       }
     })
   } catch (error) {
@@ -853,156 +180,235 @@ const handleDetail = async (id: number) => {
   }
 }
 
-// 响应式变量存储选中的部门
-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 handleApprove = async (id: number) => {
+function handleApprove(id: number) {
   try {
-    // 跳转到 FillDailyReportForm 页面,传递审批模式和ID
-    push({
+    router.push({
       name: 'FillDailyReportForm',
       params: {
         id: id.toString(),
-        mode: 'approval' // 添加审批模式标识
+        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.exportIotRdDailyReportDetails(queryParams)
-
-  download.excel(res, '瑞都日报明细.xlsx')
-}
-
-// 声明 ResizeObserver 实例
-let resizeObserver: ResizeObserver | null = null
-
-/** 初始化 **/
-onMounted(() => {
-  if (Object.keys(route.query).length > 0) {
-    nextTick(() => {
-      if (route.query.deptId) {
-        queryParams.deptId = Number(route.query.deptId) as any
-      }
-
-      if (route.query.createTime?.length) {
-        queryParams.createTime = route.query.createTime as any
-      }
-
-      if (route.query.wellName) {
-        queryParams.taskName = route.query.wellName as any
-      }
-      if (route.query.taskId) {
-        queryParams.taskId = route.query.taskId as any
-      }
-
-      handleQuery()
-    })
-  } else 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(
-  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%;
-}
-
-/* 长文本样式 - 多行显示并添加省略号 */
-.long-text {
-  display: -webkit-box;
-  max-height: 3em; /* 两行文本的高度 */
-  overflow: hidden;
-  line-height: 1.5;
-  text-overflow: ellipsis;
-  -webkit-box-orient: vertical;
-  -webkit-line-clamp: 2;
-}
+<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="list"
+              :loading="loading"
+              :width="width"
+              :max-height="height"
+              :height="height"
+              show-border
+            >
+              <zm-table-column
+                prop="createTime"
+                label="创建时间"
+                cover-formatter
+                :real-value="formCreateTime"
+              />
+              <zm-table-column prop="deptName" label="施工队伍" />
+              <zm-table-column prop="taskName" label="任务" />
+              <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="productionStatus" label="当日生产动态" />
+              <zm-table-column prop="nextPlan" label="下步工作计划" />
+              <zm-table-column label="当日">
+                <zm-table-column prop="cumulativeWorkingWell" label="施工井" />
+                <zm-table-column prop="cumulativeWorkingLayers" label="施工层" />
+                <zm-table-column prop="dailyPumpTrips" label="泵车台次" />
+                <zm-table-column prop="dailyToolsSand" label="仪表/混砂" />
+              </zm-table-column>
+              <zm-table-column prop="runCount" label="趟数" />
+              <zm-table-column prop="bridgePlug" label="桥塞" />
+              <zm-table-column prop="waterVolume" label="水方量" />
+              <zm-table-column prop="hourCount" label="时间(H)" />
+              <zm-table-column prop="dailyFuel" label="油耗(L)" />
+              <zm-table-column prop="externalRental" label="外租设备" />
+              <zm-table-column prop="malfunction" label="故障情况" />
+              <zm-table-column prop="faultDowntime" label="故障误工(H)" />
+              <zm-table-column
+                prop="nonProductionRate"
+                label="非生产时效"
+                cover-formatter
+                :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="设备故障" />
+                <zm-table-column prop="selfStopTime" label="设备保养" />
+                <zm-table-column prop="complexityTime" label="技术受限" />
+                <zm-table-column prop="relocationTime" label="生产配合" />
+                <zm-table-column prop="rectificationTime" label="生产组织" />
+                <zm-table-column prop="waitingStopTime" label="不可抗力" />
+                <zm-table-column prop="winterBreakTime" label="待命" />
+                <zm-table-column prop="partyaDesign" label="甲方设计" />
+                <zm-table-column prop="partyaPrepare" label="甲方准备" />
+                <zm-table-column prop="partyaResource" label="甲方资源" />
+                <zm-table-column prop="otherNptTime" label="其它非生产时间" />
+              </zm-table-column>
+              <zm-table-column prop="otherNptReason" label="其他非生产时间原因" />
+              <zm-table-column prop="nonProductFlag" label="非生产时间填写">
+                <template #default="scope">
+                  <el-tag
+                    :type="
+                      scope.row.nonProductFlag || scope.row.processInstanceId === '2'
+                        ? 'success'
+                        : 'danger'
+                    "
+                  >
+                    {{
+                      scope.row.nonProductFlag || scope.row.processInstanceId === '2'
+                        ? '已填写'
+                        : '未填写'
+                    }}
+                  </el-tag>
+                </template>
+              </zm-table-column>
+              <zm-table-column prop="contractName" label="项目" />
+              <zm-table-column prop="timeRange" label="时间节点" />
+              <zm-table-column prop="auditStatus" label="审批状态">
+                <template #default="scope">
+                  <el-tag v-if="scope.row.auditStatus === 0" type="info">
+                    {{ '待提交' }}
+                  </el-tag>
+                  <el-tag v-else-if="scope.row.auditStatus === 10">
+                    {{ '待审批' }}
+                  </el-tag>
+                  <el-tag v-else-if="scope.row.auditStatus === 20" type="success">
+                    {{ '审批通过' }}
+                  </el-tag>
+                  <el-tag v-else-if="scope.row.auditStatus === 30" type="danger">
+                    {{ '审批拒绝' }}
+                  </el-tag>
+                </template>
+              </zm-table-column>
+              <zm-table-column label="操作" width="120" fixed="right">
+                <template #default="scope">
+                  <el-button
+                    link
+                    type="success"
+                    @click="handleDetail(scope.row.id)"
+                    v-hasPermi="['pms:iot-rd-daily-report:query']"
+                  >
+                    查看
+                  </el-button>
+                  <el-button
+                    link
+                    type="warning"
+                    @click="handleApprove(scope.row.id)"
+                    v-hasPermi="['pms:iot-rd-daily-report:update']"
+                    v-if="scope.row.auditStatus === 10"
+                  >
+                    审批
+                  </el-button>
+                </template>
+              </zm-table-column>
+            </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="query.pageNo"
+          v-model: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>
 
-/* 确保固定宽度列不参与自动调整 */
-:deep(.el-table__header-wrapper .el-table__cell.fixed-width),
-:deep(.el-table__body-wrapper .el-table__cell.fixed-width) {
-  flex-shrink: 0;
-  flex-grow: 0;
-}
-</style>
+  <IotRdDailyReportForm ref="formRef" @success="loadList" />
+</template>
 
-<style>
-/* 长文本 tooltip 样式 - 保留换行符 */
-.long-text-tooltip {
-  max-width: 500px;
-  line-height: 1.5;
-  white-space: pre-line;
+<style scoped>
+:deep(.el-form-item) {
+  margin-bottom: 0;
 }
 </style>

+ 996 - 0
src/views/pms/iotrddailyreport/index1.vue

@@ -0,0 +1,996 @@
+<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="createTime"
+            :formatter="dateFormatter2"
+            :min-width="columnWidths.createTime.width"
+            resizable
+          />
+          <el-table-column
+            label="施工队伍"
+            align="center"
+            prop="deptName"
+            :min-width="columnWidths.deptName.width"
+            resizable
+          />
+
+          <el-table-column
+            label="任务"
+            align="center"
+            prop="taskName"
+            :min-width="columnWidths.taskName.width"
+            resizable
+          />
+
+          <el-table-column
+            :label="t('project.status')"
+            align="center"
+            prop="rdStatus"
+            :min-width="columnWidths.rdStatus.width"
+            resizable
+          >
+            <template #default="scope">
+              <dict-tag :type="DICT_TYPE.PMS_PROJECT_RD_STATUS" :value="scope.row.rdStatus" />
+            </template>
+          </el-table-column>
+
+          <el-table-column
+            label="当日生产动态"
+            align="center"
+            prop="productionStatus"
+            :min-width="columnWidths.productionStatus.width"
+            resizable
+          />
+          <el-table-column
+            label="下步工作计划"
+            align="center"
+            prop="nextPlan"
+            :min-width="columnWidths.nextPlan.width"
+            fixed-width
+          />
+
+          <!--
+          <el-table-column label="项目类别(钻井 修井 注氮 酸化压裂... )" align="center" prop="projectClassification" />
+          <el-table-column label="施工工艺" align="center" prop="techniqueIds" /> -->
+          <!--
+          <el-table-column label="施工设备" align="center" prop="deviceIds" /> -->
+          <!--
+          <el-table-column label="时间节点-结束" align="center" prop="endTime" /> -->
+          <el-table-column align="center" label="当日">
+            <el-table-column
+              label="施工井"
+              align="center"
+              prop="cumulativeWorkingWell"
+              :min-width="columnWidths.cumulativeWorkingWell.width"
+              resizable
+            />
+            <el-table-column
+              label="施工层"
+              align="center"
+              prop="cumulativeWorkingLayers"
+              :min-width="columnWidths.cumulativeWorkingLayers.width"
+              resizable
+            />
+            <el-table-column
+              label="泵车台次"
+              align="center"
+              prop="dailyPumpTrips"
+              :min-width="columnWidths.dailyPumpTrips.width"
+              resizable
+            />
+            <el-table-column
+              label="仪表/混砂"
+              align="center"
+              prop="dailyToolsSand"
+              :min-width="columnWidths.dailyToolsSand.width"
+              resizable
+            />
+          </el-table-column>
+          <el-table-column
+            label="趟数"
+            align="center"
+            prop="runCount"
+            :min-width="columnWidths.runCount.width"
+            resizable
+          />
+          <el-table-column
+            label="桥塞"
+            align="center"
+            prop="bridgePlug"
+            :min-width="columnWidths.bridgePlug.width"
+            resizable
+          />
+          <el-table-column
+            label="水方量"
+            align="center"
+            prop="waterVolume"
+            :min-width="columnWidths.waterVolume.width"
+            resizable
+          />
+          <el-table-column
+            label="时间H"
+            align="center"
+            prop="hourCount"
+            :min-width="columnWidths.hourCount.width"
+            resizable
+          />
+          <el-table-column
+            label="油耗(L)"
+            align="center"
+            prop="dailyFuel"
+            :min-width="columnWidths.dailyFuel.width"
+            resizable
+          />
+
+          <el-table-column
+            label="外租设备"
+            align="center"
+            prop="externalRental"
+            :min-width="columnWidths.externalRental.width"
+            resizable
+          />
+          <el-table-column
+            label="故障情况"
+            align="center"
+            prop="malfunction"
+            :min-width="columnWidths.malfunction.width"
+            resizable
+          />
+          <el-table-column
+            label="故障误工H"
+            align="center"
+            prop="faultDowntime"
+            :min-width="columnWidths.faultDowntime.width"
+            resizable
+          />
+          <el-table-column label="非生产时间" align="center">
+            <el-table-column
+              label="工程质量"
+              align="center"
+              prop="accidentTime"
+              :min-width="columnWidths.accidentTime.width"
+              resizable
+            />
+            <el-table-column
+              label="设备故障"
+              align="center"
+              prop="repairTime"
+              :min-width="columnWidths.repairTime.width"
+              resizable
+            />
+            <el-table-column
+              label="设备保养"
+              align="center"
+              prop="selfStopTime"
+              :min-width="columnWidths.selfStopTime.width"
+              resizable
+            />
+            <el-table-column
+              label="技术受限"
+              align="center"
+              prop="complexityTime"
+              :min-width="columnWidths.complexityTime.width"
+              resizable
+            />
+            <el-table-column
+              label="生产配合"
+              align="center"
+              prop="relocationTime"
+              :min-width="columnWidths.relocationTime.width"
+              resizable
+            />
+            <el-table-column
+              label="生产组织"
+              align="center"
+              prop="rectificationTime"
+              :min-width="columnWidths.rectificationTime.width"
+              resizable
+            />
+            <el-table-column
+              label="不可抗力"
+              align="center"
+              prop="waitingStopTime"
+              :min-width="columnWidths.waitingStopTime.width"
+              resizable
+            />
+            <el-table-column
+              label="待命"
+              align="center"
+              prop="winterBreakTime"
+              :min-width="columnWidths.winterBreakTime.width"
+              resizable
+            />
+            <el-table-column
+              label="甲方设计"
+              align="center"
+              prop="partyaDesign"
+              :min-width="columnWidths.partyaDesign.width"
+              resizable
+            />
+            <el-table-column
+              label="甲方准备"
+              align="center"
+              prop="partyaPrepare"
+              :min-width="columnWidths.partyaPrepare.width"
+              resizable
+            />
+            <el-table-column
+              label="甲方资源"
+              align="center"
+              prop="partyaResource"
+              :min-width="columnWidths.partyaResource.width"
+              resizable
+            />
+            <el-table-column
+              label="其它非生产时间"
+              align="center"
+              prop="otherNptTime"
+              :min-width="columnWidths.otherNptTime.width"
+              resizable
+            />
+          </el-table-column>
+          <el-table-column
+            label="其他非生产时间原因"
+            align="center"
+            prop="otherNptReason"
+            :min-width="columnWidths.otherNptReason.width"
+            resizable
+          />
+          <el-table-column
+            label="非生产时间填写"
+            align="center"
+            prop="nonProductFlag"
+            :min-width="110"
+          >
+            <template #default="scope">
+              <el-tag
+                :type="
+                  scope.row.nonProductFlag || scope.row.processInstanceId === '2'
+                    ? 'success'
+                    : 'danger'
+                "
+              >
+                {{
+                  scope.row.nonProductFlag || scope.row.processInstanceId === '2'
+                    ? '已填写'
+                    : '未填写'
+                }}
+              </el-tag>
+            </template>
+          </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="contractName"
+            :min-width="columnWidths.contractName.width"
+            resizable
+          />
+          <el-table-column
+            label="时间节点"
+            align="center"
+            prop="timeRange"
+            :min-width="columnWidths.timeRange.width"
+            resizable
+          />
+          <el-table-column label="审批状态" align="center" prop="auditStatus" :min-width="84">
+            <template #default="scope">
+              <el-tag v-if="scope.row.auditStatus === 0" type="info">
+                {{ '待提交' }}
+              </el-tag>
+              <el-tag v-else-if="scope.row.auditStatus === 10">
+                {{ '待审批' }}
+              </el-tag>
+              <el-tag v-else-if="scope.row.auditStatus === 20" type="success">
+                {{ '审批通过' }}
+              </el-tag>
+              <el-tag v-else-if="scope.row.auditStatus === 30" type="danger">
+                {{ '审批拒绝' }}
+              </el-tag>
+            </template>
+          </el-table-column>
+
+          <el-table-column label="操作" align="center" min-width="120px" fixed="right">
+            <template #default="scope">
+              <el-button
+                link
+                type="success"
+                @click="handleDetail(scope.row.id)"
+                v-hasPermi="['pms:iot-rd-daily-report:query']"
+              >
+                查看
+              </el-button>
+              <el-button
+                link
+                type="warning"
+                @click="handleApprove(scope.row.id)"
+                v-hasPermi="['pms:iot-rd-daily-report:update']"
+                v-if="scope.row.auditStatus === 10"
+              >
+                审批
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+        <!-- 分页 -->
+        <Pagination
+          :total="total"
+          v-model:page="queryParams.pageNo"
+          v-model:limit="queryParams.pageSize"
+          @pagination="getList"
+        />
+      </ContentWrap>
+
+      <!-- 表单弹窗:添加/修改 -->
+      <IotRdDailyReportForm ref="formRef" @success="getList" />
+    </el-col>
+  </el-row>
+</template>
+
+<script setup lang="ts">
+import { dateFormatter, dateFormatter2 } from '@/utils/formatTime'
+import { IotRdDailyReportApi, IotRdDailyReportVO } from '@/api/pms/iotrddailyreport'
+import IotRdDailyReportForm from './IotRdDailyReportForm.vue'
+import { DICT_TYPE } from '@/utils/dict'
+import { useRoute } from 'vue-router'
+import DeptTree2 from '@/views/pms/iotrhdailyreport/DeptTree2.vue'
+import { useDebounceFn } from '@vueuse/core'
+
+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: 'IotRdDailyReport' })
+
+const message = useMessage() // 消息弹窗
+const { t } = useI18n() // 国际化
+const { push } = useRouter() // 路由跳转
+const loading = ref(true) // 列表的加载中
+const list = ref<IotRdDailyReportVO[]>([]) // 列表的数据
+const total = ref(0) // 列表的总页数
+
+const route = useRoute() // 路由信息
+
+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 tableRef = ref()
+// 表格容器引用
+const tableContainerRef = ref()
+
+const columnWidths = ref<
+  Record<
+    string,
+    { label: string; prop: string; width: string; fn?: (row: IotRdDailyReportVO) => string }
+  >
+>({
+  createTime: {
+    label: '创建时间',
+    prop: 'createTime',
+    width: '120px',
+    fn: (row: IotRdDailyReportVO) => dateFormatter(null, null, row.createTime)
+  },
+  deptName: {
+    label: '施工队伍',
+    prop: 'deptName',
+    width: '120px'
+  },
+  contractName: {
+    label: '项目',
+    prop: 'contractName',
+    width: '120px'
+  },
+  taskName: {
+    label: '任务',
+    prop: 'taskName',
+    width: '120px'
+  },
+  timeRange: {
+    label: '时间节点',
+    prop: 'timeRange',
+    width: '120px'
+  },
+  rdStatus: {
+    label: '施工状态',
+    prop: 'rdStatus',
+    width: '120px'
+  },
+  cumulativeWorkingWell: {
+    label: '施工井',
+    prop: 'cumulativeWorkingWell',
+    width: '120px'
+  },
+  cumulativeWorkingLayers: {
+    label: '施工层',
+    prop: 'cumulativeWorkingLayers',
+    width: '120px'
+  },
+  dailyPumpTrips: {
+    label: '泵车台次',
+    prop: 'dailyPumpTrips',
+    width: '120px'
+  },
+  dailyToolsSand: {
+    label: '仪表/混砂',
+    prop: 'dailyToolsSand',
+    width: '120px'
+  },
+  runCount: {
+    label: '趟数',
+    prop: 'runCount',
+    width: '120px'
+  },
+  bridgePlug: {
+    label: '桥塞',
+    prop: 'bridgePlug',
+    width: '120px'
+  },
+  waterVolume: {
+    label: '水方量',
+    prop: 'waterVolume',
+    width: '120px'
+  },
+  hourCount: {
+    label: '时间H',
+    prop: 'hourCount',
+    width: '120px'
+  },
+  dailyFuel: {
+    label: '油耗(L)',
+    prop: 'dailyFuel',
+    width: '120px'
+  },
+  productionStatus: {
+    label: '当日生产动态',
+    prop: 'productionStatus',
+    width: '120px'
+  },
+  nextPlan: {
+    label: '下步工作计划',
+    prop: 'nextPlan',
+    width: '120px'
+  },
+  externalRental: {
+    label: '外租设备',
+    prop: 'externalRental',
+    width: '120px'
+  },
+  malfunction: {
+    label: '故障情况',
+    prop: 'malfunction',
+    width: '120px'
+  },
+  faultDowntime: {
+    label: '故障误工H',
+    prop: 'faultDowntime',
+    width: '120px'
+  },
+  accidentTime: {
+    label: '工程质量',
+    prop: 'accidentTime',
+    width: '120px'
+  },
+  repairTime: {
+    label: '设备故障',
+    prop: 'repairTime',
+    width: '120px'
+  },
+  selfStopTime: {
+    label: '设备保养',
+    prop: 'selfStopTime',
+    width: '120px'
+  },
+  complexityTime: {
+    label: '技术受限',
+    prop: 'complexityTime',
+    width: '120px'
+  },
+  relocationTime: {
+    label: '生产配合',
+    prop: 'relocationTime',
+    width: '120px'
+  },
+  rectificationTime: {
+    label: '生产组织',
+    prop: 'rectificationTime',
+    width: '120px'
+  },
+  waitingStopTime: {
+    label: '不可抗力',
+    prop: 'waitingStopTime',
+    width: '120px'
+  },
+  winterBreakTime: {
+    label: '待命',
+    prop: 'winterBreakTime',
+    width: '120px'
+  },
+  partyaDesign: {
+    label: '甲方设计',
+    prop: 'partyaDesign',
+    width: '120px'
+  },
+  partyaPrepare: {
+    label: '甲方资源',
+    prop: 'partyaPrepare',
+    width: '120px'
+  },
+  partyaResource: {
+    label: '甲方准备',
+    prop: 'partyaResource',
+    width: '120px'
+  },
+  otherNptTime: {
+    label: '其它非生产时间',
+    prop: 'otherNptTime',
+    width: '120px'
+  },
+  otherNptReason: {
+    label: '其他非生产时间原因',
+    prop: 'otherNptReason',
+    width: '120px'
+  }
+})
+
+// 计算文本宽度
+const getTextWidth = (text: string, fontSize = 12) => {
+  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 = 'PingFang SC'
+  span.innerText = text
+
+  document.body.appendChild(span)
+  const width = span.offsetWidth
+  document.body.removeChild(span)
+
+  return width
+}
+
+const calculateColumnWidths = useDebounceFn(() => {
+  if (!tableContainerRef.value?.$el) return
+  Object.values(columnWidths.value).forEach(({ fn, prop, label, width }) => {
+    width =
+      Math.min(
+        ...[
+          Math.max(
+            ...[
+              getTextWidth(label),
+              ...list.value.map((v) => {
+                return getTextWidth(fn ? fn(v) : v[prop])
+              })
+            ]
+          ) + (label === '施工状态' ? 35 : 20),
+          200
+        ]
+      ) + 'px'
+
+    console.log('width :>> ', width)
+
+    columnWidths.value[prop].width = width
+  })
+}, 1000)
+
+/** 查询列表 */
+const getList = async () => {
+  loading.value = true
+  try {
+    const data = await IotRdDailyReportApi.getIotRdDailyReportPage(queryParams)
+    list.value = data.list
+    total.value = data.total
+    // 获取数据后计算列宽
+    nextTick(() => {
+      calculateColumnWidths()
+    })
+  } finally {
+    loading.value = false
+  }
+}
+
+/** 搜索按钮操作 */
+const handleQuery = () => {
+  queryParams.pageNo = 1
+  getList()
+}
+
+/** 重置按钮操作 */
+const resetQuery = () => {
+  queryFormRef.value.resetFields()
+  handleQuery()
+}
+
+/** 添加/修改操作 */
+const formRef = ref()
+const openForm = (type: string, id?: number) => {
+  formRef.value.open(type, id)
+}
+
+/** 查看日报详情 */
+const handleDetail = async (id: number) => {
+  try {
+    // 跳转到 FillDailyReportForm 页面,传递审批模式和ID
+    push({
+      name: 'FillDailyReportForm',
+      params: {
+        id: id.toString(),
+        mode: 'detail' // 添加详情模式标识
+      }
+    })
+  } catch (error) {
+    console.error('跳转详情页面失败:', error)
+  }
+}
+
+// 响应式变量存储选中的部门
+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 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.exportIotRdDailyReportDetails(queryParams)
+
+  download.excel(res, '瑞都日报明细.xlsx')
+}
+
+// 声明 ResizeObserver 实例
+let resizeObserver: ResizeObserver | null = null
+
+/** 初始化 **/
+onMounted(() => {
+  // 检查是否有路由参数传递过来的 wellName
+  if (route.query.wellName) {
+    queryParams.taskName = route.query.wellName as string
+  }
+  if (route.query.taskId) {
+    queryParams.taskId = route.query.taskId as number
+  }
+  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(
+  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%;
+}
+
+/* 长文本样式 - 多行显示并添加省略号 */
+.long-text {
+  display: -webkit-box;
+  max-height: 3em; /* 两行文本的高度 */
+  overflow: hidden;
+  line-height: 1.5;
+  text-overflow: ellipsis;
+  -webkit-box-orient: vertical;
+  -webkit-line-clamp: 2;
+}
+
+/* 确保固定宽度列不参与自动调整 */
+:deep(.el-table__header-wrapper .el-table__cell.fixed-width),
+:deep(.el-table__body-wrapper .el-table__cell.fixed-width) {
+  flex-shrink: 0;
+  flex-grow: 0;
+}
+</style>
+
+<style>
+/* 长文本 tooltip 样式 - 保留换行符 */
+.long-text-tooltip {
+  max-width: 500px;
+  line-height: 1.5;
+  white-space: pre-line;
+}
+</style>

+ 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="[10, 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>