From 4c8d18cc5ed8a7b0e220c91a858d16d0310896df Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 29 六月 2026 16:50:03 +0800
Subject: [PATCH] BOM新增修改删除功能开发、以及BOM结构的可编辑

---
 src/pages/productionDesign/bom/BomStructureItem.vue |   44 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/src/pages/productionDesign/bom/BomStructureItem.vue b/src/pages/productionDesign/bom/BomStructureItem.vue
index 689010c..e49f35c 100644
--- a/src/pages/productionDesign/bom/BomStructureItem.vue
+++ b/src/pages/productionDesign/bom/BomStructureItem.vue
@@ -58,23 +58,39 @@
             </view>
           </view>
         </view>
+        <view v-if="isEdit"
+              class="item-actions">
+          <up-button size="mini"
+                     type="primary"
+                     @click.stop="emitEdit">缂栬緫</up-button>
+          <up-button size="mini"
+                     type="success"
+                     @click.stop="emitAddChild">娣诲姞</up-button>
+          <up-button size="mini"
+                     type="error"
+                     @click.stop="emitRemove">鍒犻櫎</up-button>
+        </view>
       </view>
     </view>
     <!-- 閫掑綊灞曠ず瀛愯妭鐐� -->
     <view v-if="hasChildren && isExpanded"
           class="children-container">
       <BomStructureItem v-for="(child, index) in item.children"
-                        :key="index"
+                        :key="child.tempId || child.id || index"
                         :item="child"
                         :level="level + 1"
                         :isLast="index === item.children.length - 1"
-                        :processOptions="processOptions" />
+                        :processOptions="processOptions"
+                        :isEdit="isEdit"
+                        @edit="$emit('edit', $event)"
+                        @add-child="$emit('add-child', $event)"
+                        @remove="$emit('remove', $event)" />
     </view>
   </view>
 </template>
 
 <script setup>
-  import { ref, computed, defineProps } from "vue";
+  import { ref, computed, defineProps, defineEmits } from "vue";
 
   const props = defineProps({
     item: {
@@ -93,7 +109,12 @@
       type: Array,
       default: () => [],
     },
+    isEdit: {
+      type: Boolean,
+      default: false,
+    },
   });
+  const emit = defineEmits(["edit", "add-child", "remove"]);
 
   const isExpanded = ref(true);
   const hasChildren = computed(
@@ -109,6 +130,16 @@
   const getProcessName = id => {
     const process = props.processOptions.find(p => p.id === id);
     return process ? process.name : "-";
+  };
+
+  const emitEdit = () => {
+    emit("edit", props.item);
+  };
+  const emitAddChild = () => {
+    emit("add-child", props.item);
+  };
+  const emitRemove = () => {
+    emit("remove", props.item);
   };
 </script>
 
@@ -253,4 +284,11 @@
   .children-container {
     position: relative;
   }
+
+  .item-actions {
+    display: flex;
+    justify-content: flex-end;
+    gap: 16rpx;
+    margin-top: 16rpx;
+  }
 </style>

--
Gitblit v1.9.3