知与行后台管理端

userSource.jsx 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import dayjs from 'dayjs';
  2. import React from 'react';
  3. import {Radio, DatePicker, Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, Breadcrumb } from 'antd';
  4. import UserSource from './components/UserSource.jsx';
  5. // import XForm, { FieldTypes } from '../../components/XForm';
  6. import moment from 'moment';
  7. const header = props => {
  8. const { RangePicker } = DatePicker;
  9. function onChange(dates, dateStrings) {
  10. console.log('From: ', dates[0], ', to: ', dates[1]);
  11. console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]);
  12. }
  13. const handleSubmit = (e, props) => {
  14. e.preventDefault();
  15. // props.form.validateFields((err, values) => {
  16. // if (!err) {
  17. // getList({ pageNum: 1, pageSize: 10, ...values })
  18. // }
  19. // });
  20. }
  21. function getDataOf(days){
  22. // const endDate = new Date()
  23. // const startDate = dayjs().subtract(days, 'day').toDate()
  24. // this.$refs.chart.getData({ startDate, endDate })
  25. }
  26. function onChange(e) {
  27. console.log(`radio checked:${e.target.value}`);
  28. }
  29. return (<>
  30. {/* <el-button type="text" @click="() => getDataOf(7)">最近7天</el-button>
  31. <el-button type="text" @click="() => getDataOf(30)">最近1月</el-button>
  32. <el-date-picker
  33. v-model="dateRange"
  34. type="daterange"
  35. start-placeholder="开始日期"
  36. end-placeholder="结束日期"
  37. style="margin-left: 16px">
  38. </el-date-picker>
  39. <el-button type="primary" icon="el-icon-search" style="margin-left: 32px" @click="search">查询</el-button>
  40. </div>
  41. <user-source ref="chart" mode="all"></user-source> */}
  42. <Radio.Group onChange={onChange} defaultValue="a">
  43. <Radio.Button value="a" onClick={getDataOf(7)}>最近7天</Radio.Button>
  44. <Radio.Button value="b" onClick={getDataOf(30)}>最近1月</Radio.Button>
  45. </Radio.Group>
  46. <RangePicker
  47. ranges={{
  48. Today: [moment(), moment()],
  49. 'This Month': [moment().startOf('month'), moment().endOf('month')],
  50. }}
  51. showTime
  52. format="YYYY/MM/DD HH:mm:ss"
  53. // onChange={onChange}
  54. />
  55. <Button type="primary" htmlType="submit" >
  56. 查询
  57. </Button>
  58. <div>
  59. <UserSource ></UserSource>
  60. </div>
  61. </>
  62. )
  63. }
  64. export default header