forked from nsjcy/frontEnd/nsjcy

liuwh
2020-02-24 2bcd556961208b80af1cb157633c594faab1eca2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import React from 'react';
import HeadView from '../view/HeadView';
import CardView from '../view/CardView';
import TableView from '../view/TableView';
import BarView from '../view/BarView';
import Fetch from '../fetch';
import {Divider, Badge} from 'antd'
 
 
export default class Index extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      countArr: [],
      dateArr: [],
      count: [],
      businessList: []
    };
  }
 
  componentDidMount() {
    document.title = '南检后台中心';
    Fetch.getIndex()
      .then(res => {
        this.setState({
          countArr: res.countArr,
          dateArr: res.dateArr,
          count: res.count,
          businessList: res.businessList
        });
      });
  }
 
  onDetail = (_text, _record) =>{
    this.props.history.push('/busDetail/' +  _text.type + '/' + _text.businessId + '/' + _text.createId  + '/' + 'detail');
  }
  onDo = (_text, _record) =>{
    this.props.history.push('/busDetail/' +  _text.type + '/' + _text.businessId + '/' + _text.createId  + '/' + 'bus');
  }
  render() {
    const { countArr, dateArr, count, businessList } = this.state;
    const columns = [{
      title: '业务类型',
      dataIndex: 'businessType',
      key: 'businessType',
    }, {
      title: '详细内容',
      dataIndex: 'content',
      key: 'content',
    }, {
      title: '状态',
      dataIndex: 'status',
      key: 'status',
      render: text => (
        <Badge count={text} />
      )
    }, {
      title: '创建时间',
      dataIndex: 'createTime',
      key: 'createTime',
    }, {
      title: '操作',
      key: 'action',
      render: (text, record) => (
        <span style={{cursor : 'pointer'}}>
          <label onClick={()=>{this.onDetail(text, record)}} className="theme-color">详情</label>
          <Divider type="vertical" />
          <label onClick={()=>{this.onDo(text, record)}} className="theme-color">处理</label>
        </span>
      ),
    }];
    return (
      <div className="app-page" style={{ width: '100%' }}>
        <HeadView history={this.props.history} />
        <CardView dateSource={count} />
        <TableView history={this.props.history} pageSize='6' size='small' columns={columns} data={businessList}/>
        <BarView key={Date.now()} countArr={countArr} dateArr={dateArr}/>
      </div>
    );
  }
 
}