Browse Source

部分优化逻辑

zhuth 6 years ago
parent
commit
fe056ba878

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

@@ -20,7 +20,7 @@ class ChartCard extends React.Component {
             <Card
                 bordered={false}
                 title={
-                    <Row type='flex' justify='space-between'>
+                    <Row type='flex' justify='space-between' title={chart.name}>
                         <Col className='label' style={{ overflow: 'hidden', textOverflow: 'ellipsis', padding: '0 16px' }} >
                             { (filterItem.name === 'name' && filterLabel) ?
                                 ((chart.name || '').split(new RegExp(`(${filterLabel})`, 'i')).map((fragment, i) => {

+ 15 - 2
src/components/dataSourceDetail/baseConfig.jsx

@@ -89,7 +89,7 @@ class DataSourceBaseConfig extends React.Component {
                     help={validInfo.name.help}
                 >
                     <Input
-                        key={dataSourceDetail.name}
+                        key={dataSourceDetail.code + '-name'}
                         defaultValue={dataSourceDetail.name}
                         onBlur={(e) => {
                             let value = e.target.value;
@@ -100,6 +100,7 @@ class DataSourceBaseConfig extends React.Component {
                         onChange={e => {
                             let val = e.target.value + '';
                             let status, help;
+                            
                             if(val.trim().length === 0) {
                                 status = 'error';
                                 help = '数据源名称不能为空';
@@ -110,6 +111,12 @@ class DataSourceBaseConfig extends React.Component {
                                 status = 'success';
                                 help = '';
                             }
+
+                            // 如果status发生了改变,将数据同步到dataSourceDetail Model
+                            if(validInfo.name.status !== status) {
+                                dispatch({ type: 'dataSourceDetail/setField', name: 'name', value: val });
+                            }
+
                             window.clearTimeout(this.nameTimeout);
                             this.nameTimeout = window.setTimeout(() => {
                                 this.setState({
@@ -263,7 +270,7 @@ class DataSourceBaseConfig extends React.Component {
                      help={validInfo.description.help}
                 >
                     <Input.TextArea
-                        key={dataSourceDetail.description}
+                        key={dataSourceDetail.code+'-description'}
                         autosize={{ minRows: 2, maxRows: 5 }}
                         defaultValue={dataSourceDetail.description}
                         onBlur={(e) => {
@@ -282,6 +289,12 @@ class DataSourceBaseConfig extends React.Component {
                                 status = 'success';
                                 help = '';
                             }
+
+                            // 如果status发生了改变,将数据同步到dataSourceDetail Model
+                            if(validInfo.name.status !== status) {
+                                dispatch({ type: 'dataSourceDetail/setField', name: 'description', value: val });
+                            }
+
                             window.clearTimeout(this.descriptionTimeout);
                             this.descriptionTimeout = window.setTimeout(() => {
                                 this.setState({

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

@@ -27,7 +27,7 @@ class DataSourceDetailHeader extends React.Component {
         const { dataSourceDetail } = this.props;
         const { type, name, columns, targetDirty, description } = dataSourceDetail; 
         return type === 'database' ? (
-            !!name && name.length < 50 && !targetDirty && !!columns && columns.length > 0 && (description === undefined || description === null || description.length <= 150)
+            !!name && name.length <= 50 && !targetDirty && !!columns && columns.length > 0 && (description === undefined || description === null || description.length <= 150)
         ) : ( type === 'file' ? (
             +1 === 2
         ) : false )

+ 1 - 1
src/models/EChartsMedia.js

@@ -25,7 +25,7 @@ export default function(chartType, legendVisible, dataZoomVisible, assignConfig)
                 deepAssign({ legend: { type: 'scroll', right: 'center', top: 50, orient: 'horizontal', width: '90%' }, }, assignConfig)
         }, {
             query: { minWidth: 1000, maxHeight: 1000 }, // F
-            option: deepAssign({ legend: { type: 'scroll', top: 50, right: 50, orient: 'vertical', height: '80%', width: '35%' }, grid: { right: '16%' } }, assignConfig)
+            option: deepAssign({ legend: { type: 'scroll', top: 50, right: 50, bottom: 100, orient: 'vertical', width: '35%' }, grid: { right: '16%' } }, assignConfig)
         }, {
             query: { maxWidth: 1000, maxHeight: 1000 }, // E
             option: !dataZoomVisible ? deepAssign({ legend: { type: 'scroll', right: 'center', bottom: 50, orient: 'horizontal', width: '90%' }, grid: { bottom: 100 } }, assignConfig) :