Browse Source

报表复制不切换数据连接时返回0

zhuth 6 years ago
parent
commit
2de3b5a72c

+ 1 - 1
src/components/common/echarts/thumbnail.jsx

@@ -14,7 +14,7 @@ class ThumbnailEcharts extends React.Component {
     componentDidMount() {
         const { dispatch, option } = this.props;
         let base64;
-        if(!option || ((!option.series || option.series.length === 0) && (!option.baseOption || !option.baseOption.series || option.baseOption.series.length === 0))) {
+        if(!option || ((!option.series || option.series.length === 0 || !option.series[0].data || option.series[0].data.length === 0) && (!option.baseOption || !option.baseOption.series || option.baseOption.series.length === 0 || !option.baseOption.series[0].data || option.baseOption.series[0].data.length === 0))) {
             base64 = '';
         }else {
             base64 = this.echartsRef.getEchartsInstance().getDataURL({

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

@@ -47,7 +47,7 @@ class CopyBox extends React.Component {
                         this.setState({
                             loading: true
                         });
-                        dispatch({ type: 'dashboard/copy', dashboardCode: currentDashboardCode, dataConnectCode: selectedDataConnectCode }).then(() => {
+                        dispatch({ type: 'dashboard/copy', dashboardCode: currentDashboardCode, dataConnectCode: selectedDataConnectCode === currentDataConnectCode ? 0 : selectedDataConnectCode }).then(() => {
                             this.setState({
                                 loading: false
                             }, hideBox);

+ 0 - 19
src/components/dashboard/thumbnail.jsx

@@ -1,19 +0,0 @@
-/* thumbnail为data:image/png;base64
-此处alt未定义,只是占位
-*/
-const Thumbnail = ({ type, code, option, thumbnail }) => {
-    if (thumbnail === null) {
-        return (
-            <div style={{ width: '100%', height: '100%' }}>
-                <div className='dashboard-default'></div>
-            </div>
-        );
-    }
-    return (
-        <div style={{ width: '100%', height: '100%' }}>
-            <img src={thumbnail} alt={code} width='100%' height='100%'></img>
-        </div>
-    );
-}
-
-export default Thumbnail;