From cd1f2d9605c2e208bb7e70f5d3bc83b45a9ec8a6 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 18 六月 2026 15:16:53 +0800
Subject: [PATCH] feat: 产品规格带出产品大类
---
src/views/salesManagement/salesLedger/index.vue | 37 ++++++++++++++++++++++++++++++-------
1 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 268cd1b..303271b 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/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;
--
Gitblit v1.9.3