From ed702dac689a4ec90fab47a301d007bc493998fe Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期三, 15 四月 2026 09:46:28 +0800
Subject: [PATCH] 中兴实强 1.新增工艺路线的时候产品可以多选
---
src/views/productionManagement/processRoute/New.vue | 44 ++++++--------------------------------------
1 files changed, 6 insertions(+), 38 deletions(-)
diff --git a/src/views/productionManagement/processRoute/New.vue b/src/views/productionManagement/processRoute/New.vue
index 11d954a..9e876dd 100644
--- a/src/views/productionManagement/processRoute/New.vue
+++ b/src/views/productionManagement/processRoute/New.vue
@@ -75,7 +75,7 @@
<script setup>
import { computed, getCurrentInstance, ref } from "vue";
import { add } from "@/api/productionManagement/processRoute.js";
-import { getByModel } from "@/api/productionManagement/productBom.js";
+import { getByModelList } from "@/api/productionManagement/productBom.js";
import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
const props = defineProps({
@@ -131,14 +131,14 @@
isShow.value = false;
};
-const loadBomList = async (productModelId) => {
- if (!productModelId) {
+const loadBomList = async (productModelIds) => {
+ if (!productModelIds?.length) {
bomOptions.value = [];
return;
}
try {
- const res = await getByModel(productModelId);
+ const res = await getByModelList(productModelIds);
if (Array.isArray(res)) {
bomOptions.value = res;
return;
@@ -151,38 +151,6 @@
} catch (error) {
bomOptions.value = [];
}
-};
-
-const loadBomOptionsByProducts = async (products) => {
- if (!products?.length) {
- bomOptions.value = [];
- return;
- }
-
- const bomGroups = await Promise.all(
- products.map(async (product) => {
- try {
- const res = await getByModel(product.id);
- if (Array.isArray(res)) {
- return res;
- }
- if (res && res.data) {
- return Array.isArray(res.data) ? res.data : [res.data];
- }
- return res && typeof res === "object" ? [res] : [];
- } catch (error) {
- return [];
- }
- })
- );
-
- const bomMap = new Map();
- bomGroups.flat().forEach((item) => {
- if (item?.id && !bomMap.has(item.id)) {
- bomMap.set(item.id, item);
- }
- });
- bomOptions.value = Array.from(bomMap.values());
};
const handleProductSelect = async (products) => {
@@ -200,13 +168,13 @@
formState.value.productModelId = product.id;
formState.value.productName = product.productName;
formState.value.productModelName = product.model;
- await loadBomList(product.id);
+ await loadBomList([product.id]);
} else {
formState.value.productId = undefined;
formState.value.productModelId = undefined;
formState.value.productName = "";
formState.value.productModelName = "";
- await loadBomOptionsByProducts(products);
+ await loadBomList(products.map((product) => product.id));
}
showProductSelectDialog.value = false;
--
Gitblit v1.9.3