浏览代码

pms 瑞都 日报 填报 平台井 下拉列表

zhangcl 1 天之前
父节点
当前提交
022c40b0bc
共有 1 个文件被更改,包括 58 次插入0 次删除
  1. 58 0
      src/views/pms/iotrddailyreport/FillDailyReportForm.vue

+ 58 - 0
src/views/pms/iotrddailyreport/FillDailyReportForm.vue

@@ -158,6 +158,27 @@
           </el-col>
         </el-row>
 
+        <!-- 平台井 -->
+        <el-row v-if="showPlatformField">
+          <el-col :span="24">
+            <el-form-item label="平台井" prop="platformId">
+              <el-select
+                v-model="formData.platformId"
+                placeholder="请选择平台井"
+                style="width: 100%"
+                :disabled="isReadonlyMode"
+              >
+                <el-option
+                  v-for="platform in platformOptions"
+                  :key="platform.id"
+                  :label="platform.wellName"
+                  :value="platform.id"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+
         <!-- 施工设备字段 -->
         <el-row>
           <el-col :span="24">
@@ -604,6 +625,39 @@ const filteredDeviceList = ref<any[]>([])
 const selectedDeviceIds = ref<number[]>([])
 const deviceMap = ref<Record<number, any>>({})
 
+// 添加平台井相关响应式数据
+const platformOptions = ref<any[]>([]) // 平台井下拉选项
+const showPlatformField = ref(false) // 是否显示平台井字段
+
+// 计算属性:是否显示平台井字段
+const shouldShowPlatformField = computed(() => {
+  return dailyReportData.value.platformWell === 1
+})
+
+// 初始化平台井数据
+const initPlatformData = (reportData: any) => {
+  // 设置是否显示平台井字段
+  showPlatformField.value = reportData.platformWell === 1
+
+  // 设置平台井下拉选项
+  if (reportData.platforms && Array.isArray(reportData.platforms)) {
+    platformOptions.value = reportData.platforms
+  } else {
+    platformOptions.value = []
+  }
+
+  // 设置默认选中的平台井
+  if (reportData.taskId && platformOptions.value.length > 0) {
+    // 查找与 taskId 匹配的平台井
+    const defaultPlatform = platformOptions.value.find(
+      (platform: any) => platform.id === reportData.taskId
+    )
+    if (defaultPlatform) {
+      formData.value.platformId = defaultPlatform.id
+    }
+  }
+}
+
 // 添加审批表单相关变量
 const approvalFormRef = ref()
 const approvalForm = reactive({
@@ -632,6 +686,7 @@ const formData = ref({
   projectDepartment: '',
   costCenterId: undefined,
   costCenter: '',
+  platformId: undefined, // 平台井ID
   // 新增日报填报字段
   timeRange: [ // 设置默认时间范围 8:00 - 8:00
     dayjs().hour(8).minute(0).second(0).toDate(),
@@ -1220,6 +1275,9 @@ const initFormData = (reportData: any) => {
 
   // 初始化设备数据
   initDeviceData(reportData)
+
+  // 初始化平台井数据
+  initPlatformData(reportData)
 }
 
 onMounted(async () => {