Kaynağa Gözat

5号国日报

yanghao 6 gün önce
ebeveyn
işleme
ddabd558dc

+ 16 - 3
src/views/pms/constructionDailyReport/components/ConstructionDailyReportDrawer.vue

@@ -31,6 +31,7 @@ const disabled = computed(() => drawerMode.value === 'readonly')
 
 function normalizeDetail(detail: Record<string, any> = {}) {
   const createTime = detail.createTime
+  const constructionEndDate = detail.constructionEndDate
   return {
     ...createEmptyConstructionDailyReport(),
     ...detail,
@@ -38,7 +39,12 @@ function normalizeDetail(detail: Record<string, any> = {}) {
       ? dayjs(createTime).isValid()
         ? dayjs(createTime).format('YYYY-MM-DD')
         : createTime
-      : detail.createTime
+      : detail.createTime,
+    constructionEndDate: constructionEndDate
+      ? dayjs(constructionEndDate).isValid()
+        ? dayjs(constructionEndDate).format('YYYY-MM-DD')
+        : constructionEndDate
+      : detail.constructionEndDate
   } as ConstructionDailyReportRow
 }
 
@@ -60,6 +66,8 @@ async function handleOpenForm(id: number, type: 'edit' | 'readonly') {
 }
 
 async function handleSubmit() {
+  // console.log('handleSubmit', form.value)
+  // return
   if (drawerMode.value === 'readonly') {
     emits('update:visible', false)
     return
@@ -108,8 +116,13 @@ defineExpose({ handleOpenForm })
     </el-form>
 
     <template #footer>
-      <el-button @click="emits('update:visible', false)">取消</el-button>
-      <el-button v-if="!disabled" type="primary" :loading="submitLoading" @click="handleSubmit">
+      <el-button size="default" @click="emits('update:visible', false)">取消</el-button>
+      <el-button
+        size="default"
+        v-if="!disabled"
+        type="primary"
+        :loading="submitLoading"
+        @click="handleSubmit">
         保存
       </el-button>
     </template>

+ 15 - 11
src/views/pms/constructionDailyReport/components/ConstructionDailyReportFormSection.vue

@@ -1,5 +1,6 @@
 <script setup lang="ts">
 import type {
+  ConstructionDailyReportField,
   ConstructionDailyReportRow,
   ConstructionDailyReportSection
 } from './report-config'
@@ -29,6 +30,10 @@ function getNumberValue(prop: keyof ConstructionDailyReportRow) {
   const value = props.model[prop]
   return typeof value === 'number' ? value : undefined
 }
+
+function isFieldDisabled(field: ConstructionDailyReportField) {
+  return props.disabled || !field.editableInEdit
+}
 </script>
 
 <template>
@@ -45,33 +50,32 @@ function getNumberValue(prop: keyof ConstructionDailyReportRow) {
         :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"
           :model-value="props.model[field.prop]"
           type="textarea"
           :autosize="{ minRows: 3 }"
           resize="none"
-          :disabled="props.disabled"
-          @update:model-value="updateField(field.prop, $event)"
-        />
+          :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)"
           class="!w-full"
           :controls="false"
           :min="0"
+          size="default"
           :precision="field.precision"
-          :disabled="props.disabled"
-          @update:model-value="updateField(field.prop, $event)"
-        />
+          :disabled="isFieldDisabled(field)"
+          @update:model-value="updateField(field.prop, $event)" />
         <el-input
           v-else
+          size="default"
           :model-value="props.model[field.prop]"
-          :disabled="props.disabled"
-          @update:model-value="updateField(field.prop, $event)"
-        />
+          :disabled="isFieldDisabled(field)"
+          @update:model-value="updateField(field.prop, $event)" />
       </el-form-item>
     </div>
   </div>

+ 51 - 16
src/views/pms/constructionDailyReport/components/report-config.ts

@@ -50,6 +50,7 @@ export interface ConstructionDailyReportField {
   type?: 'text' | 'number' | 'textarea'
   span?: 1 | 2
   precision?: number
+  editableInEdit?: boolean
 }
 
 export interface ConstructionDailyReportSection {
@@ -66,18 +67,17 @@ export const tableColumns: Array<{
 }> = [
   { prop: 'reportName', label: '日报名称', minWidth: 180, fixed: 'left' },
   { prop: 'createTime', label: '创建(施工)日期', width: 120 },
-  // { prop: 'constructionStartDate', label: '施工开始日期', width: 120 },
   { prop: 'constructionEndDate', label: '施工结束日期', width: 120 },
   { prop: 'projectName', label: '项目', minWidth: 160, fixed: 'left' },
   { prop: 'location', label: '施工区域', minWidth: 140 },
   { prop: 'deptName', label: '队伍', minWidth: 140 },
-  { prop: 'mainDeviceNum', label: '主设备(泵车)数量', width: 110 },
+  { prop: 'mainDeviceNum', label: '主设备(泵车)数量', width: 130 },
   { prop: 'wellName', label: '生产任务', minWidth: 140 },
   { prop: 'wokDeviceNum', label: '作业泵车数量', width: 120 },
   { prop: 'fiveStatusLabel', label: '队伍状态', minWidth: 120 },
   { prop: 'dailyWorkingLayers', label: '当日主压层数', width: 120 },
-  { prop: 'dailySandVolume', label: '当日加砂量(吨)', width: 120 },
-  { prop: 'dailyLiquidVolume', label: '当日注液量(‌m³)', width: 120 },
+  { prop: 'dailySandVolume', label: '当日加砂量(吨)', width: 130 },
+  { prop: 'dailyLiquidVolume', label: '当日注液量(m3)', width: 130 },
   { prop: 'monthWorkingWells', label: '当月作业井数', width: 120 },
   { prop: 'monthWorkingLayers', label: '当月作业层数', width: 120 },
   { prop: 'dailyFuel', label: '当日油耗(L)', width: 110 },
@@ -97,15 +97,14 @@ export const formSections: ConstructionDailyReportSection[] = [
     title: '基础信息',
     fields: [
       { prop: 'reportName', label: '日报名称' },
-      { prop: 'createTime', label: '日报日期' },
-      { prop: 'constructionEndDate', label: '施工结束日期' },
-
+      // { prop: 'createTime', label: '日报日期' },
+      // { prop: 'constructionEndDate', label: '施工结束日期' },
       { prop: 'projectName', label: '项目' },
       { prop: 'location', label: '施工区域' },
       { prop: 'deptName', label: '队伍' },
       { prop: 'wellName', label: '生产任务' },
-      { prop: 'deviceNames', label: '设备名称', span: 2 },
-      { prop: 'customer', label: '合同甲方' }
+      { prop: 'customer', label: '合同甲方' },
+      { prop: 'deviceNames', label: '设备名称', span: 2 }
     ]
   },
   {
@@ -114,13 +113,43 @@ export const formSections: ConstructionDailyReportSection[] = [
       { prop: 'mainDeviceNum', label: '主设备数量', type: 'number' },
       { prop: 'wokDeviceNum', label: '作业泵车数量', type: 'number' },
       { prop: 'fiveStatusLabel', label: '队伍状态' },
-      { prop: 'dailyWorkingLayers', label: '当日主压层数', type: 'number', precision: 2 },
-      { prop: 'dailySandVolume', label: '当日加砂量', type: 'number', precision: 2 },
-      { prop: 'dailyLiquidVolume', label: '当日注液量', type: 'number', precision: 2 },
+      {
+        prop: 'dailyWorkingLayers',
+        label: '当日主压层数',
+        type: 'number',
+        precision: 2,
+        editableInEdit: true
+      },
+      {
+        prop: 'dailySandVolume',
+        label: '当日加砂量(吨)',
+        type: 'number',
+        precision: 2,
+        editableInEdit: true
+      },
+      {
+        prop: 'dailyLiquidVolume',
+        label: '当日注液量(m³)',
+        type: 'number',
+        precision: 2,
+        editableInEdit: true
+      },
       { prop: 'jingshu', label: '当月作业井数', type: 'number' },
       { prop: 'cengshu', label: '当月作业层数', type: 'number' },
-      { prop: 'dailyFuel', label: '当日油耗', type: 'number', precision: 2 },
-      { prop: 'nonProductionTime', label: '当日非生产时间', type: 'number', precision: 2 },
+      {
+        prop: 'dailyFuel',
+        label: '当日油耗(L)',
+        type: 'number',
+        precision: 2,
+        editableInEdit: true
+      },
+      {
+        prop: 'nonProductionTime',
+        label: '当日非生产时间',
+        type: 'number',
+        precision: 2,
+        editableInEdit: true
+      },
       { prop: 'singleWellWorkload', label: '单井工作量' },
       { prop: 'planWorkingLayers', label: '本月计划层数', type: 'number', precision: 2 }
     ]
@@ -128,10 +157,16 @@ export const formSections: ConstructionDailyReportSection[] = [
   {
     title: '现场说明',
     fields: [
-      { prop: 'nptReason', label: '造成非生产时间原因', type: 'textarea', span: 2 },
+      {
+        prop: 'nptReason',
+        label: '造成非生产时间原因',
+        type: 'textarea',
+        span: 2,
+        editableInEdit: true
+      },
       { prop: 'productionStatus', label: '施工动态', type: 'textarea', span: 2 },
       { prop: 'weather', label: '天气' },
-      { prop: 'temperature', label: '气温' }
+      { prop: 'temperature', label: '气温(℃)' }
     ]
   }
 ]