wms-antdvue/src/views/data/config/columnsItem.ts

116 lines
2.4 KiB
TypeScript

import { h } from 'vue';
import { Tag } from 'ant-design-vue';
export const columns = [
{
title: 'ID',
dataIndex: 'id',
fixed: 'left',
width: 50,
},
{
title: '配置项名称',
dataIndex: 'name',
width: 100,
},
{
title: '配置项编码',
dataIndex: 'code',
width: 150,
},
{
title: '配置项值',
dataIndex: 'value',
width: 200,
},
{
title: '配置项类型',
dataIndex: 'type',
width: 100,
customRender({ record }) {
let typeText = '';
switch (record.type) {
case 'hidden':
typeText = '隐藏';
break;
case 'readonly':
typeText = '只读文本';
break;
case 'number':
typeText = '数字';
break;
case 'text':
typeText = '单行文本';
break;
case 'textarea':
typeText = '多行文本';
break;
case 'password':
typeText = '密码';
break;
case 'radio':
typeText = '单选框';
break;
case 'checkbox':
typeText = '复选框';
break;
case 'select':
typeText = '下拉框(单选)';
break;
case 'selects':
typeText = '下拉框(多选)';
break;
case 'icon':
typeText = '字体图标';
break;
case 'date':
typeText = '日期';
break;
case 'datetime':
typeText = '时间';
break;
case 'image':
typeText = '单张图片';
break;
case 'images':
typeText = '多张图片';
break;
case 'file':
typeText = '单个文件';
break;
case 'files':
typeText = '多个文件';
break;
case 'ueditor':
typeText = '富文本编辑器';
break;
default:
break;
}
return h('span', typeText || '-');
},
},
{
title: '配置项状态',
dataIndex: 'status',
width: 100,
customRender({ record }) {
return h(
Tag,
{
color: record.status == 1 ? 'success' : 'error',
},
{
default: () => (record.status == 1 ? '正常' : '停用'),
},
);
},
},
{
title: '操作',
fixed: 'right',
dataIndex: 'action',
key: 'action',
width: 200,
},
];