Эх сурвалжийг харах

pms 瑞都日报 平台井 兼容 主井施工完成 关联井未施工完成的情况 显示关联井的任务名称

zhangcl 1 долоо хоног өмнө
parent
commit
832cc318a6

+ 31 - 31
src/views/pms/iotrddailyreport/FillDailyReportForm.vue

@@ -35,7 +35,7 @@
           <div class="table-cell">
             <div class="cell-content">
               <span class="cell-label">井号:</span>
-              <span class="cell-value">{{ dailyReportData.wellName || dailyReportData.taskName || '-' }}</span>
+              <span class="cell-value">{{ displayWellName || dailyReportData.taskName || '-' }}</span>
             </div>
           </div>
         </div>
@@ -633,46 +633,46 @@ const isReadonlyMode = computed(() => isApprovalMode.value || isDetailMode.value
 const platformWellPairs = ref<any[]>([]) // 存储各平台井的工作量数据
 const currentPlatformId = ref<number>() // 当前选中的平台井ID
 
-// 页面标题计算
-const pageTitle = computed(() => {
-  // 获取要显示的井名
-  const getDisplayWellName = () => {
-    // 如果是平台井模式且有平台井数据
-    if (dailyReportData.value.platformWell === 1 &&
-      dailyReportData.value.platforms &&
-      dailyReportData.value.platforms.length > 0) {
-
-      // 检查主井是否在平台井列表中
-      const isMainWellInPlatforms = dailyReportData.value.platforms.some(
-        (platform: any) => platform.id === dailyReportData.value.taskId
-      )
-
-      // 如果主井不在平台井列表中(说明主井已施工完成),使用第一个平台井的名称
-      if (!isMainWellInPlatforms) {
-        const firstPlatformWellName = dailyReportData.value.platforms[0].wellName
-        console.log(`主井已施工完成,标题使用平台井名称: ${firstPlatformWellName}`)
-        return firstPlatformWellName
-      }
+// 计算属性:显示井名(统一处理主井和平台井逻辑)
+const displayWellName = computed(() => {
+  // 如果是平台井模式且有平台井数据
+  if (dailyReportData.value.platformWell === 1 &&
+    dailyReportData.value.platforms &&
+    dailyReportData.value.platforms.length > 0) {
+
+    // 检查主井是否在平台井列表中
+    const isMainWellInPlatforms = dailyReportData.value.platforms.some(
+      (platform: any) => platform.id === dailyReportData.value.taskId
+    )
+
+    // 如果主井不在平台井列表中(说明主井已施工完成),使用第一个平台井的名称
+    if (!isMainWellInPlatforms) {
+      const firstPlatformWellName = dailyReportData.value.platforms[0].wellName
+      console.log(`主井已施工完成,井号显示使用平台井名称: ${firstPlatformWellName}`)
+      return firstPlatformWellName
     }
-
-    // 其他情况使用原来的井名
-    return dailyReportData.value.wellName
   }
 
-  const displayWellName = getDisplayWellName()
+  // 其他情况使用原来的井名
+  return dailyReportData.value.wellName
+})
+
+// 页面标题计算
+const pageTitle = computed(() => {
+  const displayWellNameValue = displayWellName.value
   const constructionDate = dailyReportData.value.constructionStartDate
 
   if (isApprovalMode.value) {
-    return displayWellName && constructionDate
-      ? `${displayWellName} - ${formatDate(constructionDate)} 日报审批`
+    return displayWellNameValue && constructionDate
+      ? `${displayWellNameValue} - ${formatDate(constructionDate)} 日报审批`
       : '日报审批'
   } else if (isDetailMode.value) {
-    return displayWellName && constructionDate
-      ? `${displayWellName} - ${formatDate(constructionDate)} 日报详情`
+    return displayWellNameValue && constructionDate
+      ? `${displayWellNameValue} - ${formatDate(constructionDate)} 日报详情`
       : '日报详情'
   } else {
-    return displayWellName && constructionDate
-      ? `${displayWellName} - ${formatDate(constructionDate)} 生产日报`
+    return displayWellNameValue && constructionDate
+      ? `${displayWellNameValue} - ${formatDate(constructionDate)} 生产日报`
       : '日报填报'
   }
 })