Parcourir la source

✨ feat(报表统计): 瑞都单井队

Zimo il y a 2 jours
Parent
commit
9875a3e760
2 fichiers modifiés avec 120 ajouts et 182 suppressions
  1. 1 1
      src/views/report-statistics/costs.vue
  2. 119 181
      src/views/report-statistics/rd-daily-report.vue

+ 1 - 1
src/views/report-statistics/costs.vue

@@ -77,7 +77,7 @@ const defaultStats: StatItem[] = [
     trend: 0
   },
   {
-    key: 'msg',
+    key: 'byFee',
     title: '保养成本',
     icon: 'i-material-symbols:construction-rounded',
     class: {

+ 119 - 181
src/views/report-statistics/rd-daily-report.vue

@@ -4,7 +4,6 @@ import { rangeShortcuts } from '@/utils/formatTime'
 import { useDebounceFn } from '@vueuse/core'
 import dayjs from 'dayjs'
 import { DICT_TYPE, getDictOptions } from '@/utils/dict'
-import { TableColumnCtx } from 'element-plus/es/components/table/src/table-column/defaults'
 import { useUserStore } from '@/store/modules/user'
 
 defineOptions({ name: 'DailyReport' })
@@ -21,29 +20,22 @@ interface List {
   deptId: number
   projectId: number
   taskId: number
-  relocationDays: number // 搬迁安装天数
-  designInjection: string // 设计注气量(万方)
-  transitTime: number // 运行时效
-  dailyGasInjection: number // 注气量(万方)
-  dailyWaterInjection: number // 注水量(方)
-  dailyInjectGasTime: number // 注气时间(H)
-  dailyInjectWaterTime: number // 注水时间(H)
-  dailyPowerUsage: number // 日耗电量(度)
-  dailyOilUsage: number // 日耗油量(升)
-  nonProductionTime: number // 非生产时间(小时)
-  nptReason: string // 非生产时间原因
-  constructionStartDate: number // 施工开始日期
-  constructionEndDate: number // 施工结束日期
-  productionStatus: string // 生产动态
-  constructionStatus: string // 施工状态
-  totalGasInjection: number // 注气量(万方)
-  totalWaterInjection: number // 注水量(方)
-  cumulativeCompletion: number // 完工井次
-  capacity: number // 产能(万方)
-  remark: string // 备注
-  auditStatus: number // 审核状态
-  status: number // 状态
-  opinion: string // 审核意见
+  timeRange: any // 时间节点
+  rdStatus: string // 施工状态
+  cumulativeWorkingWell: number // 施工井
+  cumulativeWorkingLayers: number // 施工层
+  dailyPumpTrips: number // 泵车台次
+  dailyToolsSand: number // 仪表/混砂
+  runCount: number // 趟数
+  bridgePlug: number // 桥塞
+  waterVolume: number // 水方量
+  hourCount: number // 时间H
+  dailyFuel: number // 油耗(L)
+  productionStatus: string // 当日生产动态
+  nextPlan: string // 下步工作计划
+  externalRental: string // 外租设备
+  malfunction: string // 故障情况
+  faultDowntime: number // 故障误工H
   lastGroupIdFlag: boolean
 }
 
@@ -79,147 +71,91 @@ const columns = ref<Column[]>([
     'min-width': '120px'
   },
   {
-    label: '施工状态',
-    prop: 'constructionStatus',
-    fixed: 'left',
-    'min-width': '120px',
-    isTag: true,
-    dictType: DICT_TYPE.PMS_PROJECT_TASK_SCHEDULE
+    label: '时间节点',
+    prop: 'timeRange',
+    'min-width': '120px'
   },
   {
-    label: '审批状态',
-    prop: 'auditStatus',
+    label: '施工状态',
+    prop: 'rdStatus',
     'min-width': '120px',
     isTag: true,
-    formatter: (row: List) => {
-      switch (row.auditStatus) {
-        case 0:
-          return '待提交'
-        case 10:
-          return '待审批'
-        case 20:
-          return '审批通过'
-        case 30:
-          return '审批拒绝'
-        default:
-          return ''
-      }
-    }
-  },
-  {
-    label: '搬迁安装天数',
-    prop: 'relocationDays',
-    'min-width': '120px',
-    formatter: (row: List) => (row.relocationDays < 0 ? '0' : String(row.relocationDays))
-  },
-  {
-    label: '设计注气量(万方)',
-    prop: 'designInjection',
-    'min-width': '120px',
-    formatter: (row: List) => row.designInjection || '0'
-  },
-  {
-    label: '运行时效',
-    prop: 'transitTime',
-    'min-width': '120px',
-    formatter: (row: List) => (row.transitTime * 100).toFixed(2) + '%'
+    dictType: DICT_TYPE.PMS_PROJECT_RD_STATUS
   },
   {
     label: '当日',
     children: [
       {
-        label: '注气量(万方)',
-        prop: 'dailyGasInjection',
-        'min-width': '120px',
-        formatter: (row: List) => (row.dailyGasInjection / 10000).toFixed(2)
-      },
-      {
-        label: '注水量(方)',
-        prop: 'dailyWaterInjection',
-        'min-width': '120px'
-      },
-      {
-        label: '注气时间(H)',
-        prop: 'dailyInjectGasTime',
+        label: '施工井',
+        prop: 'cumulativeWorkingWell',
         'min-width': '120px'
       },
       {
-        label: '注水时间(H)',
-        prop: 'dailyInjectWaterTime',
+        label: '施工层',
+        prop: 'cumulativeWorkingLayers',
         'min-width': '120px'
       },
       {
-        label: '用电量(kWh)',
-        prop: 'dailyPowerUsage',
+        label: '泵车台次',
+        prop: 'dailyPumpTrips',
         'min-width': '120px'
       },
       {
-        label: '油耗(L)',
-        prop: 'dailyOilUsage',
+        label: '仪表/混砂',
+        prop: 'dailyToolsSand',
         'min-width': '120px'
       }
     ]
   },
   {
-    label: '非生产时间(H)',
-    prop: 'nonProductionTime',
+    label: '趟数',
+    prop: 'runCount',
     'min-width': '120px'
   },
   {
-    label: '非生产时间原因',
-    prop: 'nptReason',
-    'min-width': '120px',
-    isTag: true,
-    dictType: DICT_TYPE.PMS_PROJECT_NPT_REASON
+    label: '桥塞',
+    prop: 'bridgePlug',
+    'min-width': '120px'
+  },
+  {
+    label: '水方量',
+    prop: 'waterVolume',
+    'min-width': '120px'
+  },
+  {
+    label: '时间H',
+    prop: 'hourCount',
+    'min-width': '120px'
   },
-  // {
-  //   label: '施工开始日期',
-  //   prop: 'constructionStartDate',
-  //   'min-width': '120px',
-  //   formatter: (row: List) => dayjs(row.constructionStartDate).format('YYYY-MM-DD HH:mm:ss')
-  // },
-  // {
-  //   label: '施工结束日期',
-  //   prop: 'constructionEndDate',
-  //   'min-width': '120px',
-  //   formatter: (row: List) => dayjs(row.constructionEndDate).format('YYYY-MM-DD HH:mm:ss')
-  // },
   {
-    label: '生产动态',
+    label: '油耗(L)',
+    prop: 'dailyFuel',
+    'min-width': '120px'
+  },
+  {
+    label: '当日生产动态',
     prop: 'productionStatus',
     'min-width': '120px'
   },
   {
-    label: '项目',
-    prop: 'contractName',
+    label: '下步工作计划',
+    prop: 'nextPlan',
     'min-width': '120px'
   },
   {
-    label: '累计',
-    children: [
-      {
-        label: '注气量(万方)',
-        prop: 'totalGasInjection',
-        'min-width': '120px',
-        formatter: (row: List) => (row.totalGasInjection / 10000).toFixed(2)
-      },
-      {
-        label: '注水量(方)',
-        prop: 'totalWaterInjection',
-        'min-width': '120px'
-      },
-      {
-        label: '完工井次',
-        prop: 'cumulativeCompletion',
-        'min-width': '120px'
-      }
-    ]
+    label: '外租设备',
+    prop: 'externalRental',
+    'min-width': '120px'
   },
   {
-    label: '产能(万方)',
-    prop: 'capacity',
-    'min-width': '120px',
-    formatter: (row: List) => (row.capacity / 10000).toFixed(2)
+    label: '故障情况',
+    prop: 'malfunction',
+    'min-width': '120px'
+  },
+  {
+    label: '故障误工H',
+    prop: 'faultDowntime',
+    'min-width': '120px'
   }
 ])
 
@@ -276,50 +212,50 @@ const calculateColumnWidths = (colums: Column[]) => {
   }
 }
 
