gaoluyang
10 天以前 a2c33664f683aee11fdc62391c8d1e21cc74f5b2
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
@@ -43,7 +43,7 @@
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="尺寸:" prop="productModelId">
            <el-form-item label="规格型号:" prop="productModelId">
              <el-select v-model="form.productModelId" placeholder="请选择" clearable :disabled="operationType === 'edit'"
                         filterable readonly @change="handleChangeModel">
                <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id" />
@@ -258,14 +258,14 @@
  }
  testStandardOptions.value = [];
  tableData.value = [];
  // 先确保产品树已加载,否则编辑时产品/尺寸无法反显
  // 先确保产品树已加载,否则编辑时产品/规格型号无法反显
  await getProductOptions();
  if (operationType.value === 'edit') {
    // 先保存 testStandardId,避免被清空
    const savedTestStandardId = row.testStandardId;
    form.value = {...row}
    currentProductId.value = row.productId || 0
    // 关键:编辑时加载尺寸下拉选项,才能反显 productModelId
    // 关键:编辑时加载规格型号下拉选项,才能反显 productModelId
    if (currentProductId.value) {
      try {
        const res = await modelList({ id: currentProductId.value });
@@ -275,7 +275,7 @@
          handleChangeModel(form.value.productModelId);
        }
      } catch (e) {
        console.error("加载尺寸失败", e);
        console.error("加载规格型号失败", e);
        modelOptions.value = [];
      }
    }