zhuth 6 years ago
parent
commit
b5d983868f

+ 8 - 15
src/components/dashboardDesigner/chooseChartBox.jsx

@@ -1,6 +1,6 @@
 import React from 'react'
 import '../../models/dashboardDesigner'
-import { Modal, Checkbox, Row, Col, Table } from 'antd'
+import { Modal, Checkbox, Row, Col, Table, message } from 'antd'
 import { connect } from 'dva'
 import moment from 'moment'
 import 'braft-editor/dist/braft.css'
@@ -56,26 +56,19 @@ class ChooseChartBox extends React.Component {
     }
 
     okHandler = () => {
-        // const { selectedRecord } = this.state;
-        // const { dispatch, hideBox } = this.props;
-        // if(selectedRecord) {
-        //     dispatch({ type: 'dashboardDesigner/addChart', chart: selectedRecord });
-        //     hideBox();
-        // }else {
-        //     message.warning('未选中图表');
-        // }
         const { selectedRecords } = this.state;
         const { dispatch, hideBox } = this.props;
         if(selectedRecords.length > 0) {
             dispatch({ type: 'dashboardDesigner/addCharts', charts: selectedRecords });
+            setTimeout(() => {
+                // 滚动到最底部
+                let viewScrollContent = document.querySelector('.viewlayout');
+                viewScrollContent.scrollTo(0, viewScrollContent.scrollHeight - viewScrollContent.clientHeight);
+            }, 500);
+        }else {
+            message.warning('请选择需要填加的图表');
         }
         hideBox();
-
-        setTimeout(() => {
-            // 滚动到最底部
-            let viewScrollContent = document.querySelector('.viewlayout');
-            viewScrollContent.scrollTo(0, viewScrollContent.scrollHeight - viewScrollContent.clientHeight);
-        }, 500);
     }
 
     onSearch = (list) => {

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

@@ -152,7 +152,7 @@ class DataConnect extends React.Component {
                                 ] });
                             }}
                         >
-                            <Col className='label'>
+                            <Col className='label' title={l.name}>
                                 { (filterItem.name === 'name' && filterLabel) ?
                                     ((l.name || '').split(new RegExp(`(${filterLabel})`, 'i')).map((fragment, i) => {
                                         return (

+ 1 - 1
src/components/dataSourceDetail/dataConnectConfig.jsx

@@ -54,7 +54,7 @@ class DataConnectConfig extends React.Component {
                                 ] });
                             }}
                         >
-                            <Col className='label'>
+                            <Col className='label' title={l.name}>
                                 { (filterLabel) ?
                                     ((l.name || '').split(new RegExp(`(${filterLabel})`, 'i')).map((fragment, i) => {
                                         return (

+ 35 - 7
src/components/dataSourceDetail/header.jsx

@@ -9,6 +9,7 @@ class DataSourceDetailHeader extends React.Component {
         super(props);
         this.state = {
             visibleConfirm: false,
+            visibleSaveConfirm: false,
         }
     }
 
@@ -16,6 +17,10 @@ class DataSourceDetailHeader extends React.Component {
         this.setState({ visibleConfirm: visible });
     }
 
+    handleVisibleSaveConfirmChange = (visible) => {
+        this.setState({ visibleSaveConfirm: visible });
+    }
+
     render() {
         const { dataSourceDetail, dispatch } = this.props;
         const { code, type, name, columns, targetDirty} = dataSourceDetail;
@@ -71,13 +76,36 @@ class DataSourceDetailHeader extends React.Component {
                     }}>
                         <Icon type='left' />返回
                     </Button>}
-                    {code && code !== 'create' && <Button disabled={ ( ( type === 'database' && (!name || targetDirty) ) || ( type === 'file' && +1 === 2) ) ||
-                        (!columns || columns.length === 0)
-                    } onClick={() => {
-                        dispatch({ type: 'dataSource/remoteModify' });
-                    }}>
-                        保存
-                    </Button>}
+                    {code && code !== 'create' && <Popconfirm
+                        placement="bottomLeft"
+                        title={<span style={{ color: 'red' }}>修改数据源可能会对已创建的图表/报表产生影响,是否确认修改?</span>}
+                        visible={this.state.visibleSaveConfirm}
+                        onVisibleChange={this.handleVisibleSaveConfirmChange}
+                        onConfirm={() => {
+                            this.setState({
+                                visibleSaveConfirm: false
+                            }, () => {
+                                dispatch({ type: 'dataSource/remoteModify' });
+                            });
+                        }}
+                        onCancel={() => {
+                            this.setState({
+                                visibleSaveConfirm: false
+                            });
+                        }}
+                        okText="确定"
+                        cancelText="取消"
+                    >
+                        <Button disabled={ ( ( type === 'database' && (!name || targetDirty) ) || ( type === 'file' && +1 === 2) ) ||
+                            (!columns || columns.length === 0)
+                        } onClick={() => {
+                            this.setState({
+                                visibleSaveConfirm: true
+                            });
+                        }}>
+                            保存
+                        </Button>
+                    </Popconfirm>}
                 </div>
             </div>
         );

+ 0 - 2
src/constants/url.js

@@ -1,6 +1,4 @@
 // const BASE_URL = 'http://10.1.1.168:8081/BI/';
-// const BASE_URL = 'http://10.1.80.78:8011/';
-// const BASE_URL = 'http://218.18.115.198:8888/BI/'
 const BASE_URL = ''
 
 /**后台接口地址 */