wms-naivevue/src/views/file/emailTemplate/columns.ts
2024-12-14 16:52:02 +08:00

96 lines
1.6 KiB
TypeScript

import { h } from 'vue';
import { NTag } from 'naive-ui';
export const columns = [
{
type: 'selection',
width: 50,
fixed: 'left',
},
{
title: 'ID',
key: 'id',
fixed: 'left',
width: 50,
},
{
title: '模板名称',
key: 'title',
width: 200,
},
{
title: '模板编码',
key: 'code',
width: 150,
},
{
title: '模板类型',
key: 'type',
width: 100,
render(record) {
let typeText = '';
let color = '';
switch (record.type) {
case 1:
typeText = '普通邮件';
color = 'success';
break;
case 2:
typeText = '图文邮件';
color = 'primary';
break;
case 3:
typeText = '模板文件';
color = 'warning';
break;
default:
break;
}
// return h('span', typeText || '-');
return h(
NTag,
{
style: {
marginRight: '6px',
},
bordered: false,
type: color,
},
{
default: () => typeText,
},
);
},
},
{
title: '文件名称',
key: 'fileName',
width: 100,
},
{
title: '文件路径',
key: 'filePath',
width: 150,
render(record) {
return h(
'a',
{
href: record.filePath,
target: '_blank',
},
'点击查看文件',
);
},
},
{
title: '创建人',
key: 'createUser',
width: 100,
},
{
title: '创建时间',
key: 'createTime',
width: 180,
},
];