Some checks failed
Build and Deploy Front / deploy (push) Failing after 8s
管理页支持选模板批量打印;标签设计增加大包/主单类型;价格表计算公式改为轻量选项菜单。 Co-authored-by: Cursor <cursoragent@cursor.com>
733 lines
24 KiB
Vue
733 lines
24 KiB
Vue
<script lang="ts" setup>
|
||
import { computed, defineAsyncComponent, onMounted, reactive, ref } from 'vue'
|
||
import { Message, Modal } from '@arco-design/web-vue'
|
||
import HandsontablePro from '@/components/HandsontablePro/index.vue'
|
||
import PaginationPro from '@/components/PaginationPro/index.vue'
|
||
import SlidingTabs from '@/components/SlidingTabs/index.vue'
|
||
import { useTableContainerHeight } from '@/composables/useTableContainerHeight'
|
||
import { buildStatusTagHtml, type StatusTagTone } from '@/utils/statusTag'
|
||
import { renderWarehouseActionBtn, wrapWarehouseActions } from '@/utils/warehouseActionRenderer'
|
||
import { getLabelTemplateList, type LabelTemplateListItem } from '@/api/channel/labelTemplate'
|
||
import {
|
||
addBagToMaster,
|
||
addParcelToMaster,
|
||
bindMasterMawb,
|
||
getShipMaster,
|
||
handOverMaster,
|
||
pageShipMasters,
|
||
printShipMasterLabels,
|
||
removeMasterItem,
|
||
sealShipMaster,
|
||
updateShipMasterMeta,
|
||
type ShipMaster,
|
||
} from '@/api/operation/shipContainer'
|
||
|
||
defineOptions({ name: 'MasterBill' })
|
||
|
||
const OrderPrintModal = defineAsyncComponent(
|
||
() => import('@/components/PrintTemplate/OrderPrintModal.vue'),
|
||
)
|
||
|
||
const STATUS_ALL = 'all'
|
||
const LABEL_TYPE = 'shipMaster'
|
||
const { tableContainerRef, tableHeight } = useTableContainerHeight()
|
||
|
||
const listLoading = ref(false)
|
||
const detailLoading = ref(false)
|
||
const adding = ref(false)
|
||
const tableRows = ref<ShipMaster[]>([])
|
||
const selectedRows = ref<ShipMaster[]>([])
|
||
const currentPage = ref(1)
|
||
const pageSize = ref(50)
|
||
const totalCount = ref(0)
|
||
const keyword = ref('')
|
||
const statusTab = ref(STATUS_ALL)
|
||
const detail = ref<ShipMaster | null>(null)
|
||
const detailVisible = ref(false)
|
||
const mawbVisible = ref(false)
|
||
const addMode = ref<'bag' | 'parcel'>('bag')
|
||
const addNo = ref('')
|
||
const mawbForm = reactive({ masterNo: '', externalMawb: '', flightOrVoyage: '' })
|
||
|
||
const templateModalVisible = ref(false)
|
||
const templateLoading = ref(false)
|
||
const templateOptions = ref<LabelTemplateListItem[]>([])
|
||
const selectedTemplateId = ref<number | undefined>()
|
||
const pendingPrintMasterNos = ref<string[]>([])
|
||
const printVisible = ref(false)
|
||
const printPreparing = ref(false)
|
||
const printItems = ref<Array<{ id: number | string; label: string; url: string }>>([])
|
||
const batchPrintLoading = ref(false)
|
||
|
||
const statusTabs = [
|
||
{ key: STATUS_ALL, label: '全部' },
|
||
{ key: 'open', label: '打板中' },
|
||
{ key: 'sealed', label: '已封板' },
|
||
{ key: 'handed', label: '已交运' },
|
||
{ key: 'voided', label: '已作废' },
|
||
]
|
||
|
||
const addModeTabs = [
|
||
{ key: 'bag', label: '加大包' },
|
||
{ key: 'parcel', label: '加小包' },
|
||
]
|
||
|
||
const detailEditable = computed(() => detail.value?.status === 'open')
|
||
const metaEditable = computed(
|
||
() => !!detail.value && detail.value.status !== 'handed' && detail.value.status !== 'voided',
|
||
)
|
||
const savingMeta = ref(false)
|
||
const metaForm = reactive({
|
||
destinationCountry: '',
|
||
destinationPort: '',
|
||
flightOrVoyage: '',
|
||
length: undefined as number | undefined,
|
||
width: undefined as number | undefined,
|
||
height: undefined as number | undefined,
|
||
weight: undefined as number | undefined,
|
||
remark: '',
|
||
})
|
||
const addPlaceholder = computed(() =>
|
||
addMode.value === 'bag' ? '扫描或输入已封袋大包号' : '扫描或输入散货运单号',
|
||
)
|
||
|
||
function syncMetaForm(row: ShipMaster) {
|
||
metaForm.destinationCountry = row.destinationCountry || ''
|
||
metaForm.destinationPort = row.destinationPort || ''
|
||
metaForm.flightOrVoyage = row.flightOrVoyage || ''
|
||
metaForm.length = row.length
|
||
metaForm.width = row.width
|
||
metaForm.height = row.height
|
||
metaForm.weight = row.weight
|
||
metaForm.remark = row.remark || ''
|
||
}
|
||
|
||
const statusTone: Record<string, StatusTagTone> = {
|
||
open: 'brand',
|
||
sealed: 'wait',
|
||
handed: 'ok',
|
||
voided: 'alert',
|
||
}
|
||
|
||
function renderStatusCell(row: ShipMaster, value: string) {
|
||
const code = String(value || row?.status || '')
|
||
return buildStatusTagHtml(row?.statusName || code || '—', statusTone[code] || 'neutral')
|
||
}
|
||
|
||
const hotColumns = computed(() => [
|
||
{ key: 'masterNo', label: '内部主单号', width: 180 },
|
||
{ key: 'externalMawb', label: '外部MAWB', width: 160 },
|
||
{ key: 'status', label: '状态', width: 100, renderer: renderStatusCell },
|
||
{ key: 'bagCount', label: '大包数', width: 80 },
|
||
{ key: 'parcelCount', label: '小包数', width: 80 },
|
||
{ key: 'weight', label: '重量kg', width: 90 },
|
||
{ key: 'length', label: '长cm', width: 80 },
|
||
{ key: 'width', label: '宽cm', width: 80 },
|
||
{ key: 'height', label: '高cm', width: 80 },
|
||
{ key: 'destinationCountry', label: '目的国', width: 90 },
|
||
{ key: 'destinationPort', label: '目的口岸', width: 120 },
|
||
{ key: 'flightOrVoyage', label: '航班/航次', width: 120 },
|
||
{ key: 'sealTime', label: '封板时间', width: 170 },
|
||
{ key: 'handTime', label: '交运时间', width: 170 },
|
||
{ key: 'createTime', label: '创建时间', width: 170 },
|
||
])
|
||
|
||
function actionRenderer(row: ShipMaster) {
|
||
const parts: string[] = [
|
||
renderWarehouseActionBtn('view', '详情'),
|
||
renderWarehouseActionBtn('printLabel', '打印', 'print'),
|
||
]
|
||
if (row.status !== 'handed' && row.status !== 'voided') {
|
||
parts.push(renderWarehouseActionBtn('label', '绑MAWB', 'label'))
|
||
}
|
||
if (row.status === 'open') {
|
||
parts.push(renderWarehouseActionBtn('approve', '封板', 'approve'))
|
||
}
|
||
if (row.status === 'sealed') {
|
||
parts.push(renderWarehouseActionBtn('ship', '交运', 'ship'))
|
||
}
|
||
return wrapWarehouseActions(parts)
|
||
}
|
||
|
||
function handleActionClick(row: ShipMaster, _i: number, action?: string) {
|
||
if (action === 'view') openDetail(row)
|
||
if (action === 'printLabel') openPrintTemplateModal([row.masterNo])
|
||
if (action === 'label') openMawb(row)
|
||
if (action === 'approve') onSeal(row)
|
||
if (action === 'ship') onHandOver(row)
|
||
}
|
||
|
||
function handleSelectionChange(rows: ShipMaster[]) {
|
||
selectedRows.value = rows || []
|
||
}
|
||
|
||
async function loadTemplateOptions() {
|
||
templateLoading.value = true
|
||
try {
|
||
templateOptions.value = await getLabelTemplateList({ templateType: LABEL_TYPE })
|
||
if (
|
||
selectedTemplateId.value == null ||
|
||
!templateOptions.value.some((x) => x.id === selectedTemplateId.value)
|
||
) {
|
||
selectedTemplateId.value = templateOptions.value[0]?.id
|
||
}
|
||
} catch (e: any) {
|
||
templateOptions.value = []
|
||
Message.error(e?.message || '加载标签模板失败')
|
||
} finally {
|
||
templateLoading.value = false
|
||
}
|
||
}
|
||
|
||
async function openPrintTemplateModal(masterNos: string[]) {
|
||
const nos = masterNos.map((x) => String(x || '').trim()).filter(Boolean)
|
||
if (!nos.length) {
|
||
Message.warning('请先选择要打印的主单')
|
||
return
|
||
}
|
||
pendingPrintMasterNos.value = nos
|
||
templateModalVisible.value = true
|
||
await loadTemplateOptions()
|
||
}
|
||
|
||
function handleBatchPrint() {
|
||
const nos = selectedRows.value.map((x) => x.masterNo).filter(Boolean)
|
||
void openPrintTemplateModal(nos)
|
||
}
|
||
|
||
async function confirmPrintWithTemplate() {
|
||
const nos = pendingPrintMasterNos.value
|
||
if (!nos.length) {
|
||
Message.warning('请先选择要打印的主单')
|
||
return false
|
||
}
|
||
if (!selectedTemplateId.value) {
|
||
Message.warning('请选择打印模板(类型:主单标签)')
|
||
return false
|
||
}
|
||
|
||
batchPrintLoading.value = true
|
||
try {
|
||
const res = await printShipMasterLabels({
|
||
masterNos: nos,
|
||
labelTemplateId: selectedTemplateId.value,
|
||
})
|
||
const urlMap = new Map(
|
||
(res.items || [])
|
||
.filter((x) => x.masterNo && x.printUrl)
|
||
.map((x) => [String(x.masterNo), String(x.printUrl)]),
|
||
)
|
||
const items = nos.map((no) => ({
|
||
id: no,
|
||
label: no,
|
||
url: urlMap.get(no) || '',
|
||
}))
|
||
const okCount = items.filter((x) => !!x.url).length
|
||
if (!okCount) {
|
||
Message.info('未获取到可打印文件')
|
||
return false
|
||
}
|
||
if (okCount < nos.length) {
|
||
Message.warning(`已获取 ${okCount}/${nos.length} 张面单`)
|
||
}
|
||
printItems.value = items
|
||
printPreparing.value = false
|
||
printVisible.value = true
|
||
return true
|
||
} catch (e: any) {
|
||
Message.error(e?.message || '批量打印失败')
|
||
return false
|
||
} finally {
|
||
batchPrintLoading.value = false
|
||
}
|
||
}
|
||
|
||
async function loadList() {
|
||
listLoading.value = true
|
||
try {
|
||
const res = await pageShipMasters({
|
||
pageIndex: currentPage.value,
|
||
pageSize: pageSize.value,
|
||
keyword: keyword.value.trim() || undefined,
|
||
status: statusTab.value === STATUS_ALL ? undefined : statusTab.value,
|
||
})
|
||
tableRows.value = res.items || []
|
||
totalCount.value = Number(res.total || 0)
|
||
} catch (e: any) {
|
||
Message.error(e?.message || '加载失败')
|
||
} finally {
|
||
listLoading.value = false
|
||
}
|
||
}
|
||
|
||
function handleSearch() {
|
||
currentPage.value = 1
|
||
loadList()
|
||
}
|
||
|
||
function handleStatusChange(key: string) {
|
||
statusTab.value = key
|
||
currentPage.value = 1
|
||
loadList()
|
||
}
|
||
|
||
function handlePageChange(page: number) {
|
||
currentPage.value = page
|
||
loadList()
|
||
}
|
||
|
||
function handlePageSizeChange(size: number) {
|
||
pageSize.value = size
|
||
currentPage.value = 1
|
||
loadList()
|
||
}
|
||
|
||
async function refreshDetail(masterNo?: string) {
|
||
const no = masterNo || detail.value?.masterNo
|
||
if (!no) return
|
||
detailLoading.value = true
|
||
try {
|
||
detail.value = await getShipMaster(no)
|
||
syncMetaForm(detail.value)
|
||
} catch (e: any) {
|
||
Message.error(e?.message || '加载详情失败')
|
||
} finally {
|
||
detailLoading.value = false
|
||
}
|
||
}
|
||
|
||
async function openDetail(row: ShipMaster) {
|
||
addNo.value = ''
|
||
addMode.value = 'bag'
|
||
detailVisible.value = true
|
||
await refreshDetail(row.masterNo)
|
||
}
|
||
|
||
async function saveMeta() {
|
||
if (!detail.value?.masterNo || !metaEditable.value) return
|
||
savingMeta.value = true
|
||
try {
|
||
detail.value = await updateShipMasterMeta({
|
||
masterNo: detail.value.masterNo,
|
||
destinationCountry: metaForm.destinationCountry || undefined,
|
||
destinationPort: metaForm.destinationPort || undefined,
|
||
flightOrVoyage: metaForm.flightOrVoyage || undefined,
|
||
length: metaForm.length ?? null,
|
||
width: metaForm.width ?? null,
|
||
height: metaForm.height ?? null,
|
||
weight: metaForm.weight ?? null,
|
||
remark: metaForm.remark || undefined,
|
||
})
|
||
syncMetaForm(detail.value)
|
||
Message.success('属性已保存')
|
||
await loadList()
|
||
} catch (e: any) {
|
||
Message.error(e?.message || '保存失败')
|
||
} finally {
|
||
savingMeta.value = false
|
||
}
|
||
}
|
||
|
||
async function onAddItem() {
|
||
if (!detail.value?.masterNo || !detailEditable.value) return
|
||
const no = addNo.value.trim()
|
||
if (!no) {
|
||
Message.warning(addMode.value === 'bag' ? '请输入大包号' : '请输入运单号')
|
||
return
|
||
}
|
||
adding.value = true
|
||
try {
|
||
detail.value =
|
||
addMode.value === 'bag'
|
||
? await addBagToMaster(detail.value.masterNo, no)
|
||
: await addParcelToMaster(detail.value.masterNo, no)
|
||
addNo.value = ''
|
||
Message.success(addMode.value === 'bag' ? `大包 ${no} 已上板` : `小包 ${no} 已上板`)
|
||
await loadList()
|
||
} catch (e: any) {
|
||
Message.error(e?.message || '上板失败')
|
||
} finally {
|
||
adding.value = false
|
||
}
|
||
}
|
||
|
||
function onRemoveItem(itemId: number, label: string) {
|
||
if (!detail.value?.masterNo || !detailEditable.value) return
|
||
Modal.confirm({
|
||
title: '移出板上明细',
|
||
content: `确定从 ${detail.value.masterNo} 移出 ${label}?`,
|
||
okText: '移出',
|
||
onOk: async () => {
|
||
detail.value = await removeMasterItem(detail.value!.masterNo, itemId)
|
||
Message.success('已移出')
|
||
await loadList()
|
||
},
|
||
})
|
||
}
|
||
|
||
function openMawb(row: ShipMaster) {
|
||
mawbForm.masterNo = row.masterNo
|
||
mawbForm.externalMawb = row.externalMawb || ''
|
||
mawbForm.flightOrVoyage = row.flightOrVoyage || ''
|
||
mawbVisible.value = true
|
||
}
|
||
|
||
async function saveMawb() {
|
||
try {
|
||
await bindMasterMawb(mawbForm.masterNo, mawbForm.externalMawb, mawbForm.flightOrVoyage || undefined)
|
||
Message.success('已绑定 MAWB')
|
||
mawbVisible.value = false
|
||
await loadList()
|
||
if (detail.value?.masterNo === mawbForm.masterNo) await refreshDetail(mawbForm.masterNo)
|
||
} catch (e: any) {
|
||
Message.error(e?.message || '绑定失败')
|
||
}
|
||
}
|
||
|
||
async function onSeal(row: ShipMaster) {
|
||
try {
|
||
await sealShipMaster(row.masterNo)
|
||
Message.success('封板成功')
|
||
await loadList()
|
||
if (detail.value?.masterNo === row.masterNo) await refreshDetail(row.masterNo)
|
||
} catch (e: any) {
|
||
Message.error(e?.message || '封板失败')
|
||
}
|
||
}
|
||
|
||
function onSealDetail() {
|
||
if (!detail.value) return
|
||
Modal.confirm({
|
||
title: '确认封板',
|
||
content: `主单 ${detail.value.masterNo}:大包 ${detail.value.bagCount}、小包合计 ${detail.value.parcelCount}。封板后不可再增删,是否继续?`,
|
||
okText: '封板',
|
||
onOk: async () => {
|
||
await onSeal(detail.value!)
|
||
},
|
||
})
|
||
}
|
||
|
||
function onHandOver(row: ShipMaster) {
|
||
Modal.confirm({
|
||
title: '交运确认',
|
||
content: `确认主单 ${row.masterNo} 已交运?`,
|
||
onOk: async () => {
|
||
await handOverMaster(row.masterNo)
|
||
Message.success('已交运')
|
||
await loadList()
|
||
if (detail.value?.masterNo === row.masterNo) await refreshDetail(row.masterNo)
|
||
},
|
||
})
|
||
}
|
||
|
||
function itemLabel(record: { itemType: string; bagNo?: string; waybillNo?: string }) {
|
||
if (record.itemType === 'bag') return `大包 ${record.bagNo || ''}`
|
||
return `小包 ${record.waybillNo || ''}`
|
||
}
|
||
|
||
onMounted(loadList)
|
||
</script>
|
||
|
||
<template>
|
||
<div class="master-bill-container warehouse-list-page">
|
||
<div class="warehouse-list-page-card">
|
||
<div class="status-tabs">
|
||
<SlidingTabs
|
||
:model-value="statusTab"
|
||
size="mini"
|
||
:items="statusTabs"
|
||
aria-label="主单状态"
|
||
@change="handleStatusChange"
|
||
/>
|
||
</div>
|
||
|
||
<div class="table-toolbar">
|
||
<div class="toolbar-left">
|
||
<a-space wrap :size="8">
|
||
<a-input
|
||
v-model="keyword"
|
||
placeholder="主单号/MAWB/目的国"
|
||
allow-clear
|
||
style="width: 220px"
|
||
@press-enter="handleSearch"
|
||
/>
|
||
<a-button class="app-btn-search" @click="handleSearch">查询</a-button>
|
||
<a-button
|
||
class="app-btn-toolbar"
|
||
:loading="batchPrintLoading"
|
||
:disabled="selectedRows.length === 0 || batchPrintLoading"
|
||
@click="handleBatchPrint"
|
||
>
|
||
批量打印
|
||
</a-button>
|
||
</a-space>
|
||
</div>
|
||
<div class="toolbar-right">
|
||
<PaginationPro
|
||
:total-count="totalCount"
|
||
v-model:current-page="currentPage"
|
||
v-model:page-size="pageSize"
|
||
:page-sizes="[10, 30, 50, 100]"
|
||
@page-change="handlePageChange"
|
||
@page-size-change="handlePageSizeChange"
|
||
/>
|
||
</div>
|
||
</div>
|
||
|
||
<div ref="tableContainerRef" class="list-wrap">
|
||
<HandsontablePro
|
||
:columns="hotColumns"
|
||
:data="tableRows"
|
||
:height="tableHeight"
|
||
:loading="listLoading"
|
||
:stretch-columns="true"
|
||
show-action-column
|
||
:action-renderer="actionRenderer"
|
||
@action-click="handleActionClick"
|
||
@selection-change="handleSelectionChange"
|
||
/>
|
||
</div>
|
||
</div>
|
||
|
||
<a-modal
|
||
v-model:visible="templateModalVisible"
|
||
title="选择打印模板"
|
||
:ok-loading="batchPrintLoading"
|
||
ok-text="打印"
|
||
unmount-on-close
|
||
:on-before-ok="confirmPrintWithTemplate"
|
||
>
|
||
<a-form :model="{ selectedTemplateId }" auto-label-width>
|
||
<a-form-item label="标签模板" required>
|
||
<a-select
|
||
v-model="selectedTemplateId"
|
||
:loading="templateLoading"
|
||
:options="templateOptions.map((x) => ({ label: x.name, value: x.id }))"
|
||
placeholder="请选择主单标签模板"
|
||
allow-search
|
||
/>
|
||
</a-form-item>
|
||
<div class="print-tip">将打印 {{ pendingPrintMasterNos.length }} 个主单 · 模板类型:主单标签</div>
|
||
</a-form>
|
||
</a-modal>
|
||
|
||
<OrderPrintModal
|
||
v-if="printVisible"
|
||
v-model:visible="printVisible"
|
||
:mode="printItems.length > 1 ? 'batch' : 'single'"
|
||
:items="printItems"
|
||
:preparing="printPreparing"
|
||
/>
|
||
|
||
<a-drawer
|
||
v-model:visible="detailVisible"
|
||
:width="680"
|
||
title="主单详情"
|
||
unmount-on-close
|
||
:footer="false"
|
||
>
|
||
<a-spin :loading="detailLoading" style="width: 100%">
|
||
<template v-if="detail">
|
||
<div class="detail-head">
|
||
<div class="detail-no">{{ detail.masterNo }}</div>
|
||
<div class="detail-meta">
|
||
<a-tag size="small" color="arcoblue">{{ detail.statusName || detail.status }}</a-tag>
|
||
<span>大包 {{ detail.bagCount }}</span>
|
||
<span>小包合计 {{ detail.parcelCount }}</span>
|
||
<span v-if="detail.externalMawb">MAWB {{ detail.externalMawb }}</span>
|
||
<span v-if="detail.destinationCountry">目的国 {{ detail.destinationCountry }}</span>
|
||
<a-button
|
||
size="mini"
|
||
class="app-btn-toolbar"
|
||
@click="openPrintTemplateModal([detail.masterNo])"
|
||
>
|
||
打印面单
|
||
</a-button>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="detail-meta-form">
|
||
<div class="detail-meta-form__title">件重尺 / 口岸</div>
|
||
<a-form :model="metaForm" layout="vertical" size="small">
|
||
<a-row :gutter="12">
|
||
<a-col :span="8">
|
||
<a-form-item label="重量(kg)">
|
||
<a-input-number v-model="metaForm.weight" :min="0" :precision="2" :disabled="!metaEditable" style="width: 100%" />
|
||
</a-form-item>
|
||
</a-col>
|
||
<a-col :span="8">
|
||
<a-form-item label="长(cm)">
|
||
<a-input-number v-model="metaForm.length" :min="0" :precision="2" :disabled="!metaEditable" style="width: 100%" />
|
||
</a-form-item>
|
||
</a-col>
|
||
<a-col :span="8">
|
||
<a-form-item label="宽(cm)">
|
||
<a-input-number v-model="metaForm.width" :min="0" :precision="2" :disabled="!metaEditable" style="width: 100%" />
|
||
</a-form-item>
|
||
</a-col>
|
||
<a-col :span="8">
|
||
<a-form-item label="高(cm)">
|
||
<a-input-number v-model="metaForm.height" :min="0" :precision="2" :disabled="!metaEditable" style="width: 100%" />
|
||
</a-form-item>
|
||
</a-col>
|
||
<a-col :span="8">
|
||
<a-form-item label="目的国">
|
||
<a-input v-model="metaForm.destinationCountry" :disabled="!metaEditable" allow-clear />
|
||
</a-form-item>
|
||
</a-col>
|
||
<a-col :span="8">
|
||
<a-form-item label="目的口岸">
|
||
<a-input v-model="metaForm.destinationPort" :disabled="!metaEditable" allow-clear />
|
||
</a-form-item>
|
||
</a-col>
|
||
</a-row>
|
||
<a-button v-if="metaEditable" type="primary" class="app-btn-primary-soft" :loading="savingMeta" @click="saveMeta">
|
||
保存属性
|
||
</a-button>
|
||
</a-form>
|
||
</div>
|
||
|
||
<div v-if="detailEditable" class="detail-add">
|
||
<SlidingTabs v-model="addMode" size="mini" :items="addModeTabs" aria-label="上板类型" />
|
||
<div class="detail-add__row">
|
||
<a-input
|
||
v-model="addNo"
|
||
:placeholder="addPlaceholder"
|
||
allow-clear
|
||
@press-enter="onAddItem"
|
||
/>
|
||
<a-button type="primary" :loading="adding" @click="onAddItem">上板</a-button>
|
||
<a-button
|
||
type="primary"
|
||
class="app-btn-primary-soft"
|
||
:disabled="!(detail.items || []).length"
|
||
@click="onSealDetail"
|
||
>
|
||
封板
|
||
</a-button>
|
||
</div>
|
||
</div>
|
||
<p v-else class="detail-hint">仅「打板中」可增删板上明细;已交运/作废属性只读。</p>
|
||
|
||
<a-table
|
||
:data="detail.items || []"
|
||
:pagination="false"
|
||
row-key="id"
|
||
size="small"
|
||
:bordered="false"
|
||
:stripe="true"
|
||
>
|
||
<template #columns>
|
||
<a-table-column title="类型" :width="80">
|
||
<template #cell="{ record }">
|
||
<a-tag :color="record.itemType === 'bag' ? 'arcoblue' : 'purple'" size="small">
|
||
{{ record.itemType === 'bag' ? '大包' : '小包' }}
|
||
</a-tag>
|
||
</template>
|
||
</a-table-column>
|
||
<a-table-column title="大包号" data-index="bagNo">
|
||
<template #cell="{ record }">{{ record.bagNo || '—' }}</template>
|
||
</a-table-column>
|
||
<a-table-column title="运单号" data-index="waybillNo">
|
||
<template #cell="{ record }">{{ record.waybillNo || '—' }}</template>
|
||
</a-table-column>
|
||
<a-table-column v-if="detailEditable" title="操作" :width="80" align="center">
|
||
<template #cell="{ record }">
|
||
<a-button
|
||
type="text"
|
||
size="small"
|
||
status="danger"
|
||
@click="onRemoveItem(record.id, itemLabel(record))"
|
||
>
|
||
移出
|
||
</a-button>
|
||
</template>
|
||
</a-table-column>
|
||
</template>
|
||
</a-table>
|
||
<div v-if="!(detail.items || []).length" class="detail-empty">暂无板上明细</div>
|
||
</template>
|
||
</a-spin>
|
||
</a-drawer>
|
||
|
||
<a-modal v-model:visible="mawbVisible" title="绑定外部 MAWB" @ok="saveMawb">
|
||
<a-form :model="mawbForm" layout="vertical">
|
||
<a-form-item label="主单号">
|
||
<a-input :model-value="mawbForm.masterNo" disabled />
|
||
</a-form-item>
|
||
<a-form-item label="外部 MAWB / 提单号" required>
|
||
<a-input v-model="mawbForm.externalMawb" placeholder="承运商主单号" />
|
||
</a-form-item>
|
||
<a-form-item label="航班 / 航次">
|
||
<a-input v-model="mawbForm.flightOrVoyage" placeholder="可选" />
|
||
</a-form-item>
|
||
</a-form>
|
||
</a-modal>
|
||
</div>
|
||
</template>
|
||
|
||
<style lang="less" scoped>
|
||
@import '@/styles/warehouse-list-page.less';
|
||
|
||
.detail-head {
|
||
margin-bottom: 16px;
|
||
padding: 14px 16px;
|
||
border-radius: 8px;
|
||
background: color-mix(in srgb, var(--app-primary-color) 8%, #fff);
|
||
border: 1px solid color-mix(in srgb, var(--app-primary-color) 18%, var(--color-border-2));
|
||
}
|
||
.detail-no {
|
||
font-size: 20px;
|
||
font-weight: 700;
|
||
color: var(--color-text-1);
|
||
}
|
||
.detail-meta {
|
||
margin-top: 8px;
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 8px 14px;
|
||
font-size: 13px;
|
||
color: var(--color-text-2);
|
||
align-items: center;
|
||
}
|
||
.detail-meta-form {
|
||
margin-bottom: 16px;
|
||
padding: 12px;
|
||
border-radius: 8px;
|
||
background: var(--color-fill-1);
|
||
}
|
||
.detail-meta-form__title {
|
||
margin-bottom: 8px;
|
||
font-size: 13px;
|
||
font-weight: 600;
|
||
color: var(--color-text-2);
|
||
}
|
||
.detail-add {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 10px;
|
||
margin-bottom: 12px;
|
||
}
|
||
.detail-add__row {
|
||
display: flex;
|
||
gap: 8px;
|
||
flex-wrap: wrap;
|
||
}
|
||
.detail-hint {
|
||
margin: 0 0 12px;
|
||
font-size: 12px;
|
||
color: var(--color-text-3);
|
||
}
|
||
.detail-empty {
|
||
padding: 24px;
|
||
text-align: center;
|
||
color: var(--color-text-3);
|
||
font-size: 13px;
|
||
}
|
||
.print-tip {
|
||
margin-top: 4px;
|
||
font-size: 12px;
|
||
color: var(--color-text-3);
|
||
}
|
||
</style>
|