wms-antdvue/.svn/pristine/b1/b160a6dd42dd96cc9cb195f129ac3ece92e0c360.svn-base
2024-11-07 16:33:03 +08:00

100 lines
1.7 KiB
Plaintext

import { h } from 'vue';
import { Avatar } from 'ant-design-vue';
import { BasicColumn } from '@/components/Table';
export const columns: BasicColumn[] = [
{
title: 'id',
dataIndex: 'id',
width: 100,
},
{
title: '编码',
dataIndex: 'no',
width: 100,
},
{
title: '名称',
dataIndex: 'name',
editComponent: 'Input',
editRow: true,
// 默认必填校验
editRule: true,
edit: true,
width: 150,
},
{
title: '头像',
dataIndex: 'avatar',
key: 'avatar',
width: 100,
customRender({ record }) {
return h(Avatar, {
size: 48,
src: record.avatar,
shape: 'square',
});
},
},
{
title: '地址',
dataIndex: 'address',
editRow: true,
editComponent: 'Select',
editComponentProps: {
options: [
{
label: '广东省',
value: 1,
},
{
label: '浙江省',
value: 2,
},
],
},
edit: true,
width: 200,
ellipsis: false,
},
{
title: '开始日期',
dataIndex: 'beginTime',
editRow: true,
edit: true,
width: 240,
editComponent: 'DatePicker',
editComponentProps: {
valueFormat: 'YYYY-MM-DD HH:mm:ss',
format: 'YYYY-MM-DD HH:mm:ss',
},
ellipsis: false,
},
{
title: '结束日期',
dataIndex: 'endTime',
width: 160,
},
{
title: '状态',
dataIndex: 'status',
editRow: true,
edit: true,
width: 100,
editComponent: 'Switch',
editValueMap: (value) => {
return value ? '启用' : '禁用';
},
},
{
title: '创建时间',
dataIndex: 'date',
width: 160,
},
{
title: '停留时间',
dataIndex: 'time',
width: 80,
},
];