|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
originData: {
|
|
|
code: null,
|
|
|
header: { label: '未命名' },
|
|
|
- baseConfig: { dataSource: { key: '', label: '' }, viewType: { key: '', label: '' } },
|
|
|
+ baseConfig: { dataSource: '', viewType: '' },
|
|
|
preparing: { groupBy: [] },
|
|
|
aggregateTableConfig: {},
|
|
|
dataViewConfig: {},
|
|
|
@@ -72,14 +72,8 @@ export default {
|
|
|
label: '标题'
|
|
|
},
|
|
|
baseConfig: {
|
|
|
- dataSource: {
|
|
|
- key: '',
|
|
|
- label: ''
|
|
|
- },
|
|
|
- viewType: {
|
|
|
- key: '',
|
|
|
- label: ''
|
|
|
- }
|
|
|
+ dataSource: '',
|
|
|
+ viewType: ''
|
|
|
},
|
|
|
preparing: {
|
|
|
groupBy: []
|
|
|
@@ -209,18 +203,18 @@ export default {
|
|
|
*changeDataSource(action, { select, call, put }) {
|
|
|
const { value } = action;
|
|
|
yield put({ type: 'setDataSource', value });
|
|
|
- yield put({ type: 'remoteDataColumn', code: value.dataSource.key });
|
|
|
+ yield put({ type: 'remoteDataColumn', code: value.dataSource });
|
|
|
},
|
|
|
*remoteAdd(action, { select, call, put }) {
|
|
|
try{
|
|
|
const chartDesigner = yield select(state => state.present.chartDesigner);
|
|
|
const { header, baseConfig, preparing, barConfig } = chartDesigner;
|
|
|
let body = {}; // 基本属性
|
|
|
- if(baseConfig.viewType.key == 'bar') {
|
|
|
+ if(baseConfig.viewType == 'bar') {
|
|
|
body = {
|
|
|
chartName: header.label,
|
|
|
chartType: 'Histogram',
|
|
|
- dataId: baseConfig.dataSource.key,
|
|
|
+ dataId: baseConfig.dataSource,
|
|
|
groupBy: preparing.groupBy.map(g => {
|
|
|
return {
|
|
|
columnName: g.key,
|
|
|
@@ -268,12 +262,12 @@ export default {
|
|
|
const chartDesigner = yield select(state => state.present.chartDesigner);
|
|
|
const { code, header, baseConfig, preparing, barConfig } = chartDesigner;
|
|
|
let body = {}; // 基本属性
|
|
|
- if(baseConfig.viewType.key == 'bar') {
|
|
|
+ if(baseConfig.viewType == 'bar') {
|
|
|
body = {
|
|
|
chartId: code,
|
|
|
chartName: header.label,
|
|
|
chartType: 'Histogram',
|
|
|
- dataId: baseConfig.dataSource.key,
|
|
|
+ dataId: baseConfig.dataSource,
|
|
|
groupBy: preparing.groupBy.map(g => {
|
|
|
return {
|
|
|
columnName: g.key,
|
|
|
@@ -319,28 +313,21 @@ export default {
|
|
|
},
|
|
|
*remoteDataColumn(action, { select, call, put }) {
|
|
|
const code = action.code;
|
|
|
- console.log(code);
|
|
|
try {
|
|
|
const res = yield call(service.fetch, {
|
|
|
- url: URLS.DATASOURCE_DETAIL,
|
|
|
+ url: URLS.DATASOURCE_QUERY_DATACOLUMNS,
|
|
|
body: code
|
|
|
});
|
|
|
if(!res.err && res.data.code > 0) {
|
|
|
let resData = res.data.data;
|
|
|
- let columnConfig = JSON.parse(resData.columnConfig);
|
|
|
|
|
|
- let columns = columnConfig.map((c, i) => {
|
|
|
+ let columns = resData.map((c, i) => {
|
|
|
return {
|
|
|
key: i,
|
|
|
- using: c.isOpen=='1'?true:false,
|
|
|
name: c.columnName,
|
|
|
- label: c.columnLable,
|
|
|
- dataType: c.dataType,
|
|
|
+ label: c.columnRaname,
|
|
|
type: c.columnType,
|
|
|
- selection: [],
|
|
|
- groupable: c.isGroup=='1'?true:false,
|
|
|
- bucketizable: c.isSubsection=='1'?true:false,
|
|
|
- description: c.remarks
|
|
|
+ selection: []
|
|
|
}
|
|
|
})
|
|
|
console.log(columns);
|
|
|
@@ -357,11 +344,10 @@ export default {
|
|
|
const chartDesigner = yield select(state => state.present.chartDesigner);
|
|
|
const { baseConfig } = chartDesigner;
|
|
|
const { viewType } = baseConfig;
|
|
|
- const viewTypeKey = viewType.key;
|
|
|
|
|
|
- if(viewTypeKey == 'bar') {
|
|
|
+ if(viewType == 'bar') {
|
|
|
yield put({ type: 'fetchBarData' });
|
|
|
- }else if(viewTypeKey == 'pie') {
|
|
|
+ }else if(viewType == 'pie') {
|
|
|
//yield put({ type: 'fetchPieData' });
|
|
|
}else {
|
|
|
console.log(13)
|
|
|
@@ -460,10 +446,6 @@ export default {
|
|
|
subscriptions: {
|
|
|
setup({ dispatch, history }) {
|
|
|
return history.listen(({ pathname, query }) => {
|
|
|
- if (pathname === '/home') {
|
|
|
- console.log(111);
|
|
|
- dispatch({ type: 'redirect'});
|
|
|
- }
|
|
|
});
|
|
|
},
|
|
|
},
|