From 49f09cc6f8ff8c30a75ed1a9d6f510b69b73962a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 12 十二月 2023 21:05:37 +0800
Subject: [PATCH] 2023-12-12

---
 src/menu/components/chart/antv-pie/chartcompile/index.jsx |   64 ++++++++++++++++++++------------
 1 files changed, 40 insertions(+), 24 deletions(-)

diff --git a/src/menu/components/chart/antv-pie/chartcompile/index.jsx b/src/menu/components/chart/antv-pie/chartcompile/index.jsx
index ce879c3..2d6fdc4 100644
--- a/src/menu/components/chart/antv-pie/chartcompile/index.jsx
+++ b/src/menu/components/chart/antv-pie/chartcompile/index.jsx
@@ -1,7 +1,8 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Modal, Form, Row, Col, Select, Icon, Radio, Tooltip, Input, InputNumber, Tabs, Button } from 'antd'
+import { Modal, Form, Row, Col, Select, Radio, Tooltip, Input, notification, InputNumber, Tabs, Button } from 'antd'
+import { QuestionCircleOutlined, EditOutlined } from '@ant-design/icons'
 
 import Utils from '@/utils/utils.js'
 import { getBaseForm, getOptionForm } from './formconfig'
@@ -16,8 +17,6 @@
 
 class LineChartDrawerForm extends Component {
   static propTpyes = {
-    MenuType: PropTypes.any,
-    dict: PropTypes.object,
     plot: PropTypes.object,
     config: PropTypes.object,
     plotchange: PropTypes.func
@@ -28,7 +27,7 @@
     plot: null,
     formlist: null,
     baseFormlist: null,
-    view: 'normal',
+    view: 'base',
     colorColumns: [
       {
         title: '鎸囨爣',
@@ -51,13 +50,13 @@
   }
 
   showDrawer = () => {
-    const { config, MenuType } = this.props
+    const { config } = this.props
 
     this.setState({
       visible: true,
-      view: 'normal',
+      view: 'base',
       plot: fromJS(config.plot).toJS(),
-      baseFormlist: getBaseForm(config.plot, MenuType),
+      baseFormlist: getBaseForm(config.plot),
       formlist: getOptionForm(config.plot, config.columns)
     })
   }
@@ -71,6 +70,10 @@
         formlist: formlist.map(item => {
           if (item.key === 'innerRadius') {
             item.hidden = val === 'pie'
+          } else if (item.key === 'type') {
+            item.hidden = val !== 'nest'
+          } else if (item.key === 'legend') {
+            item.hidden = val === 'nest'
           }
           return item
         })
@@ -101,7 +104,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -110,7 +113,7 @@
                 rules: [
                   {
                     required: !!item.required,
-                    message: this.props.dict['form.required.input'] + item.label + '!'
+                    message: '璇疯緭鍏�' + item.label + '!'
                   }
                 ]
               })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.onSubmit}/>)}
@@ -122,7 +125,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -131,7 +134,7 @@
                 rules: [
                   {
                     required: !!item.required,
-                    message: this.props.dict['form.required.input'] + item.label + '!'
+                    message: '璇疯緭鍏�' + item.label + '!'
                   }
                 ]
               })(<InputNumber min={item.min} max={item.max} precision={item.decimal} onPressEnter={this.onSubmit}/>)}
@@ -143,7 +146,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -152,13 +155,13 @@
                 rules: [
                   {
                     required: !!item.required,
-                    message: this.props.dict['form.required.select'] + item.label + '!'
+                    message: '璇烽�夋嫨' + item.label + '!'
                   }
                 ]
               })(
                 <Select mode={item.multi ? 'multiple' : ''}>
                   {item.options.map((option, index) =>
-                    <Select.Option key={index} value={option.field}>
+                    <Select.Option key={index} value={option.field || option.value}>
                       {option.label}
                     </Select.Option>
                   )}
@@ -172,7 +175,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -181,11 +184,11 @@
                 rules: [
                   {
                     required: !!item.required,
-                    message: this.props.dict['form.required.select'] + item.label + '!'
+                    message: '璇烽�夋嫨' + item.label + '!'
                   }
                 ]
               })(
-                <Radio.Group disabled={item.readonly} onChange={(e) => this.radioChange(e, item.key)}>
+                <Radio.Group style={{whiteSpace: 'nowrap'}} disabled={item.readonly} onChange={(e) => this.radioChange(e, item.key)}>
                   {item.options.map(option => {
                     return (
                       <Radio key={option.value} value={option.value}>{option.text}</Radio>
@@ -201,7 +204,7 @@
           <Col span={12} key={index}>
             <Form.Item label={item.tooltip ?
               <Tooltip placement="topLeft" title={item.tooltip}>
-                <Icon type="question-circle" />
+                <QuestionCircleOutlined className="mk-form-tip" />
                 {item.label}
               </Tooltip> : item.label
             }>
@@ -273,6 +276,18 @@
       this.baseRef.handleConfirm().then(res => {
         let _plot = {...plot, ...res}
 
+        if (!plot.Xaxis && tab === 'color') {
+          this.setState({
+            plot: _plot,
+            view: 'normal'
+          })
+          notification.warning({
+            top: 92,
+            message: '璇锋坊鍔犲浘琛ㄨ缃��',
+            duration: 3
+          })
+          return
+        }
         this.setState({
           plot: _plot,
           view: tab
@@ -305,6 +320,7 @@
   }
 
   render() {
+    const { config } = this.props
     const { visible, plot, colorColumns, view, baseFormlist } = this.state
     const formItemLayout = {
       labelCol: {
@@ -319,10 +335,9 @@
 
     return (
       <div className="line-chart-drawer-form">
-        <Icon type="edit" onClick={this.showDrawer} />
+        <EditOutlined title="缂栬緫" onClick={this.showDrawer} />
         <Modal
-          wrapClassName="popview-modal menu-chart-edit-modal"
-          title="鍥捐〃缂栬緫"
+          wrapClassName="mk-pop-modal"
           visible={visible}
           width={850}
           maskClosable={false}
@@ -330,9 +345,10 @@
           onCancel={() => { this.setState({ visible: false }) }}
           destroyOnClose
         >
+          {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 dict={this.props.dict} formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/>
+              <NormalForm formlist={baseFormlist} inputSubmit={this.onSubmit} wrappedComponentRef={(inst) => this.baseRef = inst}/>
             </TabPane>
             <TabPane tab="鍥捐〃璁剧疆" key="normal">
               <Form {...formItemLayout}>
@@ -341,8 +357,8 @@
             </TabPane>
             {plot ? <TabPane tab="棰滆壊璁剧疆" key="color">
               <div>
-                <Button className="color-add mk-green" onClick={this.addColor}>{this.props.dict['model.add']}</Button>
-                <EditTable data={plot.colors || []} columns={colorColumns} onChange={this.changeColor}/>
+                <Button className="color-add mk-green" onClick={this.addColor}>娣诲姞</Button>
+                <EditTable actions={['edit', 'move', 'del']} data={plot.colors || []} columns={colorColumns} onChange={this.changeColor}/>
               </div>
             </TabPane> : null}
           </Tabs>

--
Gitblit v1.8.0