zhangwencui
5 天以前 b39e0358272ba224a7659fa2ed262c00e790ff0b
src/pages/equipmentManagement/upkeep/detail.vue
@@ -80,8 +80,7 @@
          <view v-for="(item, index) in sparePartsList"
                :key="index"
                class="spare-part-item">
            <text class="spare-part-name">{{ item.sparePartName || item.name || '-' }}</text>
            <text class="spare-part-code">{{ item.sparePartCode || item.code || '-' }}</text>
            <text class="spare-part-name">{{ item || '-' }}</text>
          </view>
        </view>
        <view v-else
@@ -107,7 +106,7 @@
                class="file-item"
                @click="previewFile(file)">
            <image v-if="file.type.includes('image')"
                   :src="file.url"
                   :src="formatFileUrl(file.url)"
                   class="file-preview"
                   mode="aspectFill" />
            <view v-else
@@ -197,12 +196,12 @@
    if (url.startsWith("http://") || url.startsWith("https://")) {
      return url;
    }
    const uploadsIndex = url.indexOf("uploads");
    if (uploadsIndex !== -1) {
      const relativePath = url.substring(uploadsIndex);
      return `${config.baseUrl}/profile/${relativePath}`;
    }
    return `${config.baseUrl}/profile/${url}`;
    // const uploadsIndex = url.indexOf("uploads");
    // if (uploadsIndex !== -1) {
    //   const relativePath = url.substring(uploadsIndex);
    //   return `${config.fileUrl}/${relativePath}`;
    // }
    return `${config.fileUrl}/${url}`;
  };
  // 判断是否为图片文件
@@ -257,10 +256,11 @@
    detailData.value = data;
    pageId.value = data.id;
    // 处理备件数据 - 支持多种数据结构
    sparePartsList.value = data.spareParts || data.sparePartList || [];
    sparePartsList.value = data.sparePartsNames.split(",") || [];
    // 处理附件数据 - 支持多种数据结构
    console.log(data.imagesFile);
    fileList.value = data.imagesFile;
    console.log(formatFileUrl(fileList.value[0].url));
  };
  // 返回上一页