From a660db06773007b1be690e0674829c00a57aeb7b Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 24 十二月 2025 16:21:23 +0800
Subject: [PATCH] 订单首页流程卡新增楼层编号显示

---
 north-glass-erp/northglass-erp/src/views/sd/bom/ProductBomAdd.vue |   45 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/sd/bom/ProductBomAdd.vue b/north-glass-erp/northglass-erp/src/views/sd/bom/ProductBomAdd.vue
index 1d74ce3..a364e41 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/bom/ProductBomAdd.vue
+++ b/north-glass-erp/northglass-erp/src/views/sd/bom/ProductBomAdd.vue
@@ -6,7 +6,7 @@
 import deepClone from "@/utils/deepClone"
 import { ElMessage, ElMessageBox} from "element-plus"
 const { t } = useI18n()
-
+const emit = defineEmits(['closeDialog'])
 let produceList = ref([])
 let props = defineProps({
   productName:null,
@@ -15,10 +15,18 @@
 
   gridDataByProduct: { type: Object, default: () => ({}) }
 })
+
+
+
 const xGrid = ref()
 const xGridByProduct = ref()
 const activeProduct = ref('')                 // 褰撳墠閫変腑鐨勪骇鍝佸悕
 let materialType = ref(1)
+
+//鍏抽棴寮圭獥
+const closeDialog = () => {
+  emit('closeDialog')
+}
 
 const value = ref('')
 const options = [
@@ -152,7 +160,8 @@
       })
 
       getWorks()
-
+      getDetails();
+      editProductBOM();
     }else{
       ElMessage.warning(res.msg)
     }
@@ -236,6 +245,9 @@
 }
 
 
+const getDetails = () => {
+}
+
 //鎷嗗垎姣忎釜浜у搧
 const productList = computed(() => {
   const raw = (props.productName ?? '').toString().trim()
@@ -292,6 +304,7 @@
 }
 
 const saveProductBOM = () => {
+  gridOptionsByProduct.loading=true
   productList.value.forEach((name, index) => {
     const rows = gridDataMapByProduct[index] || []
     const seq = index + 1
@@ -302,12 +315,38 @@
       row.produceId = props.produceId
     })
   })
-  console.log(gridDataMapByProduct)
   request.post(`/BomData/saveProductBOM`,gridDataMapByProduct).then((res) => {
     if(res.code==200){
       ElMessage.success(t('basicData.msg.saveSuccess'))
+      gridOptionsByProduct.loading=false
+      emit('closeDialog')
     }})
 }
+
+const editProductBOM = () => {
+  request.post(`/BomData/editProductBOM/${props.produceId}`).then((res) => {
+    if (res.code == 200 ) {
+      // 鍒濆鍖栨竻绌�
+      productList.value.forEach((_, index) => {
+        gridDataMapByProduct[index + 1] = []
+      })
+      // 閬嶅巻鍚庣杩斿洖鐨勬暟鎹�
+      res.data.data.forEach(item => {
+        const layer = item.product_layer - 1  // 渚嬪 1, 2, 3
+        if (!gridDataMapByProduct[layer]) {
+          gridDataMapByProduct[layer] = []
+        }
+
+        const plainItem = JSON.parse(JSON.stringify(item))
+        gridDataMapByProduct[layer].push(plainItem)
+      })
+
+      // 榛樿閫夋嫨绗竴灞�
+      activeProductIndex.value = 0
+      xGridByProduct.value.loadData(gridDataMapByProduct[0])
+    }
+  })
+}
 </script>
 
 <template>

--
Gitblit v1.8.0