|
|
@@ -293,53 +293,57 @@ export default {
|
|
|
const { baseConfig } = chartDesigner;
|
|
|
const { viewType } = baseConfig;
|
|
|
|
|
|
- yield put({ type: 'silentSetField', name: 'fetchConfig', value: {} });
|
|
|
- if(viewType === 'bar') {
|
|
|
- const { barConfig } = chartDesigner;
|
|
|
- if(barConfig.xAxis.column.value && barConfig.yAxis.column.value) {
|
|
|
- yield put({ type: 'fetchBarData' });
|
|
|
- }else {
|
|
|
- yield put({ type: 'silentSetField', name: 'chartOption', value: {} });
|
|
|
- }
|
|
|
- }else if(viewType === 'pie') {
|
|
|
- const { pieConfig } = chartDesigner;
|
|
|
- if(pieConfig.xAxis.column.value && pieConfig.yAxis.column.value) {
|
|
|
- yield put({ type: 'fetchPieData' });
|
|
|
- }else {
|
|
|
- yield put({ type: 'silentSetField', name: 'chartOption', value: {} });
|
|
|
- }
|
|
|
- }else if(viewType === 'line') {
|
|
|
- const { lineConfig } = chartDesigner;
|
|
|
- if(lineConfig.xAxis.column.value && lineConfig.yAxis.column.value) {
|
|
|
- yield put({ type: 'fetchLineData' });
|
|
|
- }else {
|
|
|
- yield put({ type: 'silentSetField', name: 'chartOption', value: {} });
|
|
|
- }
|
|
|
- }else if(viewType === 'scatter') {
|
|
|
- const { scatterConfig } = chartDesigner;
|
|
|
- if(scatterConfig.xAxis.column.value && scatterConfig.yAxis.column.value) {
|
|
|
- yield put({ type: 'fetchScatterData' });
|
|
|
- }else {
|
|
|
- yield put({ type: 'silentSetField', name: 'chartOption', value: {} });
|
|
|
- }
|
|
|
- }else if(viewType === 'dataView') {
|
|
|
- const { dataViewConfig } = chartDesigner;
|
|
|
- if(dataViewConfig.viewColumns.length > 0 &&
|
|
|
- dataViewConfig.sortColumn.key &&
|
|
|
- dataViewConfig.sortType) {
|
|
|
- yield put({ type: 'fetchDataViewData' });
|
|
|
- }else {
|
|
|
- yield put({ type: 'silentSetField', name: 'chartOption', value: {} });
|
|
|
- }
|
|
|
- }else if(viewType === 'aggregateTable') {
|
|
|
- const { aggregateTableConfig } = chartDesigner;
|
|
|
- if(aggregateTableConfig.targetColumn.name && aggregateTableConfig.statistics.length > 0) {
|
|
|
- yield put({ type: 'fetchAggregateTableData' });
|
|
|
+ try{
|
|
|
+ yield put({ type: 'silentSetField', name: 'fetchConfig', value: {} });
|
|
|
+ if(viewType === 'bar') {
|
|
|
+ const { barConfig } = chartDesigner;
|
|
|
+ if(barConfig.xAxis.column.value && barConfig.yAxis.column.value) {
|
|
|
+ yield put({ type: 'fetchBarData' });
|
|
|
+ }else {
|
|
|
+ yield put({ type: 'silentSetField', name: 'chartOption', value: {} });
|
|
|
+ }
|
|
|
+ }else if(viewType === 'pie') {
|
|
|
+ const { pieConfig } = chartDesigner;
|
|
|
+ if(pieConfig.xAxis.column.value && pieConfig.yAxis.column.value) {
|
|
|
+ yield put({ type: 'fetchPieData' });
|
|
|
+ }else {
|
|
|
+ yield put({ type: 'silentSetField', name: 'chartOption', value: {} });
|
|
|
+ }
|
|
|
+ }else if(viewType === 'line') {
|
|
|
+ const { lineConfig } = chartDesigner;
|
|
|
+ if(lineConfig.xAxis.column.value && lineConfig.yAxis.column.value) {
|
|
|
+ yield put({ type: 'fetchLineData' });
|
|
|
+ }else {
|
|
|
+ yield put({ type: 'silentSetField', name: 'chartOption', value: {} });
|
|
|
+ }
|
|
|
+ }else if(viewType === 'scatter') {
|
|
|
+ const { scatterConfig } = chartDesigner;
|
|
|
+ if(scatterConfig.xAxis.column.value && scatterConfig.yAxis.column.value) {
|
|
|
+ yield put({ type: 'fetchScatterData' });
|
|
|
+ }else {
|
|
|
+ yield put({ type: 'silentSetField', name: 'chartOption', value: {} });
|
|
|
+ }
|
|
|
+ }else if(viewType === 'dataView') {
|
|
|
+ const { dataViewConfig } = chartDesigner;
|
|
|
+ if(dataViewConfig.viewColumns.length > 0 &&
|
|
|
+ dataViewConfig.sortColumn.key &&
|
|
|
+ dataViewConfig.sortType) {
|
|
|
+ yield put({ type: 'fetchDataViewData' });
|
|
|
+ }else {
|
|
|
+ yield put({ type: 'silentSetField', name: 'chartOption', value: {} });
|
|
|
+ }
|
|
|
+ }else if(viewType === 'aggregateTable') {
|
|
|
+ const { aggregateTableConfig } = chartDesigner;
|
|
|
+ if(aggregateTableConfig.targetColumn.name && aggregateTableConfig.statistics.length > 0) {
|
|
|
+ yield put({ type: 'fetchAggregateTableData' });
|
|
|
+ }else {
|
|
|
+ yield put({ type: 'silentSetField', name: 'chartOption', value: {} });
|
|
|
+ }
|
|
|
}else {
|
|
|
- yield put({ type: 'silentSetField', name: 'chartOption', value: {} });
|
|
|
+ console.log('no viewType......')
|
|
|
}
|
|
|
- }else {
|
|
|
- console.log('no viewType......')
|
|
|
+ }catch(e) {
|
|
|
+ message.error('加载数据错误: ' + e.message);
|
|
|
}
|
|
|
},
|
|
|
*fetchBarData(action, { select, call, put }) {
|