Эх сурвалжийг харах

change: cargo-consolidation-request功能迭代.bug修正.

peter 1 сар өмнө
parent
commit
71199916af

+ 3 - 2
src/components/print.vue

@@ -204,9 +204,10 @@ import debounce from 'lodash.debounce'
 defineComponent({
   name: 'ComponentPrint',
 })
-const { content = [], scene = 'SO' } = defineProps<{
+const { content = [], scene = 'SO', autoOpenQRCode = true } = defineProps<{
   content: any[]
   scene?: string
+  autoOpenQRCode?: boolean
 }>()
 let selectedContent = ref([] as any[])
 const mai = ref('')
@@ -221,7 +222,7 @@ watch(
     } else if (scene === 'QC') {
       mai.value = selectedContent.value.join('')
     }
-    if (mai.value.length) {
+    if (mai.value.length && autoOpenQRCode) {
       nextTick(() => {
         reGenerateQrCode()
       })

+ 165 - 174
src/pages/cargo-consolidation-request/index.vue

@@ -20,7 +20,6 @@
             end-placeholder="End date"
             :shortcuts="dateShortcuts"
           />
-          <!-- :disabled-date="pickerOptions" -->
         </el-form-item>
         <el-form-item>
           <el-tooltip content="时间范围最好不要选太大, 不然数据太多会卡">
@@ -53,128 +52,128 @@
       >
         <el-table-column
           prop="Name"
-          label="Voyage Name"
+          label="船名&航次"
+          min-width="500"
         />
         <el-table-column
           prop="Forwarder"
-          label="Forwarder"
+          label="货代"
           width="110"
         />
-        <el-table-column
-          prop="Port_From"
-          label="Port From"
-          width="100"
-        />
-        <el-table-column
-          label="Port To"
-          prop="Port_To"
-          width="100"
-        />
         <el-table-column
           prop="ETD"
           label="ETD"
-          width="100"
+          width="110"
         />
         <el-table-column
           prop="ETA"
           label="ETA"
-          width="100"
+          width="110"
         />
         <el-table-column
           prop="Cut_Off_Date"
-          label="Cut Off"
+          label="入仓时间"
           width="120"
         />
-        <!-- <el-table-column
-          label="Owner"
-          width="100"
-        >
-          <template #default="scope">
-            {{ scope.row.Owner.name }}
-          </template>
-        </el-table-column> -->
         <el-table-column
           prop="Status"
-          label="Status"
+          label="状态"
           width="100"
         />
         <el-table-column
-          label="Last Modify Time"
-          width="180"
+          label="修改时间"
+          min-width="190"
         >
           <template #default="scope">
             {{ dayjs(scope.row.Modified_Time).format('YYYY-MM-DD HH:mm:ss') }}
           </template>
         </el-table-column>
+        <el-table-column
+          prop="GRN"
+          label="入仓单号"
+          min-width="200"
+        />
+        <el-table-column
+          prop="Booking_Number"
+          label="订舱号"
+          min-width="120"
+        />
+        <el-table-column
+          prop="Carrier"
+          label="船东"
+          min-width="120"
+        />
       </el-table>
       <div
         v-show="currentRow.Name?.length"
         class="flex justify-between mt-8"
       >
         <div class="flex">
-          <div class="flex items-center mr-4">
-            current clicked Voyage name:&nbsp;
+          <div class="flex items-center mr-2">
+            <span class="min-w-[150px]">选中的船名&航次:&nbsp;</span>
             <div class="text-red-700 font-bold">
               {{ currentRow.Name }}
             </div>
           </div>
-          <el-button
-            v-if="
-              ['可用', '已截仓'].includes(currentRow.Status) &&
-              [
-                '4791186000259693001',
-                '4791186000022965001',
-                '4791186000052269001',
-              ].includes(currentUser)
-            "
-            size="small"
-            type="danger"
-            @click="ensure"
-          >
-            确认集货
-          </el-button>
-          <el-button
-            v-if="currentTab === 'my_request'"
-            size="small"
-            @click="addBulkProduct"
-          >
-            Submit Bulk Production Request
-          </el-button>
-          <el-button
-            v-if="currentTab === 'my_request'"
-            size="small"
-            @click="addSample"
-          >
-            Submit Sample Request
-          </el-button>
-          <el-button
-            v-if="currentTab === 'my_request'"
-            :disabled="subList.length < 1"
-            size="small"
-            type="danger"
-            @click="generateSubList"
-          >
-            放弃下方表格改动
-          </el-button>
-          <el-button
-            size="small"
-            :disabled="subList.length < 1"
-            @click="exportSubTable"
-          >
-            Export Excel File
-          </el-button>
-          <el-button
-            v-if="currentTab === 'my_request'"
-            :disabled="subList.length < 1"
-            size="small"
-            type="primary"
-            class="custom-button small"
-            @click="commit(ruleFormRef)"
-          >
-            Commit
-          </el-button>
+          <div class="flex flex-wrap min-w-[800px]">
+            <el-button
+              v-if="
+                ['可用', '已截仓'].includes(currentRow.Status) &&
+                [
+                  '4791186000259693001',
+                  '4791186000022965001',
+                  '4791186000052269001',
+                ].includes(currentUser)
+              "
+              size="small"
+              type="danger"
+              @click="ensure"
+            >
+              确认集货
+            </el-button>
+            <el-button
+              v-if="currentTab === 'my_request'"
+              size="small"
+              @click="addBulkProduct"
+            >
+              Submit Bulk Production Request
+            </el-button>
+            <el-button
+              v-if="currentTab === 'my_request'"
+              size="small"
+              @click="addSample"
+            >
+              Submit Sample Request
+            </el-button>
+            <el-button
+              v-if="currentTab === 'my_request'"
+              :disabled="subList.length < 1"
+              size="small"
+              type="danger"
+              @click="generateSubList"
+            >
+              放弃下方表格改动
+            </el-button>
+            <el-button
+              size="small"
+              :disabled="subList.length < 1"
+              @click="exportSubTable"
+            >
+              Export Excel File
+            </el-button>
+            <el-button
+              v-if="currentTab === 'my_request'"
+              :disabled="subList.length < 1"
+              size="small"
+              type="primary"
+              class="custom-button small"
+              @click="commit"
+            >
+              Commit
+            </el-button>
+          </div>
         </div>
-        <div class="flex justify-between w-[350px]">
+        <div class="flex justify-between min-w-[350px]">
           <div class="flex">总重量: {{ computedWeight }}</div>
           <div class="flex">总体积: {{ computedCube }}</div>
           <div class="flex">总离岸价: {{ computedTotalFOB }}</div>
@@ -201,7 +200,7 @@
         ></el-table-column>
         <el-table-column
           fixed
-          label="CRM批次记录 (Batch Record)"
+          label="CRM批次记录"
           width="220"
         >
           <template #default="scope">
@@ -214,7 +213,7 @@
               :loading="loading2"
               filterable
               clearable
-              placeholder="非Sample行必填"
+              :placeholder="scope.row.Sample ? 'Sample' : ''"
               :disabled="scope.row.Sample"
               @change="($e) => onBatchRecordChange($e, scope.$index)"
             >
@@ -231,8 +230,8 @@
           </template>
         </el-table-column>
         <el-table-column
-          label="User Notes"
-          width="180"
+          label="备注"
+          width="110"
           fixed
         >
           <template #default="scope">
@@ -246,20 +245,8 @@
           </template>
         </el-table-column>
         <el-table-column
-          label="Sample"
-          width="60"
-          fixed
-        >
-          <template #default="scope">
-            <el-checkbox v-model="scope.row.Sample"></el-checkbox>
-            <div
-              class="absolute transparent cursor-not-allowed w-[100%] h-[100%] top-0 left-0 z-[999]"
-            ></div>
-          </template>
-        </el-table-column>
-        <el-table-column
-          label="箱数(Carton)"
-          width="115"
+          label="箱数"
+          width="80"
         >
           <template #default="scope">
             <el-input
@@ -270,7 +257,7 @@
           </template>
         </el-table-column>
         <el-table-column
-          label="唛头 (Marks & Nos)"
+          label="唛头"
           width="220"
         >
           <template #default="scope">
@@ -282,7 +269,7 @@
           </template>
         </el-table-column>
         <el-table-column
-          label="货物名称 (Description of Goods)"
+          label="货物名称"
           width="180"
         >
           <template #default="scope">
@@ -294,8 +281,8 @@
           </template>
         </el-table-column>
         <el-table-column
-          label="货物材质 (Material goods)"
-          width="250"
+          label="货物材质"
+          width="220"
         >
           <template #default="scope">
             <el-select
@@ -314,8 +301,8 @@
           </template>
         </el-table-column>
         <el-table-column
-          label="数量(Qty)"
-          width="110"
+          label="数量"
+          width="100"
         >
           <template #default="scope">
             <el-input
@@ -326,8 +313,8 @@
           </template>
         </el-table-column>
         <el-table-column
-          label="单价(澳币/AUD) (Unit Price)"
-          width="220"
+          label="单价(澳币/AUD)"
+          width="120"
         >
           <template #default="scope">
             <el-input
@@ -338,9 +325,9 @@
           </template>
         </el-table-column>
         <el-table-column
-          label="负责人(Owner)"
+          label="负责人"
           fixed="right"
-          width="140"
+          width="120"
         >
           <template #default="scope">
             <el-input
@@ -351,9 +338,9 @@
           </template>
         </el-table-column>
         <el-table-column
-          label="申请人(Sales Person)"
+          label="申请人"
           fixed="right"
-          width="140"
+          width="120"
           prop="Sales_Person"
         >
           <template #default="scope">
@@ -389,8 +376,8 @@
             ].includes(currentUser)
           "
           fixed="right"
-          label="action"
-          width="95"
+          label="操作"
+          width="85"
         >
           <template #default="scope">
             <el-tooltip
@@ -418,7 +405,7 @@
         </el-table-column>
         <el-table-column
           fixed="right"
-          label="重量 (KG) (Weight)"
+          label="重量 (KG)"
           width="70"
         >
           <template #default="scope">
@@ -431,7 +418,7 @@
         </el-table-column>
         <el-table-column
           fixed="right"
-          label="体积 m&sup3; (Cube)"
+          label="体积 m&sup3;"
           width="70"
         >
           <template #default="scope">
@@ -444,8 +431,8 @@
         </el-table-column>
         <el-table-column
           fixed="right"
-          label="总离岸价 (澳币/AUD)(Total FOB)"
-          width="150"
+          label="总离岸价 (澳币/AUD)"
+          width="140"
         >
           <template #default="scope">
             <el-input
@@ -466,6 +453,7 @@
       >
         <comp-print
           v-if="printDrawerVisible"
+          :autoOpenQRCode="false"
           :content="[currentPrintRow.Marks_Nos || '']"
           :scene="'QC'"
         />
@@ -489,22 +477,18 @@ import {
   ElTooltip,
   ElSelect,
   ElOption,
-  ElCheckbox,
   ElMessage,
   ElMessageBox,
   ElNotification,
   ElDrawer,
 } from 'element-plus'
-import type { FormInstance } from 'element-plus'
 import cloneDeep from 'lodash.clonedeep'
 import dayjs from 'dayjs'
 import * as XLSX from 'xlsx'
 import debounce from 'lodash.debounce'
 import compPrint from '@/components/print.vue'
 import request from '@/utils/axios'
-// import { useRouter } from 'vue-router'
-// const $router = useRouter()
-// $router.push('/so-search')
+
 defineComponent({
   name: 'ComponentCargoConsolidationRequest',
 })
@@ -541,7 +525,7 @@ let computedList = computed(() => {
         condition = i.Status && i.Status === '可用'
         break
       case 'voyage_closed':
-        condition = ['已截仓', '已确认', '已发出'].includes(i.Status)
+        condition = ['已截仓', '已确认', '已发出', '已到达'].includes(i.Status)
         break
     }
     return condition
@@ -583,7 +567,7 @@ let getList = () => {
   loading.value = true
   zoho.CRM.API.coql({
     select_query:
-      'select Name,Forwarder,Port_From,Port_To,ETD,ETA,Cut_Off_Date,Owner,Status,Modified_Time from Sea_Freight_Table' +
+      'select Name,Forwarder,ETD,ETA,Cut_Off_Date,Owner,Status,Modified_Time,Carrier,Booking_Number,GRN from Sea_Freight_Table' +
       " where ETD between '" +
       `${dateRange.value.map((i) => dayjs(i).format('YYYY-MM-DD')).join("' and '")}` +
       "'",
@@ -712,15 +696,17 @@ let getSubList = (e: any = {}) => {
   })
     .then((res: any) => {
       if (Array.isArray(res.data) && res.data.length) {
-        subListBackup = res.data.slice()
+        subListBackup = cloneDeep(res.data)
+      } else {
+        subListBackup = []
+      }
 
-        generateSubList()
-        newLineTemplate.Parent_Id = { id: currentRow.value.id }
-        newLineTemplate.Sales_Person = currentUserName.value
-        newLineTemplate.Requester = {
-          id: currentUser.value,
-          name: currentUserName.value,
-        }
+      generateSubList()
+      newLineTemplate.Parent_Id = { id: currentRow.value.id }
+      newLineTemplate.Sales_Person = currentUserName.value
+      newLineTemplate.Requester = {
+        id: currentUser.value,
+        name: currentUserName.value,
       }
     })
     .finally(() => (loading.value = false))
@@ -792,9 +778,7 @@ const calcRowStyle = ($e: any) => {
   return result
 }
 
-const ruleFormRef = ref<FormInstance>()
-
-const commit = (formEl: FormInstance | undefined) => {
+const commit = () => {
   let temp = cloneDeep(subList.value)
   let result = temp
     .filter((i) => !i.deleteFlag)
@@ -838,12 +822,16 @@ const commit = (formEl: FormInstance | undefined) => {
       .map((i) => ({ id: i.id, _delete: null, Material_of_Goods: null })),
   )
   const emptyBatchRecordList: number[] = []
+  const emptyUserNotesList: number[] = []
   result.forEach((i, index) => {
     if (!i.Sample) {
       if (!i.Batch_Record) {
         emptyBatchRecordList.push(index)
       }
     }
+    if (!i.User_Notes) {
+      emptyUserNotesList.push(index)
+    }
   })
 
   if (emptyBatchRecordList.length) {
@@ -854,43 +842,46 @@ const commit = (formEl: FormInstance | undefined) => {
     })
     return
   }
+  if (emptyUserNotesList.length) {
+    ElNotification({
+      title: '请检查表单, 备注是必填的',
+      message: `第 ${emptyUserNotesList
+        .map((i) => i + 1)
+        .join(', ')} 行的备注数据, 不能为空`,
+      duration: 5000,
+    })
+    return
+  }
 
-  if (!formEl) return
-  formEl.validate((valid) => {
-    if (valid) {
-      console.log(result, 'submit result')
-      loading.value = true
-      request
-        .post('/sea_freight/updateSeaFreightData', {
-          id: newLineTemplate.Parent_Id.id,
-          Sea_Freight_array: result,
-          Sales_Person: currentUserName.value,
-          Sales_Person_Obj: {
-            id: currentUser.value,
-            name: currentUserName.value,
-          },
-        })
-        .then((res) => {
-          if (res.data.code === 1) {
-            ElNotification({
-              title: '保存成功',
-              message: '正在刷新数据',
-              duration: 3000,
-            })
-            getSubList(currentRow.value)
-          } else {
-            ElMessage.error('保存出错')
-            loading.value = false
-          }
-        })
-        .catch((e) => {
-          console.log(e, 'commit error')
-          loading.value = false
+  console.log(result, 'submit result')
+  loading.value = true
+  request
+    .post('/sea_freight/updateSeaFreightData', {
+      id: newLineTemplate.Parent_Id.id,
+      Sea_Freight_array: result,
+      Sales_Person: currentUserName.value,
+      Sales_Person_Obj: {
+        id: currentUser.value,
+        name: currentUserName.value,
+      },
+    })
+    .then((res) => {
+      if (res.data.code === 1) {
+        ElNotification({
+          title: '保存成功',
+          message: '正在刷新数据',
+          duration: 3000,
         })
-    } else {
-      console.log('error submit!')
-    }
-  })
+        getSubList(currentRow.value)
+      } else {
+        ElMessage.error('保存出错')
+        loading.value = false
+      }
+    })
+    .catch((e) => {
+      console.log(e, 'commit error')
+      loading.value = false
+    })
 }
 let printDrawerVisible = ref(false)
 let currentPrintRow = ref({} as any)