{"size": 1796, "ext": "js", "max_stars_repo_path": "StatDisplay/src/routes/newOld/newOldPage.js", "max_stars_repo_name": "ruig2/WIFIProbe", "max_stars_repo_stars_event_min_datetime": "2017-09-09T00:46:08.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-30T09:00:29.000Z", "max_issues_repo_path": "StatDisplay/src/routes/newOld/newOldPage.js", "max_issues_repo_name": "91wangmeng/WIFIProbe", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "StatDisplay/src/routes/newOld/newOldPage.js", "max_forks_repo_name": "91wangmeng/WIFIProbe", "max_forks_repo_forks_event_min_datetime": "2017-09-07T04:44:07.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-04T20:57:58.000Z"}
{"max_stars_count": 34, "max_issues_count": null, "max_forks_count": 32, "avg_line_length": 24.602739726, "max_line_length": 77, "alphanum_fraction": 0.5785077951}
/**
 * Created by yyy on 2017/5/26.
 */

import { Row, Col, Card } from 'antd';
import React, { PropTypes } from 'react';
import { connect } from 'dva';
import SelectorForm from '../../components/charts/selectorForm';
import DetailSelectorForm from '../../components/charts/detailSelectorForm';
import HourNewOldChart from '../../components/charts/newOld/hourNewOldChart';
import DetailPieChart from '../../components/charts/detailPieChart';
import DetailBarChart from '../../components/charts/detailBarChart';

function NewOldPage({dispatch,newOldInfo}) {
  const {hourData, detailData, probeOptions} = newOldInfo;

  const selectorProps = {
    probeOptions,
    getHourData(fieldValue) {
      dispatch({
        type: 'newOldInfo/getHourData',
        payload: fieldValue,
      });
    }
  }

  const detailProps = {
    probeOptions,
    getDetailData(fieldValue) {
      dispatch({
        type: 'newOldInfo/getDetail',
        payload: fieldValue,
      })
    },
  }

  return (
    <Row>
      <Card>
        <Col lg={24} md={24}>
          <Card title="请选择需要分析的时间范围：">
            <SelectorForm {...selectorProps}/>
          </Card>
        </Col>
        <Col lg={24} md={24}>
          <Card title="新老顾客统计图">
            <HourNewOldChart data={hourData} />
          </Card>
        </Col>
      </Card>

      <Card>
        <Col lg={24} md={24}>
          <Card title="请选择需要分析的具体时间">
            <DetailSelectorForm {...detailProps}/>
          </Card>
        </Col>
        <Col lg={24} md={24}>
          <Card title="具体时间新老顾客统计图">
            <DetailBarChart data={detailData}/>
          </Card>
        </Col>
      </Card>

    </Row>
  )
}

NewOldPage.prototypes = {
  newOldInfo: PropTypes.object
};
export default connect( ({newOldInfo}) => ({newOldInfo}) )(NewOldPage)
