wms-elevue/src/views/data/config/columnsItem.ts
2024-12-12 15:42:25 +08:00

117 lines
2.4 KiB
TypeScript

import { h } from 'vue';
import { ElTag } from 'element-plus';
export const columns = [
{
type: 'selection',
},
{
label: 'ID',
prop: 'id',
fixed: 'left',
width: 50,
},
{
label: '配置项名称',
prop: 'name',
width: 100,
},
{
label: '配置项编码',
prop: 'code',
width: 150,
},
{
label: '配置项值',
prop: 'value',
width: 200,
},
{
label: '配置项类型',
prop: 'type',
width: 150,
render(record) {
let typeText = '';
switch (record.row.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 || '-');
},
},
{
label: '配置项状态',
prop: 'status',
width: 100,
render(record) {
return h(
ElTag,
{
type: record.row.status == 1 ? 'success' : 'danger',
},
{
default: () => (record.row.status == 1 ? '正常' : '停用'),
},
);
},
},
{
label: '排序',
prop: 'sort',
width: 100,
},
];