From 8acfcd6e349ef2d1b797a7483940a2f3f2dfcfe6 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 03 二月 2024 17:49:25 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/menu/components/chart/antv-scatter/chartcompile/index.jsx |  187 ++++------------------------------------------
 1 files changed, 18 insertions(+), 169 deletions(-)

diff --git a/src/menu/components/chart/antv-scatter/chartcompile/index.jsx b/src/menu/components/chart/antv-scatter/chartcompile/index.jsx
index 4d829ba..307f6b6 100644
--- a/src/menu/components/chart/antv-scatter/chartcompile/index.jsx
+++ b/src/menu/components/chart/antv-scatter/chartcompile/index.jsx
@@ -1,16 +1,15 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Modal, Form, Row, Col, Select, Radio, Tooltip, Input, InputNumber, Tabs } from 'antd'
-import { QuestionCircleOutlined, EditOutlined } from '@ant-design/icons'
+import { Modal, Form, Tabs } from 'antd'
+import { EditOutlined } from '@ant-design/icons'
 
 import { getBaseForm, getOptionForm } from './formconfig'
 import asyncComponent from '@/utils/asyncComponent'
-import ColorSketch from '@/mob/colorsketch'
 import './index.scss'
 
 const { TabPane } = Tabs
-const NormalForm = asyncComponent(() => import('@/menu/components/share/normalform'))
+const ModalForm = asyncComponent(() => import('@/components/normalform/modalform'))
 
 class LineChartDrawerForm extends Component {
   static propTpyes = {
@@ -39,156 +38,20 @@
     })
   }
 
