瀏覽代碼

5#日报添加非生产时间明细

yanghao 4 天之前
父節點
當前提交
161a079fa9

+ 40 - 14
src/views/pms/constructionDailyReport/components/ConstructionDailyReportTable.vue

@@ -1,7 +1,11 @@
 <script setup lang="ts">
 import { useTableComponents } from '@/components/ZmTable/useTableComponents'
 import dayjs from 'dayjs'
-import type { ConstructionDailyReportRow } from './report-config'
+import type {
+  ConstructionDailyReportRow,
+  ConstructionDailyReportTableColumn,
+  ConstructionDailyReportTableColumnLeaf
+} from './report-config'
 import { tableColumns } from './report-config'
 
 const props = withDefaults(
@@ -28,6 +32,12 @@ const emits = defineEmits<{
 
 const { ZmTable, ZmTableColumn } = useTableComponents<ConstructionDailyReportRow>()
 
+function isColumnGroup(
+  column: ConstructionDailyReportTableColumn
+): column is Extract<ConstructionDailyReportTableColumn, { children: ConstructionDailyReportTableColumnLeaf[] }> {
+  return 'children' in column
+}
+
 function formatCellValue(row: ConstructionDailyReportRow, prop: keyof ConstructionDailyReportRow) {
   const value = row[prop]
   if (prop === 'createTime' || prop === 'constructionStartDate' || prop === 'constructionEndDate') {
@@ -51,19 +61,35 @@ function formatCellValue(row: ConstructionDailyReportRow, prop: keyof Constructi
             :max-height="height"
             show-border>
             <ZmTableColumn type="index" label="序号" :width="60" fixed="left" />
-            <ZmTableColumn
-              v-for="column in tableColumns"
-              :key="`${String(column.prop)}-${column.label}`"
-              :prop="column.prop"
-              :label="column.label"
-              :width="column.width"
-              :min-width="column.minWidth"
-              :fixed="column.fixed"
-              show-overflow-tooltip
-              cover-formatter
-              :real-value="
-                (row: ConstructionDailyReportRow) => formatCellValue(row, column.prop)
-              " />
+            <template v-for="column in tableColumns" :key="column.label">
+              <ZmTableColumn v-if="isColumnGroup(column)" :label="column.label">
+                <ZmTableColumn
+                  v-for="child in column.children"
+                  :key="`${String(child.prop)}-${child.label}`"
+                  :prop="child.prop"
+                  :label="child.label"
+                  :width="child.width"
+                  :min-width="child.minWidth"
+                  :fixed="child.fixed"
+                  show-overflow-tooltip
+                  cover-formatter
+                  :real-value="
+                    (row: ConstructionDailyReportRow) => formatCellValue(row, child.prop)
+                  " />
+              </ZmTableColumn>
+              <ZmTableColumn
+                v-else
+                :prop="column.prop"
+                :label="column.label"
+                :width="column.width"
+                :min-width="column.minWidth"
+                :fixed="column.fixed"
+                show-overflow-tooltip
+                cover-formatter
+                :real-value="
+                  (row: ConstructionDailyReportRow) => formatCellValue(row, column.prop)
+                " />
+            </template>
             <ZmTableColumn label="操作" :width="120" fixed="right" action>
               <template #default="{ row }">
                 <slot name="action" :row="row"></slot>

+ 123 - 22
src/views/pms/constructionDailyReport/components/report-config.ts

@@ -79,13 +79,24 @@ export interface ConstructionDailyReportSection {
   fields: ConstructionDailyReportField[]
 }
 
-export const tableColumns: Array<{
+export interface ConstructionDailyReportTableColumnLeaf {
   prop: keyof ConstructionDailyReportRow
   label: string
   width?: number
   minWidth?: number
   fixed?: 'left' | 'right'
-}> = [
+}
+
+export interface ConstructionDailyReportTableColumnGroup {
+  label: string
+  children: ConstructionDailyReportTableColumnLeaf[]
+}
+
+export type ConstructionDailyReportTableColumn =
+  | ConstructionDailyReportTableColumnLeaf
+  | ConstructionDailyReportTableColumnGroup
+
+export const tableColumns: ConstructionDailyReportTableColumn[] = [
   { prop: 'reportName', label: '日报名称', minWidth: 180, fixed: 'left' },
   { prop: 'createTime', label: '创建日期', width: 120 },
   { prop: 'projectName', label: '项目', minWidth: 160, fixed: 'left' },
@@ -101,7 +112,25 @@ export const tableColumns: Array<{
   { prop: 'monthWorkingWells', label: '当月作业井数', width: 120 },
   { prop: 'monthWorkingLayers', label: '当月作业层数', width: 120 },
   { prop: 'dailyFuel', label: '当日油耗(L)', width: 110 },
-  { prop: 'nptReason', label: '造成非生产时间原因', minWidth: 180 },
+  {
+    label: '非生产时间',
+    children: [
+      { prop: 'accidentTime', label: '工程质量', width: 110 },
+      { prop: 'repairTime', label: '设备故障', width: 110 },
+      { prop: 'selfStopTime', label: '设备保养', width: 110 },
+      { prop: 'complexityTime', label: '技术受限', width: 110 },
+      { prop: 'relocationTime', label: '生产配合', width: 110 },
+      { prop: 'rectificationTime', label: '生产组织', width: 110 },
+      { prop: 'waitingStopTime', label: '不可抗力', width: 110 },
+      { prop: 'winterBreakTime', label: '待命', width: 110 },
+      { prop: 'partyaDesign', label: '甲方设计', width: 110 },
+      { prop: 'partyaPrepare', label: '甲方准备', width: 110 },
+      { prop: 'partyaResource', label: '甲方资源', width: 110 },
+      { prop: 'otherNptTime', label: '其它非生产时间', width: 130 }
+    ]
+  },
+  { prop: 'otherNptReason', label: '其它非生产时间原因', minWidth: 180 },
+  // { prop: 'nptReason', label: '造成非生产时间原因', minWidth: 180 },
   { prop: 'singleWellWorkload', label: '单井工作量', width: 120 },
   { prop: 'productionStatus', label: '施工动态', minWidth: 180 },
   { prop: 'planWorkingLayers', label: '本月计划层数', width: 120 },
@@ -169,13 +198,13 @@ export const formSections: ConstructionDailyReportSection[] = [
   {
     title: '现场说明',
     fields: [
-      {
-        prop: 'nptReason',
-        label: '造成非生产时间原因',
-        type: 'textarea',
-        span: 2,
-        editableInEdit: true
-      },
+      // {
+      //   prop: 'nptReason',
+      //   label: '造成非生产时间原因',
+      //   type: 'textarea',
+      //   span: 2,
+      //   editableInEdit: true
+      // },
       {
         prop: 'productionStatus',
         label: '施工动态',
@@ -191,18 +220,90 @@ export const formSections: ConstructionDailyReportSection[] = [
     title: '非生产时间',
     columns: 3,
     fields: [
-      { prop: 'accidentTime', label: '工程质量', type: 'number', suffix: '小时(H)', editableInEdit: true },
-      { prop: 'repairTime', label: '设备故障', type: 'number', suffix: '小时(H)', editableInEdit: true },
-      { prop: 'selfStopTime', label: '设备保养', type: 'number', suffix: '小时(H)', editableInEdit: true },
-      { prop: 'complexityTime', label: '技术受限', type: 'number', suffix: '小时(H)', editableInEdit: true },
-      { prop: 'relocationTime', label: '生产配合', type: 'number', suffix: '小时(H)', editableInEdit: true },
-      { prop: 'rectificationTime', label: '生产组织', type: 'number', suffix: '小时(H)', editableInEdit: true },
-      { prop: 'waitingStopTime', label: '不可抗力', type: 'number', suffix: '小时(H)', editableInEdit: true },
-      { prop: 'winterBreakTime', label: '待命', type: 'number', suffix: '小时(H)', editableInEdit: true },
-      { prop: 'partyaDesign', label: '甲方设计', type: 'number', suffix: '小时(H)', editableInEdit: true },
-      { prop: 'partyaPrepare', label: '甲方准备', type: 'number', suffix: '小时(H)', editableInEdit: true },
-      { prop: 'partyaResource', label: '甲方资源', type: 'number', suffix: '小时(H)', editableInEdit: true },
-      { prop: 'otherNptTime', label: '其它非生产时间', type: 'number', suffix: '小时(H)', editableInEdit: true },
+      {
+        prop: 'accidentTime',
+        label: '工程质量',
+        type: 'number',
+        suffix: '小时(H)',
+        editableInEdit: true
+      },
+      {
+        prop: 'repairTime',
+        label: '设备故障',
+        type: 'number',
+        suffix: '小时(H)',
+        editableInEdit: true
+      },
+      {
+        prop: 'selfStopTime',
+        label: '设备保养',
+        type: 'number',
+        suffix: '小时(H)',
+        editableInEdit: true
+      },
+      {
+        prop: 'complexityTime',
+        label: '技术受限',
+        type: 'number',
+        suffix: '小时(H)',
+        editableInEdit: true
+      },
+      {
+        prop: 'relocationTime',
+        label: '生产配合',
+        type: 'number',
+        suffix: '小时(H)',
+        editableInEdit: true
+      },
+      {
+        prop: 'rectificationTime',
+        label: '生产组织',
+        type: 'number',
+        suffix: '小时(H)',
+        editableInEdit: true
+      },
+      {
+        prop: 'waitingStopTime',
+        label: '不可抗力',
+        type: 'number',
+        suffix: '小时(H)',
+        editableInEdit: true
+      },
+      {
+        prop: 'winterBreakTime',
+        label: '待命',
+        type: 'number',
+        suffix: '小时(H)',
+        editableInEdit: true
+      },
+      {
+        prop: 'partyaDesign',
+        label: '甲方设计',
+        type: 'number',
+        suffix: '小时(H)',
+        editableInEdit: true
+      },
+      {
+        prop: 'partyaPrepare',
+        label: '甲方准备',
+        type: 'number',
+        suffix: '小时(H)',
+        editableInEdit: true
+      },
+      {
+        prop: 'partyaResource',
+        label: '甲方资源',
+        type: 'number',
+        suffix: '小时(H)',
+        editableInEdit: true
+      },
+      {
+        prop: 'otherNptTime',
+        label: '其它非生产时间',
+        type: 'number',
+        suffix: '小时(H)',
+        editableInEdit: true
+      },
       {
         prop: 'otherNptReason',
         label: '其它非生产时间原因',