import React from 'react' import Echarts from 'echarts-for-react' import { connect } from 'dva' import { Table } from 'antd' import resolveChartOption from '../chart/resolveChartOption.js' import RichTextEditor from './richTextEditor' const ChartView = ({ item, chart, editMode, dispatch }) => { const { viewType, chartCode, content } = item; let children =
; console.log(editMode); if(viewType === 'chart') { // 图表类型 let targetChart = chart.list.filter(c => c.code === chartCode)[0]; if(targetChart) { let option = resolveChartOption(targetChart ? targetChart.chartOption : {}, editMode); let type = ['bar', 'line', 'pie', 'scatter'].indexOf(targetChart.type) !== -1 ? 'echarts' : (['aggregateTable', 'dataView'].indexOf(targetChart.type) !== -1 ? 'table' : 'default'); if(type === 'echarts') { children = }else if(type === 'table') { const { columns, data } = option; children = } } }else if(viewType === 'richText') { // 富文本类型 children = { dispatch({ type: 'dashboardDesigner/modifyItem', fields: { code: item.code, content } }); }}/> }else { children =
错误类型
} return (
{children}
); } export default connect(({ present: { chart } }) => ({ chart }))(ChartView);