From 0011ec870d3d1fe9d77a4941358c84acf8632e5e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 18 五月 2022 22:51:51 +0800
Subject: [PATCH] 2022-05-18

---
 src/menu/components/chart/antv-bar/chartcompile/index.jsx |  122 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 115 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 ee2421e..b2d1d56 100644
--- a/src/menu/components/chart/antv-bar/chartcompile/index.jsx
+++ b/src/menu/components/chart/antv-bar/chartcompile/index.jsx
@@ -206,6 +206,7 @@
         dataIndex: 'title',
         inputType: 'select',
         editable: true,
+        required: false,
         width: '12%',
         options: [
           { value: 'true', text: '鏄剧ず'},
@@ -213,7 +214,23 @@
         ],
         render: (text, record) => {
           let trans = {'true': '鏄剧ず', 'false': '闅愯棌'}
-          return trans[text] || '鏄剧ず'
+          return trans[text] || ''
+        }
+      },
+      {
+        title: '鏄剧ず锛堝��/%锛�',
+        dataIndex: 'show',
+        inputType: 'select',
+        editable: true,
+        required: false,
+        width: '12%',
+        options: [
+          { value: 'value', text: '鏁板��'},
+          { value: 'percent', text: '鐧惧垎姣�'}
+        ],
+        render: (text, record) => {
+          let trans = {'value': '鏁板��', 'percent': '鐧惧垎姣�'}
+          return trans[text] || ''
         }
       },
       {
@@ -257,7 +274,7 @@
       datatype: config.plot.datatype || 'query',
       fieldName: fieldName,
       plot: fromJS(config.plot).toJS(),
-      baseFormlist: getBaseForm(config.plot),
+      baseFormlist: getBaseForm(config.plot, config.columns),
       formlist: getOptionForm(config.plot, config.columns)
     })
   }
@@ -269,7 +286,7 @@
     if (key === 'datatype') {
       this.setState({
         datatype: val,
-        formlist: formlist.map(item => {
+        formlist: fromJS(formlist).toJS().map(item => {
           if (['Yaxis'].includes(item.key)) {
             item.hidden = val === 'statistics'
           } else if (['InfoType', 'InfoValue'].includes(item.key)) {
@@ -278,6 +295,26 @@
           return item
         })
       })
+    } else if (key === 'label') {
+      this.setState({formlist: fromJS(formlist).toJS().map(cell => {
+        if (!['labelColor', 'labelValue'].includes(cell.key)) return cell
+        
+        if (cell.key === 'labelColor') {
+          if (val !== 'true') {
+            cell.hidden = true
+          } else {
+            cell.hidden = false
+          }
+        } else {
+          if (val === 'false') {
+            cell.hidden = true
+          } else {
+            cell.hidden = false
+          }
+        }
+
+        return cell
+      })})
     }
   }
 
@@ -485,6 +522,40 @@
       this.baseRef.handleConfirm().then(res => {
         let _plot = {...plot, ...res}
 
+        if (res.click === 'menu') {
+          delete _plot.menus
+        } else if (res.click === 'menus') {
+          delete _plot.menu
+        } else {
+          delete _plot.menus
+          delete _plot.menu
+        }
+
+        delete _plot.MenuID
+        delete _plot.MenuName
+        delete _plot.MenuNo
+        delete _plot.tabType
+
+        if (_plot.click === 'menu' && sessionStorage.getItem('appType') === '' && _plot.menu) {
+          let list = null
+          try {
+            list = JSON.parse(sessionStorage.getItem('thdMenuList')) || []
+          } catch (e) {
+            list = []
+          }
+    
+          let id = _plot.menu[_plot.menu.length - 1]
+    
+          list.forEach(item => {
+            if (item.MenuID === id) {
+              _plot.MenuID = id
+              _plot.MenuName = item.MenuName
+              _plot.MenuNo = item.MenuNo
+              _plot.tabType = item.type
+            }
+          })
+        }
+
         this.setState({
           plot: _plot,
           visible: false
@@ -562,8 +633,44 @@
       })
     } else if (view === 'base') {
       this.baseRef.handleConfirm().then(res => {
+        let _plot = {...plot, ...res}
+
+        if (res.click === 'menu') {
+          delete _plot.menus
+        } else if (res.click === 'menus') {
+          delete _plot.menu
+        } else {
+          delete _plot.menus
+          delete _plot.menu
+        }
+
+        delete _plot.MenuID
+        delete _plot.MenuName
+        delete _plot.MenuNo
+        delete _plot.tabType
+
+        if (_plot.click === 'menu' && sessionStorage.getItem('appType') === '' && _plot.menu) {
+          let list = null
+          try {
+            list = JSON.parse(sessionStorage.getItem('thdMenuList')) || []
+          } catch (e) {
+            list = []
+          }
+    
+          let id = _plot.menu[_plot.menu.length - 1]
+    
+          list.forEach(item => {
+            if (item.MenuID === id) {
+              _plot.MenuID = id
+              _plot.MenuName = item.MenuName
+              _plot.MenuNo = item.MenuNo
+              _plot.tabType = item.type
+            }
+          })
+        }
+
         this.setState({
-          plot: {...plot, ...res},
+          plot: _plot,
           view: tab
         })
       })
@@ -601,6 +708,7 @@
   }
 
   render() {
+    const { config } = this.props
     const { view, visible, datatype, plot, ramp, colorColumns, rampColorColumns, statColorColumns, rampStatColorColumns, cusColumns, baseFormlist } = this.state
     const formItemLayout = {
       labelCol: {
@@ -618,9 +726,9 @@
         <EditOutlined title="缂栬緫" onClick={this.showDrawer}/>
         <Modal
           wrapClassName="popview-modal menu-chart-edit-modal"
-          title="鍥捐〃缂栬緫"
+          title={config.type === 'bar' ? '鏌辩姸鍥剧紪杈�' : '鎶樼嚎鍥剧紪杈�'}
           visible={visible}
-          width={950}
+          width={1000}
           maskClosable={false}
           onOk={this.onSubmit}
           onCancel={() => { this.setState({ visible: false }) }}
@@ -685,7 +793,7 @@
                 </Form>
               </Col>
               <Col style={{fontSize: '12px', color: '#757575', paddingLeft: '10px'}} span={24}>娉細浣跨敤鑷畾涔夎缃椂锛屾樉绀虹殑鍧愭爣杞寸涓�涓湪宸︿晶锛岀浜屼釜鍦ㄥ彸渚э紝澶氫綑鐨勪笉鐢熸晥銆�</Col>
-              <EditTable actions={['edit', 'move']} data={plot.customs || []} columns={cusColumns} onChange={this.changeCustom}/>
+              <EditTable indexShow={false} actions={['edit', 'move']} data={plot.customs || []} columns={cusColumns} onChange={this.changeCustom}/>
             </TabPane> : null}
           </Tabs>
         </Modal>

--
Gitblit v1.8.0