|
@@ -0,0 +1,127 @@
|
|
|
+/* eslint-disable prefer-destructuring */
|
|
|
+import React, { Component } from 'react';
|
|
|
+import moment from 'moment';
|
|
|
+import { connect } from 'dva';
|
|
|
+import { Card, message } from 'antd';
|
|
|
+import { StandardTableList } from '../../../components/AXList';
|
|
|
+import { addRowKey, renderStatus } from '../../../utils/utils';
|
|
|
+
|
|
|
+const Message = message;
|
|
|
+
|
|
|
+@connect(({ terminal, loading }) => ({
|
|
|
+ terminal,
|
|
|
+ loading: loading.models.terminal,
|
|
|
+}))
|
|
|
+
|
|
|
+export default class TerminalResourceListPage extends Component {
|
|
|
+ constructor(props) {
|
|
|
+ super(props);
|
|
|
+ const { state } = props.location;
|
|
|
+ this.state = {
|
|
|
+ UIParams: (state || {}).UIParams, // 组件的状态参数
|
|
|
+ Queryers: (state || {}).Queryers, // 查询的条件参数
|
|
|
+ };
|
|
|
+ }
|
|
|
+ componentDidMount() {
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'terminal/fetchTerminalResourceList',
|
|
|
+ payload: { ...this.state.Queryers },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ handleFilterOperation = (params, states) => {
|
|
|
+ this.props.dispatch({
|
|
|
+ type: 'terminal/fetchTerminalResourceList',
|
|
|
+ payload: params,
|
|
|
+ });
|
|
|
+ this.setState({
|
|
|
+ UIParams: states,
|
|
|
+ Queryers: params,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ handleBatchOperation = () => {
|
|
|
+ Message.info('暂不支持批量操作!');
|
|
|
+ }
|
|
|
+ render() {
|
|
|
+ const { terminal, loading } = this.props;
|
|
|
+ const { pageNo, pageSize, totalSize, list } = terminal;
|
|
|
+ const basicSearch = {
|
|
|
+ keys: [{
|
|
|
+ name: '终端编号',
|
|
|
+ field: 'code',
|
|
|
+ }],
|
|
|
+ };
|
|
|
+ const batchActions = [{
|
|
|
+ key: 'delete',
|
|
|
+ name: '批量删除',
|
|
|
+ }];
|
|
|
+ const pagination = {
|
|
|
+ pageNo,
|
|
|
+ pageSize,
|
|
|
+ totalSize,
|
|
|
+ };
|
|
|
+ const columns = [{
|
|
|
+ title: '终端编号',
|
|
|
+ key: 1,
|
|
|
+ dataIndex: 'ucode',
|
|
|
+ width: '12%',
|
|
|
+ }, {
|
|
|
+ title: '终端名称',
|
|
|
+ key: 2,
|
|
|
+ dataIndex: 'uname',
|
|
|
+ width: '12%',
|
|
|
+ }, {
|
|
|
+ title: '产品名称',
|
|
|
+ key: 3,
|
|
|
+ dataIndex: 'pname',
|
|
|
+ width: '22%',
|
|
|
+ }, {
|
|
|
+ title: '产品编号',
|
|
|
+ key: 4,
|
|
|
+ dataIndex: 'pcode',
|
|
|
+ width: '14%',
|
|
|
+ }, {
|
|
|
+ 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%',
|
|
|
+ }, {
|
|
|
+ title: '修改时间',
|
|
|
+ key: 7,
|
|
|
+ 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%',
|
|
|
+ }];
|
|
|
+ return (
|
|
|
+ <Card>
|
|
|
+ <StandardTableList
|
|
|
+ columns={columns}
|
|
|
+ loading={loading}
|
|
|
+ dataSource={addRowKey(list)}
|
|
|
+ header={{
|
|
|
+ basicSearch,
|
|
|
+ onFilterClick: this.handleFilterOperation,
|
|
|
+ }}
|
|
|
+ footer={{
|
|
|
+ pagination,
|
|
|
+ batchActions,
|
|
|
+ onBatchClick: this.handleBatchOperation,
|
|
|
+ }}
|
|
|
+ keepUIState={{ ...this.state.UIParams }}
|
|
|
+ />
|
|
|
+ </Card>
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|