yanghao 5 dienas atpakaļ
vecāks
revīzija
849d866832

+ 24 - 4
src/views/pms/constructionDailyReport/components/ConstructionDailyReportFormSection.vue

@@ -1,4 +1,5 @@
 <script setup lang="ts">
+import { getStrDictOptions } from '@/utils/dict'
 import type {
   ConstructionDailyReportField,
   ConstructionDailyReportRow,
@@ -34,6 +35,10 @@ function getNumberValue(prop: keyof ConstructionDailyReportRow) {
 function isFieldDisabled(field: ConstructionDailyReportField) {
   return props.disabled || !field.editableInEdit
 }
+
+function getDictOptions(field: ConstructionDailyReportField) {
+  return field.dictType ? getStrDictOptions(field.dictType) : []
+}
 </script>
 
 <template>
@@ -50,7 +55,8 @@ function isFieldDisabled(field: ConstructionDailyReportField) {
         :key="`${props.section.title}-${String(field.prop)}-${field.label}`"
         :label="field.label"
         :prop="field.prop"
-        :class="{ 'col-span-2': field.span === 2 }">
+        :class="{ 'col-span-2': field.span === 2 }"
+      >
         <el-input
           v-if="field.type === 'textarea'"
           size="default"
@@ -59,7 +65,19 @@ function isFieldDisabled(field: ConstructionDailyReportField) {
           :autosize="{ minRows: 3 }"
           resize="none"
           :disabled="isFieldDisabled(field)"
-          @update:model-value="updateField(field.prop, $event)" />
+          @update:model-value="updateField(field.prop, $event)"
+        />
+        <el-select
+          v-else-if="field.type === 'select'"
+          size="default"
+          :model-value="props.model[field.prop]"
+          :options="getDictOptions(field)"
+          class="w-full"
+          clearable
+          placeholder="请选择"
+          :disabled="isFieldDisabled(field)"
+          @update:model-value="updateField(field.prop, $event)"
+        />
         <el-input-number
           v-else-if="field.type === 'number' || isNumberField(props.model[field.prop])"
           :model-value="getNumberValue(field.prop)"
@@ -69,13 +87,15 @@ function isFieldDisabled(field: ConstructionDailyReportField) {
           size="default"
           :precision="field.precision"
           :disabled="isFieldDisabled(field)"
-          @update:model-value="updateField(field.prop, $event)" />
+          @update:model-value="updateField(field.prop, $event)"
+        />
         <el-input
           v-else
           size="default"
           :model-value="props.model[field.prop]"
           :disabled="isFieldDisabled(field)"
-          @update:model-value="updateField(field.prop, $event)" />
+          @update:model-value="updateField(field.prop, $event)"
+        />
       </el-form-item>
     </div>
   </div>

+ 19 - 34
src/views/pms/constructionDailyReport/components/report-config.ts

@@ -1,3 +1,5 @@
+import { DICT_TYPE } from '@/utils/dict'
+
 export interface ConstructionDailyReportRow {
   id?: number
   deptId?: number
@@ -33,6 +35,7 @@ export interface ConstructionDailyReportRow {
   constructionStartDate?: string | number
   monthWorkingLayers?: number | null
   monthWorkingWells?: number | null
+  fiveStatus?: string
 }
 
 export interface ConstructionDailyReportQuery {
@@ -47,10 +50,11 @@ export interface ConstructionDailyReportQuery {
 export interface ConstructionDailyReportField {
   prop: keyof ConstructionDailyReportRow
   label: string
-  type?: 'text' | 'number' | 'textarea'
+  type?: 'text' | 'number' | 'textarea' | 'select'
   span?: 1 | 2
   precision?: number
   editableInEdit?: boolean
+  dictType?: string
 }
 
 export interface ConstructionDailyReportSection {
@@ -97,8 +101,6 @@ export const formSections: ConstructionDailyReportSection[] = [
     title: '基础信息',
     fields: [
       { prop: 'reportName', label: '日报名称' },
-      // { prop: 'createTime', label: '日报日期' },
-      // { prop: 'constructionEndDate', label: '施工结束日期' },
       { prop: 'projectName', label: '项目' },
       { prop: 'location', label: '施工区域' },
       { prop: 'deptName', label: '队伍' },
@@ -110,60 +112,49 @@ export const formSections: ConstructionDailyReportSection[] = [
   {
     title: '生产数据',
     fields: [
+      { prop: 'mainDeviceNum', label: '主设备数量', type: 'number' },
+      { prop: 'wokDeviceNum', label: '作业泵车数量', type: 'number' },
       {
-        prop: 'mainDeviceNum',
-        label: '主设备数量',
-        type: 'number',
-
-        editableInEdit: true
+        prop: 'fiveStatus',
+        label: '队伍状态',
+        type: 'select',
+        editableInEdit: true,
+        dictType: DICT_TYPE.PMS_PROJECT_RD_STATUS
       },
-      {
-        prop: 'wokDeviceNum',
-        label: '作业泵车数量',
-        type: 'number',
-        // precision: 2,
-        editableInEdit: true
-      },
-      { prop: 'fiveStatusLabel', label: '队伍状态', editableInEdit: true },
       {
         prop: 'dailyWorkingLayers',
         label: '当日主压层数',
         type: 'number',
-        // precision: 2,
         editableInEdit: true
       },
       {
         prop: 'dailySandVolume',
-        label: '当日加砂量(吨)',
+        label: '当日加砂量',
         type: 'number',
-
         editableInEdit: true
       },
       {
         prop: 'dailyLiquidVolume',
-        label: '当日注液量(m³)',
+        label: '当日注液量',
         type: 'number',
-
         editableInEdit: true
       },
       { prop: 'jingshu', label: '当月作业井数', type: 'number' },
       { prop: 'cengshu', label: '当月作业层数', type: 'number' },
       {
         prop: 'dailyFuel',
-        label: '当日油耗(L)',
+        label: '当日油耗',
         type: 'number',
-
         editableInEdit: true
       },
       {
         prop: 'nonProductionTime',
         label: '当日非生产时间',
         type: 'number',
-
         editableInEdit: true
       },
-      { prop: 'singleWellWorkload', label: '单井工作量', editableInEdit: true },
-      { prop: 'planWorkingLayers', label: '本月计划层数', type: 'number', precision: 2 }
+      { prop: 'singleWellWorkload', label: '单井工作量' },
+      { prop: 'planWorkingLayers', label: '本月计划层数', type: 'number' }
     ]
   },
   {
@@ -176,15 +167,9 @@ export const formSections: ConstructionDailyReportSection[] = [
         span: 2,
         editableInEdit: true
       },
-      {
-        prop: 'productionStatus',
-        label: '施工动态',
-        type: 'textarea',
-        span: 2,
-        editableInEdit: true
-      },
+      { prop: 'productionStatus', label: '施工动态', type: 'textarea', span: 2 },
       { prop: 'weather', label: '天气' },
-      { prop: 'temperature', label: '气温(℃)' }
+      { prop: 'temperature', label: '气温' }
     ]
   }
 ]