import React from 'react' import { Modal, Form, Row, Col, Input, Button, Select, Icon, Menu, Dropdown, Table, Checkbox, Switch, Divider } from 'antd' const FormItem = Form.Item const SelectOption = Select.Option const OptionGroup = Select.OptGroup const InputGroup = Input.Group const SubMenu = Menu.SubMenu const MenuItem = Menu.Item const MenuItemGroup = Menu.ItemGroup; import { connect } from 'dva' import dataSource from '../../models/dataSource' class DataSourceColumnConfig extends React.Component { constructor(props) { super(props); this.state = { } } onCheckAllChange() { } render() { const { dataSource, dispatch } = this.props; const columns = [{ title:
0 ? 'inline-block' : 'none') : 'none'}} indeterminate={dataSource.newOne.columns ? (dataSource.newOne.columns.filter(c => c.using).length > 0 && dataSource.newOne.columns.filter(c => c.using).length < dataSource.newOne.columns.length) : false} checked={dataSource.newOne.columns ? (dataSource.newOne.columns.filter(c => c.using).length == dataSource.newOne.columns.length) : false} onChange={(e) => { let target = e.target; let columns = dataSource.newOne.columns ? dataSource.newOne.columns.map(c => { c.using = target.checked; return c; }) : []; dispatch({ type: 'dataSource/setNewModelField', name: 'columns', value: columns }); }} />启用
, dataIndex: 'using', key: 'using', width: 50, render: (v, r) => { let target = e.target; let key = target.dataKey; let columns = dataSource.newOne.columns.map(c => { if(c.key == key) { c.using = target.checked; } return c; }); dispatch({ type: 'dataSource/setNewModelField', name: 'columns', value: columns }); }} checked={v} /> }, { title: '列名', dataIndex: 'name', key: 'name', width: 80 }, { title: '别名', dataIndex: 'alias', key: 'alias', width: 100, render: (text, record) => { return( { const value = e.target.value; let columns = dataSource.newOne.columns.map(c => { if(c.key == record.key) { c['alias'] = value; } return c; }); dispatch({ type: 'dataSource/setNewModelField', name: 'columns', value: columns }); }} > ) } }, { title: '数据类型', dataIndex: 'dataType', key: 'dataType', width: 80 }, { title: '分析类型', dataIndex: 'columnType', key: 'columnType', width: 80, render: (text, record) => { return ( ) } }, { title: '允许分组', dataIndex: 'groupable', key: 'groupable', width: 50, className: 'column-groupable', render: (value, record) => { let columns = dataSource.newOne.columns.map(c => { if(c.key == record.key) { c.groupable = checked; } return c; }); dispatch({ type: 'dataSource/setNewModelField', name: 'columns', value: columns }); }}/> }, { title: '允许分段', dataIndex: 'bucketizable', key: 'bucketizable', width: 50, className: 'column-bucketizable', render: (value, record) => { let columns = dataSource.newOne.columns.map(c => { if(c.key == record.key) { c.bucketizable = checked; } return c; }); dispatch({ type: 'dataSource/setNewModelField', name: 'columns', value: columns }); }} /> }, { title: '备注', dataIndex: 'description', key: 'description', width: 200, render: (text, record) => { return { let columns = dataSource.newOne.columns.map(c => { if(c.key == record.key) { c['description'] = e.target.value; } return c; }); dispatch({ type: 'dataSource/setNewModelField', name: 'columns', value: columns }); }} > } }]; console.log(dataSource.newOne.type); return (
{ dataSource.newOne.type=='database'?(
数据对象 { dispatch({ type: 'dataSource/setNewModelField', name: 'target', value: e.target.value }); }} />
数据列
):null } ); } } function mapStateToProps({ present: { dataSource } }) { return { dataSource } } export default connect(mapStateToProps)(DataSourceColumnConfig);