import { reactive, ref } from 'vue';
import { $t } from '@/plugins/i18n';
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 $baseFieldList)
// $field.annotation
{ label: $t('$field.name'), prop: '$field.name' },
#end
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
{ label: $t('table.createUser'), prop: 'createUser', slot: 'createUser', width: 130 },
{ label: $t('table.updateUser'), prop: 'updateUser', slot: 'updateUser', width: 130 },
{ label: $t('table.operation'), fixed: 'right', width: 210, slot: 'operation' },
];

// 添加规则
export const rules = reactive
<FormRules>({
    #foreach($field in $baseFieldList)
        // $field.annotation
        $field.name: [{ required: true, message: `$leftBrace$t('input')}$leftBrace$t('${field.name}')}`, trigger: 'blur' }],
    #end
    });
