gaoluyang
5 天以前 74e6e4431b82fcd30e31f59b91bcdf2c8a5cf3f8
src/pages/qualityManagement/materialInspection/detail.vue
@@ -131,7 +131,7 @@
<script setup>
  import { ref, onMounted } from "vue";
  import { onShow } from "@dcloudio/uni-app";
  import { onShow, onLoad } from "@dcloudio/uni-app";
  import PageHeader from "@/components/PageHeader.vue";
  import dayjs from "dayjs";
  import { qualityInspectParamInfo } from "@/api/qualityManagement/materialInspection.js";
@@ -204,16 +204,9 @@
    }, 1500);
  };
  // 获取页面ID
  const getPageId = () => {
    const pages = getCurrentPages();
    const currentPage = pages[pages.length - 1];
    return currentPage.options.id;
  };
  // 获取详情数据
  const getDetail = () => {
    const id = getPageId();
    const id = optionsId.value;
    if (!id) {
      showToast("参数错误");
      return;
@@ -235,31 +228,6 @@
            ) {
              // 如果接口没有返回数据,使用本地存储中的数据
              inspectionItems.value = detailDataFromStorage.qualityInspectParams;
            } else {
              // 模拟检验项目
              inspectionItems.value = [
                {
                  parameterItem: "厚度",
                  unit: "mm",
                  standardValue: "2.0 ± 0.1",
                  controlValue: "2.0 ± 0.05",
                  testValue: "2.05",
                },
                {
                  parameterItem: "硬度",
                  unit: "HB",
                  standardValue: "≥ 200",
                  controlValue: "≥ 210",
                  testValue: "220",
                },
                {
                  parameterItem: "表面质量",
                  unit: "",
                  standardValue: "无划痕、无锈蚀",
                  controlValue: "无划痕、无锈蚀",
                  testValue: "合格",
                },
              ];
            }
          })
          .catch(error => {
@@ -272,90 +240,10 @@
              inspectionItems.value = detailDataFromStorage.qualityInspectParams;
            }
          });
      } else {
        // 模拟数据
        detailData.value = {
          id: id,
          checkTime: "2026-03-03",
          purchaseContractNo: "PO20260303001",
          supplier: "上海金属材料有限公司",
          checkName: "张三",
          productName: "不锈钢板材",
          model: "304",
          unit: "kg",
          quantity: 1000,
          checkCompany: "第三方检测机构",
          checkResult: "合格",
          inspectState: true,
        };
        // 模拟检验项目
        inspectionItems.value = [
          {
            parameterItem: "厚度",
            unit: "mm",
            standardValue: "2.0 ± 0.1",
            controlValue: "2.0 ± 0.05",
            testValue: "2.05",
          },
          {
            parameterItem: "硬度",
            unit: "HB",
            standardValue: "≥ 200",
            controlValue: "≥ 210",
            testValue: "220",
          },
          {
            parameterItem: "表面质量",
            unit: "",
            standardValue: "无划痕、无锈蚀",
            controlValue: "无划痕、无锈蚀",
            testValue: "合格",
          },
        ];
      }
    } catch (error) {
      console.error("加载详情数据失败:", error);
      showToast("加载详情数据失败,请重试");
      // 加载失败时使用模拟数据
      detailData.value = {
        id: id,
        checkTime: "2026-03-03",
        purchaseContractNo: "PO20260303001",
        supplier: "上海金属材料有限公司",
        checkName: "张三",
        productName: "不锈钢板材",
        model: "304",
        unit: "kg",
        quantity: 1000,
        checkCompany: "第三方检测机构",
        checkResult: "合格",
        inspectState: true,
      };
      inspectionItems.value = [
        {
          parameterItem: "厚度",
          unit: "mm",
          standardValue: "2.0 ± 0.1",
          controlValue: "2.0 ± 0.05",
          testValue: "2.05",
        },
        {
          parameterItem: "硬度",
          unit: "HB",
          standardValue: "≥ 200",
          controlValue: "≥ 210",
          testValue: "220",
        },
        {
          parameterItem: "表面质量",
          unit: "",
          standardValue: "无划痕、无锈蚀",
          controlValue: "无划痕、无锈蚀",
          testValue: "合格",
        },
      ];
    }
  };
@@ -366,6 +254,11 @@
  onMounted(() => {
    getDetail();
  });
  const optionsId = ref("");
  onLoad(options => {
    optionsId.value = options.id || "";
    getDetail();
  });
</script>
<style scoped lang="scss">