<template> 
 | 
  <view class="list"> 
 | 
    <div class="inspection-report"> 
 | 
      <!-- 基本信息模块 --> 
 | 
      <wd-row> 
 | 
        <text class="title">{{ "基本信息" }}</text> 
 | 
        <wd-col :span="24"> 
 | 
          <wd-form-item label="日期" prop="recordDate"> 
 | 
            {{ formatDate(detailData.fixedInfo?.recordDate) }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="机台" prop="deviceModel"> 
 | 
            {{ formatValue(detailData.fixedInfo?.deviceModel) }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="班次" prop="workShift"> 
 | 
            {{ formatValue(detailData.fixedInfo?.workShift) }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="班组" prop="teamName"> 
 | 
            {{ formatValue(detailData.fixedInfo?.teamName) }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="单丝规格" prop="model"> 
 | 
            {{ formatValue(detailData.fixedInfo?.model) }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="生产轴数" prop="outputNumber"> 
 | 
            {{ formatValue(detailData.fixedInfo?.outputNumber, "轴") }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="型号" prop="poleModel"> 
 | 
            {{ formatValue(detailData.fixedInfo?.poleModel) }} 
 | 
          </wd-form-item> 
 | 
  
 | 
          <wd-form-item label="批次" prop="poleNumber"> 
 | 
            {{ formatValue(detailData.fixedInfo?.poleNumber) }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="记录人" prop="createUserName"> 
 | 
            {{ formatValue(detailData.fixedInfo?.createUserName) }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="首检盘号" prop="firstNo"> 
 | 
            {{ formatValue(detailData.fixedInfo?.firstNo) }} 
 | 
          </wd-form-item> 
 | 
        </wd-col> 
 | 
      </wd-row> 
 | 
      <!-- 自检记录详情模块 --> 
 | 
      <wd-row> 
 | 
        <text class="title">{{ "自检记录详情" }}</text> 
 | 
        <wd-col :span="24"> 
 | 
          <wd-form-item label="巡检员" prop="processInspectionUserName"> 
 | 
            {{ detailData.processInspectionUserName || "-" }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="状态" prop="status"> 
 | 
            <wd-tag custom-class="space" :type="getStatusType(detailData.status)"> 
 | 
              {{ getStatusText(detailData.status) }} 
 | 
            </wd-tag> 
 | 
          </wd-form-item> 
 | 
        </wd-col> 
 | 
      </wd-row> 
 | 
      <!-- 检验结果 --> 
 | 
      <wd-row> 
 | 
        <text class="title">{{ "检验结果" }}</text> 
 | 
        <wd-col :span="24"> 
 | 
          <wd-form-item label="单丝直径" prop="dia"> 
 | 
            {{ formatValue(detailData.inspectionResult?.dia, "mm") || "-" }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="最大直径" prop="maxDia"> 
 | 
            {{ formatValue(detailData.inspectionResult?.maxDia, "mm") || "-" }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="最小直径" prop="minDia"> 
 | 
            {{ formatValue(detailData.inspectionResult?.minDia, "mm") || "-" }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="外观" prop="appearance"> 
 | 
            {{ formatProductAppearance(detailData.inspectionResult?.appearance) || "-" }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="卷绕紧密" prop="windingTightness"> 
 | 
            {{ formatValue(detailData.inspectionResult?.windingTightness) }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="排列整齐" prop="arrangementNeatness"> 
 | 
            {{ formatValue(detailData.inspectionResult?.arrangementNeatness) }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item 
 | 
            label="外层铝线离侧板边缘距离" 
 | 
            prop="aluminumWireDistance" 
 | 
            label-width="500rpx" 
 | 
          > 
 | 
            {{ formatValue(detailData.inspectionResult?.aluminumWireDistance, "mm") || "-" }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="成品模后接头情况" prop="jointCondition" label-width="250rpx"> 
 | 
            {{ formatValue(detailData.inspectionResult?.jointCondition) || "-" }} 
 | 
          </wd-form-item> 
 | 
          <wd-form-item label="结论" prop="conclusion"> 
 | 
            {{ formatValue(detailData.inspectionResult?.conclusion) || "-" }} 
 | 
          </wd-form-item> 
 | 
        </wd-col> 
 | 
      </wd-row> 
 | 
      <!-- 巡检结果 --> 
 | 
      <wd-row v-if="detailData.processInspectionResult?.isFully"> 
 | 
        <text class="title">{{ "巡检结果" }}</text> 
 | 
        <wd-col :span="24"> 
 | 
          <wd-form-item label="铝杆前、中、尾样品是否齐全" prop="processInspectionUserName"> 
 | 
            <wd-tag 
 | 
              custom-class="space" 
 | 
              :type="detailData.processInspectionResult?.isFully ? 'success' : 'danger'" 
 | 
            > 
 | 
              {{ detailData.processInspectionResult?.isFully ? "是" : "否" }} 
 | 
            </wd-tag> 
 | 
          </wd-form-item> 
 | 
        </wd-col> 
 | 
      </wd-row> 
 | 
      <!-- 附件模块 --> 
 | 
      <wd-row class="attachment-section" v-if="detailData.files && detailData.files.length > 0"> 
 | 
        <text class="title">{{ "附件" }}</text> 
 | 
        <view class="attachment-grid"> 
 | 
          <wd-col v-for="(file, index) in detailData.files" :key="index" class="attachment-item"> 
 | 
            <wd-img :width="80" :height="80" :src="file.url" @click="previewImage(file.url)"> 
 | 
              <template #error> 
 | 
                <view class="error-wrap">加载失败</view> 
 | 
              </template> 
 | 
              <template #loading> 
 | 
                <view class="loading-wrap"> 
 | 
                  <wd-loading /> 
 | 
                </view> 
 | 
              </template> 
 | 
            </wd-img> 
 | 
          </wd-col> 
 | 
        </view> 
 | 
      </wd-row> 
 | 
    </div> 
 | 
    <wd-popup v-model="show" custom-style="border-radius:32rpx;" @close="handleClose"> 
 | 
      <div class="image-preview"> 
 | 
        <img :src="previewImageUrl" alt="预览图片" style="width: 100%; height: auto" /> 
 | 
      </div> 
 | 
    </wd-popup> 
 | 
  </view> 
 | 
</template> 
 | 
  
 | 
<script setup lang="ts"> 
 | 
import { onLoad } from "@dcloudio/uni-app"; 
 | 
import RoutingInspectionApi from "@/api/routingInspection/routingInspection"; 
 | 
  
 | 
const paramsId = ref(""); 
 | 
const detailData = ref<any>({}); 
 | 
const show = ref(false); 
 | 
const previewImageUrl = ref(""); 
 | 
  
 | 
// 状态类型映射 
 | 
const getStatusType = (status: number) => { 
 | 
  switch (status) { 
 | 
    case 0: 
 | 
      return "warning"; // 待巡检 
 | 
    case 1: 
 | 
      return "danger"; // 已驳回 
 | 
    case 2: 
 | 
      return "info"; // 待审核 
 | 
    case 3: 
 | 
      return "success"; // 通过 
 | 
    default: 
 | 
      return "info"; 
 | 
  } 
 | 
}; 
 | 
  
 | 
// 状态文本映射 
 | 
const getStatusText = (status: number) => { 
 | 
  switch (status) { 
 | 
    case 0: 
 | 
      return "待巡检"; 
 | 
    case 1: 
 | 
      return "已驳回"; 
 | 
    case 2: 
 | 
      return "待审核"; 
 | 
    case 3: 
 | 
      return "通过"; 
 | 
    default: 
 | 
      return "未知"; 
 | 
  } 
 | 
}; 
 | 
  
 | 
// 获取外观文本 
 | 
const getAppearanceText = (appearance: string[]) => { 
 | 
  if (!appearance || appearance.length === 0) return "-"; 
 | 
  return appearance.join("、"); 
 | 
}; 
 | 
  
 | 
// 格式化产品外观显示 
 | 
const formatProductAppearance = (productAppearance: string[]) => { 
 | 
  if (!productAppearance || productAppearance.length === 0) return "-"; 
 | 
  return productAppearance.join("、"); 
 | 
}; 
 | 
  
 | 
// 格式化数值显示 
 | 
const formatValue = (value: any, unit?: string) => { 
 | 
  if (value === null || value === undefined || value === "") return "-"; 
 | 
  return unit ? `${value}${unit}` : value; 
 | 
}; 
 | 
  
 | 
// 格式化日期显示 
 | 
const formatDate = (date: string) => { 
 | 
  if (!date) return "-"; 
 | 
  return new Date(date).toLocaleDateString("zh-CN", { 
 | 
    year: "numeric", 
 | 
    month: "2-digit", 
 | 
    day: "2-digit", 
 | 
  }); 
 | 
}; 
 | 
  
 | 
// 格式化结构值显示 
 | 
const formatStructureValue = (value1: any, value2: any) => { 
 | 
  const val1 = value1 || "-"; 
 | 
  const val2 = value2 ? `${value2}mm` : "-"; 
 | 
  return { count: val1, diameter: val2 }; 
 | 
}; 
 | 
  
 | 
const getDetailData = async (id: string, deviceType: string) => { 
 | 
  try { 
 | 
    let response; 
 | 
    // 获取拉丝单个结构 
 | 
    response = await RoutingInspectionApi.getDrawInspectInfoById({ 
 | 
      id: id, 
 | 
    }); 
 | 
    detailData.value = response.data; 
 | 
    console.log(detailData.value); 
 | 
  } catch (error) { 
 | 
    console.error("获取详情失败:", error); 
 | 
  } 
 | 
}; 
 | 
  
 | 
onLoad((options: any) => { 
 | 
  paramsId.value = options.id; 
 | 
  getDetailData(options.id, options.deviceType); 
 | 
}); 
 | 
  
 | 
const previewImage = (url: string) => { 
 | 
  previewImageUrl.value = url; 
 | 
  show.value = true; 
 | 
}; 
 | 
  
 | 
const handleClose = () => { 
 | 
  show.value = false; 
 | 
}; 
 | 
</script> 
 | 
<style lang="scss" scoped> 
 | 
.list { 
 | 
  height: calc(100vh - 80px); 
 | 
  padding: 12px; 
 | 
  background: #f3f9f8; 
 | 
  
 | 
  :deep() { 
 | 
    .round { 
 | 
      border-radius: 4px; 
 | 
    } 
 | 
  } 
 | 
} 
 | 
  
 | 
.title { 
 | 
  position: relative; 
 | 
  margin-left: 10px; 
 | 
  font-size: 16px; 
 | 
  font-weight: 500; 
 | 
  color: #0d867f; 
 | 
} 
 | 
  
 | 
.title::after { 
 | 
  position: absolute; 
 | 
  content: ""; 
 | 
  top: 4px; 
 | 
  left: -10px; 
 | 
  width: 4px; 
 | 
  height: 16px; 
 | 
  background: #0d867f; 
 | 
  border-radius: 2px; 
 | 
} 
 | 
  
 | 
.attachment-section { 
 | 
  width: 100%; 
 | 
} 
 | 
  
 | 
.attachment-grid { 
 | 
  display: flex; 
 | 
  flex-wrap: wrap; 
 | 
  /* 超出自动换行 */ 
 | 
  gap: 10px; 
 | 
  /* 图片之间的间距 */ 
 | 
  padding: 10px 0; 
 | 
} 
 | 
  
 | 
.attachment-item { 
 | 
  width: calc(25% - 10px); 
 | 
  /* 每行4张,间距由gap控制,需计算宽度 */ 
 | 
  box-sizing: border-box; 
 | 
} 
 | 
  
 | 
/* 适配小屏幕,可调整每行数量(如每行2张) */ 
 | 
@media (max-width: 768px) { 
 | 
  .attachment-item { 
 | 
    width: calc(25% - 10px); 
 | 
  } 
 | 
} 
 | 
</style> 
 |