Răsfoiți Sursa

feat: 解决表格range格式化为空时的格式化

Jack Zhou 4 luni în urmă
părinte
comite
357c080b93

+ 1 - 10
src/views/DestinationDelivery/src/components/DeliveryDate.vue

@@ -48,16 +48,7 @@ onMounted(() => {
   getDeliveryDateData()
 })
 
-const stateDataList = ref({
-  // '2025-06-01': {
-  //   pending: 3,
-  //   approved: 3
-  // },
-  // '2025-05-20': {
-  //   pending: 2,
-  //   approved: 1
-  // }
-})
+const stateDataList = ref({})
 const isShowStatus = (date: string) => {
   return stateDataList.value[date] ? true : false
 }

+ 10 - 7
src/views/DestinationDelivery/src/components/TableView/src/TableView.vue

@@ -53,8 +53,11 @@ const handleColumns = (columns: any, status?: string) => {
       curColumn = {
         ...curColumn,
         formatter: ({ cellValue }: any) => {
+          if (!cellValue) return '--'
           const rangeData = cellValue.split(';')
-          return formatTimezone(rangeData[0]) + ' -- ' + formatTimezone(rangeData[1])
+          const leftDate = rangeData[0] ? formatTimezone(rangeData[0]) : '_'
+          const rightDate = rangeData[1] ? formatTimezone(rangeData[0]) : '_'
+          return leftDate + ' -- ' + rightDate
         }
       }
     }
@@ -320,7 +323,7 @@ const clickEmailBtn = (row: any) => {
 const handelEdit = (row: any) => {
   router.push({
     path: '/destination-delivery/CreateNewBooking',
-    query: { a: row._serial_no}
+    query: { a: row._serial_no }
   })
 }
 
@@ -409,7 +412,7 @@ defineExpose({
         </el-button>
         <!-- email -->
         <el-button
-          v-if="isEmployeeRole && row.status === 'Approved'"
+          v-if="!isEmployeeRole && row.status === 'Approved'"
           @click="clickEmailBtn(row)"
           class="action-btn el-button--blue"
           style="height: 24px; width: 24px"
@@ -421,7 +424,7 @@ defineExpose({
           @click="handelEdit(row)"
           class="action-btn el-button--blue"
           style="height: 24px; width: 24px"
-          v-if="isEmployeeRole && row.status === 'Pending Approval'"
+          v-if="!isEmployeeRole && row.status === 'Pending Approval'"
         >
           <span class="font_family icon-icon_edit_b"> </span>
         </el-button>
@@ -430,7 +433,7 @@ defineExpose({
           @click="handleTips('cancel', row)"
           class="action-btn el-button--blue"
           style="height: 24px; width: 24px"
-          v-if="isEmployeeRole && row.status === 'Pending Approval'"
+          v-if="!isEmployeeRole && row.status === 'Pending Approval'"
         >
           <span class="font_family icon-icon_cancelled_b"> </span>
         </el-button>
@@ -438,14 +441,14 @@ defineExpose({
         <el-button
           @click="handleTips('approve', row)"
           class="action-btn el-button--blue"
-          v-if="!isEmployeeRole && row.status === 'Pending Approval'"
+          v-if="isEmployeeRole && row.status === 'Pending Approval'"
           style="height: 24px; width: 24px"
         >
           <span class="font_family icon-icon_confirm_b"> </span>
         </el-button>
         <!-- reject -->
         <el-button
-          v-if="!isEmployeeRole && row.status === 'Pending Approval'"
+          v-if="isEmployeeRole && row.status === 'Pending Approval'"
           @click="handleTips('reject', row)"
           class="action-btn el-button--blue"
           style="height: 24px; width: 24px"

+ 1 - 1
src/views/DestinationDelivery/src/components/TableView/src/components/BookingDetailDialog.vue

@@ -22,7 +22,7 @@ const openDialog = (row: any) => {
       }
       handleStepData(data.status, data)
       processList.value = data.operation_log
-      const rowData = data
+      rowData.value = data
       shipmentInfoTableData.value = data.shipmentsData || []
     })
     .finally(() => {

+ 4 - 1
src/views/DestinationDelivery/src/components/TableView/src/components/ShipmentInforTable.vue

@@ -37,8 +37,11 @@ const tableData = ref<VxeGridProps<any>>({
       title: 'Recommended Delivery Date',
       width: 220,
       formatter: ({ cellValue }: any) => {
+        if (!cellValue) return '--'
         const rangeData = cellValue.split(';')
-        return formatTimezone(rangeData[0]) + ' -- ' + formatTimezone(rangeData[1])
+        const leftDate = rangeData[0] ? formatTimezone(rangeData[0]) : '_'
+        const rightDate = rangeData[1] ? formatTimezone(rangeData[0]) : '_'
+        return leftDate + ' -- ' + rightDate
       }
     }
   ],