From 04687ca035e6fa517e88470aac7247812f85eb95 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 17 四月 2026 17:09:29 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_New' into dev_New
---
src/views/productionManagement/productStructure/Detail/index.vue | 72 ++++++++++++++++++++++-------------
1 files changed, 45 insertions(+), 27 deletions(-)
diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index 6734830..832c121 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"
@@ -119,7 +119,7 @@
</el-form-item>
</template>
</el-table-column>
- <el-table-column label="鎿嶄綔"
+ <el-table-column v-if="!embedded" label="鎿嶄綔"
fixed="right"
width="200">
<template #default="{ row, $index }">
@@ -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,29 +240,27 @@
};
const fetchData = async () => {
- if (isOrderPage.value) {
- // 璁㈠崟鎯呭喌锛氫娇鐢ㄨ鍗曠殑浜у搧缁撴瀯鎺ュ彛
- const { data } = await listProcessBom({ orderId: routeOrderId.value });
- dataValue.dataList = (data as any) || [];
- } 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");
+ 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);
+ }
+ });
+ };
+
+ // 缁熶竴浣跨敤 BOM 鏌ヨ浜у搧缁撴瀯锛�/productStructure/listBybomId/{bomId}
+ // 璇存槑锛氳鍗曢〉涔熶細浠庤矾鐢�/鐖剁粍浠跺甫鍏� bomId锛坮oute.query.bomId 鎴� props.bomId锛�
+ const bomId = routeId.value;
+ if (!bomId) {
+ dataValue.dataList = [];
+ return;
}
+ const { data } = await queryList(bomId);
+ dataValue.dataList = (data as any) || [];
+ setNameRecursively(dataValue.dataList);
};
const fetchProcessOptions = async () => {
@@ -518,4 +529,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