import {reactive} from 'vue';
import type {FormRules} from 'element-plus';

export const columns: TableColumnList = [
    {type: 'selection', align: 'left'},
    {type: 'index', index: (index: number) => index + 1, label: '序号', width: 60},
    #foreach($field in $columnInfoList)
        // $field.comment
        {label: "$field.comment", prop: '$field.lowercaseName'},
    #end
    {label: "更新时间", prop: 'updateTime', sortable: true, width: 160},
    {label: "创建时间", prop: 'createTime', sortable: true, width: 160},
    {label: "创建用户", prop: 'createUser', slot: 'createUser', width: 130},
    {label: "更新用户", prop: 'updateUser', slot: 'updateUser', width: 130},
    {label: "操作", fixed: 'right', width: 210, slot: 'operation'},
];

// 添加规则
export const rules = reactive < FormRules > ({
    #foreach($field in $columnInfoList)
        // $field.comment
    $field.lowercaseName: [{
            required: true,
            message: `需要输入${field.lowercaseName}`,
            trigger: 'blur'
        }],
    #end
});


