import React from 'react' import { connect } from 'dva' import { Layout, Steps, Button, message, Tabs } from 'antd' const { Header, Content } = Layout const Step = Steps.Step const TabPane = Tabs.TabPane import { Link } from 'react-router-dom' import BaseConfig from './baseConfig' import ConnectConfig from './connectConfig' import ColumnConfig from './columnConfig' import AccessConfig from './accessConfig' import './dataSourceDetail.less' class DataSourceDetail extends React.Component { constructor(props) { super(props); this.state = { mode: props.match.params.code&&props.match.params.code=='create'?'create':'modify', type: props.match.params.type, code: props.match.params.code, tab: props.match.params.tab, current: ['base', 'column', 'access'].indexOf(props.match.params.tab) } } componentDidMount() { this.props.dispatch({ type: 'dataSource/setNewModelFields', fields: [ { name: 'type', value: this.props.match.params.type }, { name: 'code', value: this.props.match.params.code } ] }); } next() { const { type, current } = this.state; this.setState({ current: current + 1 }); let step = ['base', 'column', 'access'][current + 1]; this.props.dispatch({ type: 'main/redirect', path: '/datasource/' + type + '/create/' + step }) } prev() { const { type, current } = this.state; this.setState({ current: current - 1 }); let step = ['base', 'column', 'access'][current - 1]; this.props.dispatch({ type: 'main/redirect', path: '/datasource/' + type + '/create/' + step }) } render() { const { dispatch } = this.props; const { type, mode, code, tab, current } = this.state; const steps = [{ tabName: 'base', title: '属性配置', content: }, { tabName: 'column', title: '数据列配置', content: }, { tabName: 'access', title: '权限配置', content: }]; return ( {mode == 'create' ? (
{steps.map((item,index) => )}
{steps[current].content}
{ current > 0 && ( ) } { current < steps.length - 1 && } { current === steps.length - 1 && }
) : ( { dispatch({ type: 'main/redirect', path: '/datasource/' + type + '/' + code + '/' + key }) this.setState({ tab: key }) }} tabBarExtraContent={} > {steps.map((item, index) => { return {item.content} })} )}
) } } export default connect()(DataSourceDetail);