-function checkTimeSumEquals24(row: List) {
-  // 获取三个字段的值,转换为数字,如果为空则视为0
-  const gasTime = row.dailyInjectGasTime || 0
-  const waterTime = row.dailyInjectWaterTime || 0
-  const nonProdTime = row.nonProductionTime || 0
-
-  // 计算总和
-  const sum = gasTime + waterTime + nonProdTime
-
-  // 返回是否等于24(允许一定的浮点数误差)
-  return Math.abs(sum - 24) < 0.01 // 使用0.01作为误差范围
-}
-
-function cellStyle(data: {
-  row: List
-  column: TableColumnCtx<List>
-  rowIndex: number
-  columnIndex: number
-}) {
-  const { row, column } = data
-
-  if (column.property === 'transitTime') {
-    const originalValue = row.transitTime ?? 0
-
-    if (originalValue > 1.2)
-      return {
-        color: 'red',
-        fontWeight: 'bold'
-      }
-  }
-
-  const timeFields = ['dailyInjectGasTime', 'dailyInjectWaterTime', 'nonProductionTime']
-  if (timeFields.includes(column.property)) {
-    if (!checkTimeSumEquals24(row)) {
-      return {
-        color: 'orange',
-        fontWeight: 'bold'
-      }
-    }
-  }
-
-  // 默认返回空对象,不应用特殊样式
-  return {}
-}
+// function checkTimeSumEquals24(row: List) {
+//   // 获取三个字段的值,转换为数字,如果为空则视为0
+//   const gasTime = row.dailyInjectGasTime || 0
+//   const waterTime = row.dailyInjectWaterTime || 0
+//   const nonProdTime = row.nonProductionTime || 0
+
+//   // 计算总和
+//   const sum = gasTime + waterTime + nonProdTime
+
+//   // 返回是否等于24(允许一定的浮点数误差)
+//   return Math.abs(sum - 24) < 0.01 // 使用0.01作为误差范围
+// }
+
+// function cellStyle(data: {
+//   row: List
+//   column: TableColumnCtx<List>
+//   rowIndex: number
+//   columnIndex: number
+// }) {
+//   const { row, column } = data
+
+//   if (column.property === 'transitTime') {
+//     const originalValue = row.transitTime ?? 0
+
+//     if (originalValue > 1.2)
+//       return {
+//         color: 'red',
+//         fontWeight: 'bold'
+//       }
+//   }
+
+//   const timeFields = ['dailyInjectGasTime', 'dailyInjectWaterTime', 'nonProductionTime']
+//   if (timeFields.includes(column.property)) {
+//     if (!checkTimeSumEquals24(row)) {
+//       return {
+//         color: 'orange',
+//         fontWeight: 'bold'
+//       }
+//     }
+//   }
+
+//   // 默认返回空对象,不应用特殊样式
+//   return {}
+// }
 
 function rowClassName(data: { row: List; rowIndex: number }) {
   const { row } = data
@@ -487,12 +423,12 @@ const expandRowKeys = computed(() => {
     <div class="p-4 bg-white dark:bg-[#1d1e1f] shadow rounded-lg h-full">
       <DeptTreeSelect
         v-show="tab === '队伍'"
-        :top-id="157"
+        :top-id="163"
         :deptId="deptId"
         v-model="query.deptId"
         title="队伍"
       />
-      <WellSelect v-show="tab === '井'" :deptId="157" v-model="query.wellName" />
+      <WellSelect v-show="tab === '井'" :deptId="163" v-model="query.wellName" />
     </div>
 
     <!-- 第二行右侧:自动落入第 2 行第 2 列 -->
@@ -509,7 +445,6 @@ const expandRowKeys = computed(() => {
               :height="height"
               show-overflow-tooltip
               :width="width"
-              :cell-style="cellStyle"
               :row-class-name="rowClassName"
               :tree-props="{ hasChildren: 'lastGroupIdFlag' }"
               row-key="id"
@@ -522,12 +457,15 @@ const expandRowKeys = computed(() => {
                   <div
                     class="flex items-center gap-8 h-10 px-14 sticky left-0 w-fit box-border bg-[var(--el-bg-color)]"
                   >
-                    <el-tag>累计注气量(方): {{ row.groupIdGasInjection }} </el-tag>
-                    <el-tag>累计注水量(方): {{ row.groupIdWaterInjection }} </el-tag>
-                    <el-tag>累计用电量(kWh) : {{ row.groupIdPower }} </el-tag>
-                    <el-tag>累计油耗(L) : {{ row.groupIdFuel }} </el-tag>
-                    <el-tag>累计注气时间H : {{ row.groupIdGasTime }} </el-tag>
-                    <el-tag>累计非生产时间H : {{ row.groupIdNoProductTime }} </el-tag>
+                    <el-tag>桥塞: {{ row.groupIdBridgePlug }} </el-tag>
+                    <el-tag>趟数: {{ row.groupIdRunCount }} </el-tag>
+                    <el-tag>井数: {{ row.groupIdCumulativeWorkingWell }} </el-tag>
+                    <el-tag>小时H: {{ row.groupIdHourCount }} </el-tag>
+                    <el-tag>油耗L: {{ row.groupIdFuel }} </el-tag>
+                    <el-tag>水方量(方): {{ row.groupIdWaterVolume }} </el-tag>
+                    <el-tag>台次(泵车): {{ row.groupIdPumpTrips }} </el-tag>
+                    <el-tag>段数: {{ row.groupIdCumulativeWorkingLayers }} </el-tag>
+                    <el-tag>台次(仪表/混砂): {{ row.groupIdMixSand }} </el-tag>
                   </div>
                 </template>
               </el-table-column>