Browse Source

【bug】部分文本替换/报表元素最小高度调整/报表元素为空时显示替换

zhuth 6 years ago
parent
commit
8dd12653a8

+ 3 - 1
src/components/dashboardDesigner/chartView.jsx

@@ -5,6 +5,7 @@ import RichTextEditor from './richTextEditor'
 import { connect } from 'dva'
 import resolveChartOption from '../chart/resolveChartOption'
 import { hashcode } from '../../utils/baseUtils'
+import EmptyContent from '../common/emptyContent/index'
 
 class ChartView extends React.Component {
     
@@ -28,7 +29,8 @@ class ChartView extends React.Component {
     render() {
         const { item, tableBodyHeight, editMode, dispatch, readOnly } = this.props;
         const { viewType, chartType, content, chartOption, fetching } = item;
-        let children = <div className='chart-default mover'></div>;
+        // let children = <div className='chart-default mover'></div>;
+        let children = <EmptyContent/>;
         
         if(viewType === 'chart') { // 图表类型
             if(chartOption) {

+ 1 - 1
src/components/dashboardDesigner/chooseChartBox.jsx

@@ -200,7 +200,7 @@ class ChooseChartBox extends React.Component {
             width: 120,
             render: (text) => moment(text).format('YYYY-MM-DD')
         }, {
-            title: '说明',
+            title: '备注',
             dataIndex: 'description',
             key: 'description',
             render: (text, record) => {

+ 1 - 1
src/components/dashboardDesigner/configSider.jsx

@@ -93,7 +93,7 @@ class ConfigSider extends React.Component {
                     }}
                 />
             </FormItem>
-            <FormItem label='分享码'>
+            <FormItem label='报表编号'>
                 <Input
                     value={dashboardDesigner.shareCode}
                     onChange={(e) => {

+ 2 - 0
src/components/dashboardDesigner/viewLayout.less

@@ -73,6 +73,8 @@
         background-image: url(../../../static/images/chart-default.png);
         width: 100%;
         height: 100%;
+        max-width: 200px;
+        
         background-position: center;
         background-size: contain;
         background-repeat: no-repeat;

+ 30 - 5
src/components/dataSource/list.jsx

@@ -117,21 +117,32 @@ class DataSource extends React.Component {
         this.setState({ visibleGroupMenu: flag });
     }
 
-    getParens = (group) => {
+    getParents = (group) => {
         const groupData = this.props.dataSource.groupList;
         let pgroups = [group];
         let fgroup = groupData.find(g => g.code === group.pcode);
         if(fgroup) {
-            pgroups = this.getParens(fgroup).concat(pgroups);
+            pgroups = this.getParents(fgroup).concat(pgroups);
         }
         return pgroups;
     }
 
+    getParentsByCode = (groupCode) => {
+        const groupData = this.props.dataSource.groupList;
+        let group = groupData.find(g => g.code === groupCode);
+        console.log(group);
+        if(group) {
+            return this.getParents(group);
+        }else {
+            return [{ label: '未分组' }]
+        }
+    }
+
     generateGroupTags = () => {
         const { dataSource, dispatch } = this.props;
         const { noGroup } = this.state;
         const { currentGroup } = dataSource;
-        const pGroups = (currentGroup) ? [{ code: '-1', label: '全部分组' }].concat(this.getParens(currentGroup)) : [{ code: '-1', label: '全部分组' }];
+        const pGroups = (currentGroup) ? [{ code: '-1', label: '全部分组' }].concat(this.getParents(currentGroup)) : [{ code: '-1', label: '全部分组' }];
         return <Breadcrumb className={`group${noGroup ? ' nogroup' : ''}`} separator=">">
             { pGroups.map(g => (
                 <Breadcrumb.Item key={g.code}>
@@ -300,6 +311,20 @@ class DataSource extends React.Component {
                     </div>
                 </div>
             }
+        }, {
+            title: '分组',
+            dataIndex: 'groupCode',
+            key: 'groupCode',
+            width: 100,
+            onCell: () => {
+                return {
+                    style: {
+                        whiteSpace: 'nowrap',
+                        maxWidth: 100,
+                    }
+                }
+            },
+            render: (text) => <EllipsisTooltip title={this.getParentsByCode(text).map(g => g.label).join('/')}>{this.getParentsByCode(text).map(g => g.label).join('/')}</EllipsisTooltip>,
         }, {
             title: '数据链接',
             dataIndex: 'dbConfig.name',
@@ -318,7 +343,7 @@ class DataSource extends React.Component {
             title: '创建人',
             dataIndex: 'creatorName',
             key: 'creatorName',
-            width: 100,
+            width: 80,
             render: (text, record) => {
                 return (
                     <span>
@@ -349,7 +374,7 @@ class DataSource extends React.Component {
                     <Icon type="setting" />
                 </Dropdown>
             ),
-            width: 50
+            width: 30
         }];
 
         return ( 

+ 1 - 1
src/models/dashboardDesigner.js

@@ -87,7 +87,7 @@ export default {
         originData: {
             code: null,
             name: '无标题',
-            defaultLayout: { x: 0, y: 50, w: 12, h: 6, minW: 2, maxW: 12, minH: 1 },
+            defaultLayout: { x: 0, y: 50, w: 12, h: 6, minW: 2, maxW: 12, minH: 4 },
             items: [],
             chartCodes: [], // 报表包含的所有图表
             description: '',