优化
This commit is contained in:
@@ -12,12 +12,11 @@ import ListPageLayout from '@/shared/components/ListPageLayout.vue'
|
||||
import LoadErrorState from '@/shared/components/LoadErrorState.vue'
|
||||
import OperationErrorToast from '@/shared/components/OperationErrorToast.vue'
|
||||
import QueryToolbar, { type QueryField, type QueryModel } from '@/shared/components/QueryToolbar.vue'
|
||||
import { convertLastMileContainerToInboundPlans, listLastMileOrders, transferLastMileOrders } from '../api/lastMileOrders'
|
||||
import { convertLastMileContainerToInboundPlans, listLastMileOrders, listPendingContainerSummaries, transferLastMileOrders, type PendingContainerSummaryDto } from '../api/lastMileOrders'
|
||||
import OrderReferenceText from '../components/OrderReferenceText.vue'
|
||||
import { useAccessPreviewStore } from '@/core/access/accessPreview'
|
||||
import { overseasWarehousePermissions as permission } from '../permissions'
|
||||
import { toLastMileOrderListItem } from '../lastMilePresentation'
|
||||
import type { LastMileContainerPlanRow } from '../lastMileContainerPlanning'
|
||||
import type { LastMileOrderListItem } from '../types'
|
||||
|
||||
const rows = ref<LastMileOrderListItem[]>([])
|
||||
@@ -28,15 +27,16 @@ const router = useRouter()
|
||||
const page = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const total = ref(0)
|
||||
const containerTotal = ref(0)
|
||||
const selectedRows = ref<LastMileOrderListItem[]>([])
|
||||
const containerRows = ref<LastMileContainerPlanRow[]>([])
|
||||
const containerRows = ref<PendingContainerSummaryDto[]>([])
|
||||
const actionLoading = ref(false)
|
||||
const actionError = ref<ApiErrorDetails | null>(null)
|
||||
const transferOpen = ref(false)
|
||||
const transferForm = reactive({ warehouseId: '', warehouseCode: '', warehouseName: '', remark: '' })
|
||||
const statusTab = ref<'全部' | '待分配'>('全部')
|
||||
const filters = ref<QueryModel>({ orderNo: '', orderType: '', warehouse: '', inboundCode: '', sourceOrderNo: '', containerNo: '', status: '', transferWarehouseCode: '', abnormal: '', detained: '', createdAt: [] })
|
||||
const fields = computed<QueryField[]>(() => [
|
||||
const allFields: QueryField[] = [
|
||||
{ key: 'orderNo', type: 'input', label: '尾程单号', placeholder: '请输入尾程单号' },
|
||||
{ key: 'inboundCode', type: 'input', label: '入仓码', placeholder: '请输入入仓码' },
|
||||
{ key: 'orderType', type: 'select', label: '订单类型', placeholder: '全部类型', options: [
|
||||
@@ -59,7 +59,10 @@ const fields = computed<QueryField[]>(() => [
|
||||
{ key: 'abnormal', type: 'select', label: '是否异常', placeholder: '全部', options: [{ label: '是', value: 'true' }, { label: '否', value: 'false' }] },
|
||||
{ key: 'detained', type: 'select', label: '是否暂扣', placeholder: '全部', options: [{ label: '是', value: 'true' }, { label: '否', value: 'false' }] },
|
||||
{ key: 'createdAt', type: 'daterange', label: '创建时间' },
|
||||
])
|
||||
]
|
||||
const fields = computed(() => statusTab.value === '待分配'
|
||||
? allFields.filter((field) => ['containerNo', 'createdAt'].includes(field.key))
|
||||
: allFields)
|
||||
const columns: DataTableColumn[] = [
|
||||
{ key: 'actions', label: '操作', width: 110, fixed: 'left', slotName: 'actions' },
|
||||
{ key: 'selection', type: 'selection', width: 48, fixed: 'left' },
|
||||
@@ -101,11 +104,11 @@ const containerColumns: DataTableColumn[] = [
|
||||
{ key: 'orderCount', prop: 'orderCount', label: '订单数', width: 90, align: 'right' },
|
||||
{ key: 'inboundCodeCount', prop: 'inboundCodeCount', label: '入仓码数', width: 100, align: 'right' },
|
||||
{ key: 'customerCount', prop: 'customerCount', label: '客户数', width: 90, align: 'right' },
|
||||
{ key: 'totalCartons', prop: 'totalCartons', label: '总箱数', width: 100, align: 'right' },
|
||||
{ key: 'totalPallets', prop: 'totalPallets', label: '总托数', width: 100, align: 'right' },
|
||||
{ key: 'totalPackageCount', prop: 'totalPackageCount', label: '总箱数', width: 100, align: 'right' },
|
||||
{ key: 'totalPalletCount', prop: 'totalPalletCount', label: '总托数', width: 100, align: 'right' },
|
||||
{ key: 'totalVolumeCbm', prop: 'totalVolumeCbm', label: '总体积(m³)', width: 120, align: 'right' },
|
||||
{ key: 'eligibility', prop: 'eligibility', label: '资格', minWidth: 160, slotName: 'eligibility' },
|
||||
{ key: 'planNotice', prop: 'planNotice', label: '生成说明', minWidth: 320 },
|
||||
{ key: 'planNotice', label: '生成说明', minWidth: 320, slotName: 'planNotice' },
|
||||
]
|
||||
|
||||
async function load(model: QueryModel = filters.value) {
|
||||
@@ -114,10 +117,24 @@ async function load(model: QueryModel = filters.value) {
|
||||
loadError.value = null
|
||||
if (statusTab.value === '待分配') {
|
||||
rows.value = []
|
||||
containerRows.value = []
|
||||
total.value = 0
|
||||
loadError.value = { message: '柜级待分配摘要分页接口尚未在当前 test 后端提供,已停止从订单分页本地聚合整柜' }
|
||||
loading.value = false
|
||||
const dateRange = Array.isArray(filters.value.createdAt) ? filters.value.createdAt.map(String) : []
|
||||
try {
|
||||
const result = await listPendingContainerSummaries({
|
||||
page: page.value,
|
||||
size: pageSize.value,
|
||||
containerNo: String(filters.value.containerNo || '').trim() || undefined,
|
||||
createdFrom: dateRange[0] ? `${dateRange[0]}T00:00:00` : undefined,
|
||||
createdTo: dateRange[1] ? `${dateRange[1]}T23:59:59` : undefined,
|
||||
})
|
||||
containerRows.value = result.records
|
||||
containerTotal.value = result.total
|
||||
} catch (error) {
|
||||
containerRows.value = []
|
||||
containerTotal.value = 0
|
||||
loadError.value = getApiErrorDetails(error, '柜级待分配摘要加载失败,请重试')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
return
|
||||
}
|
||||
try {
|
||||
@@ -174,9 +191,9 @@ async function submitTransfer() {
|
||||
} catch (error) { actionError.value = getApiErrorDetails(error, '转仓失败,请重试') }
|
||||
finally { actionLoading.value = false }
|
||||
}
|
||||
async function generateContainerInboundPlans(row: LastMileContainerPlanRow) {
|
||||
async function generateContainerInboundPlans(row: PendingContainerSummaryDto) {
|
||||
if (!row.eligible) {
|
||||
actionError.value = { message: row.eligibility }
|
||||
actionError.value = { message: row.ineligibleReason || '当前整柜不满足生成资格' }
|
||||
return
|
||||
}
|
||||
if (!row.sourceContainerBookingId) {
|
||||
@@ -229,13 +246,15 @@ onMounted(() => { void load() })
|
||||
</LoadErrorState>
|
||||
<section v-if="!loadError && statusTab === '待分配'" class="surface-panel table-panel container-planning-panel">
|
||||
<el-alert title="选择一行即代表整柜;一次调用将为柜内每个尾程订单/入仓码分别生成独立入库计划,海外 PDA 仍按同一柜号作业。" type="info" :closable="false" show-icon />
|
||||
<DataTable :data="containerRows" :columns="containerColumns" :loading="loading" preference-key="overseas-last-mile-container-plans" row-key="id" empty-text="暂无待分配整柜">
|
||||
<DataTable v-model:page="page" v-model:page-size="pageSize" :data="containerRows" :columns="containerColumns" :loading="loading" :total="containerTotal" preference-key="overseas-last-mile-container-plans" row-key="sourceContainerBookingId" empty-text="暂无待分配整柜" @update:page="load()" @update:page-size="page = 1; load()">
|
||||
<template #actions="{ row }">
|
||||
<el-tooltip content="按整柜原子生成入库计划" placement="top">
|
||||
<span><el-button v-if="access.can(permission.inboundOrderCreate)" size="small" type="primary" plain :disabled="!(row as LastMileContainerPlanRow).eligible || actionLoading" @click="generateContainerInboundPlans(row as LastMileContainerPlanRow)">生成整柜入库计划</el-button></span>
|
||||
<span><el-button v-if="access.can(permission.inboundOrderCreate)" size="small" type="primary" plain :disabled="!(row as PendingContainerSummaryDto).eligible || actionLoading" @click="generateContainerInboundPlans(row as PendingContainerSummaryDto)">生成整柜入库计划</el-button></span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
<template #eligibility="{ row }"><el-tag :type="(row as LastMileContainerPlanRow).eligible ? 'success' : 'danger'" effect="plain">{{ (row as LastMileContainerPlanRow).eligibility }}</el-tag></template>
|
||||
<template #eligibility="{ row }"><el-tag :type="(row as PendingContainerSummaryDto).eligible ? 'success' : 'danger'" effect="plain">{{ (row as PendingContainerSummaryDto).eligible ? '可生成' : (row as PendingContainerSummaryDto).ineligibleReason || '不可生成' }}</el-tag></template>
|
||||
<template #planNotice="{ row }">将为 {{ (row as PendingContainerSummaryDto).orderCount }} 个尾程订单生成 {{ (row as PendingContainerSummaryDto).orderCount }} 个独立入库计划,PDA仍按同柜作业</template>
|
||||
<template #pagination-left>共 {{ containerTotal }} 个待分配整柜</template>
|
||||
</DataTable>
|
||||
</section>
|
||||
<section v-else-if="!loadError" class="surface-panel table-panel"><DataTable v-model:page="page" v-model:page-size="pageSize" :data="rows" :columns="columns" :loading="loading" :total="total" preference-key="overseas-last-mile-orders" row-key="id" empty-text="暂无尾程订单" @selection-change="onSelectionChange" @update:page="load()" @update:page-size="page = 1; load()">
|
||||
|
||||
Reference in New Issue
Block a user