|
@@ -30,7 +30,7 @@ const tableData = ref<VxeGridProps<any>>({
|
|
|
backgroundColor: 'var(--color-table-header-bg)'
|
|
backgroundColor: 'var(--color-table-header-bg)'
|
|
|
},
|
|
},
|
|
|
columnConfig: { resizable: true, useKey: true },
|
|
columnConfig: { resizable: true, useKey: true },
|
|
|
- rowConfig: { isHover: true, isCurrent: true },
|
|
|
|
|
|
|
+ rowConfig: { isHover: true, isCurrent: true }
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const tableRef = ref<VxeGridInstance | null>(null)
|
|
const tableRef = ref<VxeGridInstance | null>(null)
|
|
@@ -48,7 +48,7 @@ const handleColumns = (columns: any) => {
|
|
|
...curColumn,
|
|
...curColumn,
|
|
|
formatter: ({ cellValue }: any) => formatTimezone(cellValue)
|
|
formatter: ({ cellValue }: any) => formatTimezone(cellValue)
|
|
|
}
|
|
}
|
|
|
- } else if (item.type === 'link') {
|
|
|
|
|
|
|
+ } else if (item.type === 'link') {
|
|
|
curColumn = {
|
|
curColumn = {
|
|
|
...curColumn,
|
|
...curColumn,
|
|
|
slots: { default: 'trackingNo' }
|
|
slots: { default: 'trackingNo' }
|
|
@@ -57,7 +57,7 @@ const handleColumns = (columns: any) => {
|
|
|
curColumn = {
|
|
curColumn = {
|
|
|
...curColumn,
|
|
...curColumn,
|
|
|
formatter: ({ cellValue }: any) => {
|
|
formatter: ({ cellValue }: any) => {
|
|
|
- const array = cellValue.split("-")
|
|
|
|
|
|
|
+ const array = cellValue.split('-')
|
|
|
return `${formatTimezone(array[0])} - ${formatTimezone(array[1])}`
|
|
return `${formatTimezone(array[0])} - ${formatTimezone(array[1])}`
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -71,15 +71,13 @@ const getTableColumns = async () => {
|
|
|
tableLoadingColumn.value = true
|
|
tableLoadingColumn.value = true
|
|
|
await $api.BookingTableColumn().then((res: any) => {
|
|
await $api.BookingTableColumn().then((res: any) => {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
- if(a == undefined) {
|
|
|
|
|
|
|
+ if (a == undefined) {
|
|
|
tableData.value.columns = [
|
|
tableData.value.columns = [
|
|
|
{ type: 'checkbox', width: 50, fixed: 'left' },
|
|
{ type: 'checkbox', width: 50, fixed: 'left' },
|
|
|
...handleColumns(res.data.TrackingTableColumns)
|
|
...handleColumns(res.data.TrackingTableColumns)
|
|
|
]
|
|
]
|
|
|
- }else {
|
|
|
|
|
- tableData.value.columns = [
|
|
|
|
|
- ...handleColumns(res.data.TrackingTableColumns)
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ } else {
|
|
|
|
|
+ tableData.value.columns = [...handleColumns(res.data.TrackingTableColumns)]
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -96,15 +94,15 @@ const getTableData = (val: any) => {
|
|
|
const searchTableData = (val: any) => {
|
|
const searchTableData = (val: any) => {
|
|
|
tableLoadingTable.value = true
|
|
tableLoadingTable.value = true
|
|
|
$api
|
|
$api
|
|
|
- .BookingTableSearch({
|
|
|
|
|
- ...val
|
|
|
|
|
- })
|
|
|
|
|
- .then((res: any) => {
|
|
|
|
|
- if (res.code === 200) {
|
|
|
|
|
- tableLoadingTable.value = false
|
|
|
|
|
- tableData.value.data = res.data.data
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ .BookingTableSearch({
|
|
|
|
|
+ ...val
|
|
|
|
|
+ })
|
|
|
|
|
+ .then((res: any) => {
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
|
+ tableLoadingTable.value = false
|
|
|
|
|
+ tableData.value.data = res.data.data
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const emits = defineEmits(['selectChangeEvent'])
|
|
const emits = defineEmits(['selectChangeEvent'])
|
|
@@ -116,78 +114,100 @@ let checkShipmentsdata = []
|
|
|
let checkShipmentsInfo = {}
|
|
let checkShipmentsInfo = {}
|
|
|
let checkShipmentsSubmitInfo = {}
|
|
let checkShipmentsSubmitInfo = {}
|
|
|
const checkUniformArray = (arrary: Array<{ consignee_id: any; country: any }>) => {
|
|
const checkUniformArray = (arrary: Array<{ consignee_id: any; country: any }>) => {
|
|
|
- if (arrary.length === 0) return false;
|
|
|
|
|
- const first = arrary[0];
|
|
|
|
|
|
|
+ if (arrary.length === 0) return false
|
|
|
|
|
+ const first = arrary[0]
|
|
|
for (let i = 1; i < arrary.length; i++) {
|
|
for (let i = 1; i < arrary.length; i++) {
|
|
|
if (arrary[i].consignee_id !== first.consignee_id) {
|
|
if (arrary[i].consignee_id !== first.consignee_id) {
|
|
|
- return false;
|
|
|
|
|
|
|
+ return false
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return [first];
|
|
|
|
|
|
|
+ return [first]
|
|
|
}
|
|
}
|
|
|
-const selectChangeEvent = () => {
|
|
|
|
|
|
|
+
|
|
|
|
|
+// 将具有相同same_mbol的行选中或取消选中
|
|
|
|
|
+const selectRowsWithSameMbol = ({ row, checked }) => {
|
|
|
|
|
+ const key = row.same_mbol
|
|
|
|
|
+ if (!key) return
|
|
|
|
|
+ const tableRowData = tableRef.value?.getTableData().fullData || []
|
|
|
|
|
+ tableRowData.forEach((item, index) => {
|
|
|
|
|
+ if (item.same_mbol === key) {
|
|
|
|
|
+ tableRef.value?.setCheckboxRow(item, checked)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+const selectChangeEvent = (selectItem) => {
|
|
|
|
|
+ selectRowsWithSameMbol(selectItem)
|
|
|
const $grid = tableRef.value
|
|
const $grid = tableRef.value
|
|
|
if ($grid) {
|
|
if ($grid) {
|
|
|
const records = $grid.getCheckboxRecords()
|
|
const records = $grid.getCheckboxRecords()
|
|
|
- checkShipments = records.map(item => ({ consignee_id: item.consignee_id, country: item.dc_country }))
|
|
|
|
|
- checkRecommend = records.map(item => ({ date_range: item.date_range.split('-'), Hbol: item.h_bol }))
|
|
|
|
|
|
|
+ checkShipments = records.map((item) => ({
|
|
|
|
|
+ consignee_id: item.consignee_id,
|
|
|
|
|
+ country: item.dc_country
|
|
|
|
|
+ }))
|
|
|
|
|
+ checkRecommend = records.map((item) => ({
|
|
|
|
|
+ date_range: item.date_range.split('-'),
|
|
|
|
|
+ Hbol: item.h_bol
|
|
|
|
|
+ }))
|
|
|
const array = checkUniformArray(checkShipments)
|
|
const array = checkUniformArray(checkShipments)
|
|
|
- if(array != false) {
|
|
|
|
|
|
|
+ if (array != false) {
|
|
|
checkShipmentsdata = Object.keys(checkUniformArray(checkShipments)?.[0])
|
|
checkShipmentsdata = Object.keys(checkUniformArray(checkShipments)?.[0])
|
|
|
checkShipmentsSubmit = Object.keys(records?.[0])
|
|
checkShipmentsSubmit = Object.keys(records?.[0])
|
|
|
checkShipmentsdata.forEach((item) => {
|
|
checkShipmentsdata.forEach((item) => {
|
|
|
Object.assign(checkShipmentsInfo, {
|
|
Object.assign(checkShipmentsInfo, {
|
|
|
- [item]: array.map((row) => row[item] )
|
|
|
|
|
|
|
+ [item]: array.map((row) => row[item])
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
checkShipmentsSubmit.forEach((item) => {
|
|
checkShipmentsSubmit.forEach((item) => {
|
|
|
Object.assign(checkShipmentsSubmitInfo, {
|
|
Object.assign(checkShipmentsSubmitInfo, {
|
|
|
[item]: records.map((row) => {
|
|
[item]: records.map((row) => {
|
|
|
- if(row[item] == null){
|
|
|
|
|
|
|
+ if (row[item] == null) {
|
|
|
return ''
|
|
return ''
|
|
|
} else {
|
|
} else {
|
|
|
return row[item]
|
|
return row[item]
|
|
|
}
|
|
}
|
|
|
- } )
|
|
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
checkShipmentsSubmitInfo = {}
|
|
checkShipmentsSubmitInfo = {}
|
|
|
checkShipmentsInfo = {}
|
|
checkShipmentsInfo = {}
|
|
|
}
|
|
}
|
|
|
- emits('selectChangeEvent',checkShipmentsInfo, checkRecommend,checkShipmentsSubmitInfo)
|
|
|
|
|
|
|
+ emits('selectChangeEvent', checkShipmentsInfo, checkRecommend, checkShipmentsSubmitInfo)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 全选
|
|
// 全选
|
|
|
-const selectAllChangeEvent= () => {
|
|
|
|
|
|
|
+const selectAllChangeEvent = () => {
|
|
|
const $grid = tableRef.value
|
|
const $grid = tableRef.value
|
|
|
if ($grid) {
|
|
if ($grid) {
|
|
|
const records = $grid.getCheckboxRecords()
|
|
const records = $grid.getCheckboxRecords()
|
|
|
- checkShipments = records.map(item => ({ consignee_id: item.consignee_id }))
|
|
|
|
|
- checkRecommend = records.map(item => ({ date_range: item.date_range.split('-'), Hbol: item.h_bol }))
|
|
|
|
|
- if(checkShipments.length != 0) {
|
|
|
|
|
|
|
+ checkShipments = records.map((item) => ({ consignee_id: item.consignee_id }))
|
|
|
|
|
+ checkRecommend = records.map((item) => ({
|
|
|
|
|
+ date_range: item.date_range.split('-'),
|
|
|
|
|
+ Hbol: item.h_bol
|
|
|
|
|
+ }))
|
|
|
|
|
+ if (checkShipments.length != 0) {
|
|
|
checkShipmentsdata = Object.keys(checkShipments?.[0])
|
|
checkShipmentsdata = Object.keys(checkShipments?.[0])
|
|
|
checkShipmentsSubmit = Object.keys(records?.[0])
|
|
checkShipmentsSubmit = Object.keys(records?.[0])
|
|
|
checkShipmentsdata.forEach((item) => {
|
|
checkShipmentsdata.forEach((item) => {
|
|
|
Object.assign(checkShipmentsInfo, {
|
|
Object.assign(checkShipmentsInfo, {
|
|
|
- [item]: checkShipments.map((row) => row[item] )
|
|
|
|
|
|
|
+ [item]: checkShipments.map((row) => row[item])
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
checkShipmentsSubmit.forEach((item) => {
|
|
checkShipmentsSubmit.forEach((item) => {
|
|
|
Object.assign(checkShipmentsSubmitInfo, {
|
|
Object.assign(checkShipmentsSubmitInfo, {
|
|
|
[item]: records.map((row) => {
|
|
[item]: records.map((row) => {
|
|
|
- if(row[item] == null){
|
|
|
|
|
|
|
+ if (row[item] == null) {
|
|
|
return ''
|
|
return ''
|
|
|
} else {
|
|
} else {
|
|
|
return row[item]
|
|
return row[item]
|
|
|
}
|
|
}
|
|
|
- } )
|
|
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
checkShipmentsSubmitInfo = {}
|
|
checkShipmentsSubmitInfo = {}
|
|
|
}
|
|
}
|
|
|
- emits('selectChangeEvent',checkShipmentsInfo, checkRecommend,checkShipmentsSubmitInfo)
|
|
|
|
|
|
|
+ emits('selectChangeEvent', checkShipmentsInfo, checkRecommend, checkShipmentsSubmitInfo)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -201,7 +221,6 @@ defineExpose({
|
|
|
getTableData,
|
|
getTableData,
|
|
|
searchTableData
|
|
searchTableData
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -218,9 +237,7 @@ defineExpose({
|
|
|
<div v-if="isNotActivated" class="empty-text">
|
|
<div v-if="isNotActivated" class="empty-text">
|
|
|
This service isn't activated yet. Please contact our team to enable it.
|
|
This service isn't activated yet. Please contact our team to enable it.
|
|
|
</div>
|
|
</div>
|
|
|
- <div v-else class="empty-text">
|
|
|
|
|
- No eligible shipments found to create a new booking.
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div v-else class="empty-text">No eligible shipments found to create a new booking.</div>
|
|
|
</template>
|
|
</template>
|
|
|
</vxe-grid>
|
|
</vxe-grid>
|
|
|
</div>
|
|
</div>
|