@@ -2,9 +2,12 @@ import * as React from 'react'
2
2
import { inject , observer } from 'mobx-react'
3
3
import { Row , Col , Form , Input , Button , DatePicker , Table , Modal , Badge } from 'antd'
4
4
import { object2Str } from '@utils/tools'
5
+ import { ColumnProps } from 'antd/lib/table'
5
6
6
7
const FormItem = Form . Item
7
8
9
+ type TStatus = 'default' | 'success' | 'warning' | 'error'
10
+
8
11
9
12
@inject ( 'apiLogStore' )
10
13
@observer
@@ -18,7 +21,7 @@ export default class APILog extends React.Component<ICommonProps> {
18
21
detailInfo : { }
19
22
}
20
23
21
- columns = [ {
24
+ columns : ColumnProps < AnyObject > [ ] = [ {
22
25
title : 'ID' ,
23
26
dataIndex : 'id' ,
24
27
// render: (name: any) => `${name.first} ${name.last}`,
@@ -62,6 +65,7 @@ export default class APILog extends React.Component<ICommonProps> {
62
65
title : '操作' ,
63
66
dataIndex : '' ,
64
67
width : '80px' ,
68
+ fixed : 'right' ,
65
69
render : ( text : string , record : any , index : number ) => < Button size = "small" type = "primary" onClick = { ( ) => this . viewDetail ( record ) } > 详情</ Button > ,
66
70
} ]
67
71
@@ -165,8 +169,8 @@ export default class APILog extends React.Component<ICommonProps> {
165
169
}
166
170
167
171
// 获取状态badge
168
- getStatus = ( status : any ) : 'default' | 'success' | 'warning' | 'error' => {
169
- let info : 'default' | 'success' | 'warning' | 'error' = 'default'
172
+ getStatus = ( status : any ) : TStatus => {
173
+ let info : TStatus = 'default'
170
174
switch ( status ) {
171
175
case 200 :
172
176
case 201 :
@@ -259,6 +263,7 @@ export default class APILog extends React.Component<ICommonProps> {
259
263
< Table
260
264
bordered
261
265
className = "table-list"
266
+ scroll = { { x : 1600 } }
262
267
columns = { this . columns }
263
268
rowKey = { ( record : any ) => record . id }
264
269
dataSource = { list }
0 commit comments