-  getFields() {
-    const { formlist } = this.state
-    const { getFieldDecorator } = this.props.form
-    const fields = []
-
-    if (!formlist) {
-      return fields
-    }
-
-    formlist.forEach((item, index) => {
-      if (item.hidden || item.forbid) return
-      
-      if (item.type === 'text') {
-        fields.push(
-          <Col span={12} key={index}>
-            <Form.Item label={item.tooltip ?
-              <Tooltip placement="topLeft" title={item.tooltip}>
-                <QuestionCircleOutlined className="mk-form-tip" />
-                {item.label}
-              </Tooltip> : item.label
-            }>
-              {getFieldDecorator(item.key, {
-                initialValue: item.initVal,
-                rules: [
-                  {
-                    required: !!item.required,
-                    message: '璇疯緭鍏�' + item.label + '!'
-                  }
-                ]
-              })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.onSubmit}/>)}
-            </Form.Item>
-          </Col>
-        )
-      } else if (item.type === 'number') {
-        fields.push(
-          <Col span={12} key={index}>
-            <Form.Item label={item.tooltip ?
-              <Tooltip placement="topLeft" title={item.tooltip}>
-                <QuestionCircleOutlined className="mk-form-tip" />
-                {item.label}
-              </Tooltip> : item.label
-            }>
-              {getFieldDecorator(item.key, {
-                initialValue: item.initVal,
-                rules: [
-                  {
-                    required: !!item.required,
-                    message: '璇疯緭鍏�' + item.label + '!'
-                  }
-                ]
-              })(<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.onSubmit}/>)}
-            </Form.Item>
-          </Col>
-        )
-      } else if (item.type === 'select') { // 涓嬫媺
-        fields.push(
-          <Col span={12} key={index}>
-            <Form.Item label={item.tooltip ?
-              <Tooltip placement="topLeft" title={item.tooltip}>
-                <QuestionCircleOutlined className="mk-form-tip" />
-                {item.label}
-              </Tooltip> : item.label
-            }>
-              {getFieldDecorator(item.key, {
-                initialValue: item.initVal,
-                rules: [
-                  {
-                    required: !!item.required,
-                    message: '璇烽�夋嫨' + item.label + '!'
-                  }
-                ]
-              })(
-                <Select mode={item.multi ? 'multiple' : ''}>
-                  {item.options.map((option, index) =>
-                    <Select.Option key={index} value={option.field || option.value}>
-                      {option.label || option.text}
-                    </Select.Option>
-                  )}
-                </Select>
-              )}
-            </Form.Item>
-          </Col>
-        )
-      } else if (item.type === 'radio') {
-        fields.push(
-          <Col span={12} key={index}>
-            <Form.Item label={item.tooltip ?
-              <Tooltip placement="topLeft" title={item.tooltip}>
-                <QuestionCircleOutlined className="mk-form-tip" />
-                {item.label}
-              </Tooltip> : item.label
-            }>
-              {getFieldDecorator(item.key, {
-                initialValue: item.initVal,
-                rules: [
-                  {
-                    required: !!item.required,
-                    message: '璇烽�夋嫨' + item.label + '!'
-                  }
-                ]
-              })(
-                <Radio.Group disabled={item.readonly}>
-                  {item.options.map(option => {
-                    return (
-                      <Radio key={option.value} value={option.value}>{option.text}</Radio>
-                    )
-                  })}
-                </Radio.Group>
-              )}
-            </Form.Item>
-          </Col>
-        )
-      } else if (item.type === 'color') {
-        fields.push(
-          <Col span={12} key={index}>
-            <Form.Item label={item.tooltip ?
-              <Tooltip placement="topLeft" title={item.tooltip}>
-                <QuestionCircleOutlined className="mk-form-tip" />
-                {item.label}
-              </Tooltip> : item.label
-            }>
-              {getFieldDecorator(item.key, {
-                initialValue: item.initVal
-              })(
-                <ColorSketch />
-              )}
-            </Form.Item>
-          </Col>
-        )
-      }
-    })
-    return fields
-  }
-
   onSubmit = () => {
     const { config } = this.props
     const { plot, view } = this.state
 
     if (view === 'normal') {
-      this.props.form.validateFieldsAndScroll((err, values) => {
-        if (!err) {
-          let _plot = {...plot, ...values}
+      this.normalRef.handleConfirm().then(values => {
+        let _plot = {...plot, ...values}
 
-          this.setState({
-            plot: _plot,
-            visible: false
-          })
+        this.setState({
+          plot: _plot,
+          visible: false
+        })
 
-          this.props.plotchange({...config, plot: _plot})
-        }
+        this.props.plotchange({...config, plot: _plot})
       })
     } else if (view === 'base') {
       this.baseRef.handleConfirm().then(res => {
@@ -208,13 +71,11 @@
     const { plot, view } = this.state
 
     if (view === 'normal') {
-      this.props.form.validateFieldsAndScroll((err, values) => {
-        if (!err) {
-          this.setState({
-            plot: {...plot, ...values},
-            view: tab
-          })
-        }
+      this.normalRef.handleConfirm().then(values => {
+        this.setState({
+          plot: {...plot, ...values},
+          view: tab
+        })
       })
     } else if (view === 'base') {
       this.baseRef.handleConfirm().then(res => {
@@ -228,17 +89,7 @@
 
   render() {
     const { config } = this.props
-    const { view, visible, baseFormlist } = this.state
-    const formItemLayout = {
-      labelCol: {
-        xs: { span: 24 },
-        sm: { span: 6 }
-      },
-      wrapperCol: {
-        xs: { span: 24 },
-        sm: { span: 18 }
-      }
-    }
+    const { view, visible, baseFormlist, formlist } = this.state
 
     return (
       <div className="line-chart-drawer-form">
@@ -255,12 +106,10 @@
           {config.name ? <div className="mk-com-name">{config.name} - 缂栬緫</div> : null}
           <Tabs activeKey={view} className="menu-chart-edit-box" onChange={this.changeTab}>
             <TabPane tab="缁勪欢璁剧疆" key="base">
-              <NormalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/>
+              <ModalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/>
             </TabPane>
             <TabPane tab="鍥捐〃璁剧疆" key="normal">
-              <Form {...formItemLayout}>
-                <Row gutter={16}>{this.getFields()}</Row>
-              </Form>
+              <ModalForm formlist={formlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.normalRef = inst}/>
             </TabPane>
           </Tabs>
         </Modal>

--
Gitblit v1.8.0