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