wms-antdvue/.svn/pristine/5d/5da4997831b002b60dce88a7c57ab8eff3c9926f.svn-base
2024-11-07 16:33:03 +08:00

140 lines
2.5 KiB
Plaintext

import { h } from 'vue';
import { Tag,Avatar } from 'ant-design-vue';
export const columns = [
{
title:'ID',
dataIndex: 'id',
fixed:'left',
width: 50,
},
{
title: '登录账号',
dataIndex: 'username',
key: 'username',
width: 160,
},
{
title: '用户姓名',
dataIndex: 'realname',
key: 'realname',
width: 160,
},
{
title: '头像',
dataIndex: 'avatar',
key: 'avatar',
customRender({ record }) {
return h(Avatar, {
size: 48,
src: record.avatar,
shape: 'square',
fit: 'fill',
});
},
width: 100,
},
{
title: '性别',
dataIndex: 'gender',
key: 'gender',
customRender({ record }) {
let typeText = ''
let color = ''
switch (record.gender) {
case 1:
typeText='男'
color='processing'
break;
case 2:
typeText='女'
color='error'
break;
case 3:
typeText='保密'
color='warning'
break;
default:
break;
}
return h(
Tag,
{
color: color,
},
{
default: () => typeText,
},
);
},
width: 70,
},
{
title: '手机号',
dataIndex: 'mobile',
key: 'mobile',
width: 140,
},
{
title: '用户角色',
dataIndex: 'role',
key: 'role',
customRender({ record }) {
let roleNames = ''
if(record.roles.length > 0){
roleNames = record.roles.map(role => role.name).join(',');
}
return h('span', roleNames || '-');
},
width: 160,
},
{
title: '职级',
prop: 'levelName',
dataIndex: 'levelName',
width: 160,
},
{
title: '岗位',
prop: 'positionName',
dataIndex: 'positionName',
width: 160,
},
{
title: '部门',
prop: 'deptName',
dataIndex: 'deptName',
width: 160,
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
customRender({ record }) {
return h(
Tag,
{
color: record.status ==1 ? 'success' : 'error',
},
{
default: () => (record.status ==1 ? '正常' : '禁用'),
},
);
},
width: 100,
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
width: 180,
},
{
title: '操作',
fixed:'right',
dataIndex: 'action',
key: 'action',
width: 400,
},
];