Browse Source

调整moment的import方式/预览数据功能实现/antd版本更新之后icon的调整/支持批量添加用户到用户组/

zhuth 7 years ago
parent
commit
2e2ac380f2

+ 3 - 0
.gitignore

@@ -13,3 +13,6 @@ gitbook/BI商业智能平台 - 产品文档.pdf
 gitbook/BI商业智能平台 - 研发设计文档.pdf
 gitbook/BI商业智能平台 - 研发设计文档.pdf
 issueMD/
 issueMD/
 yarn.lock
 yarn.lock
+
+# vscode
+.vscode

+ 1 - 1
package.json

@@ -15,7 +15,7 @@
     "dva": "^2.3.1",
     "dva": "^2.3.1",
     "dva-loading": "^2.0.3",
     "dva-loading": "^2.0.3",
     "echarts": "^4.1.0",
     "echarts": "^4.1.0",
-    "echarts-for-react": "^2.0.12-beta.0",
+    "echarts-for-react": "^2.0.14",
     "html2canvas": "^1.0.0-alpha.12",
     "html2canvas": "^1.0.0-alpha.12",
     "jspdf": "^1.4.1",
     "jspdf": "^1.4.1",
     "moment": "^2.22.2",
     "moment": "^2.22.2",

+ 4 - 4
src/components/admin/userGroupManagement.jsx

@@ -144,7 +144,7 @@ class UserGroupManagement extends React.Component {
                         }}>
                         }}>
                             <Icon type="plus-circle-o" />添加用户
                             <Icon type="plus-circle-o" />添加用户
                         </Button>}
                         </Button>}
-                        <AddMemberBox
+                        {this.state.visibleAddMemberBox && <AddMemberBox
                             visibleBox={this.state.visibleAddMemberBox}
                             visibleBox={this.state.visibleAddMemberBox}
                             title='添加用户组成员'
                             title='添加用户组成员'
                             hideBox={() => {
                             hideBox={() => {
@@ -152,11 +152,11 @@ class UserGroupManagement extends React.Component {
                                     visibleAddMemberBox: false
                                     visibleAddMemberBox: false
                                 });
                                 });
                             }}
                             }}
-                            multiple={false}
+                            multiple={true}
                             okHandler={(selectedUser) => {
                             okHandler={(selectedUser) => {
-                                dispatch({ type: 'userGroup/remoteMemberAdd', user: selectedUser, group: selectedGroup });
+                                selectedUser.length > 0 && dispatch({ type: 'userGroup/remoteMemberAdd', userList: selectedUser, group: selectedGroup });
                             }}
                             }}
-                        />
+                        />}
                     </div>
                     </div>
                 </Content>
                 </Content>
             </Layout>
             </Layout>

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

@@ -3,7 +3,7 @@ import { Modal, Layout, Card, Table, Col, Row, Button, Input, Icon, Tag, Checkbo
 import { connect } from 'dva'
 import { connect } from 'dva'
 import FilterBox from '../common/filterBox/filterBox'
 import FilterBox from '../common/filterBox/filterBox'
 import AccessObjectBox from '../datasource/accessObjectBox'
 import AccessObjectBox from '../datasource/accessObjectBox'
-import * as moment from 'moment'
+import moment from 'moment'
 import './distributeBox.less'
 import './distributeBox.less'
 const { Content } = Layout
 const { Content } = Layout
 
 

+ 21 - 4
src/components/chart/list.jsx

@@ -14,6 +14,7 @@ import Thumbnail from './thumbnail'
 import DistributeBox from './distributeBox';
 import DistributeBox from './distributeBox';
 import TransferBox from '../common/selectUserBox/selectUserBox'
 import TransferBox from '../common/selectUserBox/selectUserBox'
 import DeleteBox from '../common/deleteBox/deleteBox'
 import DeleteBox from '../common/deleteBox/deleteBox'
+import DataPreview from '../common/dataPreview/dataPreview'
 const { Content } = Layout
 const { Content } = Layout
 const { Search } = Input
 const { Search } = Input
 const CardGrid = Card.Grid
 const CardGrid = Card.Grid
@@ -29,7 +30,8 @@ class ChartList extends React.Component {
             visibleDistributeBox: false,
             visibleDistributeBox: false,
             visibleTransferBox: false,
             visibleTransferBox: false,
             visibleGroupMenu: false, // 显示分组菜单
             visibleGroupMenu: false, // 显示分组菜单
-            visibleDeleteBox: false
+            visibleDeleteBox: false,
+            visibleDataPreviewBox: false
         }
         }
     }
     }
 
 
