U 优化表格支持部分字段排序
This commit is contained in:
parent
56df2145a2
commit
5a8fbf48a2
|
@ -78,7 +78,8 @@ class ComTable extends React.Component {
|
|||
dataIndex: 'created_by_user',
|
||||
}, {
|
||||
title: '申请时间',
|
||||
dataIndex: 'created_at'
|
||||
dataIndex: 'created_at',
|
||||
sorter: (a, b) => a['created_at'].localeCompare(b['created_at'])
|
||||
}, {
|
||||
title: '操作',
|
||||
render: info => {
|
||||
|
|
|
@ -29,9 +29,11 @@ class ComTable extends React.Component {
|
|||
}, {
|
||||
title: '主机名称',
|
||||
dataIndex: 'name',
|
||||
sorter: (a, b) => a.name.localeCompare(b.name)
|
||||
}, {
|
||||
title: '连接地址',
|
||||
dataIndex: 'hostname',
|
||||
sorter: (a, b) => a.name.localeCompare(b.name)
|
||||
}, {
|
||||
title: '端口',
|
||||
dataIndex: 'port'
|
||||
|
|
|
@ -83,7 +83,8 @@ class ComTable extends React.Component {
|
|||
}
|
||||
}, {
|
||||
title: '更新于',
|
||||
dataIndex: 'latest_run_time',
|
||||
dataIndex: 'latest_run_time_alias',
|
||||
sorter: (a, b) => a.latest_run_time.localeCompare(b.latest_run_time)
|
||||
}, {
|
||||
title: '操作',
|
||||
render: info => (
|
||||
|
|
|
@ -26,7 +26,7 @@ class Store {
|
|||
res.map(item => {
|
||||
tmp.add(item['type_alias']);
|
||||
const value = item['latest_run_time'];
|
||||
item['latest_run_time'] = value ? moment(value).fromNow() : null;
|
||||
item['latest_run_time_alias'] = value ? moment(value).fromNow() : null;
|
||||
return null
|
||||
});
|
||||
this.types = Array.from(tmp);
|
||||
|
|
|
@ -65,7 +65,8 @@ class ComTable extends React.Component {
|
|||
},
|
||||
}, {
|
||||
title: '更新于',
|
||||
dataIndex: 'latest_run_time',
|
||||
dataIndex: 'latest_run_time_alias',
|
||||
sorter: (a, b) => a.latest_run_time.localeCompare(b.latest_run_time)
|
||||
}, {
|
||||
title: '描述信息',
|
||||
dataIndex: 'desc',
|
||||
|
|
|
@ -27,7 +27,7 @@ class Store {
|
|||
.then(({types, tasks}) => {
|
||||
tasks.map(item => {
|
||||
const value = item['latest_run_time'];
|
||||
item['latest_run_time'] = value ? moment(value).fromNow() : null;
|
||||
item['latest_run_time_alias'] = value ? moment(value).fromNow() : null;
|
||||
return null
|
||||
});
|
||||
this.records = tasks;
|
||||
|
|
Loading…
Reference in New Issue