From b9c0cee25748ea2d5621a8ca56ceb855a9ce3700 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 17 四月 2026 16:08:01 +0800
Subject: [PATCH] fix: 修改生产模块
---
src/views/productionManagement/productStructure/Detail/index.vue | 54 ++++++++++++++++++++++++++++++++++++++----------------
1 files changed, 38 insertions(+), 16 deletions(-)
diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index 6734830..9f8ad51 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -1,6 +1,6 @@
<template>
- <div class="app-container">
- <PageHeader content="浜у搧缁撴瀯璇︽儏">
+ <div :class="embedded ? 'embedded-container' : 'app-container'">
+ <PageHeader v-if="!embedded" content="浜у搧缁撴瀯璇︽儏">
<template #right-button>
<el-button v-if="!dataValue.isEdit && !isOrderPage"
type="primary"
@@ -174,6 +174,18 @@
const ProductSelectDialog = defineAsyncComponent(
() => import("@/views/basicData/product/ProductSelectDialog.vue")
);
+ const props = defineProps({
+ embedded: {
+ type: Boolean,
+ default: false,
+ },
+ // 鏄惧紡鎸囧畾BOM涓婚敭锛堢敤浜庡祵鍏ュ埌鈥滃伐鑹鸿矾绾块」鐩�濈瓑椤甸潰鏃讹紝璺敱 query.id 涓嶆槸 bomId 鐨勬儏鍐碉級
+ bomId: {
+ type: [String, Number],
+ default: undefined,
+ },
+ });
+ const embedded = computed(() => props.embedded);
const emit = defineEmits(["update:router"]);
const form = ref();
@@ -181,7 +193,8 @@
const router = useRouter();
const routeId = computed({
get() {
- return route.query.id;
+ // 浼樺厛浣跨敤澶栭儴浼犲叆鐨� bomId锛屽叾娆′娇鐢ㄨ矾鐢辩殑 bomId锛屾渶鍚庡洖閫�鍒拌矾鐢辩殑 id锛堝吋瀹瑰師椤甸潰锛�
+ return props.bomId ?? route.query.bomId ?? route.query.id;
},
set(val) {
@@ -227,26 +240,28 @@
};
const fetchData = async () => {
+ const setNameRecursively = (items: any[]) => {
+ items.forEach((item: any) => {
+ item.tempId = item.tempId || item.id || new Date().getTime() + Math.random();
+ item.processName =
+ dataValue.processOptions.find(option => option.id === item.processId)?.name || item.processName || "";
+ if (item.children && item.children.length > 0) {
+ setNameRecursively(item.children);
+ }
+ });
+ };
+
if (isOrderPage.value) {
// 璁㈠崟鎯呭喌锛氫娇鐢ㄨ鍗曠殑浜у搧缁撴瀯鎺ュ彛
const { data } = await listProcessBom({ orderId: routeOrderId.value });
- dataValue.dataList = (data as any) || [];
+ const list = Array.isArray(data) ? data : (data as any)?.records || [];
+ dataValue.dataList = list;
+ setNameRecursively(dataValue.dataList);
} else {
// 闈炶鍗曟儏鍐碉細浣跨敤鍘熸潵鐨勬帴鍙�
const { data } = await queryList(routeId.value);
dataValue.dataList = (data as any) || [];
// 涓烘墍鏈夐」鍙婂叾瀛愰」璁剧疆name灞炴��
- const setNameRecursively = (items: any[]) => {
- items.forEach((item: any) => {
- item.tempId = item.id;
- item.processName =
- dataValue.processOptions.find(option => option.id === item.processId)
- ?.name || "";
- if (item.children && item.children.length > 0) {
- setNameRecursively(item.children);
- }
- });
- };
setNameRecursively(dataValue.dataList);
console.log(dataValue.dataList, "dataValue.dataList");
}
@@ -518,4 +533,11 @@
await fetchProcessOptions();
await fetchData();
});
-</script>
\ No newline at end of file
+</script>
+
+<style scoped>
+.embedded-container {
+ padding: 0;
+ margin: 0;
+}
+</style>
\ No newline at end of file
--
Gitblit v1.9.3