financial-web/src/views/financial-user/budget-saving/saving-goal/utils/columns.tsx

71 lines
2.1 KiB
TypeScript
Raw Normal View History

2024-11-11 16:50:48 +08:00
import { reactive } from 'vue';
import { $t } from '@/plugins/i18n';
import type { FormRules } from 'element-plus';
2024-11-15 00:41:32 +08:00
import { ElText } from 'element-plus';
2024-11-11 16:50:48 +08:00
// 表格列
export const columns: TableColumnList = [
{ type: 'selection', align: 'left' },
{ type: 'index', index: (index: number) => index + 1, label: '序号', width: 60 },
// 完成状态
2024-11-15 00:41:32 +08:00
{ label: $t('statusType'), prop: 'statusType', slot: 'statusType' },
2024-11-11 16:50:48 +08:00
// 储值目标名称
{ label: $t('savingGoalName'), prop: 'savingGoalName' },
2024-11-15 00:41:32 +08:00
// 预算金额
{
label: $t('amount'),
prop: 'amount',
width: 150,
formatter({ amount }) {
return (
<ElText style={{ fontWeight: 800 }} type={'info'} size={'large'}>
{amount}
</ElText>
);
},
},
2024-11-29 16:56:28 +08:00
// 已存入金额
{
label: $t('amountDeposited'),
prop: 'amountDeposited',
width: 150,
formatter({ amountDeposited }) {
return (
<ElText style={{ fontWeight: 800 }} type={'info'} size={'large'}>
{amountDeposited}
</ElText>
);
},
},
2024-11-11 16:50:48 +08:00
// 目标时长
2024-11-15 00:41:32 +08:00
{
label: $t('duration'),
prop: 'duration',
formatter({ startDuration, endDuration }) {
return (
<ElText type={'success'} style={{ fontWeight: 800 }}>
{startDuration} ~ {endDuration}
</ElText>
);
},
width: 360,
},
2024-11-11 16:50:48 +08:00
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
2024-11-15 00:41:32 +08:00
{ label: $t('table.operation'), fixed: 'right', width: 160, slot: 'operation' },
2024-11-11 16:50:48 +08:00
];
// 添加规则
export const rules = reactive<FormRules>({
// 完成状态
statusType: [{ required: true, message: `${$t('input')}${$t('statusType')}`, trigger: 'blur' }],
// 储值目标名称
savingGoalName: [{ required: true, message: `${$t('input')}${$t('savingGoalName')}`, trigger: 'blur' }],
// 目标金额
amount: [{ required: true, message: `${$t('input')}${$t('amount')}`, trigger: 'blur' }],
2024-11-29 16:56:28 +08:00
// 已存入金额
amountDeposited: [{ required: true, message: `${$t('input')}${$t('amountDeposited')}`, trigger: 'blur' }],
2024-11-11 16:50:48 +08:00
// 目标时长
duration: [{ required: true, message: `${$t('input')}${$t('duration')}`, trigger: 'blur' }],
});