Bladeren bron

feat: cargo船期凑货.功能迭代3.

peter 1 maand geleden
bovenliggende
commit
63bda21cee
1 gewijzigde bestanden met toevoegingen van 40 en 23 verwijderingen
  1. 40 23
      src/pages/cargo-consolidation-request/index.vue

+ 40 - 23
src/pages/cargo-consolidation-request/index.vue

@@ -754,6 +754,10 @@ const newLineTemplate = {
     name: '',
     id: '',
   } as any,
+  Sales_Order: '',
+  Purchase_Order: '',
+  Reference: '',
+  PO_Number: '',
   Parent_Id: {
     name: '',
     id: '',
@@ -846,7 +850,7 @@ let getGoodMaterialOption = () => {
       // console.log(resp, 'res')
       const res = resp.data.result || {}
       if (Array.isArray(res.data) && res.data.length) {
-        console.log(res.data, 'res.data')
+        // console.log(res.data, 'res.data')
         goodMaterialOption.value =
           res.data[0].Website_Subform.map(
             (i: any) => i.Website_Subform_Value,
@@ -898,6 +902,10 @@ const onBatchRecordChange = ($e: string, line = -1) => {
         id: result.Owner.id,
       }
     }
+    subList.value[line].Sales_Order = result.Sales_Order || ''
+    subList.value[line].Purchase_Order = result.Purchase_Order || ''
+    subList.value[line].Reference = result.Reference || ''
+    subList.value[line].PO_Number = result.PO_Number || ''
   }
 }
 // 给子表格加红绿背景. 颜色用的tailwind的 red green
@@ -944,6 +952,10 @@ const commit = () => {
         Cube: i.Cube || '',
         Total_FOB: i.Total_FOB || '',
         User_Notes: i.User_Notes || '',
+        Sales_Order: i.Sales_Order || '',
+        Purchase_Order: i.Purchase_Order || '',
+        Reference: i.Reference || '',
+        PO_Number: i.PO_Number || '',
       }
     }) as any[]
 
@@ -952,27 +964,27 @@ const commit = () => {
       .filter((i) => i.deleteFlag)
       .map((i) => ({ id: i.id, _delete: null, Material_of_Goods: null })),
   )
-  const emptyBatchRecordList: number[] = []
+  // const emptyBatchRecordList: number[] = []
   const emptyUserNotesList: number[] = []
   result.forEach((i, index) => {
-    if (!i.Sample) {
-      if (!i.Batch_Record) {
-        emptyBatchRecordList.push(index)
-      }
-    }
+    // if (!i.Sample) {
+    //   if (!i.Batch_Record) {
+    //     emptyBatchRecordList.push(index)
+    //   }
+    // }
     if (!i.User_Notes) {
       emptyUserNotesList.push(index)
     }
   })
 
-  if (emptyBatchRecordList.length) {
-    ElNotification({
-      title: '请检查表单',
-      message: `第 ${emptyBatchRecordList.map((i) => i + 1).join(', ')} 行的Batch Record数据`,
-      duration: 5000,
-    })
-    return
-  }
+  // if (emptyBatchRecordList.length) {
+  //   ElNotification({
+  //     title: '请检查表单',
+  //     message: `第 ${emptyBatchRecordList.map((i) => i + 1).join(', ')} 行的Batch Record数据`,
+  //     duration: 5000,
+  //   })
+  //   return
+  // }
   if (emptyUserNotesList.length) {
     ElNotification({
       title: '请检查表单, 备注是必填的',
@@ -1032,6 +1044,7 @@ const exportSubTable = () => {
     '体积m³ Cube',
     '总离岸价 澳币/AUD Total FOB',
     '负责人 Owner',
+    'Reference',
   ]
 
   const data: any[] = subList.value.map((i) => {
@@ -1046,6 +1059,7 @@ const exportSubTable = () => {
       '体积m³ Cube': i.Cube || '',
       '总离岸价 澳币/AUD Total FOB': i.Total_FOB || '',
       '负责人 Owner': i.Requester.name || '',
+      Reference: i.Reference || i.PO_Number || '',
     }
   })
   if (data.length === 0) {
@@ -1079,10 +1093,14 @@ const exportSubTable = () => {
     { wpx: 100 },
     { wpx: 120 },
     { wpx: 120 },
+    { wpx: 100 },
   ]
 
   XLSX.utils.book_append_sheet(wb, ws, 'Sheet1')
-  XLSX.writeFile(wb, 'test.xlsx')
+  XLSX.writeFile(
+    wb,
+    encodeURIComponent(currentRow.value.Name || 'test') + '.xlsx',
+  )
 }
 
 let qcList = ref([] as any[])
@@ -1100,13 +1118,12 @@ const search = (keyword: string) => {
   })
     .then((res: any) => {
       if (Array.isArray(res.data) && res.data.length) {
-        qcList.value = res.data
-          .map((i: any) => {
-            return {
-              ...i,
-              isSearch: true,
-            }
-          })
+        qcList.value = res.data.map((i: any) => {
+          return {
+            ...i,
+            isSearch: true,
+          }
+        })
       } else {
         qcList.value = []
         ElMessage.warning('No Data Found')