@@ -73,6 +75,11 @@ class ChartList extends React.Component {
                 <Menu.Item>
                 <Menu.Item>
                     <Icon type="link" />分享
                     <Icon type="link" />分享
                 </Menu.Item>
                 </Menu.Item>
+                <Menu.Item onClick={() => {
+                    this.setState({
+                        visibleDataPreviewBox: true
+                    });
+                }}><Icon type="search" />预览数据</Menu.Item>
                 {selectedRecord && currentUser.code === selectedRecord.creatorCode && <Menu.Item onClick={() => {
                 {selectedRecord && currentUser.code === selectedRecord.creatorCode && <Menu.Item onClick={() => {
                     const { selectedRecord } = this.state;
                     const { selectedRecord } = this.state;
                     // const selectedChartDataSourceCode = selectedRecord ? selectedRecord.code : '';
                     // const selectedChartDataSourceCode = selectedRecord ? selectedRecord.code : '';
@@ -356,7 +363,7 @@ class ChartList extends React.Component {
     }
     }
 
 
     render() {
     render() {
-        const { visibleChooseDataSourceBox, visibleDistributeBox, visibleTransferBox, visibleDeleteBox, selectedRecord } = this.state;
+        const { visibleChooseDataSourceBox, visibleDistributeBox, visibleTransferBox, visibleDeleteBox, visibleDataPreviewBox, selectedRecord } = this.state;
         const { dispatch, chart } = this.props;
         const { dispatch, chart } = this.props;
         const TAG_COLOR = ['blue'];
         const TAG_COLOR = ['blue'];
         return (
         return (
@@ -459,7 +466,7 @@ class ChartList extends React.Component {
                         })
                         })
                     }}
                     }}
                 />
                 />
-                <DeleteBox
+                {visibleDeleteBox && <DeleteBox
                     visibleDeleteBox={visibleDeleteBox}
                     visibleDeleteBox={visibleDeleteBox}
                     type='chart'
                     type='chart'
                     hideBox={() => {
                     hideBox={() => {
@@ -470,7 +477,17 @@ class ChartList extends React.Component {
                     selectedRecord={selectedRecord}
                     selectedRecord={selectedRecord}
                     onOk={() => {
                     onOk={() => {
                         dispatch({ type: 'chart/remoteDelete', code: this.state.selectedRecord.code })
                         dispatch({ type: 'chart/remoteDelete', code: this.state.selectedRecord.code })
-                    }} />
+                }} />}
+                {visibleDataPreviewBox && <DataPreview
+                    visibleBox={visibleDataPreviewBox}
+                    hideBox={() => {
+                        this.setState({
+                            visibleDataPreviewBox: false
+                        });
+                    }}
+                    byChart={true}
+                    code={selectedRecord.code}
+                />}
             </Layout>
             </Layout>
         )
         )
     }
     }

+ 3 - 0
src/components/chart/list.less

@@ -7,6 +7,9 @@
                 line-height: 1.6;
                 line-height: 1.6;
                 font-size: 20px;
                 font-size: 20px;
                 margin-right: 6px;
                 margin-right: 6px;
+                &> svg {
+                    height: 100%;
+                }
             }
             }
             .group {
             .group {
                 line-height: 2.1;
                 line-height: 2.1;

+ 1 - 1
src/components/chart/resolveChartOption.js

@@ -1,4 +1,4 @@
-import * as moment from 'moment'
+import moment from 'moment'
 import GRANULARITY from '../chartDesigner/sections/granularity'
 import GRANULARITY from '../chartDesigner/sections/granularity'
 
 
 export default (config, styleConfig, silent, thumbnail) => {
 export default (config, styleConfig, silent, thumbnail) => {

+ 2 - 2
src/components/chartDesigner/content.less

@@ -8,11 +8,11 @@
 
 
         .ant-layout-sider-children {
         .ant-layout-sider-children {
             padding-bottom: 40px;
             padding-bottom: 40px;
-            .sider-tabs {
+            .ant-tabs {
                 height: 100%;
                 height: 100%;
                 padding-top: 38px;
                 padding-top: 38px;
                 
                 
-                .ant-tabs-bar {
+                &>.ant-tabs-bar {
                     margin-top: -36px;
                     margin-top: -36px;
                 }
                 }
                 .ant-tabs-content {
                 .ant-tabs-content {

+ 7 - 0
src/components/chartDesigner/sections/baseConfigForm.less

@@ -3,6 +3,10 @@
         display: flex;
         display: flex;
         i {
         i {
             line-height: 30px;
             line-height: 30px;
+            &> svg {
+                height: 100%;
+                font-size: 16px;
+            }
         }
         }
     }
     }
 }
 }
@@ -20,6 +24,9 @@
                     height: 20px;
                     height: 20px;
                     background-size: contain;
                     background-size: contain;
                     margin: 0 auto;
                     margin: 0 auto;
+                    &> svg {
+                        font-size: 24px;
+                    }
                 }
                 }
             }
             }
         }
         }

+ 4 - 4
src/components/chartDesigner/sections/chartType.json

@@ -9,17 +9,17 @@
 }, {
 }, {
     "type": "line",
     "type": "line",
     "label": "折线图",
     "label": "折线图",
-    "icon": "chart-line"
+    "icon": "line-chart"
 }, {
 }, {
     "type": "bar",
     "type": "bar",
     "label": "柱状图",
     "label": "柱状图",
-    "icon": "chart-bar"
+    "icon": "bar-chart"
 }, {
 }, {
     "type": "pie",
     "type": "pie",
     "label": "饼图",
     "label": "饼图",
-    "icon": "chart-pie"
+    "icon": "pie-chart"
 }, {
 }, {
     "type": "scatter",
     "type": "scatter",
     "label": "散点图",
     "label": "散点图",
-    "icon": "chart-scatter"
+    "icon": "dot-chart"
 }]
 }]

+ 63 - 12
src/components/common/dataPreview/dataPreview.jsx

@@ -1,19 +1,70 @@
+import React from 'react'
 import { Modal, Table } from 'antd'
 import { Modal, Table } from 'antd'
 import { connect } from 'dva'
 import { connect } from 'dva'
 import './dataPreview.less'
 import './dataPreview.less'
 
 
