gongchunyi
2026-09-18 4dee4cb5b31a7f1dcd2c7b3d72f74b78d2fe3f29
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
@@ -349,7 +349,11 @@
        modelOptions.value = res || [];
        // 同步回填 model / unit(有些接口返回的 row 里可能没带全)
        if (form.value.productModelId) {
          handleChangeModel(form.value.productModelId);
          const selectedModel = modelOptions.value.find(item => item.id == form.value.productModelId);
          if (selectedModel) {
            form.value.model = selectedModel.model || '';
            form.value.unit = selectedModel.unit || '';
          }
        }
      } catch (e) {
        console.error("加载规格型号失败", e);
@@ -361,6 +365,7 @@
      // 先加载指标选项
      let params = {
        productId: currentProductId.value,
        productModelId: form.value.productModelId || undefined,
        inspectType: 0
      }
      qualityInspectDetailByProductId(params).then(res => {
@@ -425,6 +430,8 @@
const handleChangeModel = (value) => {
  form.value.model = modelOptions.value.find(item => item.id == value)?.model || '';
  form.value.unit = modelOptions.value.find(item => item.id == value)?.unit || '';
  // 规格型号变化后按 产品+规格型号 重新过滤可选指标
  getList(value);
}
const findNodeById = (nodes, productId) => {
@@ -483,7 +490,7 @@
  })
}
const getList = () => {
const getList = (modelId) => {
  if (!currentProductId.value) {
    testStandardOptions.value = [];
    tableData.value = [];
@@ -491,6 +498,7 @@
  }
  let params = {
    productId: currentProductId.value,
    productModelId: modelId ?? form.value.productModelId ?? undefined,
    inspectType: 0
  }
  qualityInspectDetailByProductId(params).then(res => {