feat(stocking): 查看备货单详情展示每辆车附件
OrderDetailContent 车辆明细展开行备注下方列出附件 (点击新窗口打开),备货单与终版查看弹窗共用生效; 兼容数组与历史字符串格式。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -60,9 +60,29 @@
|
||||
<template #default>
|
||||
<ElTableColumn type="expand" width="30">
|
||||
<template #default="scope">
|
||||
<div style="padding: 6px;display: flex">
|
||||
<div><strong>备注:</strong></div>
|
||||
<div><span v-html="scope.row.remark || '暂无备注'"></span></div>
|
||||
<div style="padding: 6px">
|
||||
<div style="display: flex">
|
||||
<div><strong>备注:</strong></div>
|
||||
<div><span v-html="scope.row.remark || '暂无备注'"></span></div>
|
||||
</div>
|
||||
<div
|
||||
v-if="getItemAttachments(scope.row).length"
|
||||
style="display: flex; margin-top: 6px"
|
||||
>
|
||||
<div><strong>附件:</strong></div>
|
||||
<div style="display: flex; flex-wrap: wrap; gap: 12px">
|
||||
<a
|
||||
v-for="(f, aIdx) in getItemAttachments(scope.row)"
|
||||
:key="aIdx"
|
||||
:href="f.url"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
style="color: #3471ff; text-decoration: none"
|
||||
>
|
||||
<i class="iconfont-sys"></i> {{ f.name }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</ElTableColumn>
|
||||
@@ -460,6 +480,25 @@
|
||||
const vehItems = computed(() => {
|
||||
return (props.orderData as any).veh_list || (props.orderData as any).items || []
|
||||
})
|
||||
|
||||
// 车辆附件(后端返回数组;兼容历史字符串数据)
|
||||
const getItemAttachments = (row: any) => {
|
||||
const raw = row?.attachment
|
||||
let list: any[] = []
|
||||
if (Array.isArray(raw)) {
|
||||
list = raw
|
||||
} else if (typeof raw === 'string' && raw.trim()) {
|
||||
try {
|
||||
const parsed = JSON.parse(raw)
|
||||
if (Array.isArray(parsed)) list = parsed
|
||||
} catch {
|
||||
list = []
|
||||
}
|
||||
}
|
||||
return list
|
||||
.filter((f: any) => f && f.url)
|
||||
.map((f: any) => ({ name: f.original_name || f.name || '附件', url: f.url }))
|
||||
}
|
||||
const tableRef = ref()
|
||||
const expandWhenReady = () => {
|
||||
nextTick(() => {
|
||||
@@ -487,7 +526,8 @@
|
||||
paymentTableData,
|
||||
vehItems,
|
||||
formatPrice,
|
||||
tableRef
|
||||
tableRef,
|
||||
getItemAttachments
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user