feat(admin): add simulated container booking links
This commit is contained in:
@@ -51,7 +51,7 @@ const assignOpen = ref(false)
|
||||
const selectedCandidate = ref<SmartLoadingCandidate | null>(null)
|
||||
const assignForm = reactive({ packageCount: 1 })
|
||||
const quantityDrafts = reactive<Record<string, number>>({})
|
||||
const query = ref<QueryModel>({ customerId: '', inboundCode: '', destinationWarehouse: '' })
|
||||
const query = ref<QueryModel>({ customerId: '', inboundCode: '' })
|
||||
const appliedQuery = ref<QueryModel>({ ...query.value })
|
||||
let selectionRequest = 0
|
||||
|
||||
@@ -84,18 +84,9 @@ const volumePercent = computed(() => volumeLimit.value ? totalVolume.value / vol
|
||||
const weightPercent = computed(() => weightLimit.value ? totalWeight.value / weightLimit.value * 100 : 0)
|
||||
const displayedVolumePercent = computed(() => percentage(volumePercent.value))
|
||||
const displayedWeightPercent = computed(() => percentage(weightPercent.value))
|
||||
const destinationWarehouseOptions = computed(() => {
|
||||
const options = new Map<string, string>()
|
||||
for (const item of candidates.value) {
|
||||
const value = destinationWarehouseKey(item)
|
||||
if (value) options.set(value, item.destinationWarehouseName || item.destinationWarehouseCode || value)
|
||||
}
|
||||
return [...options].map(([value, label]) => ({ label, value }))
|
||||
})
|
||||
const queryFields = computed<QueryField[]>(() => [
|
||||
{ key: 'customerId', type: 'select', label: '客户', placeholder: '全部客户', width: 220, options: customers.value.filter((customer) => customer.status === 'ACTIVE').map((customer) => ({ label: customer.tenantName, value: String(customer.id) })), props: { filterable: true, loading: customersLoading.value } },
|
||||
{ key: 'inboundCode', type: 'input', label: '入仓码', placeholder: '请输入入仓码', width: 240 },
|
||||
{ key: 'destinationWarehouse', type: 'select', label: '目的仓', placeholder: '全部目的仓', width: 200, options: destinationWarehouseOptions.value, props: { filterable: true } },
|
||||
])
|
||||
|
||||
const filteredContainers = computed(() => containers.value.filter((item) => (
|
||||
@@ -106,10 +97,8 @@ const filteredContainers = computed(() => containers.value.filter((item) => (
|
||||
const filteredCandidates = computed(() => {
|
||||
const customerId = String(appliedQuery.value.customerId || '')
|
||||
const inboundCode = String(appliedQuery.value.inboundCode || '').trim().toLowerCase()
|
||||
const destinationWarehouse = String(appliedQuery.value.destinationWarehouse || '')
|
||||
return candidates.value.filter((item) => {
|
||||
if (customerId && item.accountId !== customerId) return false
|
||||
if (destinationWarehouse && destinationWarehouseKey(item) !== destinationWarehouse) return false
|
||||
return !inboundCode || String(item.inboundCode || '').toLowerCase().includes(inboundCode)
|
||||
})
|
||||
})
|
||||
@@ -149,9 +138,6 @@ function adjustmentMax(source: object) {
|
||||
const remaining = candidates.value.find((candidate) => candidate.inboundDetailId === item.inboundDetailId)?.availablePackageCount || 0
|
||||
return Math.max(1, item.packageCount + remaining)
|
||||
}
|
||||
function destinationWarehouseKey(candidate: SmartLoadingCandidate) {
|
||||
return candidate.destinationWarehouseId || candidate.destinationWarehouseCode || candidate.destinationWarehouseName || ''
|
||||
}
|
||||
function displayContainerNo(container: ContainerBookingResource | null | undefined) {
|
||||
if (!container) return '柜号待生成'
|
||||
const actual = String(container.containerNo || '').trim()
|
||||
@@ -460,11 +446,6 @@ onMounted(() => { void load(); void loadCustomers() })
|
||||
@click="selectContainer(item.id)"
|
||||
>
|
||||
<span class="container-option__top"><strong>{{ displayContainerNo(item) }}</strong></span>
|
||||
<span>箱型 {{ item.containerType }}</span>
|
||||
<span>{{ item.channelName || item.channelCode || '渠道未设置' }}</span>
|
||||
<span>{{ item.warehouseName || '仓库未设置' }}</span>
|
||||
<span v-if="item.id === selectedContainerId && plan">体积 {{ formatNumber(totalVolume) }} / {{ formatNumber(volumeLimit) }} m³</span>
|
||||
<span v-else>容量 {{ formatNumber(Number(item.capacityCbm || 0)) }} m³ · {{ formatNumber(Number(item.maxWeightKg || 0), 0) }} kg</span>
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
Reference in New Issue
Block a user