import React from 'react'; import { Button } from 'antd'; 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, bindSearch, formatDate } from '@src/services/Tools'; // import { asyncSMessage } from '@src/services/AsyncTools'; import { TextbookType } from '../../../../Constant'; // import { System } from '../../../stores/system'; import { Textbook } from '../../../stores/textbook'; // import { Slient } from '../../../stores/slient'; const TextbookTypeMap = getMap(TextbookType, 'value', 'label'); const filterForm = [ { key: 'questionType', type: 'select', allowClear: true, name: '题型', select: TextbookType, placeholder: '请选择', }, { key: 'paperId', type: 'select', allowClear: true, name: '练习册', select: [], placeholder: '请选择', number: true, }, { key: 'id', type: 'select', allowClear: true, name: '题目ID', select: [], number: true, placeholder: '请输入', }, ]; export default class extends Page { constructor(props) { super(props); this.actionList = [{ key: 'add', name: '新建', render: (item) => { return ; }, }]; this.categoryMap = {}; this.columns = [{ title: '题型', dataIndex: 'questionType', render: (text, record) => { return TextbookTypeMap[record.question.questionType] || text; }, }, { title: '题目ID', dataIndex: 'title', }, { title: '修改时间', dataIndex: 'updateTime', render: (text, record) => { return formatDate(record.question.updateTime, 'YYYY-MM-DD HH:mm:ss'); }, }, { title: '操作', dataIndex: 'handler', render: (text, record) => { return
{( 编辑 )}
; }, }]; } init() { bindSearch(filterForm, 'paperId', this, (search) => { return Textbook.listPaper(search); }, (row) => { return { title: row.title, value: row.id, }; }, this.state.search.paperId ? Number(this.state.search.paperId) : null, null); bindSearch(filterForm, 'id', this, (search) => { return Textbook.searchQuestion(search); }, (row) => { return { title: row.title, value: row.id, }; }, this.state.search.id ? Number(this.state.search.id) : null, null); } initData() { const { search } = this.state; const data = Object.assign({}, search); Textbook.listQuestion(data).then(result => { this.setTableData(result.list, result.total || 1); }); } renderView() { return { data.page = 1; this.search(data); }} /> this.onAction(key)} /> this.tableChange(pagination, filters, sorter)} onSelect={(keys, rows) => this.tableSelect(keys, rows)} selectedKeys={this.state.selectedKeys} /> ; } }