|
@@ -2,18 +2,22 @@
|
|
|
import React, { Component } from 'react';
|
|
|
import moment from 'moment';
|
|
|
import { connect } from 'dva';
|
|
|
-import { Card, message } from 'antd';
|
|
|
+import { Card, Badge, message } from 'antd';
|
|
|
import { StandardTableList } from '../../../components/AXList';
|
|
|
-import { addRowKey, renderStatus } from '../../../utils/utils';
|
|
|
+import Ellipsis from '../../../components/Ellipsis';
|
|
|
+import { addRowKey } from '../../../utils/utils';
|
|
|
+import styles from './AuthList.less';
|
|
|
|
|
|
const Message = message;
|
|
|
|
|
|
+const timestamp2Str = ts => moment(ts).format('YYYY-MM-DD HH:mm:ss');
|
|
|
+
|
|
|
@connect(({ terminal, loading }) => ({
|
|
|
terminal,
|
|
|
loading: loading.models.terminal,
|
|
|
}))
|
|
|
|
|
|
-export default class TerminalResourceListPage extends Component {
|
|
|
+export default class TerminalAuthListPage extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
const { state } = props.location;
|
|
@@ -22,25 +26,30 @@ export default class TerminalResourceListPage extends Component {
|
|
|
Queryers: (state || {}).Queryers, // 查询的条件参数
|
|
|
};
|
|
|
}
|
|
|
+ componentWillMount() {
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'terminal/cleanState',
|
|
|
+ });
|
|
|
+ }
|
|
|
componentDidMount() {
|
|
|
this.props.dispatch({
|
|
|
- type: 'terminal/fetchTerminalResourceList',
|
|
|
+ type: 'terminal/fetchTerminalAuthList',
|
|
|
payload: { ...this.state.Queryers },
|
|
|
});
|
|
|
}
|
|
|
handleFilterOperation = (params, states) => {
|
|
|
this.props.dispatch({
|
|
|
- type: 'terminal/fetchTerminalResourceList',
|
|
|
+ type: 'terminal/fetchTerminalAuthList',
|
|
|
payload: params,
|
|
|
});
|
|
|
this.setState({
|
|
|
UIParams: states,
|
|
|
Queryers: params,
|
|
|
});
|
|
|
- }
|
|
|
+ };
|
|
|
handleBatchOperation = () => {
|
|
|
Message.info('暂不支持批量操作!');
|
|
|
- }
|
|
|
+ };
|
|
|
render() {
|
|
|
const { terminal, loading } = this.props;
|
|
|
const { pageNo, pageSize, totalSize, list } = terminal;
|
|
@@ -63,46 +72,60 @@ export default class TerminalResourceListPage extends Component {
|
|
|
title: '终端编号',
|
|
|
key: 1,
|
|
|
dataIndex: 'ucode',
|
|
|
- width: '12%',
|
|
|
+ width: '15%',
|
|
|
+ render: text => (
|
|
|
+ <Ellipsis tooltip lines={1}>{text}</Ellipsis>
|
|
|
+ ),
|
|
|
}, {
|
|
|
- title: '终端名称',
|
|
|
+ title: '产品编号',
|
|
|
key: 2,
|
|
|
- dataIndex: 'uname',
|
|
|
- width: '12%',
|
|
|
+ dataIndex: 'pcode',
|
|
|
+ width: '15%',
|
|
|
+ render: text => (
|
|
|
+ <Ellipsis tooltip lines={1}>{text}</Ellipsis>
|
|
|
+ ),
|
|
|
}, {
|
|
|
title: '产品名称',
|
|
|
key: 3,
|
|
|
dataIndex: 'pname',
|
|
|
- width: '22%',
|
|
|
+ width: '18%',
|
|
|
+ render: text => (
|
|
|
+ <Ellipsis tooltip lines={1}>{text}</Ellipsis>
|
|
|
+ ),
|
|
|
}, {
|
|
|
- title: '产品编号',
|
|
|
+ title: '权限有效期',
|
|
|
key: 4,
|
|
|
- dataIndex: 'pcode',
|
|
|
- width: '14%',
|
|
|
+ render: (_, record) => {
|
|
|
+ const {startTime, endTime} = record;
|
|
|
+ return (
|
|
|
+ <div className={styles.authDesc}>
|
|
|
+ <p><span>起始时间: </span>{`${timestamp2Str(startTime)}`}</p>
|
|
|
+ <p><span>到期时间: </span>{`${timestamp2Str(endTime)}`}</p>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ },
|
|
|
+ width: '25%',
|
|
|
+ align: 'center',
|
|
|
}, {
|
|
|
- title: '开始时间',
|
|
|
+ title: '权限有效时长',
|
|
|
key: 5,
|
|
|
- dataIndex: 'startTime',
|
|
|
- render: text => moment(text).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- width: '10%',
|
|
|
- }, {
|
|
|
- title: '终止时间',
|
|
|
- key: 6,
|
|
|
- dataIndex: 'startTime',
|
|
|
- render: text => moment(text).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- width: '10%',
|
|
|
+ dataIndex: 'endTime',
|
|
|
+ render: (text) => {
|
|
|
+ const day = moment(text).diff(moment(), 'days');
|
|
|
+ if (day < 0) {
|
|
|
+ return <Badge status="error" text="已到期" />;
|
|
|
+ }
|
|
|
+ return <span><span style={{ color: '#52c41a', fontWeight: 'bold' }}>{day}</span>天到期</span>;
|
|
|
+ },
|
|
|
+ width: '12%',
|
|
|
+ align: 'center',
|
|
|
}, {
|
|
|
title: '修改时间',
|
|
|
- key: 7,
|
|
|
+ key: 6,
|
|
|
dataIndex: 'updateTime',
|
|
|
- render: text => moment(text).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
- width: '10%',
|
|
|
- }, {
|
|
|
- title: '状态',
|
|
|
- dataIndex: 'status',
|
|
|
- key: 8,
|
|
|
- render: text => renderStatus(text),
|
|
|
- width: '10%',
|
|
|
+ render: text => timestamp2Str(text),
|
|
|
+ width: '15%',
|
|
|
+ align: 'center',
|
|
|
}];
|
|
|
return (
|
|
|
<Card>
|
|
@@ -120,6 +143,7 @@ export default class TerminalResourceListPage extends Component {
|
|
|
onBatchClick: this.handleBatchOperation,
|
|
|
}}
|
|
|
keepUIState={{ ...this.state.UIParams }}
|
|
|
+ showStatusSelect={false}
|
|
|
/>
|
|
|
</Card>
|
|
|
);
|