|
|
@@ -1,27 +1,32 @@
|
|
|
import * as service from '../services/chartDesigner'
|
|
|
import { delay } from '../utils/baseUtils'
|
|
|
import deepAssign from '../utils/deepAssign';
|
|
|
+import URLS from '../constants/url';
|
|
|
|
|
|
export default {
|
|
|
namespace: 'chartDesigner',
|
|
|
state: {
|
|
|
columns: [{
|
|
|
- label: '姓名',
|
|
|
- name: 'c1',
|
|
|
- type: 'string'
|
|
|
- }, {
|
|
|
label: '编号',
|
|
|
- name: 'c2',
|
|
|
+ name: 'ID',
|
|
|
type: 'number'
|
|
|
}, {
|
|
|
- label: '出生日期',
|
|
|
- name: 'c3',
|
|
|
- type: 'time'
|
|
|
+ label: 'A值',
|
|
|
+ name: 'AMONEY',
|
|
|
+ type: 'number'
|
|
|
}, {
|
|
|
- label: '权限',
|
|
|
- name: 'c4',
|
|
|
+ label: 'B值',
|
|
|
+ name: 'BMONEY',
|
|
|
+ type: 'number'
|
|
|
+ }, {
|
|
|
+ label: '姓别',
|
|
|
+ name: 'GROUP_BY',
|
|
|
type: 'categorical',
|
|
|
- selection: ['查看', '新增', '删除', '修改', '提交', '审核']
|
|
|
+ selection: ['chen', 'he', 'wu']
|
|
|
+ }, {
|
|
|
+ label: '姓名',
|
|
|
+ name: 'WHO',
|
|
|
+ type: 'string'
|
|
|
}],
|
|
|
allPermission: [
|
|
|
{ value: 'owner', name: '创建人' },
|
|
|
@@ -63,13 +68,34 @@ export default {
|
|
|
style: {
|
|
|
|
|
|
},
|
|
|
- filters: []
|
|
|
+ filters: [],
|
|
|
+ chartOption: {}
|
|
|
},
|
|
|
reducers: {
|
|
|
setModel(state, action) {
|
|
|
+ const { model } = action;
|
|
|
+ // action = { model: { baseConfig: { dataSource: { key: 'd1'} } } }
|
|
|
+ function assign(p, c) {
|
|
|
+ for(let k in c) {
|
|
|
+ if(p.hasOwnProperty(k)) {
|
|
|
+ if(typeof c[k] == 'object') {
|
|
|
+ Object.assign({}, p, assign(p, c[k]));
|
|
|
+ }else {
|
|
|
+ let obj = p[k];
|
|
|
+ obj[k] = c[k];
|
|
|
+ return Object.assign({}, p, obj);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ return Object.assign({}, p, c[k]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let p = {baseConfig: 1};
|
|
|
+ console.log(p);
|
|
|
+ console.log(assign(p, { baseConfig: { dataSource: { key: 'd1'} } } ));
|
|
|
+ return state;
|
|
|
},
|
|
|
setTitle(state, action) {
|
|
|
- console.log(action);
|
|
|
let newState = Object.assign({}, state, {
|
|
|
header: {
|
|
|
label: action.text
|
|
|
@@ -204,13 +230,27 @@ export default {
|
|
|
}
|
|
|
return f;
|
|
|
}) } };
|
|
|
+ },
|
|
|
+ setOption(state, action) {
|
|
|
+ return { ...state, ...{ chartOption: action.chartOption } };
|
|
|
}
|
|
|
},
|
|
|
effects: {
|
|
|
- *['a'](action, { call, put }) {
|
|
|
- const data = yield call(service.fetch);
|
|
|
- console.log(data);
|
|
|
- yield put({ type: 'setTitle', text: '和哈哈哈哈哈哈' });
|
|
|
+ *['a'](action, { select, call, put }) {
|
|
|
+ const chartDesigner = yield select(state => state.present.chartDesigner);
|
|
|
+ const { barConfig } = chartDesigner;
|
|
|
+ const data = yield call(service.fetch, {
|
|
|
+ url: URLS.CHART_BAR_OPTION,
|
|
|
+ body: {
|
|
|
+ "tableName": "TEST_BI_DATA",
|
|
|
+ "groups": [],
|
|
|
+ "xAxis": barConfig.xAxis.key,
|
|
|
+ "yAxis": barConfig.yAxis[0],
|
|
|
+ "dataType": barConfig.yAxis[1]
|
|
|
+ }
|
|
|
+ });
|
|
|
+ data.viewType = 'bar';
|
|
|
+ yield put({ type: 'setOption', chartOption: data });
|
|
|
},
|
|
|
*test({payload:todo},{put,call}){
|
|
|
|