|
@@ -1,7 +1,7 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { ref, nextTick, onMounted } from 'vue'
|
|
import { ref, nextTick, onMounted } from 'vue'
|
|
|
import { type VxeGridInstance, type VxeGridProps } from 'vxe-table'
|
|
import { type VxeGridInstance, type VxeGridProps } from 'vxe-table'
|
|
|
-// import { autoWidth } from '@/utils/table'
|
|
|
|
|
|
|
+import { autoWidth } from '@/utils/table'
|
|
|
import { useRowClickStyle } from '@/hooks/rowClickStyle'
|
|
import { useRowClickStyle } from '@/hooks/rowClickStyle'
|
|
|
import dayjs from 'dayjs'
|
|
import dayjs from 'dayjs'
|
|
|
import { formatTimezone, formatNumber } from '@/utils/tools'
|
|
import { formatTimezone, formatNumber } from '@/utils/tools'
|
|
@@ -15,6 +15,10 @@ const props = defineProps({
|
|
|
height: {
|
|
height: {
|
|
|
type: Number,
|
|
type: Number,
|
|
|
default: 440
|
|
default: 440
|
|
|
|
|
+ },
|
|
|
|
|
+ queryData: {
|
|
|
|
|
+ type: Object,
|
|
|
|
|
+ default: () => ({})
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -38,14 +42,6 @@ const handleColumns = (columns: any, status?: string) => {
|
|
|
...curColumn,
|
|
...curColumn,
|
|
|
slots: { default: 'link' }
|
|
slots: { default: 'link' }
|
|
|
}
|
|
}
|
|
|
- } else if (item.type === 'mode' && status !== 'all') {
|
|
|
|
|
- curColumn = {
|
|
|
|
|
- ...curColumn,
|
|
|
|
|
- slots: { default: 'mode' },
|
|
|
|
|
- formatter: ({ cellValue }: any) => {
|
|
|
|
|
- return cellValue
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
// 格式化
|
|
// 格式化
|
|
|
if (item.formatter === 'date' || item.formatter === 'dateTime') {
|
|
if (item.formatter === 'date' || item.formatter === 'dateTime') {
|
|
@@ -62,11 +58,11 @@ const handleColumns = (columns: any, status?: string) => {
|
|
|
// 获取表格列
|
|
// 获取表格列
|
|
|
const getTableColumns = async () => {
|
|
const getTableColumns = async () => {
|
|
|
tableLoadingColumn.value = true
|
|
tableLoadingColumn.value = true
|
|
|
- await $api.getOperationTableColumns().then((res: any) => {
|
|
|
|
|
|
|
+ await $api.getDeliveryBookingTableColumn().then((res: any) => {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
tableData.value.columns = [
|
|
tableData.value.columns = [
|
|
|
{ type: 'checkbox', width: 50, fixed: 'left' },
|
|
{ type: 'checkbox', width: 50, fixed: 'left' },
|
|
|
- ...handleColumns(res.data.OperationTableColumns)
|
|
|
|
|
|
|
+ ...handleColumns(res.data.TrackingTableColumns)
|
|
|
]
|
|
]
|
|
|
console.log('tableData.value.columns', tableData.value.columns)
|
|
console.log('tableData.value.columns', tableData.value.columns)
|
|
|
const index = tableData.value.columns.findIndex((item: any) => item.title === 'Action')
|
|
const index = tableData.value.columns.findIndex((item: any) => item.title === 'Action')
|
|
@@ -82,7 +78,7 @@ const getTableColumns = async () => {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
|
- // tableRef.value && autoWidth(tableData.value, tableRef.value)
|
|
|
|
|
|
|
+ tableRef.value && autoWidth(tableData.value, tableRef.value)
|
|
|
tableLoadingColumn.value = false
|
|
tableLoadingColumn.value = false
|
|
|
selectedTableData.value = []
|
|
selectedTableData.value = []
|
|
|
})
|
|
})
|
|
@@ -109,59 +105,99 @@ const assignTableData = (data: any) => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-let searchdata: any = {}
|
|
|
|
|
|
|
+const isEmployeeRole = ref(true)
|
|
|
|
|
+
|
|
|
|
|
+const emit = defineEmits(['getNumberCards'])
|
|
|
|
|
+const rtnNumberCards = (data) => {
|
|
|
|
|
+ const cards = [
|
|
|
|
|
+ {
|
|
|
|
|
+ label: 'Total Bookings',
|
|
|
|
|
+ value: data.All || 0,
|
|
|
|
|
+ color: '#2b2f36',
|
|
|
|
|
+ key: 'ALL'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: 'Pending Approval',
|
|
|
|
|
+ value: data.pending_approval_rc || 0,
|
|
|
|
|
+ color: '#edb82f',
|
|
|
|
|
+ icon: 'icon_time_b'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: 'Approved',
|
|
|
|
|
+ value: data.approved_rc || 0,
|
|
|
|
|
+ color: '#00a870',
|
|
|
|
|
+ icon: 'icon_confirm_b'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: 'Rejected',
|
|
|
|
|
+ value: data.rejected_rc || 0,
|
|
|
|
|
+ color: '#c9353f',
|
|
|
|
|
+ icon: 'icon_reject_b'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: 'Cancelled',
|
|
|
|
|
+ value: data.cancelled_rc || 0,
|
|
|
|
|
+ color: '#243041',
|
|
|
|
|
+ icon: 'icon_cancelled_b'
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ emit('getNumberCards', cards)
|
|
|
|
|
+}
|
|
|
// 获取表格数据
|
|
// 获取表格数据
|
|
|
const getTableData = async (isPageChange?: boolean) => {
|
|
const getTableData = async (isPageChange?: boolean) => {
|
|
|
const rc = isPageChange ? pageInfo.value.total : -1
|
|
const rc = isPageChange ? pageInfo.value.total : -1
|
|
|
tableLoadingTableData.value = true
|
|
tableLoadingTableData.value = true
|
|
|
await $api
|
|
await $api
|
|
|
- .SearchOperationLog({
|
|
|
|
|
|
|
+ .getDeliveryBookingTableData({
|
|
|
cp: pageInfo.value.pageNo,
|
|
cp: pageInfo.value.pageNo,
|
|
|
ps: pageInfo.value.pageSize,
|
|
ps: pageInfo.value.pageSize,
|
|
|
rc,
|
|
rc,
|
|
|
- ...searchdata
|
|
|
|
|
|
|
+ ...props.queryData
|
|
|
})
|
|
})
|
|
|
.then((res: any) => {
|
|
.then((res: any) => {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
|
|
+ isEmployeeRole.value = res.data.is_employee
|
|
|
assignTableData(res.data)
|
|
assignTableData(res.data)
|
|
|
|
|
+ rtnNumberCards(res.data)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
.finally(() => {
|
|
.finally(() => {
|
|
|
selectedTableData.value = []
|
|
selectedTableData.value = []
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
|
- // tableRef.value && autoWidth(tableData.value, tableRef.value)
|
|
|
|
|
|
|
+ tableRef.value && autoWidth(tableData.value, tableRef.value)
|
|
|
tableLoadingTableData.value = false
|
|
tableLoadingTableData.value = false
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
-const SearchOperationLog = (val: any) => {
|
|
|
|
|
- searchdata = val
|
|
|
|
|
|
|
+const SearchOperationLog = () => {
|
|
|
tableLoadingTableData.value = true
|
|
tableLoadingTableData.value = true
|
|
|
$api
|
|
$api
|
|
|
- .SearchOperationLog({
|
|
|
|
|
|
|
+ .getDeliveryBookingTableData({
|
|
|
cp: pageInfo.value.pageNo,
|
|
cp: pageInfo.value.pageNo,
|
|
|
ps: pageInfo.value.pageSize,
|
|
ps: pageInfo.value.pageSize,
|
|
|
rc: -1,
|
|
rc: -1,
|
|
|
- ...val
|
|
|
|
|
|
|
+ ...props.queryData
|
|
|
})
|
|
})
|
|
|
.then((res: any) => {
|
|
.then((res: any) => {
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
|
|
+ isEmployeeRole.value = res.data.is_employee
|
|
|
assignTableData(res.data)
|
|
assignTableData(res.data)
|
|
|
|
|
+ rtnNumberCards(res.data)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
.finally(() => {
|
|
.finally(() => {
|
|
|
selectedTableData.value = []
|
|
selectedTableData.value = []
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
|
- // tableRef.value && autoWidth(tableData.value, tableRef.value)
|
|
|
|
|
|
|
+ tableRef.value && autoWidth(tableData.value, tableRef.value)
|
|
|
tableLoadingTableData.value = false
|
|
tableLoadingTableData.value = false
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
Promise.all([getTableColumns(), getTableData(false)]).finally(() => {
|
|
Promise.all([getTableColumns(), getTableData(false)]).finally(() => {
|
|
|
- // nextTick(() => {
|
|
|
|
|
- // tableRef.value && autoWidth(tableData.value, tableRef.value)
|
|
|
|
|
- // })
|
|
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ tableRef.value && autoWidth(tableData.value, tableRef.value)
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -227,7 +263,7 @@ const tableData = ref<VxeGridProps<any>>({
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
columnConfig: { resizable: true, useKey: true },
|
|
columnConfig: { resizable: true, useKey: true },
|
|
|
- rowConfig: { isHover: true },
|
|
|
|
|
|
|
+ rowConfig: { isHover: true, isCurrent: true },
|
|
|
exportConfig: {
|
|
exportConfig: {
|
|
|
types: ['csv', 'html', 'txt', 'xlsx'],
|
|
types: ['csv', 'html', 'txt', 'xlsx'],
|
|
|
modes: ['current', 'selected', 'all']
|
|
modes: ['current', 'selected', 'all']
|
|
@@ -256,9 +292,9 @@ const handleCustomizeColumns = () => {
|
|
|
// 定制表格
|
|
// 定制表格
|
|
|
const customizeColumns = async () => {
|
|
const customizeColumns = async () => {
|
|
|
await getTableColumns()
|
|
await getTableColumns()
|
|
|
- // nextTick(() => {
|
|
|
|
|
- // tableRef.value && autoWidth(tableData.value, tableRef.value)
|
|
|
|
|
- // })
|
|
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ tableRef.value && autoWidth(tableData.value, tableRef.value)
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const tableLoadingColumn = ref(false)
|
|
const tableLoadingColumn = ref(false)
|
|
@@ -281,7 +317,7 @@ const handelEdit = (row: any) => {
|
|
|
console.log(row)
|
|
console.log(row)
|
|
|
router.push({
|
|
router.push({
|
|
|
path: '/destination-delivery/CreateNewBooking',
|
|
path: '/destination-delivery/CreateNewBooking',
|
|
|
- query: { a: row._serial_no}
|
|
|
|
|
|
|
+ query: { a: row._serial_no }
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -290,7 +326,25 @@ const handleCreate = () => {
|
|
|
console.log('Create new booking')
|
|
console.log('Create new booking')
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const tipsDialogModel = ref(false)
|
|
|
|
|
|
|
+const handleLinkClick = (row: any, column: any) => {
|
|
|
|
|
+ if (column.title === 'Booking No.') {
|
|
|
|
|
+ router.push({
|
|
|
|
|
+ path: '/booking/detail',
|
|
|
|
|
+ query: { a: row.__serial_no, _schemas: row._schemas, status: row.Status }
|
|
|
|
|
+ })
|
|
|
|
|
+ // visitedRowState.setBookingTableData(row['__serial_no'])
|
|
|
|
|
+ } else if (column.title === 'HBOL/HAWB No.') {
|
|
|
|
|
+ router.push({
|
|
|
|
|
+ path: '/tracking/detail',
|
|
|
|
|
+ query: { a: row.__serial_no, _schemas: row._schemas }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const tipsDialogRef = ref()
|
|
|
|
|
+const handleTips = (type: string) => {
|
|
|
|
|
+ tipsDialogRef.value.openDialog(type)
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
defineExpose({
|
|
defineExpose({
|
|
|
SearchOperationLog
|
|
SearchOperationLog
|
|
@@ -346,37 +400,67 @@ defineExpose({
|
|
|
class="action-btn el-button--blue"
|
|
class="action-btn el-button--blue"
|
|
|
style="height: 24px; width: 24px"
|
|
style="height: 24px; width: 24px"
|
|
|
>
|
|
>
|
|
|
- <span style="color: 'red'" class="font_family icon-icon_view_b"> </span>
|
|
|
|
|
|
|
+ <span class="font_family icon-icon_view_b"> </span>
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<!-- email -->
|
|
<!-- email -->
|
|
|
<el-button
|
|
<el-button
|
|
|
@click="clickEmailBtn(row)"
|
|
@click="clickEmailBtn(row)"
|
|
|
class="action-btn el-button--blue"
|
|
class="action-btn el-button--blue"
|
|
|
style="height: 24px; width: 24px"
|
|
style="height: 24px; width: 24px"
|
|
|
|
|
+ v-if="isEmployeeRole && row.status === 'Approved'"
|
|
|
>
|
|
>
|
|
|
- <span style="color: 'red'" class="font_family icon-icon_email_b"> </span>
|
|
|
|
|
|
|
+ <span class="font_family icon-icon_email_b"> </span>
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<!-- edit -->
|
|
<!-- edit -->
|
|
|
<el-button
|
|
<el-button
|
|
|
@click="handelEdit(row)"
|
|
@click="handelEdit(row)"
|
|
|
class="action-btn el-button--blue"
|
|
class="action-btn el-button--blue"
|
|
|
style="height: 24px; width: 24px"
|
|
style="height: 24px; width: 24px"
|
|
|
|
|
+ v-if="isEmployeeRole && row.status === 'Pending Approval'"
|
|
|
|
|
+ >
|
|
|
|
|
+ <span class="font_family icon-icon_edit_b"> </span>
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <!-- cancel -->
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ @click="handleTips('cancel')"
|
|
|
|
|
+ class="action-btn el-button--blue"
|
|
|
|
|
+ style="height: 24px; width: 24px"
|
|
|
|
|
+ v-if="isEmployeeRole && row.status === 'Pending Approval'"
|
|
|
>
|
|
>
|
|
|
- <span style="color: 'red'" class="font_family icon-icon_edit_b"> </span>
|
|
|
|
|
|
|
+ <span class="font_family icon-icon_cancelled_b"> </span>
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<!-- confirm -->
|
|
<!-- confirm -->
|
|
|
- <el-button class="action-btn el-button--blue" style="height: 24px; width: 24px">
|
|
|
|
|
- <span style="color: 'red'" class="font_family icon-icon_confirm_b"> </span>
|
|
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ v-if="!isEmployeeRole && row.status === 'Pending Approval'"
|
|
|
|
|
+ @click="handleTips('confirm')"
|
|
|
|
|
+ class="action-btn el-button--blue"
|
|
|
|
|
+ style="height: 24px; width: 24px"
|
|
|
|
|
+ >
|
|
|
|
|
+ <span class="font_family icon-icon_confirm_b"> </span>
|
|
|
</el-button>
|
|
</el-button>
|
|
|
<!-- reject -->
|
|
<!-- reject -->
|
|
|
<el-button
|
|
<el-button
|
|
|
- @click="tipsDialogModel = true"
|
|
|
|
|
|
|
+ v-if="!isEmployeeRole && row.status === 'Pending Approval'"
|
|
|
|
|
+ @click="handleTips('reject')"
|
|
|
class="action-btn el-button--blue"
|
|
class="action-btn el-button--blue"
|
|
|
style="height: 24px; width: 24px"
|
|
style="height: 24px; width: 24px"
|
|
|
>
|
|
>
|
|
|
- <span style="color: 'red'" class="font_family icon-icon_reject_b"> </span>
|
|
|
|
|
|
|
+ <span class="font_family icon-icon_reject_b"> </span>
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
+ <!-- Status字段的插槽 -->
|
|
|
|
|
+ <template #status="{ row, column }">
|
|
|
|
|
+ <VTag :type="row[column.field]">{{ row[column.field] }}</VTag>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <!-- Booking No字段的插槽 -->
|
|
|
|
|
+ <template #link="{ row, column }">
|
|
|
|
|
+ <span
|
|
|
|
|
+ style="color: var(--color-theme); cursor: pointer"
|
|
|
|
|
+ @click="handleLinkClick(row, column)"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ row[column.field] }}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </template>
|
|
|
</vxe-grid>
|
|
</vxe-grid>
|
|
|
|
|
|
|
|
<div class="bottom-pagination">
|
|
<div class="bottom-pagination">
|
|
@@ -399,7 +483,7 @@ defineExpose({
|
|
|
<CustomizeColumns @customize="customizeColumns" ref="CustomizeColumnsRef" />
|
|
<CustomizeColumns @customize="customizeColumns" ref="CustomizeColumnsRef" />
|
|
|
<BookingDetailDialog ref="bookingDetailDiaRef" />
|
|
<BookingDetailDialog ref="bookingDetailDiaRef" />
|
|
|
<EmailDialog ref="emailDialogRef" />
|
|
<EmailDialog ref="emailDialogRef" />
|
|
|
- <TipsDialog ref="tipsDialogRef" v-model="tipsDialogModel" type="reject" booking-no="123" />
|
|
|
|
|
|
|
+ <TipsDialog ref="tipsDialogRef" type="reject" booking-no="123" />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|