huang_an 2 лет назад
Родитель
Сommit
e0ae2b0012

+ 10 - 0
src/api/classifyManage/index.js

@@ -80,3 +80,13 @@ export async function getDetailById(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+/**
+ * 产品列表
+ */
+export async function getProductList(params) {
+  const res = await request.get(`/main/category/getList`, { params });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 39 - 5
src/views/warehouseManagement/outgoingManagement/add.vue

@@ -599,7 +599,11 @@
 <script>
   import outin from '@/api/warehouseManagement/outin';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
-  import { getTreeByPid, getTreeByGroup } from '@/api/classifyManage';
+  import {
+    getTreeByPid,
+    getTreeByGroup,
+    getProductList
+  } from '@/api/classifyManage';
   import selectUpload from '@/components/selectUpload';
   import upload from '@/components/uploadImg';
   import pickOrder from './components/pickOrder.vue';
@@ -917,7 +921,7 @@
         this.title = '';
         this.$forceUpdate();
       },
-      eomSuccess(row) {
+      async eomSuccess(row) {
         console.log(row);
         this.formData.extInfo.assetType = 9;
         this.$refs.trees.valueTitle = '产品';
@@ -928,10 +932,40 @@
         this.formData.clientName = row.contactName;
         this.formData.clientUser = row.linkName;
         this.formData.clientPhone = row.linkPhone;
-        this.onSelectTableData(row.tableData, 1);
+        console.log('==sasa', row.tableData);
+        this.onSelectTableData(await this.serachMainCode(row.tableData), 1);
         this.$forceUpdate();
       },
-      pickOrderRow(row) {
+      async serachMainCode(arr) {
+        let newArr = [];
+        // 使用 Promise.all 来等待所有异步操作完成
+        await Promise.all(
+          arr.map(async (item) => {
+            const data = await getProductList({
+              pageNum: 1,
+              size: 10,
+              categoryLevelId: item.productCategoryId,
+              code: item.code
+            });
+            newArr.push(data.list); // 将结果存储到 newArr 中
+          })
+        );
+        let re = [];
+        for (const item of newArr) {
+          for (const it of item) {
+            re.push(it);
+          }
+        }
+        return re.map((item) => {
+          return {
+            ...item,
+            minUnit: item.packingUnit,
+            assetCode: item.code,
+            assetName: item.name
+          };
+        });
+      },
+      async pickOrderRow(row) {
         this.formData.sid = row.id;
         row.tableData = [];
         this.formData.sourceBizNo = row.code;
@@ -970,7 +1004,7 @@
         });
         row.tableData = uniqueItems;
         console.log(row);
-        this.onSelectTableData(row.tableData, 1);
+        this.onSelectTableData(await this.serachMainCode(row.tableData), 1);
 
         this.selectTop(row);
         this.$forceUpdate();

+ 35 - 2
src/views/warehouseManagement/stockManagement/add.vue

@@ -1105,7 +1105,11 @@
 <script>
   import picker from './components/picker.vue';
   import outin from '@/api/warehouseManagement/outin';
-  import { getTreeByPid, getTreeByGroup } from '@/api/classifyManage';
+  import {
+    getTreeByPid,
+    getTreeByGroup,
+    getProductList
+  } from '@/api/classifyManage';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
   import selectUpload from '@/components/selectUpload';
   import upload from '@/components/uploadImg';
@@ -1353,8 +1357,37 @@
               categoryId: item.productCategoryId
             };
           });
-          this.onSelectTableData(list);
+          this.onSelectTableData(await this.serachMainCode(list));
+        }
+      },
+      async serachMainCode(arr) {
+        let newArr = [];
+        // 使用 Promise.all 来等待所有异步操作完成
+        await Promise.all(
+          arr.map(async (item) => {
+            const data = await getProductList({
+              pageNum: 1,
+              size: 10,
+              categoryLevelId: item.categoryLevelPathIdParent,
+              code: item.assetCode
+            });
+            newArr.push(data.list); // 将结果存储到 newArr 中
+          })
+        );
+        let re = [];
+        for (const item of newArr) {
+          for (const it of item) {
+            re.push(it);
+          }
         }
+        return re.map((item) => {
+          return {
+            ...item,
+            minPackUnit: item.packingUnit,
+            assetCode: item.code,
+            assetName: item.name
+          };
+        });
       },
       onClear() {
         this.formData.extInfo.documentSource = '';