bixi
Version:
企业级中后台前端解决方案
92 lines (86 loc) • 2.03 kB
Markdown
title:
zh-CN: 显示状态映射
en-US: 显示状态映射
order: 22
## zh-CN
除了默认状态之外,您还可以通过添加 `options` 属性为默认状态与接口数据之间添加映射关系,如果内置状态无法满足您的需求,或者您有自定义的需求,可以在 BIXI_TABLE_CONFIG 中添加自定义状态
## en-US
除了默认状态之外,您还可以通过添加 `options` 属性为默认状态与接口数据之间添加映射关系,如果内置状态无法满足您的需求,或者您有自定义的需求,可以在 BIXI_TABLE_CONFIG 中添加自定义状态
```ts
import { Component } from '@angular/core';
import { EColType, ICol } from '@bixi/core/table';
interface IModel {
name: string;
status: number;
}
const persons: IModel[] = [{
name: '训练模型_1',
status: 0
}, {
name: '训练模型_2',
status: 1
}, {
name: '训练模型_3',
status: 2
}, {
name: '训练模型_4',
status: 3
}, {
name: '训练模型_5',
status: 4
}];
@Component({
selector: 'components-table-status',
template: `
<bixi-table
[rows]="rows"
[cols]="cols"
[loading]="loading">
</bixi-table>
`
})
export class ComponentsTableSimpleTableStatusMapComponent {
loading = false;
rows = persons;
cols: ICol[] = [
{
name: '模型名称',
key: 'name',
},
{
name: '数据返回状态',
key: 'status',
},
{
name: '映射后显示状态',
key: 'status',
type: EColType.status,
options: [
{
value: 0,
text: '训练成功',
type: 'success'
},{
value: 1,
text: '训练中',
type: 'processing'
},{
value: 2,
text: '训练失败',
type: 'error'
},{
value: 3,
text: '等待训练',
type: 'default'
},{
value: 4,
text: '暂停训练',
type: 'stop'
}
]
}
];
}
```