This commit is contained in:
bb_pan 2025-12-19 13:25:06 +08:00
parent 0f571eabc8
commit cdfcc351df
1 changed files with 9 additions and 28 deletions

View File

@ -117,11 +117,15 @@
:prop="column.prop" :prop="column.prop"
align="center" align="center"
> >
<!-- render插槽 --> <!-- 插槽 -->
<template v-slot="{ row }"> <template v-slot="{ row }">
<component :is="column.render ? { render: (h) => column.render(h, { row }) } : 'span'"> <span v-if="column.prop == 'status'">
{{ !column.render ? row[column.prop] : '' }} <el-tag v-if="row.status == 0" type="success">在库</el-tag>
</component> <el-tag v-if="row.status == 1" type="info">在用</el-tag>
<el-tag v-if="row.status == 2" type="warning">在修</el-tag>
<el-tag v-if="row.status == 3" type="danger">已报废</el-tag>
</span>
<span v-else>{{ row[column.prop] }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
@ -441,30 +445,7 @@ export default {
{ label: '规格型号', prop: 'typeName' }, { label: '规格型号', prop: 'typeName' },
{ label: '计量单位', prop: 'unitName' }, { label: '计量单位', prop: 'unitName' },
{ label: '工具编码', prop: 'toolCode' }, { label: '工具编码', prop: 'toolCode' },
{ { label: '工具状态', prop: 'status', width: 120 },
label: '工具状态',
prop: 'status',
width: 120,
render: (h, { row }) => {
const statusOptions = {
0: { text: '在库', type: 'success' },
1: { text: '在用', type: 'info' },
2: { text: '在修', type: 'warning' },
3: { text: '已报废', type: 'danger' },
}
const option = statusOptions[row.status]
return h(
'el-tag',
{
props: {
type: option.type,
size: 'mini',
},
},
option.text,
)
},
},
{ label: '下次检验时间', prop: 'nextCheckDate' }, { label: '下次检验时间', prop: 'nextCheckDate' },
{ label: '生产厂家', prop: 'supplierName', width: 200 }, { label: '生产厂家', prop: 'supplierName', width: 200 },
{ label: '出厂日期', prop: 'productionDate' }, { label: '出厂日期', prop: 'productionDate' },