-const DataPreview = ({ visibleBox, hideBox, columns, dataSource }) => {
+// const DataPreview = ({ visibleBox, hideBox, columns, dataSource }) => {
+class DataPreview extends React.Component {
     
     
-    return <Modal
-        className='datapreview'
-        visible={visibleBox}
-        footer={null}
-        onCancel={hideBox}
-    ><Table
-        columns={columns}
-        dataSource={dataSource}
-        size='small'
-    /></Modal>
+    constructor(props) {
+        super(props);
+        this.state = {
+            screenWidth: document.documentElement.clientWidth || document.body.clientWidth,
+            screenHeight: document.documentElement.clientHeight || document.body.clientHeight
+        };
+    }
+
+    componentDidMount() {
+        const { byChart, dispatch, code } = this.props;
+        window.addEventListener('resize', this.onWindowResize);
+        dispatch({ type: 'dataList/remoteDataList', byChart, code });
+    }
+
+    componentWillUnmount() {
+        const { dispatch } = this.props;
+        window.removeEventListener('resize', this.onWindowResize);
+        dispatch({ type: 'dataList/reset' });
+    }
+
+    onWindowResize = () => {
+        this.setState({
+            screenWidth: document.documentElement.clientWidth || document.body.clientWidth,
+            screenHeight: document.documentElement.clientHeight || document.body.clientHeight
+        });
+    }
+
+    render() {
+        const { dataList, visibleBox, hideBox } = this.props;
+        const { columns, dataSource } = dataList;
+        const { screenWidth, screenHeight } = this.state;
+        const tableBodyWidth = screenWidth * 0.8 - 10 - 10 - 18;
+        const tableBodyHeight = screenHeight * 0.8 - 40 - 40 - 38;
+        const tableRowHeight = 38;
+
+        return <Modal
+            className='datapreview'
+            width='80%'
+            height='80%'
+            visible={visibleBox}
+            footer={null}
+            onCancel={hideBox}
+            maskClosable={false}
+        >
+            <Table
+                columns={columns.map(c => ({
+                    ...c,
+                    width: 200,
+                }))}
+                dataSource={dataSource.map((d, i) => ({
+                    ...d,
+                    key: i
+                }))}
+                size='small'
+                pagination={{ defaultPageSize: Math.floor(tableBodyHeight/tableRowHeight) || 10 }}
+                scroll={{ x: columns ? columns.length * 200 : tableBodyWidth, y: tableBodyHeight }}
+            />
+        </Modal>
+    }
 }
 }
 
 
-export default connect()(DataPreview);
+export default connect(({ present: { dataList } }) => ({ dataList }))(DataPreview);

+ 44 - 1
src/components/common/dataPreview/dataPreview.less

@@ -1,5 +1,14 @@
 .datapreview {
 .datapreview {
+    overflow: hidden;
+    padding: 0;
+    top: 10%;
+
     .ant-modal-content {
     .ant-modal-content {
+        max-height: 100%;
+        height: 100%;
+        padding-top: 40px;
+        overflow: hidden;
+        
         .ant-modal-close {
         .ant-modal-close {
             .ant-modal-close-x {
             .ant-modal-close-x {
                 width: 40px;
                 width: 40px;
@@ -8,7 +17,41 @@
             }
             }
         }
         }
         .ant-modal-body {
         .ant-modal-body {
-            padding: 40px 24px 0 24px;
+            height: 100%;
+            padding: 0px 10px;
+
+            .ant-table-wrapper {
+                height: 100%;
+
+                .ant-spin-nested-loading {
+                    height: 100%;
+
+                    .ant-spin-container {
+                        height: 100%;
+                        padding-bottom: 40px;
+
+                        .ant-table {
+                            height: 100%;
+                            overflow: hidden;
+
+                            .ant-table-content {
+                                height: 100%;
+
+                                .ant-table-scroll {
+                                    height: 100%;
+                                    
+                                    .ant-table-body {
+                                        height: calc(~"100% - 38px");
+                                    }
+                                }
+                            }
+                        }
+                        .ant-pagination {
+                            margin: 8px 0;
+                        }
+                    }
+                }
+            }
         }
         }
     }
     }
 }
 }

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

@@ -5,7 +5,7 @@ import OPERATORS from './filterOperators.json';
 import './filterBox.less'
 import './filterBox.less'
 import * as service from '../../../services/index'
 import * as service from '../../../services/index'
 import URLS from '../../../constants/url'
 import URLS from '../../../constants/url'
-import * as moment from 'moment';
+import moment from 'moment';
 const FormItem = Form.Item
 const FormItem = Form.Item
 const SelectOption = Select.Option
 const SelectOption = Select.Option
 
 

+ 4 - 2
src/components/common/navigator.less

@@ -10,7 +10,8 @@
             border-bottom: none !important;
             border-bottom: none !important;
             .hover {
             .hover {
                 ::after {
                 ::after {
-                    width: calc(100% - 8px);
+                    z-index: 1;
+                    width: calc(~"100% - 8px");
                 }
                 }
             }
             }
             ::after {
             ::after {
@@ -29,7 +30,8 @@
         }
         }
         .ant-menu-item-selected {
         .ant-menu-item-selected {
             ::after {
             ::after {
-                width: calc(100% - 8px);
+                z-index: 1;
+                width: calc(~"100% - 8px");
                 box-shadow: inset 0 2px #1890ff;
                 box-shadow: inset 0 2px #1890ff;
             }
             }
         }
         }

