import React from 'react'; import { Link } from 'react-router-dom'; import './index.less'; import Page from '@src/containers/Page'; import Block from '@src/components/Block'; import FilterLayout from '@src/layouts/FilterLayout'; // import ActionLayout from '@src/layouts/ActionLayout'; import TableLayout from '@src/layouts/TableLayout'; import { getMap, formatDate } from '@src/services/Tools'; // import { SwitchSelect, ServiceKey } from '../../../../Constant'; import { User } from '../../../stores/user'; import { Course } from '../../../stores/course'; export default class extends Page { constructor(props) { super(props); this.filterF = null; this.courseMap = {}; } init() { this.filterForm = [ { key: 'keyword', type: 'input', name: 'ID/手机号', placeholder: '请输入', }, { key: 'courseId', type: 'select', allowClear: true, name: '课程', select: [], placeholder: '请选择', number: true, }, ]; this.columns = [ { title: '手机号', dataIndex: 'mobile', }, { title: '用户姓名', dataIndex: 'realName', }, { title: '开通科目', dataIndex: 'classes', render: (text, record) => { return (record.classes || []).map(row => { return this.courseMap[row.courseId]; }).join(
); }, }, { title: '开通时间', dataIndex: 'time', render: (text, record) => { return (record.classes || []).map(row => { return `${formatDate(row.startTime, 'YYYY-MM-DD HH:mm:ss')} - ${formatDate(row.expireTime, 'YYYY-MM-DD HH:mm:ss')}`; }).join(
); }, }, { title: '创建时间', dataIndex: 'createTime', render: (text) => { return formatDate(text, 'YYYY-MM-DD HH:mm:ss'); }, }, { title: '操作', dataIndex: 'handler', render: (text, record) => { return
{( 查看 )}
; }, }, ]; Course.list({ size: 100 }).then(result => { this.filterForm[1].select = result.list.map(row => { return { title: row.title, value: row.id, }; }); this.courseMap = getMap(result.list, 'id'); }); } initData() { User.listStudent(this.state.search).then(result => { this.setTableData(result.list, result.total); }); } renderView() { return { data.page = 1; this.search(data); }} ref={(ref) => { if (ref) this.filterF = ref; }} /> {/* this.onAction(key)} /> */} this.tableChange(pagination, filters, sorter)} onSelect={(keys, rows) => this.tableSelect(keys, rows)} selectedKeys={this.state.selectedKeys} /> ; } }