Browse Source

柱状图默认最大宽度设为80(原50%)/列表界面图表缩略图不显示label

zhuth 6 years ago
parent
commit
5a9af685e8

+ 5 - 0
src/components/chart/resolveChartThumbnailOption.js

@@ -24,6 +24,11 @@ export default (option) => {
         containLabel: false
     }
     _option.dataZoom = null;
+    _option.series = _option.series ? _option.series.map(s => ({
+        ...s, label: {
+            normal: { show: false }
+        },
+    })) : _option.series;
     // 图形
     if(viewType ==='bar') { // 柱状图
         _option.series = _option.series.map(s => ({

+ 2 - 2
src/components/chartDesigner/sections/style/bar.jsx

@@ -176,13 +176,13 @@ class BarStyle extends React.Component {
             <FormItem label={<Tooltip title="柱条的最大宽度,支持设置成绝对数值或相对于类目宽度的百分比">柱条最大宽度</Tooltip>} {...formItemLayout}>
                 <Input
                     defaultValue={barStyle.barMaxWidth ? barStyle.barMaxWidth : null}
-                    placeholder='50%'
+                    placeholder='80'
                     onBlur={e => {
                         let value = e.target.value;
                         let seriesArr = [];
                         for(let i = 0; i < chartOption.series.length; i++) {
                             seriesArr.push({
-                                barMaxWidth: value || '50%'
+                                barMaxWidth: value || '80'
                             });
                         }
                         dispatch({ type: 'chartDesigner/setFields', fields: [

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

@@ -46,7 +46,6 @@ class Filter extends React.Component {
             ) :
             (filter['value' + index] ? ( filter['value' + index].dynamic ? ( filter['value' + index] ) : moment(filter['value' + index]) ) : null)
         ) : filter['value' + index];
-        console.log(defaultValue);
         const commonProps = { defaultValue }
 
         if(['index', 'string'].indexOf(type) !== -1) {

+ 38 - 8
src/components/dataSource/list.jsx

@@ -11,8 +11,8 @@ import DataPreview from '../common/dataPreview/dataPreview'
 import ListFilter from '../common/listFilter/index'
 import EllipsisTooltip from '../common/ellipsisTooltip/index'
 import Loading from '../common/loading/index'
+import CusIcon from '../common/cusIcon'
 import './list.less'
-import CusIcon from '../common/cusIcon';
 const { Content } = Layout
 const { Option } = Select
 
@@ -148,6 +148,11 @@ class DataSource extends React.Component {
             { pGroups.map(g => (
                 <Breadcrumb.Item key={g.code}>
                     <Tag color={'blue'} >
+                        {g.code === '-1' && <Icon title="分组维护" type="bars" onClick={() => {
+                            this.setState({
+                                visibleGroupManageMentBox: true
+                            });
+                        }}/>}
                         <span onClick={() => {
                             let group = dataSource.groupList.find(group => group.code === g.code);
                             dispatch({ type: 'dataSource/setCurrentGroup', group: group });
@@ -168,7 +173,7 @@ class DataSource extends React.Component {
                                 dispatch({ type: 'dataSource/setCurrentGroup', group });
                             }}
                         >
-                            <Icon style={{ marginLeft: '2px', fontSize: '12px' }} type="down" />
+                            <Icon style={{ marginLeft: '4px', fontSize: '12px' }} type="caret-down" />
                         </GroupSelector>
                     </Tag>
                 </Breadcrumb.Item>
@@ -251,6 +256,36 @@ class DataSource extends React.Component {
                         visibleDataPreviewBox: true
                     });
                 }}><Icon type="search" />预览数据</Menu.Item>
+                {/* <Menu.Item onClick={() => {
+                    dispatch({ type: 'dataSource/remoteDataList', code: selectedRecord.code, page: 1, pageSize: 999999999 }).then(res => {
+                        if(res) {
+                            let tcolumns = []; // 时间类型列
+                            tableToExcel({
+                                fileName: selectedRecord.name,
+                                sheets: [{
+                                    columns: res.columns.map(c => {
+                                        if(c.type === 'time') {
+                                            tcolumns.push(c.name);
+                                        }
+                                        return {
+                                            name: c.label,
+                                            dataIndex: c.name,
+                                            width: 80,
+                                            type: ExcelType[c.type]
+                                        }
+                                    }),
+                                    data: tcolumns.length > 0 ? res.dataSource.map(d => {
+                                        let obj = { ...d };
+                                        tcolumns.forEach(c => {
+                                            obj[c] = new Date(obj[c]).getTime();
+                                        });
+                                        return obj;
+                                    }) : res.dataSource
+                                }]
+                            });
+                        }
+                    });
+                }}><Icon type="export" />导出</Menu.Item> */}
                 <Menu.Divider />
                 { selectedRecord && (currentUser.code === selectedRecord.creatorCode || currentUser.role === 'superAdmin') && <Menu.SubMenu className='setgroupmenu' title={<div><Icon style={{ marginRight: '6px' }} type='profile' />移动到</div>}>
                     {[<Menu.Item key='-1' onClick={() => {
@@ -387,15 +422,10 @@ class DataSource extends React.Component {
                 <Content>
                     <Card bordered={false} className='datasource-body' title={
                         <Row className='datasource-tools' type='flex' justify='space-between'>
-                            <Col style={{ display: 'flex', width: 'calc(100% - 324px)', overflow: 'hidden' }}>
+                            <Col className="groups" style={{ display: 'flex', width: 'calc(100% - 324px)', overflow: 'hidden' }}>
                                 <Checkbox style={{ marginTop: '4px' }} checked={noGroup} onChange={(e) => {
                                     this.setState({noGroup: e.target.checked})
                                 }}>未分组</Checkbox>
-                                <Icon type="bars" onClick={() => {
-                                    this.setState({
-                                        visibleGroupManageMentBox: true
-                                    });
-                                }}/>
                                 { this.generateGroupTags() }
                             </Col>
                             <Col className='search'>

+ 7 - 0
src/models/dataSource.js

@@ -804,8 +804,15 @@ export default {
                         e.initEvent("resize", true, true);
                         window.dispatchEvent(e);
                     }, 20);
+                    return {
+                        columns,
+                        dataSource,
+                        pageSize,
+                        total
+                    }
                 }else {
                     message.error('请求数据列表失败: ' + (res.err || res.data.msg));
+                    return false;
                 }
             }catch(e) {
                 message.error('请求数据列表失败: ' + e.message);

+ 1 - 1
src/models/parseChartOption.js

@@ -195,7 +195,7 @@ function barOption(data, barConfig, themeConfig, styleConfig) {
                 name: groupBy ? s.name : (yAxis.column.label || s.name),
                 type: 'bar',
                 data: s.value,
-                barMaxWidth: barMaxWidth || '50%',
+                barMaxWidth: barMaxWidth || 80,
                 barMinHeight: barMinHeight || 0,
                 barGap: barGap || '30%',
                 stack: !!groupBy && !!groupBy.key && !!stack,