+ 5 - 2
src/components/common/selectUserBox/selectUserBox.jsx

@@ -12,7 +12,7 @@ class AddGroupMemberBox extends React.Component {
     constructor(props) {
     constructor(props) {
         super(props);
         super(props);
         this.state = {
         this.state = {
-            selectedUser: null,
+            selectedUser: props.multiple ? [] : null,
             userData: [],
             userData: [],
             fetching: false
             fetching: false
         }
         }
@@ -98,7 +98,10 @@ class AddGroupMemberBox extends React.Component {
                             }}
                             }}
                             onChange={(value) => {
                             onChange={(value) => {
                                 this.setState({
                                 this.setState({
-                                    selectedUser: {
+                                    selectedUser: multiple ? value.map(v => ({
+                                        code: v.key,
+                                        name: v.label
+                                    })) : {
                                         code: value.key,
                                         code: value.key,
                                         name: value.label
                                         name: value.label
                                     }
                                     }

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

@@ -3,7 +3,7 @@ import { Modal, Layout, Card, Table, Col, Row, Button, Input, Icon, Tag, Checkbo
 import { connect } from 'dva'
 import { connect } from 'dva'
 import FilterBox from '../common/filterBox/filterBox'
 import FilterBox from '../common/filterBox/filterBox'
 import AccessObjectBox from '../datasource/accessObjectBox'
 import AccessObjectBox from '../datasource/accessObjectBox'
-import * as moment from 'moment'
+import moment from 'moment'
 import './distributeBox.less'
 import './distributeBox.less'
 const { Content } = Layout
 const { Content } = Layout
 
 

+ 1 - 1
src/components/datasource/accessConfig.jsx

@@ -3,7 +3,7 @@ import { connect } from 'dva'
 import { Layout, Card, Row, Col, Table, Input, Checkbox, Button, Switch, Icon, Tag } from 'antd'
 import { Layout, Card, Row, Col, Table, Input, Checkbox, Button, Switch, Icon, Tag } from 'antd'
 import FilterBox from '../common/filterBox/filterBox'
 import FilterBox from '../common/filterBox/filterBox'
 import AccessObjectBox from './accessObjectBox'
 import AccessObjectBox from './accessObjectBox'
-import * as moment from 'moment'
+import moment from 'moment'
 import './accessConfig.less'
 import './accessConfig.less'
 const { Content } = Layout
 const { Content } = Layout
 
 

+ 37 - 17
src/components/datasource/columnConfig.jsx

@@ -1,5 +1,5 @@
 import React from 'react'
 import React from 'react'
-import { Form, Input, Button, Select, Table, Checkbox, Divider, Icon, Popconfirm } from 'antd'
+import { Form, Input, Button, Select, Table, Checkbox, Divider, Icon, Tooltip } from 'antd'
 import { connect } from 'dva'
 import { connect } from 'dva'
 import COLUMN_TYPE from './columnType.json'
 import COLUMN_TYPE from './columnType.json'
 import { Resizable } from 'react-resizable';
 import { Resizable } from 'react-resizable';
@@ -301,23 +301,43 @@ class DataSourceColumnConfig extends React.Component {
                                 </FormItem>
                                 </FormItem>
                                 <div className='buttons'>
                                 <div className='buttons'>
                                     <div className='errormessage' style={{ cursor: dataSource.newOne.invalidSQL ? 'text' : 'default', opacity: dataSource.newOne.invalidSQL ? '1' : '0' }}>未查询到列数据,请检查SQL是否正确</div>
                                     <div className='errormessage' style={{ cursor: dataSource.newOne.invalidSQL ? 'text' : 'default', opacity: dataSource.newOne.invalidSQL ? '1' : '0' }}>未查询到列数据,请检查SQL是否正确</div>
-                                    <Popconfirm
-                                        title="已存在列数据,确定要覆盖吗?"
+                                    <Tooltip
+                                        title={
+                                            <div>
+                                                <div className="ant-popover-message">
+                                                    <Icon type="exclamation-circle" theme="outlined" style={{ color: '#faad14', top: '13px' }} />
+                                                    <div className="ant-popover-message-title">已存在列数据,确定要覆盖吗?</div>
+                                                </div>
+                                                <div className="ant-popover-buttons">
+                                                    <button type="button" className="ant-btn ant-btn-sm" onClick={() => {
+                                                        this.setState({
+                                                            visibleConfirm: false
+                                                        });
+                                                    }}>
+                                                        <span>取 消</span>
+                                                    </button>
+                                                    <button type="button" className="ant-btn ant-btn-primary ant-btn-sm" onClick={() => {
+                                                        this.setState({
+                                                            visibleConfirm: false
+                                                        });
+                                                        dispatch({ type: 'dataSource/importNewModelColumns', cover: true });
+                                                    }}>
+                                                        <span>全部覆盖</span>
+                                                    </button>
+                                                    <button type="button" className="ant-btn ant-btn-primary ant-btn-sm" onClick={() => {
+                                                        this.setState({
+                                                            visibleConfirm: false
+                                                        });
+                                                        dispatch({ type: 'dataSource/importNewModelColumns', cover: false });
+                                                    }}>
+                                                        <span>保留重复</span>
+                                                    </button>
+                                                </div>
+                                            </div>
+                                        }
                                         visible={this.state.visibleConfirm}
                                         visible={this.state.visibleConfirm}
                                         onVisibleChange={this.handleVisibleChange}
                                         onVisibleChange={this.handleVisibleChange}
-                                        onConfirm={() => {
-                                            this.setState({
-                                                visibleConfirm: false
-                                            });
-                                            dispatch({ type: 'dataSource/importNewModelColumns' });
-                                        }}
-                                        onCancel={() => {
-                                            this.setState({
-                                                visibleConfirm: false
-                                            });
-                                        }}
-                                        okText="确定"
-                                        cancelText="取消"
+                                        trigger='click'
                                     >
                                     >
                                         <Button disabled={!dataSource.newOne.address || loading.models.dataSource} onClick={() => {
                                         <Button disabled={!dataSource.newOne.address || loading.models.dataSource} onClick={() => {
                                             if(!dataSource.newOne.columns || dataSource.newOne.columns.length === 0) {
                                             if(!dataSource.newOne.columns || dataSource.newOne.columns.length === 0) {
@@ -329,7 +349,7 @@ class DataSourceColumnConfig extends React.Component {
                                         }
                                         }
                                         {'获取数据列'}
                                         {'获取数据列'}
                                         </Button>
                                         </Button>
-                                    </Popconfirm>
+                                    </Tooltip>
                                 </div>
                                 </div>
                             </Form>
                             </Form>
                             <Divider orientation="left">数据列</Divider>
                             <Divider orientation="left">数据列</Divider>

+ 5 - 45
src/components/datasource/dataSource.jsx

@@ -256,7 +256,6 @@ class DataSource extends React.Component {
         const TAG_COLOR = ['blue'];
         const TAG_COLOR = ['blue'];
         // const TAG_COLOR1 = ['magenta', 'red', 'volcano', 'orange', 'gold', 'lime', 'green', 'cyan', 'blue', 'geekblue', 'purple'];
         // const TAG_COLOR1 = ['magenta', 'red', 'volcano', 'orange', 'gold', 'lime', 'green', 'cyan', 'blue', 'geekblue', 'purple'];
 
 
-        console.log(selectedRecord, currentUser.code)
         const moreOperatingMenu = (
         const moreOperatingMenu = (
             <Menu className='operationmenu' visible={true}>
             <Menu className='operationmenu' visible={true}>
                 <Menu.Item
                 <Menu.Item
@@ -307,7 +306,10 @@ class DataSource extends React.Component {
             width: 100,
             width: 100,
             render: (text, record) => {
             render: (text, record) => {
                 return <div className='datasource-name'>
                 return <div className='datasource-name'>
-                    <div className={`datasource-type type-${record.type.key}`}></div>
+                    <div className={`datasource-type`}>
+                        <Icon type="file-excel" />
+                        {/* <Icon type="database" /> */}
+                    </div>
                     <div>
                     <div>
                         <span>
                         <span>
                             { filterLabel ?
                             { filterLabel ?
@@ -497,49 +499,7 @@ class DataSource extends React.Component {
                                     visibleDataPreviewBox: false
                                     visibleDataPreviewBox: false
                                 });
                                 });
                             }}
                             }}
-                            columns={[{
-                                title: '列1',
-                                dataIndex: 'c1'
-                            }, {
-                                title: '列2',
-                                dataIndex: 'c2'
-                            }, {
-                                title: '列3',
-                                dataIndex: 'c3'
-                            }, {
-                                title: '列4',
-                                dataIndex: 'c4'
-                            }, {
-                                title: '列5',
-                                dataIndex: 'c5'
-                            }, {
-                                title: '列6',
-                                dataIndex: 'c6'
-                            }, {
-                                title: '列7',
-                                dataIndex: 'c7'
-                            }, {
-                                title: '列8',
-                                dataIndex: 'c8'
-                            }, {
-                                title: '列9',
-                                dataIndex: 'c9'
-                            }, {
-                                title: '列10',
-                                dataIndex: 'c10'
-                            }, {
-                                title: '列11',
-                                dataIndex: 'c11'
-                            }]}
-                            dataSource={((count) => {
-                                let arr = [];
-                                for(let i = 0; i < count; i++) {
-                                    arr.push({
-                                        key: i, c1: i+'1', c2: i+'2', c3: i+'3', c4: i+'4', c5: i+'5', c6: i+'6', c7: i+'7', c8: i+'8', c9: i+'9', c10: i+'10', c11: i+'11'
-                                    });
-                                }
-                                return arr;
-                            })(25)}
+                            code={selectedRecord.code}
                         />}
                         />}
                     </Card>
                     </Card>
                 </Content>
                 </Content>

+ 4 - 8
src/components/datasource/dataSource.less

@@ -9,6 +9,9 @@
                     line-height: 1.6;
                     line-height: 1.6;
                     font-size: 20px;
                     font-size: 20px;
                     margin-right: 6px;
                     margin-right: 6px;
+                    &> svg {
+                        height: 100%;
+                    }
                 }
                 }
                 .group {
                 .group {
                     line-height: 2.1;
                     line-height: 2.1;
@@ -66,14 +69,7 @@
                                     .datasource-name {
                                     .datasource-name {
                                         display: flex;
                                         display: flex;
                                         .datasource-type {
                                         .datasource-type {
-                                            width: 20px;
-                                            height: 20px;
-                                            background-size: cover;
-                                            background-repeat: no-repeat;
-                                            background-image: url('https://test-feapp.oss-cn-beijing.aliyuncs.com/feapp/s70f_180613_fix_a_t/images/trdservices/44_2.png');
-                                        }
-                                        .type-oracle {
-                                            background-position: 0 -731px;
+                                            margin-right: 5px;
                                         }
                                         }
                                     }
                                     }
                                     .datasource-tag {
                                     .datasource-tag {

+ 5 - 1
src/constants/url.js

@@ -46,7 +46,7 @@ const URLS = {
 
 
     DATASOURCE_DETAIL: BASE_URL + '/Connector/getDataConnector', // 获得单个数据源详细数据
     DATASOURCE_DETAIL: BASE_URL + '/Connector/getDataConnector', // 获得单个数据源详细数据
 
 
-    DATASOURCE_QUERY_SQLCOLUMNS: BASE_URL + '/implementSql', // 根据sql请求列数据信息
+    DATASOURCE_QUERY_SQLCOLUMNS: BASE_URL + '/Connector/implementSql', // 根据sql请求列数据信息
     
     
     DATASOURCE_QUERY_DATACOLUMNS: BASE_URL + '/DataBase/getColumnData', // 获得数据源下的列
     DATASOURCE_QUERY_DATACOLUMNS: BASE_URL + '/DataBase/getColumnData', // 获得数据源下的列
 
 
@@ -64,6 +64,10 @@ const URLS = {
 
 
     DATASOURCE_TRANSFER: BASE_URL + '/Connector/changeDbOrder', // 数据源移交
     DATASOURCE_TRANSFER: BASE_URL + '/Connector/changeDbOrder', // 数据源移交
 
 
+    DATASOURCE_DATA_LIST: BASE_URL + '/Connector/getConnectorData', // 获取数据列表
+
+    DATASOURCE_DATA_LIST_BY_CHART: BASE_URL + '/getChartsData', // 通过图表code获取数据列表
+
     /***************************************数据连接配置***************************************/
     /***************************************数据连接配置***************************************/
 
 
     DATACONNECT_ADD: BASE_URL + '/DataBase/inputDatabases', // 新增数据连接配置
     DATACONNECT_ADD: BASE_URL + '/DataBase/inputDatabases', // 新增数据连接配置

+ 11 - 7
src/custom.less

@@ -1,11 +1,11 @@
-@import "/fonts/iconfont/custom/iconfont.css"; // 引入自定义的 iconfont
-@import "/fonts/iconfont/default/iconfont.css"; // 引入默认的 iconfont
+// @import "/fonts/iconfont/custom/iconfont.css"; // 引入自定义的 iconfont
+// @import "/fonts/iconfont/default/iconfont.css"; // 引入默认的 iconfont
 
 
-:global(.anticon) {
-    &:before {
-        font-family: "anticon", "anticon-custom" !important
-    }
-}
+// :global(.anticon) {
+//     &:before {
+//         font-family: "anticon", "anticon-custom" !important
+//     }
+// }
 
 
 .ant-dropdown-menu-item-divider, .ant-dropdown-menu-submenu-title-divider {
 .ant-dropdown-menu-item-divider, .ant-dropdown-menu-submenu-title-divider {
     margin: 0;
     margin: 0;
@@ -13,4 +13,8 @@
 
 
 .ant-dropdown-menu {
 .ant-dropdown-menu {
     padding: 0;
     padding: 0;
+}
+
+.ant-popover-message > .anticon {
+    top: 28px;
 }
 }

+ 2 - 0
src/index.js

@@ -13,6 +13,7 @@ import user from './models/user'
 import chartPolicy from './models/chartPolicy'
 import chartPolicy from './models/chartPolicy'
 import dataSourcePolicy from './models/dataSourcePolicy'
 import dataSourcePolicy from './models/dataSourcePolicy'
 import dashboardPolicy from './models/dashboardPolicy'
 import dashboardPolicy from './models/dashboardPolicy'
+import dataList from './models/dataList'
 import './utils/baseUtils'
 import './utils/baseUtils'
 import './index.less'
 import './index.less'
 import createLoading from 'dva-loading';
 import createLoading from 'dva-loading';
@@ -44,6 +45,7 @@ app.model(user); // 用户
 app.model(chartPolicy); // 图表策略
 app.model(chartPolicy); // 图表策略
 app.model(dataSourcePolicy); // 数据源策略
 app.model(dataSourcePolicy); // 数据源策略
 app.model(dashboardPolicy); // 看板策略
 app.model(dashboardPolicy); // 看板策略
+app.model(dataList); // 数据列表
 
 
 // 4. Router
 // 4. Router
 app.router(indexRouter);
 app.router(indexRouter);

+ 1 - 1
src/models/chartPolicy.js

@@ -1,7 +1,7 @@
 import { message } from 'antd'
 import { message } from 'antd'
 import * as service from '../services/index'
 import * as service from '../services/index'
 import URLS from '../constants/url'
 import URLS from '../constants/url'
-import * as moment from 'moment'
+import moment from 'moment'
 
 
 function getBodyFilter(modelFilter) {
 function getBodyFilter(modelFilter) {
     let { name, label, operator, operatorLabel, type, value1, value2 } = modelFilter;
     let { name, label, operator, operatorLabel, type, value1, value2 } = modelFilter;

+ 1 - 1
src/models/dashboardPolicy.js

@@ -1,7 +1,7 @@
 import { message } from 'antd'
 import { message } from 'antd'
 import * as service from '../services/index'
 import * as service from '../services/index'
 import URLS from '../constants/url'
 import URLS from '../constants/url'
-import * as moment from 'moment'
+import  moment from 'moment'
 
 
 function getBodyFilter(modelFilter) {
 function getBodyFilter(modelFilter) {
     let { name, label, operator, operatorLabel, type, value1, value2 } = modelFilter;
     let { name, label, operator, operatorLabel, type, value1, value2 } = modelFilter;

+ 61 - 0
src/models/dataList.js

@@ -0,0 +1,61 @@
+import { message } from 'antd'
+import * as service from '../services/index'
+import URLS from '../constants/url'
+import moment from 'moment'
+
+export default {
+    namespace: 'dataList',
+    state: {
+        columns: [],
+        dataSource: []
+    },
+    reducers: {
+        setColumns(state, action) {
+            const { columns } = action;
+            return { ...state, columns }
+        },
+        setDataSource(state, action) {
+            const { dataSource } = action;
+            return { ...state, dataSource }
+        },
+        reset(state, action) {
+            return { ...state, columns: [], dataSource: [] }
+        }
+    },
+    effects: {
+        *remoteDataList(action, { put, call, select }) {
+            const { byChart, code } = action;
+            const body = code;
+            try {
+                const res = yield call(service.fetch, {
+                    url: byChart ? URLS.DATASOURCE_DATA_LIST_BY_CHART : URLS.DATASOURCE_DATA_LIST,
+                    body
+                });
+                console.log('请求数据列表', body, res);
+                if(!res.err && res.data.code > 0) {
+                    const { columnConfig, values } = res.data.data;
+                    let columns = JSON.parse(columnConfig).map(c => ({
+                        title: c.columnLable,
+                        dataIndex: c.columnName,
+                        render: c.columnType === 'time' ? ((v, r, i) => moment(v).format('YYYY-MM-DD')) : v => v
+                    }));
+                    let dataSource = values;
+                    yield put({ type: 'setColumns', columns });
+                    yield put({ type: 'setDataSource', dataSource });
+                }else {
+                    console.log(body, (res.err || res.data.msg));
+                    message.error('请求数据列表失败: ' + (res.err || res.data.msg));
+                }
+            }catch(e) {
+                console.log(body, e);
+                message.error('请求数据列表失败');
+            }
+        }
+    },
+    subscriptions: {
+        setup({ dispatch, history }) {
+            return history.listen(({ pathname, query }) => {
+            })
+        }
+    }
+};

+ 38 - 7
src/models/dataSource.js

@@ -312,6 +312,8 @@ export default {
         *importNewModelColumns(action, { select, call, put }) {
         *importNewModelColumns(action, { select, call, put }) {
             const dataSource = yield select(state => state.present.dataSource);
             const dataSource = yield select(state => state.present.dataSource);
             const sqlStr = dataSource.newOne.target;
             const sqlStr = dataSource.newOne.target;
+            const oldColumns = dataSource.newOne.columns;
+            const { cover } = action;
             let body = {
             let body = {
                 id: dataSource.newOne.connectCode,
                 id: dataSource.newOne.connectCode,
                 strSql: sqlStr
                 strSql: sqlStr
@@ -329,28 +331,56 @@ export default {
                 console.log('请求列数据', body, res);
                 console.log('请求列数据', body, res);
 
 
                 if(!res.err && res.data.code > 0) {
                 if(!res.err && res.data.code > 0) {
+                    // let columns = res.data.data.map((d, i) => {
+                    //     return {
+                    //         key: i,
+                    //         using: true,
+                    //         name: d,
+                    //         alias: d.remarks ? d.remarks.substring(0, 10) : (d),
+                    //         dataType: d.columnType,
+                    //         columnType: getColumnType(d.columnType),
+                    //         // groupable: d.columnType === 'VARCHAR2',
+                    //         groupable: true,
+                    //         filterable: true,
+                    //         bucketizable: d.columnType === 'NUMBER',
+                    //         description: d.remarks
+                    //     }
+                    // });
                     let columns = res.data.data.map((d, i) => {
                     let columns = res.data.data.map((d, i) => {
                         return {
                         return {
                             key: i,
                             key: i,
                             using: true,
                             using: true,
-                            name: d,
-                            alias: d.remarks ? d.remarks.substring(0, 10) : (d),
+                            name: d.columnName,
+                            alias: d.columnName,
                             dataType: d.columnType,
                             dataType: d.columnType,
                             columnType: getColumnType(d.columnType),
                             columnType: getColumnType(d.columnType),
-                            // groupable: d.columnType === 'VARCHAR2',
-                            groupable: true,
+                            groupable: d.columnType === 'String',
                             filterable: true,
                             filterable: true,
-                            bucketizable: d.columnType === 'NUMBER',
-                            description: d.remarks
+                            // bucketizable: d.columnType === 'BigDecimal',
                         }
                         }
                     });
                     });
                     yield put({ type: 'setNewModelInvalidSQL', value: columns.length === 0 });
                     yield put({ type: 'setNewModelInvalidSQL', value: columns.length === 0 });
-                    yield put({ type: 'setNewModelField', name: 'columns', value: columns });
+                    // yield put({ type: 'setNewModelField', name: 'columns', value: columns });
+                    if(cover) {
+                        yield put({ type: 'setNewModelField', name: 'columns', value: columns });
+                    }else {
+                        let mergeColumns = [];
+                        columns.map(c => {
+                            let tc = oldColumns.find(o => o.name === c.name );
+                            if(tc) {
+                                mergeColumns.push(tc);
+                            }else {
+                                mergeColumns.push(c); 
+                            }
+                        });
+                        yield put({ type: 'setNewModelField', name: 'columns', value: mergeColumns });
+                    }
                 }else {
                 }else {
                     yield put({ type: 'setNewModelInvalidSQL', value: true });
                     yield put({ type: 'setNewModelInvalidSQL', value: true });
                     yield put({ type: 'setNewModelField', name: 'columns', value: [] });
                     yield put({ type: 'setNewModelField', name: 'columns', value: [] });
                 }
                 }
             }catch(e) {
             }catch(e) {
+                console.log(body)
                 yield put({ type: 'setNewModelInvalidSQL', value: true });
                 yield put({ type: 'setNewModelInvalidSQL', value: true });
                 yield put({ type: 'setNewModelField', name: 'columns', value: [] });
                 yield put({ type: 'setNewModelField', name: 'columns', value: [] });
                 message.error('请求列数据错误');
                 message.error('请求列数据错误');
@@ -807,6 +837,7 @@ export default {
                         }
                         }
                     }
                     }
                     yield put({ type: 'list', list });
                     yield put({ type: 'list', list });
+                    yield put({ type: 'chart/fetchList', mandatory: true });
                     message.success('移交成功');
                     message.success('移交成功');
                 }else {
                 }else {
                     console.log(body, (res.err || res.data.msg));
                     console.log(body, (res.err || res.data.msg));

+ 1 - 1
src/models/dataSourcePolicy.js

@@ -1,7 +1,7 @@
 import { message } from 'antd'
 import { message } from 'antd'
 import * as service from '../services/index'
 import * as service from '../services/index'
 import URLS from '../constants/url'
 import URLS from '../constants/url'
-import * as moment from 'moment'
+import  moment from 'moment'
 
 
 function getBodyFilter(modelFilter) {
 function getBodyFilter(modelFilter) {
     let { name, label, operator, operatorLabel, type, value1, value2 } = modelFilter;
     let { name, label, operator, operatorLabel, type, value1, value2 } = modelFilter;

+ 3 - 9
src/models/defaultColumnType.json

@@ -1,11 +1,5 @@
 {
 {
-    "VARCHAR": "categorical",
-    "VARCHAR2": "categorical",
-    "DATE": "time",
-    "NUMBER": "scale",
-    "CLOB": "string",
-    "FLOAT": "scale",
-    "INT": "scale",
-    "INTEGER": "scale",
-    "LONG": "index"
+    "String": "categorical",
+    "Date": "time",
+    "BigDecimal": "scale"
 }
 }

+ 0 - 7
src/models/user.js

@@ -67,14 +67,7 @@ export default {
     },
     },
     subscriptions: {
     subscriptions: {
         setup({ dispatch, history }) {
         setup({ dispatch, history }) {
-            message.config({
-                top: 60,
-                duration: 2,
-                maxCount: 3,
-            });
             return history.listen(({ pathname, query }) => {
             return history.listen(({ pathname, query }) => {
-                let page = pathname.match(/\/(\w*)/)[1];
-                dispatch({ type: 'setPage', page });
             })
             })
         }
         }
     }
     }

+ 3 - 10
src/models/userGroup.js

@@ -228,9 +228,9 @@ export default {
             }
             }
         },
         },
         *remoteMemberAdd(action, { put, call, select }) {
         *remoteMemberAdd(action, { put, call, select }) {
-            const { user, group } = action;
+            const { userList, group } = action;
             const body = {
             const body = {
-                userId: user.code,
+                userList: userList.map(u => u.code),
                 userGroupId: group.code
                 userGroupId: group.code
             };
             };
             try {
             try {
@@ -253,7 +253,7 @@ export default {
         *remoteMemberDelete(action, { put, call, select }) {
         *remoteMemberDelete(action, { put, call, select }) {
             const { userCode, groupCode } = action;
             const { userCode, groupCode } = action;
             const body = {
             const body = {
-                userId: userCode,
+                userList: [userCode],
                 userGroupId: groupCode
                 userGroupId: groupCode
             };
             };
             try {
             try {
@@ -275,14 +275,7 @@ export default {
     },
     },
     subscriptions: {
     subscriptions: {
         setup({ dispatch, history }) {
         setup({ dispatch, history }) {
-            message.config({
-                top: 60,
-                duration: 2,
-                maxCount: 3,
-            });
             return history.listen(({ pathname, query }) => {
             return history.listen(({ pathname, query }) => {
-                let page = pathname.match(/\/(\w*)/)[1];
-                dispatch({ type: 'setPage', page });
             })
             })
         }
         }
     }
     }

+ 1 - 0
src/routes/privateRoute.jsx

@@ -2,6 +2,7 @@ import { Route } from 'dva/router'
 import RootLayout from '../components/common/rootLayout'
 import RootLayout from '../components/common/rootLayout'
 import moment from 'moment'
 import moment from 'moment'
 
 
+console.log(moment);
 export default ({ component: Component, ...rest }) => (
 export default ({ component: Component, ...rest }) => (
     <Route
     <Route
         {...rest}
         {...rest}