进销存升级
1.生产报工带出来的原材料、过程、出厂检数据编辑时,规格型号回显还是有问题
已修改2个文件
86 ■■■■ 文件已修改
src/views/qualityManagement/processInspection/components/formDia.vue 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/qualityManagement/processInspection/components/formDia.vue
@@ -207,22 +207,50 @@
// 打开弹框
const openDialog = async (type, row) => {
    operationType.value = type;
    dialogFormVisible.value = true;
    getOptions().then((res) => {
        supplierList.value = res.data;
    });
    let userLists = await userListNoPage();
    userList.value = userLists.data;
    form.value = {}
    // 先重置表单数据(保持字段完整,避免弹窗首次渲染时触发必填红框“闪一下”)
    form.value = {
        checkTime: "",
        process: "",
        checkName: "",
        productName: "",
        productId: "",
        productModelId: "",
        model: "",
        testStandardId: "",
        unit: "",
        quantity: "",
        checkCompany: "",
        checkResult: "",
    }
    testStandardOptions.value = [];
    tableData.value = [];
    getProductOptions();
    // 先确保产品树已加载,否则编辑时产品/规格型号无法反显
    await getProductOptions();
    if (operationType.value === 'edit') {
        // 先保存 testStandardId,避免被清空
        const savedTestStandardId = row.testStandardId;
        // 先设置表单数据,但暂时清空 testStandardId,等选项加载完成后再设置
        form.value = {...row, testStandardId: ''}
        currentProductId.value = row.productId || 0
        // 关键:编辑时加载规格型号下拉选项,才能反显 productModelId
        if (currentProductId.value) {
            try {
                const res = await modelList({ id: currentProductId.value });
                modelOptions.value = res || [];
                // 同步回填 model / unit(有些接口返回的 row 里可能没带全)
                if (form.value.productModelId) {
                    handleChangeModel(form.value.productModelId);
                }
            } catch (e) {
                console.error("加载规格型号失败", e);
                modelOptions.value = [];
            }
        }
        // 编辑模式下,先加载指标选项,然后加载参数列表
        if (currentProductId.value) {
            // 先加载指标选项
@@ -264,10 +292,16 @@
            getQualityInspectParamList(row.id);
        }
    }
    // 最后再打开弹窗,并清理校验态,避免必填提示闪烁
    dialogFormVisible.value = true;
    nextTick(() => {
        proxy.$refs?.formRef?.clearValidate?.();
    });
}
const getProductOptions = () => {
  productTreeList().then((res) => {
  return productTreeList().then((res) => {
    productOptions.value = convertIdToValue(res);
        return productOptions.value;
  });
};
const getModels = (value) => {
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
@@ -218,21 +218,49 @@
const modelOptions = ref([]);
// 打开弹框
const openDialog = (type, row) => {
const openDialog = async (type, row) => {
  operationType.value = type;
  dialogFormVisible.value = true;
  getOptions().then((res) => {
    supplierList.value = res.data;
  });
    form.value = {}
  // 先重置表单数据(保持字段完整,避免弹窗首次渲染时触发必填红框“闪一下”)
    form.value = {
    checkTime: "",
    supplier: "",
    checkName: "",
    productName: "",
    productId: "",
    productModelId: "",
    model: "",
    testStandardId: "",
    unit: "",
    quantity: "",
    checkCompany: "",
    checkResult: "",
  }
  testStandardOptions.value = [];
  tableData.value = [];
  getProductOptions();
  // 先确保产品树已加载,否则编辑时产品/规格型号无法反显
  await getProductOptions();
  if (operationType.value === 'edit') {
    // 先保存 testStandardId,避免被清空
    const savedTestStandardId = row.testStandardId;
    form.value = {...row}
    currentProductId.value = row.productId || 0
    // 关键:编辑时加载规格型号下拉选项,才能反显 productModelId
    if (currentProductId.value) {
      try {
        const res = await modelList({ id: currentProductId.value });
        modelOptions.value = res || [];
        // 同步回填 model / unit(有些接口返回的 row 里可能没带全)
        if (form.value.productModelId) {
          handleChangeModel(form.value.productModelId);
        }
      } catch (e) {
        console.error("加载规格型号失败", e);
        modelOptions.value = [];
      }
    }
    // 编辑模式下,先加载指标选项,然后加载参数列表
    if (currentProductId.value) {
      // 先加载指标选项
@@ -273,10 +301,16 @@
      getQualityInspectParamList(row.id);
    }
  }
  // 最后再打开弹窗,并清理校验态,避免必填提示闪烁
  dialogFormVisible.value = true;
  nextTick(() => {
    proxy.$refs?.formRef?.clearValidate?.();
  });
}
const getProductOptions = () => {
  productTreeList().then((res) => {
  return productTreeList().then((res) => {
    productOptions.value = convertIdToValue(res);
    return productOptions.value;
  });
};
const getModels = (value) => {