From 6e106eb13ce404d9955d6c9045d21050d3e08294 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 20 十一月 2020 11:19:36 +0800
Subject: [PATCH] 2020-11-20

---
 src/menu/components/chart/antv-bar/chartcompile/index.jsx |   40 +++++++++++++++++++++++++++++++++-------
 1 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/src/menu/components/chart/antv-bar/chartcompile/index.jsx b/src/menu/components/chart/antv-bar/chartcompile/index.jsx
index 5390f44..283faf1 100644
--- a/src/menu/components/chart/antv-bar/chartcompile/index.jsx
+++ b/src/menu/components/chart/antv-bar/chartcompile/index.jsx
@@ -5,13 +5,14 @@
 
 import Utils from '@/utils/utils.js'
 import { chartColors } from '@/utils/option.js'
-import { getBarOrLineChartOptionForm } from './formconfig'
+import { getBaseForm, getOptionForm } from './formconfig'
 import asyncComponent from '@/utils/asyncComponent'
 import ColorSketch from '@/mob/colorsketch'
 import './index.scss'
 
 const { TabPane } = Tabs
 const EditTable = asyncComponent(() => import('@/templates/zshare/editTable'))
+const NormalForm = asyncComponent(() => import('@/menu/components/share/normalform'))
 
 class LineChartDrawerForm extends Component {
   static propTpyes = {
@@ -29,6 +30,7 @@
     datatype: '',
     plot: null,
     formlist: null,
+    baseFormlist: null,
     fieldName: null,
     colorColumns: [
       {
@@ -166,7 +168,8 @@
       datatype: config.plot.datatype || 'query',
       fieldName: fieldName,
       plot: fromJS(config.plot).toJS(),
-      formlist: getBarOrLineChartOptionForm(config.plot, config.columns, sysRoles, MenuType)
+      baseFormlist: getBaseForm(config.plot, sysRoles, MenuType),
+      formlist: getOptionForm(config.plot, config.columns, MenuType)
     })
   }
 
@@ -218,7 +221,7 @@
                     message: this.props.dict['form.required.input'] + item.label + '!'
                   }
                 ]
-              })(<Input placeholder="" autoComplete="off" disabled={item.readonly}/>)}
+              })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.onSubmit}/>)}
             </Form.Item>
           </Col>
         )
@@ -239,7 +242,7 @@
                     message: this.props.dict['form.required.input'] + item.label + '!'
                   }
                 ]
-              })(<InputNumber min={item.min} max={item.max} precision={item.decimal} />)}
+              })(<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.onSubmit}/>)}
             </Form.Item>
           </Col>
         )
@@ -341,8 +344,10 @@
 
           if (values.datatype === 'statistics' || values.datatype !== plot.datatype) {
             _plot.enabled = 'false'
+            _plot.customs = []
           } else if (!values.Yaxis || !plot.Yaxis || !is(fromJS(values.Yaxis), fromJS(plot.Yaxis))) {
             _plot.enabled = 'false'
+            _plot.customs = []
             _plot.colors = null
           }
 
@@ -357,6 +362,17 @@
 
           this.props.plotchange({...config, plot: _plot})
         }
+      })
+    } else if (view === 'base') {
+      this.baseRef.handleConfirm().then(res => {
+        let _plot = {...plot, ...res}
+
+        this.setState({
+          plot: _plot,
+          visible: false
+        })
+
+        this.props.plotchange({...config, plot: _plot})
       })
     } else {
       this.setState({
@@ -397,7 +413,7 @@
                 name: labels[item] || item,
                 axis: i === 0 ? 'true' : 'false',
                 label: 'false',
-                shape: _plot.chartType === 'bar' ? ['bar', 'rect'] : ['line', 'smooth']
+                shape: _plot.chartType === 'bar' && i === 0 ? ['bar', 'rect'] : ['line', 'smooth']
               }
             })
           }
@@ -423,6 +439,13 @@
             view: tab
           })
         }
+      })
+    } else if (view === 'base') {
+      this.baseRef.handleConfirm().then(res => {
+        this.setState({
+          plot: {...plot, ...res},
+          view: tab
+        })
       })
     } else {
       this.setState({
@@ -457,7 +480,7 @@
   }
 
   render() {
-    const { view, visible, datatype, plot, colorColumns, statColorColumns, cusColumns } = this.state
+    const { view, visible, datatype, plot, colorColumns, statColorColumns, cusColumns, baseFormlist } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -483,7 +506,10 @@
           destroyOnClose
         >
           <Tabs activeKey={view} className="menu-chart-edit-box" onChange={this.changeTab}>
-            <TabPane tab="鍩虹璁剧疆" key="normal">
+            <TabPane tab="缁勪欢璁剧疆" key="base">
+              <NormalForm dict={this.props.dict} formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/>
+            </TabPane>
+            <TabPane tab="鍥捐〃璁剧疆" key="normal">
               <Form {...formItemLayout}>
                 <Row gutter={16}>{this.getFields()}</Row>
               </Form>

--
Gitblit v1.8.0