gongchunyi
3 天以前 cd1f2d9605c2e208bb7e70f5d3bc83b45a9ec8a6
feat: 产品规格带出产品大类
已修改1个文件
37 ■■■■ 文件已修改
src/views/salesManagement/salesLedger/index.vue 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue
@@ -3004,12 +3004,19 @@
  });
  const getPinnedProductPrefill = async () => {
    if (!pinnedProductTemplate.value) return {};
    await getProductOptions();
    if (!pinnedProductTemplate.value) {
      const models = await modelList({});
      modelOptions.value = models || [];
      return {};
    }
    if (pinnedProductTemplate.value.__productCategoryId) {
      const models = await modelList({
        id: pinnedProductTemplate.value.__productCategoryId,
      });
      modelOptions.value = models || [];
    } else {
      const models = await modelList({});
      modelOptions.value = models || [];
    }
    return { ...pinnedProductTemplate.value };
@@ -4442,20 +4449,30 @@
  };
  // 获取tree子数据
  const getModels = value => {
    // 产品大类变化时,重置规格型号与厚度,避免旧值残留
    productForm.value.productModelId = null;
    productForm.value.specificationModel = "";
    productForm.value.thickness = null;
    if (!value) {
      productForm.value.productCategory = "";
      modelOptions.value = [];
      modelList({}).then(res => {
        modelOptions.value = res || [];
      });
      return;
    }
    productForm.value.productCategory = findNodeById(productOptions.value, value);
    modelList({ id: value }).then(res => {
      modelOptions.value = res || [];
      const currentModelId = productForm.value.productModelId;
      if (currentModelId) {
        const isValid = modelOptions.value.some(item => item.id === currentModelId);
        if (!isValid) {
          productForm.value.productModelId = null;
          productForm.value.specificationModel = "";
          productForm.value.thickness = null;
        }
      } else {
        productForm.value.productModelId = null;
        productForm.value.specificationModel = "";
        productForm.value.thickness = null;
      }
    });
  };
  const getProductModel = value => {
@@ -4474,6 +4491,12 @@
        modelThickness === ""
          ? null
          : Number(modelThickness);
      const categoryId = selectedModel?.productId;
      if (categoryId && productForm.value.__productCategoryId !== categoryId) {
        productForm.value.__productCategoryId = categoryId;
        productForm.value.productCategory = findNodeById(productOptions.value, categoryId);
      }
    } else {
      productForm.value.specificationModel = null;
      productForm.value.thickness = null;