ysy 1 rok temu
rodzic
commit
81ef342eb0

+ 12 - 0
src/api/material/BOM.js

@@ -163,6 +163,18 @@ export async function deleteBomTreeList(data) {
   return Promise.reject(new Error(res.data.message));
   return Promise.reject(new Error(res.data.message));
 }
 }
 
 
+
+// 保存BOM树节点
+export async function updateBatchBOM(data) {
+  const res = await request.post(`/main/bomCategory/updateBatchBOM`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+
+
 // 获取产品BOM列表
 // 获取产品BOM列表
 export async function getBomPageList(params) {
 export async function getBomPageList(params) {
   const res = await request.get(`/main/bomCategory/page`, { params });
   const res = await request.get(`/main/bomCategory/page`, { params });

+ 17 - 2
src/views/material/BOMmanage/components/detailedList.vue

@@ -15,7 +15,7 @@
             <el-button type="primary" size="mini" @click="handleAdd"
             <el-button type="primary" size="mini" @click="handleAdd"
               >新增</el-button
               >新增</el-button
             >
             >
-            <el-button type="primary" size="mini" @click="handleAdd"
+            <el-button type="primary" size="mini" @click="handleSave"
               >保存</el-button
               >保存</el-button
             >
             >
           </div>
           </div>
@@ -119,7 +119,8 @@
   import {
   import {
     getBomPageCategoryId,
     getBomPageCategoryId,
     contactList,
     contactList,
-    deleteBomTreeList
+    deleteBomTreeList,
+    updateBatchBOM
   } from '@/api/material/BOM';
   } from '@/api/material/BOM';
   import { getByCode } from '@/api/system/dictionary-data';
   import { getByCode } from '@/api/system/dictionary-data';
 
 
@@ -368,6 +369,20 @@
             });
             });
           })
           })
           .finally(() => {});
           .finally(() => {});
+      },
+
+      handleSave() {
+        let _list = this.$refs.table.getData() ?? [];
+        if (_list.length == 0) {
+          return this.$message.info('明细表最少有一条数据');
+        }
+        let list = JSON.parse(JSON.stringify(_list));
+        updateBatchBOM(list).then((res) => {
+          this.$message.success('保存成功');
+          this.$refs.table.reload({
+            pageNum: 1
+          });
+        });
       }
       }
     }
     }
   };
   };