import React, { Component } from 'react'; import moment from 'moment'; import { connect } from 'dva'; import { routerRedux } from 'dva/router'; import { Card, Modal, Button, message } from 'antd'; import { StandardTableList } from '../../../components/AXList/index'; import { renderStatus, addRowKey } from '../../../utils/utils'; const Message = message; @connect(({ loading, lesson }) => ({ lesson, loading: loading.models.lesson, })) export default class LessonListPage extends Component { constructor(props) { super(props); const { state } = props.location; this.state = { UIParams: (state || {}).UIParams, // 组件的状态参数 Queryers: (state || {}).Queryers, // 查询的条件参数 }; } componentDidMount() { this.props.dispatch({ type: 'lesson/fetchLessonList', payload: { ...this.state.Queryers }, }); } handleCreateOperation = () => { this.props.dispatch(routerRedux.push({ pathname: '/product/lesson/create', state: this.state, })); } handleDeleteOperation = (item) => { Modal.confirm({ okText: '确定', cancelText: '取消', title: '你确定要删除该课吗?', content: '如果该课已经被某些课程关联,则将导致删除失败,需要手动解除与这些课程的关联才可进行删除', onOk: () => { this.props.dispatch({ type: 'lesson/deleteLessonItem', payload: { id: item.id }, states: this.state, }); }, }); } handleEditOperation = (item) => { this.props.dispatch(routerRedux.push({ pathname: `/product/lesson/edit/${item.id}`, state: this.state, })); } handleFilterOperation = (params, states) => { this.props.dispatch({ type: 'lesson/fetchLessonList', payload: params, }); this.setState({ UIParams: states, Queryers: params, }); } handleBatchOperation = () => { Message.info('暂不支持批量操作!'); } render() { const { loading, lesson } = this.props; const { list, totalSize, pageSize, pageNo } = lesson; const renderOperation = (item) => { return (