Browse Source

未开放功能隐藏/数据源列类型扩充/图表数据视图接口参数调整

zhuth 7 years ago
parent
commit
865aa3eafb

+ 1 - 1
src/components/chart/list.jsx

@@ -155,7 +155,7 @@ class ChartList extends React.Component {
                                 }
                             </Col>
                             <Col style={{ textAlign: 'right' }} span={3} >
-                                <Icon type='star-o'/>
+                                {/* <Icon type='star-o'/> */}
                             </Col>
                         </Row>
                     }

+ 5 - 0
src/components/chartDesigner/content.jsx

@@ -41,6 +41,11 @@ class ChartDesignerContent extends React.Component {
             });
         }, 2000);
         this.refreshContentSize();
+        window.addEventListener('resize', this.refreshContentSize);
+    }
+
+    componentWillUnmount() {
+        window.removeEventListener('resize', this.refreshContentSize);
     }
 
     static getDerivedStateFromProps(nextProps, nextState) {

+ 0 - 1
src/components/chartDesigner/layout.jsx

@@ -11,7 +11,6 @@ class ChartDesigner extends React.Component {
         const { dispatch } = this.props;
         const { code } = this.props.match.params;
         dispatch({ type: 'chartDesigner/reset' });
-        dispatch({ type: 'dataSource/fetchList' });
         if(code !== 'create') {
             dispatch({ type: 'chart/remoteDetail', code: code });
             dispatch({ type: 'chart/remoteGroupList', code: code });

+ 12 - 9
src/components/chartDesigner/sections/baseConfigForm.jsx

@@ -9,23 +9,26 @@ const { Option } = Select
 class baseConfigForm extends React.Component {
 	render() {
 		const props = this.props;
-		const allDataSource = props.dataSource.list;
 		const { formItemLayout } = props
 
+		const { chartDesigner } = this.props;
+		const { baseConfig } = chartDesigner;
+
 		return (
 			<Form hideRequiredMark={true}>
 				<FormItem label='数据源' {...formItemLayout}>
 					<Select
 						disabled
-						value={props.chartDesigner.baseConfig.dataSource.code}
+						value={{ key: baseConfig.dataSource.code, label: baseConfig.dataSource.name }}
+						labelInValue={true}
 						onChange={(value) => {
-							props.dispatch({ type: 'chartDesigner/changeDataSource', name: 'baseConfig', value: {
-								...props.chartDesigner.baseConfig, dataSource: value } });
+							props.dispatch({
+								type: 'chartDesigner/changeDataSource',
+								dataSource: { code: value.key, name: value.label }
+							});
 						}}
 					>
-						{allDataSource.map((dataSource, i)=>{
-							return (<Option key={`dataSource-${i}`} value={dataSource.code}>{dataSource.name}</Option>)
-						})}
+						<Option value={baseConfig.dataSource.code}>{baseConfig.dataSource.name}</Option>
 					</Select>
 				</FormItem>
 				<FormItem label='可视化模式' {...formItemLayout}>
@@ -60,8 +63,8 @@ class baseConfigForm extends React.Component {
 	}
 }
 
-function mapStateToProps({ present: { chartDesigner, dataSource } }) {
-    return { chartDesigner, dataSource }
+function mapStateToProps({ present: { chartDesigner } }) {
+    return { chartDesigner }
 }
 
 export default Form.create()(connect(mapStateToProps)(baseConfigForm));

+ 0 - 10
src/components/chartDesigner/sections/dataViewConfigForm.jsx

@@ -64,16 +64,6 @@ class DataViewConfigForm extends React.Component {
 						<Option value="desc">降序</Option>
 					</Select>
 				</FormItem>
-				<FormItem label='数据条数' {...formItemLayout}>
-					<InputNumber
-						min={0}
-						defaultValue={chartDesigner.dataViewConfig.count}
-						onBlur={(e) => {
-							dispatch({ type: 'chartDesigner/changeField', name: 'dataViewConfig', value: { ...chartDesigner.dataViewConfig, count: e.target.value }, autoRefresh });
-						}}
-					>
-					</InputNumber>
-				</FormItem>
 				<DisplayColumnBox
 					key={Math.random()}
 					visibleDisplayColumnBox={this.state.visibleDisplayColumnBox}

+ 1 - 1
src/components/common/CardList.jsx

@@ -80,7 +80,7 @@ class CardList extends React.Component {
                                 }
                             </Col>
                             <Col style={{ textAlign: 'right' }} span={3} >
-                                <Icon type='star-o'/>
+                                {<Icon type='star-o'/>}
                             </Col>
                         </Row>
                     }

+ 1 - 1
src/components/common/navigator.jsx

@@ -63,7 +63,7 @@ class Navigator extends React.Component {
                     <Menu.Item className='nav-page' key="datasource">
                         <Link to='/datasource'><Icon type="database" />数据源</Link>
                     </Menu.Item>
-                    <Menu.Item className='nav-page' key="modeling">
+                    <Menu.Item disabled className='nav-page' key="modeling">
                         <Link to='#'><Icon type="tool" />建模分析</Link>
                     </Menu.Item>
                 </Menu>

+ 1 - 1
src/components/dashboard/list.jsx

@@ -113,7 +113,7 @@ class DashboardList extends React.Component {
                                 }
                             </Col>
                             <Col style={{ textAlign: 'right' }} span={3} >
-                                <Icon type='star-o'/>
+                                {/* <Icon type='star-o'/> */}
                             </Col>
                         </Row>
                     }

+ 5 - 5
src/components/datasource/columnType.json

@@ -1,5 +1,5 @@
 [{
-    "dataType": ["String", "BigDecimal", "Double"],
+    "dataType": ["String", "BigDecimal", "Double", "long", "float", "int"],
     "columnType": "index",
     "label": "索引"
 }, {
@@ -7,19 +7,19 @@
     "columnType": "time",
     "label": "时间"
 }, {
-    "dataType": ["String", "BigDecimal", "Double"],
+    "dataType": ["String", "BigDecimal", "Double", "Long", "Float", "Int", "Boolean", "Byte", "Short"],
     "columnType": "categorical",
     "label": "类别"
 }, {
-    "dataType": ["BigDecimal", "Double"],
+    "dataType": ["BigDecimal", "Double", "Long", "Float", "Int"],
     "columnType": "scale",
     "label": "标量"
 }, {
-    "dataType": ["BigDecimal", "String", "Double"],
+    "dataType": ["String", "BigDecimal", "Double", "Long", "Float", "Int"],
     "columnType": "ordinal",
     "label": "序值"
 }, {
-    "dataType": ["String", "BigDecimal", "Double"],
+    "dataType": ["String", "BigDecimal", "Double", "Long", "Float", "Int", "Boolean", "Byte", "Short"],
     "columnType": "string",
     "label": "文本"
 }]

+ 2 - 2
src/constants/url.js

@@ -176,9 +176,9 @@ const URLS = {
 
     /***************************************主页模块***************************************/
 
-    HOMEPAGE_RECENT_CHART_GET: BASE_URL + "/getChartRecode", // 查询最近访问图表  //可能的错字
+    HOMEPAGE_RECENT_CHART_GET: BASE_URL + "/getChartRecord", // 查询最近访问图表  //可能的错字
 
-    HOMEPAGE_RECENT_DASHBOARD_GET: BASE_URL + "/getDashRecode", //查询最近访问看板 //可能的错字
+    HOMEPAGE_RECENT_DASHBOARD_GET: BASE_URL + "/getDashRecord", //查询最近访问看板 //可能的错字
 
     HOMEPAGE_ADD_RECENT_RECORD: BASE_URL + "/addRecord", //添加最近访问记录 
 }

+ 1 - 20
src/models/chart.js

@@ -235,7 +235,7 @@ export default {
                     }
                     yield put({ type: 'chartDesigner/defaultChangeFields', fields: fields });
                     
-                    yield put({ type: 'chartDesigner/changeDataSource', code: data.baseConfig.dataSource.code });
+                    yield put({ type: 'chartDesigner/changeDataSource', dataSource: data.baseConfig.dataSource });
                 }else {
                     message.error('解析图表错误: ' + (res.err || res.data.msg));
                 }
@@ -752,25 +752,6 @@ export default {
                 message.error('移交失败: ' + e);
             }
         },
-        *addHistory(action, { put, call, select }) {
-            const { code } = action;
-            const body = {
-                tarId: code,
-                type: '0'
-            };
-            try {
-               const res = yield call(service.fetch, {
-                   url: URLS.HISTORY_ADD,
-                   body
-               });
-               if(res.err || res.data.code <= 0) {
-                   message.error('添加图表浏览历史失败: ' + (res.err || res.data.msg));
-               }
-            }catch(e) {
-                console.error(body, e);
-                message.error('添加图表浏览历史失败: ' + e);
-            }
-        }
     },
     subscriptions: {
         setup({ dispatch, history }) {

+ 16 - 9
src/models/chartDesigner.js

@@ -39,7 +39,7 @@ export default {
             header: { label: '无标题' },
             baseConfig: { dataSource: { }, viewType: '' },
             aggregateTableConfig: { targetColumn: {}, statistics: [], groupBy: [] },
-            dataViewConfig: { viewColumns: [], sortColumn: {key: ''}, sortType: 'asc', count: 25 },
+            dataViewConfig: { viewColumns: [], sortColumn: {key: ''}, sortType: 'asc' },
             barConfig: { xAxis: { column: {}, granularity: {} }, yAxis: { column: {}, gauge: {} }, groupBy: {key:''} },
             lineConfig: { xAxis: { column: {}, granularity: {} }, yAxis: { column: {}, gauge: {} }, groupBy: {key:''} },
             pieConfig: { xAxis: { column: {}, granularity: {} }, yAxis: { column: {}, gauge: {} } },
@@ -61,7 +61,7 @@ export default {
             viewType: ''
         },
         aggregateTableConfig: { targetColumn: {}, statistics: [], groupBy: [] },
-        dataViewConfig: { viewColumns: [], sortColumn: {key: ''}, sortType: 'asc', count: 25 },
+        dataViewConfig: { viewColumns: [], sortColumn: {key: ''}, sortType: 'asc' },
         barConfig: { xAxis: { column: {}, granularity: {} }, yAxis: { column: {}, gauge: {} }, groupBy: {key:''} },
         lineConfig: { xAxis: { column: {}, granularity: {} }, yAxis: { column: {}, gauge: {} }, groupBy: {key:''} },
         pieConfig: { xAxis: { column: {}, granularity: {} }, yAxis: { column: {}, gauge: {} } },
@@ -169,8 +169,8 @@ export default {
             }
         },
         *changeDataSource(action, { select, call, put }) {
-            const { code } = action;
-            yield put({ type: 'remoteDataColumn', code });
+            const { dataSource } = action;
+            yield put({ type: 'remoteDataColumn', code: dataSource.code });
         },
         *remoteQucikAdd(action, { select, call, put }) {
             try{
@@ -334,8 +334,7 @@ export default {
                 const { dataViewConfig } = chartDesigner;
                 if(dataViewConfig.viewColumns.length > 0 && 
                     dataViewConfig.sortColumn.key && 
-                    dataViewConfig.sortType && 
-                    dataViewConfig.count) {
+                    dataViewConfig.sortType) {
                     yield put({ type: 'fetchDataViewData' });
                 }else {
                     yield put({ type: 'silentSetField', name: 'chartOption', value: {} });
@@ -511,8 +510,12 @@ export default {
                     columnListName: dataViewConfig.viewColumns.map(c => c.name),
                     sortColumn: dataViewConfig.sortColumn.key,
                     sort: dataViewConfig.sortType,
-                    showLine: dataViewConfig.count,
-                    filters: getBodyFilters(filters)
+                    showLine: 999999,
+                    filters: getBodyFilters(filters),
+                    testPage: {
+                        pageNum: 1,
+                        pageSize: 999999,
+                    }
                 };
                 let res = yield call(service.fetch, {
                     url: URLS.CHART_DATAVIEW_OPTION,
@@ -545,7 +548,11 @@ export default {
                     columnName: targetColumn.name,
                     operatorList: statistics,
                     groupByList: aggregateTableConfig.groupBy && aggregateTableConfig.groupBy.length > 0 ? aggregateTableConfig.groupBy.map(g => g.key) : [],
-                    filters: getBodyFilters(filters)
+                    filters: getBodyFilters(filters),
+                    testPage: {
+                        pageNum: 1,
+                        pageSize: 999,
+                    }
                 };
                 let res = yield call(service.fetch, {
                     url: URLS.CHART_AGGREGATETABLE_OPTION,

+ 0 - 25
src/models/columnType.json

@@ -1,25 +0,0 @@
-[{
-    "dataType": ["String", "BigDecimal"],
-    "columnType": "index",
-    "label": "索引"
-}, {
-    "dataType": ["Date"],
-    "columnType": "time",
-    "label": "时间"
-}, {
-    "dataType": ["String", "BigDecimal"],
-    "columnType": "categorical",
-    "label": "类别"
-}, {
-    "dataType": ["BigDecimal", "Double"],
-    "columnType": "scale",
-    "label": "标量"
-}, {
-    "dataType": ["BigDecimal", "String"],
-    "columnType": "ordinal",
-    "label": "序值"
-}, {
-    "dataType": ["String", "BigDecimal"],
-    "columnType": "string",
-    "label": "文本"
-}]

+ 0 - 19
src/models/dashboard.js

@@ -296,25 +296,6 @@ export default {
                 message.error('移交失败: ' + e);
             }
         },
-        *addHistory(action, { put, call, select }) {
-            const { code } = action;
-            const body = {
-                tarId: code,
-                type: '1'
-            };
-            try {
-               const res = yield call(service.fetch, {
-                   url: URLS.HISTORY_ADD,
-                   body
-               });
-               if(res.err || res.data.code <= 0) {
-                   message.error('添加看板浏览历史失败: ' + (res.err || res.data.msg));
-               }
-            }catch(e) {
-                console.error(body, e);
-                message.error('添加看板浏览历史失败: ' + e);
-            }
-        }
     },
     subscriptions: {
         setup({ dispatch, history}) {

+ 7 - 1
src/models/defaultColumnType.json

@@ -2,5 +2,11 @@
     "String": "categorical",
     "Date": "time",
     "BigDecimal": "scale",
-    "Double": "scale"
+    "Double": "scale",
+    "Long": "scale",
+    "Float": "scale",
+    "Int": "scale",
+    "Boolean": "categorical",
+    "Byte": "string",
+    "Short": "string"
 }

+ 1 - 2
src/models/parseChartOption.js

@@ -284,7 +284,7 @@ function aggregateTableOption( data, aggregateTableConfig) {
 }
 
 function dataViewOption(data, dataViewConfig) {
-    const resData = data.valueList;
+    const resData = data.valueList.list;
 
     let columns = dataViewConfig.viewColumns || [];
     let dataSource = resData || [];
@@ -294,7 +294,6 @@ function dataViewOption(data, dataViewConfig) {
         columns: columns.map(c => ({
             title: c.label,
             dataIndex: c.name,
-            width: 200,
             render: c.type === 'time' ? (v, r, i) => moment(v).format('YYYY-MM-DD') : void(0)
         })),
         dataSource: dataSource.map((d, i) => {

+ 8 - 8
src/models/recent.js

@@ -24,10 +24,10 @@ export default {
     effects: {
         *fetchRecentChart(action, { select, call, put }) {
             try {
-                const main = yield select(state => state.present.main);
-                if(!action.mandatory && main.recentChart.length > 0) {
-                    return;
-                }
+                const recent = yield select(state => state.present.recent);
+                // if(!action.mandatory && recent.recentChart.length > 0) {
+                //     return;
+                // }
                 const res = yield call(service.fetch, {
                     url: URLS.HOMEPAGE_RECENT_CHART_GET,
                 });
@@ -57,10 +57,10 @@ export default {
         },
         *fetchRecentDashboard(action, { select, call, put }) {
             try {
-                const main = yield select(state => state.present.main);
-                if(!action.mandatory && main.recentDashboard.length > 0) {
-                    return;
-                }
+                const recent = yield select(state => state.present.recent);
+                // if(!action.mandatory && recent.recentDashboard.length > 0) {
+                //     return;
+                // }
                 const res = yield call(service.fetch, {
                     url: URLS.HOMEPAGE_RECENT_DASHBOARD_GET,
                 });