xuzhancheng 10 órája
szülő
commit
4fdc04dce5

+ 53 - 3
yudao-ui-admin-vue3/src/views/pressure2/pipescheduling/index.vue

@@ -297,6 +297,7 @@
             :ref="(el) => setDetailTableRef(el, props.row.id)"
             @selection-change="(selection) => handleDetailSelectionChange(selection, props.row)"
             :row-class-name="getRowClassName"
+            :cell-class-name="(params) => getDetailCellClassName(params, props.row)"
             class="inner-table"
             @row-click="handleRowClick"
           >
@@ -343,21 +344,32 @@
         prop="equipStreetName"
         min-width="100"
       />
-      <el-table-column label="使用单位名称 " align="center" prop="unitName" min-width="150" />
+      <el-table-column label="使用单位名称 " align="center" prop="unitName" min-width="180">
+        <template #default="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            @click.stop="handleEdit(row)"
+            style="cursor: pointer"
+          >
+            {{ row.unitName }}
+          </el-link>
+        </template>
+      </el-table-column>
       <el-table-column label="管道使用地址" align="center" prop="pipeAddress" min-width="150" />
       <el-table-column label="工程号" prop="projectNo" align="center" min-width="150"/>
       <el-table-column label="工程名称" prop="projectName" align="center" min-width="150"/>
       <el-table-column label="定期检验" prop="nextLegalCheckDate" align="center" min-width="150"  sortable="custom">
         <template #default="{ row }">
           <span class="schedule-date-link" @click.stop="handleSchedule(row,'100')">
-          {{formatDate(row.nextLegalCheckDate, 'YYYY-MM-DD')}}
+          {{formatDate(row.nextLegalCheckDate, 'YYYY-MM-DD') || '-'}}
           </span>
         </template>
       </el-table-column>
       <el-table-column label="年度检查" prop="nextYearCheckDate" align="center" min-width="150"  sortable="custom">
         <template #default="{ row }">
           <span class="schedule-date-link" @click.stop="handleSchedule(row,'200')">
-          {{formatDate(row.nextYearCheckDate, 'YYYY-MM-DD')}}
+          {{formatDate(row.nextYearCheckDate, 'YYYY-MM-DD') || '-'}}
           </span>
         </template>
       </el-table-column>
@@ -883,6 +895,31 @@ const loadQueryParamsFromCache = () => {
   }
 }*/
 
+/** 判断是否有已排期的时间 */
+const hasPlanSchedule = (row: any, type: 'legal' | 'year') => {
+  if (type === 'legal') {
+    return row.planLegalCheckDate != null && row.planLegalCheckDate !== '' && row.planLegalCheckDate !== 'null'
+  } else {
+    return row.planYearCheckDate != null && row.planYearCheckDate !== '' && row.planYearCheckDate !== 'null'
+  }
+}
+
+/** 获取子表单元格类名 */
+const getDetailCellClassName = ({ row, column }, mainRow) => {
+  // 检查列是否为检验日期列,只有当有有效排期时间时才添加黄色背景类
+  if (column.property === 'nextLegalCheckDateDetail') {
+    if (row.planLegalCheckDate != null && row.planLegalCheckDate !== '' && row.planLegalCheckDate !== 'null') {
+      return 'cell-scheduled'
+    }
+  }
+  if (column.property === 'nextYearCheckDateDetail') {
+    if (row.planYearCheckDate != null && row.planYearCheckDate !== '' && row.planYearCheckDate !== 'null') {
+      return 'cell-scheduled'
+    }
+  }
+  return ''
+}
+
 const detailTableRefs = ref<Record<string, any>>({})
 const setDetailTableRef = (el: any, parentId: string) => {
   if (el) {
@@ -1217,4 +1254,17 @@ onUnmounted(()=>{
     text-decoration: underline;
   }
 }
+
+// 已排期的单元格黄色背景
+:deep(.cell-scheduled) {
+  background-color: #FFFF99 !important;
+}
+
+.schedule-link {
+  color: var(--el-color-primary);
+
+  &:hover {
+    color: var(--el-color-primary-light-3);
+  }
+}
 </style>