feat: 新增质保书模板功能,优化标签样式与钢卷信息展示

This commit is contained in:
2026-06-02 13:22:58 +08:00
parent 4295a28f33
commit d6620e2449
23 changed files with 1851 additions and 389 deletions

View File

@@ -1,20 +1,16 @@
<template>
<el-descriptions
:column="column"
:border="border"
size="small"
:title="title"
>
<el-descriptions :column="column" :border="border" size="small" :title="title">
<template slot="extra">
<slot name="extra"></slot>
</template>
<el-descriptions-item
v-for="(item, index) in filteredFields"
:key="index"
:label="item.label"
:span="item.span || 1"
>
<template>
<el-descriptions-item v-for="(item, index) in filteredFields" :key="index" :label="item.label"
:span="item.span || 1">
<template v-if="item.children">
<span v-for="(child, cIndex) in item.children" :key="cIndex" style="margin-right: 12px;">
{{ child.label }}: {{ child.value || '-' }}
</span>
</template>
<template v-else>
{{ item.value || '-' }}
</template>
</el-descriptions-item>
@@ -37,7 +33,7 @@ export default {
type: Boolean,
default: false
},
// 只显示有值的字段
// 只显示有值的字段
showOnlyValue: {
type: Boolean,
default: false
@@ -66,9 +62,22 @@ export default {
{ label: '切边要求', key: 'trimmingRequirement' },
{ label: '原料材质', key: 'packingStatus' },
{ label: '包装要求', key: 'packagingRequirement' },
{ label: '实测厚度[mm]', key: 'actualThickness' },
// 设置对照属性,两个数量显示在一个格子里
{
label: '长度[m]',
children: [
{ label: '实测', key: 'actualLength' },
{ label: '理论', key: 'theoreticalLength' }
]
},
{
label: '厚度[mm]',
children: [
{ label: '实测', key: 'actualThickness' },
{ label: '理论', key: 'theoreticalThickness' }
]
},
{ label: '实测宽度[mm]', key: 'actualWidth' },
{ label: '长度[m]', key: 'length' },
{ label: '毛重[t]', key: 'grossWeight' },
{ label: '净重[t]', key: 'netWeight' },
{ label: '生产开始', key: 'productionStartTime' },
@@ -80,13 +89,29 @@ export default {
]
},
filteredFields() {
let fields = this.fields.map(item => ({
...item,
value: this.coilInfo[item.key]
}))
let fields = this.fields.map(item => {
if (item.children) {
return {
...item,
children: item.children.map(child => ({
...child,
value: this.coilInfo[child.key]
}))
}
}
return {
...item,
value: this.coilInfo[item.key]
}
})
if (this.showOnlyValue) {
fields = fields.filter(item => item.value !== undefined && item.value !== null && item.value !== '')
fields = fields.filter(item => {
if (item.children) {
return item.children.some(child => child.value !== undefined && child.value !== null && child.value !== '')
}
return item.value !== undefined && item.value !== null && item.value !== ''
})
}
return fields