瀏覽代碼

change: 创建PO. 产品表格行数据填充SO_Line_Item_Id字段.

peter 3 月之前
父節點
當前提交
5072be6fc7
共有 3 個文件被更改,包括 18 次插入22 次删除
  1. 1 0
      src/interface.ts
  2. 1 0
      src/pages/purchase-order/const.ts
  3. 16 22
      src/pages/purchase-order/edit.vue

+ 1 - 0
src/interface.ts

@@ -39,6 +39,7 @@ export interface IProductItem {
   candidate: IProduct[]
   Warehouse?: string
   CF_Product_Type?: string
+  SO_Line_Item_Id?: string
   [key: string]: number | string | IProduct | IProduct[] | undefined
 }
 export interface IForm {

+ 1 - 0
src/pages/purchase-order/const.ts

@@ -115,6 +115,7 @@ export const emptyProductItem = {
   Warehouse: '',
   // 用来区分是否 库存商品, 是则需要将库存选项设置为必选项
   CF_Product_Type: '',
+  SO_Line_Item_Id: '',
 }
 
 export const getPath = function (path: string) {

+ 16 - 22
src/pages/purchase-order/edit.vue

@@ -2113,10 +2113,7 @@ const route = useRoute()
 const soOwner = ref('')
 // 获取销售订单详情
 const p2 = request
-  .post('/common/getSalesOrdersData', { id: route.params.id })
-  .then((response) => {
-    return response
-  })
+  .post('/common/getSalesOrdersDatV7', { id: route.params.id })
 
 // 获取对 该so对应客户的标注 并弹窗提醒
 const getAccountsData = async (id: string) =>
@@ -2231,13 +2228,9 @@ Promise.all([p1, p2, p3, getAccountsData])
     form.value.Reference = res.Reference || ''
     form.value.Artwork_Link = res.Artwork_Link || ''
     let temp = []
-    if (res.details) {
-      temp = res.details.filter(
-        (item: any) => !productBlackList.includes(item.product_id),
-      )
-    } else if (res.Product_Details) {
-      temp = res.Product_Details.filter(
-        (item: any) => !productBlackList.includes(item.product.id),
+    if (res.Ordered_Items) {
+      temp = res.Ordered_Items.filter(
+        (item: any) => !productBlackList.includes(item.Product_Name.id),
       )
     }
 
@@ -2245,29 +2238,30 @@ Promise.all([p1, p2, p3, getAccountsData])
     form.value.productList = []
     recommandVendor.value = []
     temp.forEach((item: any) => {
-      getProductData(item.product.id).then((ctx) => {
+      getProductData(item.Product_Name.id).then((ctx) => {
         console.log(ctx, 'product ctx')
         form.value.productList.push(
           Object.assign({}, emptyProductItem, {
             candidate: [
               {
-                Product_Code: item.product_Product_Code,
-                label: item.product.name,
-                value: item.product.id,
+                Product_Code: item.Product_Name.Product_Code,
+                label: item.Product_Name.name,
+                value: item.Product_Name.id,
               },
             ],
-            Product_Code: item.product.Product_Code,
-            id: item.product.id,
-            name: item.product.name,
-            label: item.product.name,
-            value: item.product.id,
-            desc: item.product_description || '',
-            quantity: Number(item.quantity),
+            Product_Code: item.Product_Name.Product_Code,
+            id: item.Product_Name.id,
+            name: item.Product_Name.name,
+            label: item.Product_Name.name,
+            value: item.Product_Name.id,
+            desc: item.Description || '',
+            quantity: Number(item.Quantity),
             requirement:
               userInfo.value.Organization === 'PrimePac'
                 ? '产品名称:\n尺寸:\n材质:\n工艺:\n颜色:\n其他备注:'
                 : ctx.CF3 || '',
             CF_Product_Type: ctx.CF_Product_Type,
+            SO_Line_Item_Id: item.id,
           }),
         )
       })