From 51a60b5cb00fdeaf9e42c29341242460bf2154e8 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 18 九月 2020 09:37:22 +0800
Subject: [PATCH] 2020-09-18

---
 src/menu/components/chart/antv-bar/index.jsx                 |    1 
 src/menu/components/tabs/tabcomponents/index.jsx             |   60 ++++++
 src/menu/components/tabs/tabcomponents/index.scss            |    6 
 src/tabviews/custom/components/chart/antv-bar-line/index.jsx |  187 +++++++++++---------
 src/tabviews/custom/index.jsx                                |  135 ++++++++------
 src/tabviews/custom/index.scss                               |   23 --
 src/menu/components/tabs/tabcomponents/card.jsx              |    2 
 src/menu/components/tabs/antv-tabs/index.jsx                 |   37 +++
 src/menu/menushell/index.jsx                                 |   29 +++
 src/tabviews/zshare/chartcomponent/index.jsx                 |   19 +
 src/views/menudesign/index.jsx                               |   21 --
 11 files changed, 314 insertions(+), 206 deletions(-)

diff --git a/src/menu/components/chart/antv-bar/index.jsx b/src/menu/components/chart/antv-bar/index.jsx
index 6c216a0..c16378f 100644
--- a/src/menu/components/chart/antv-bar/index.jsx
+++ b/src/menu/components/chart/antv-bar/index.jsx
@@ -68,6 +68,7 @@
         uuid: card.uuid,
         type: card.type,
         floor: card.floor,
+        tabId: card.tabId || '',
         parentId: card.parentId || '',
         format: 'array',   // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡
         pageable: false,   // 缁勪欢灞炴�� - 鏄惁鍙垎椤�
diff --git a/src/menu/components/tabs/antv-tabs/index.jsx b/src/menu/components/tabs/antv-tabs/index.jsx
index 4c572a4..c36136a 100644
--- a/src/menu/components/tabs/antv-tabs/index.jsx
+++ b/src/menu/components/tabs/antv-tabs/index.jsx
@@ -40,12 +40,14 @@
         uuid: tabs.uuid,
         type: tabs.type,
         floor: tabs.floor,
+        tabId: tabs.tabId || '',
+        parentId: tabs.parentId || '',
         subtype: tabs.subtype,
         setting: {span: 12, position: 'top', tabStyle: 'line', name: tabs.name},
         subtabs: [
-          { uuid: Utils.getuuid(), label: 'Tab 1', icon: '', components: [] },
-          { uuid: Utils.getuuid(), label: 'Tab 2', icon: '', components: [] },
-          { uuid: Utils.getuuid(), label: 'Tab 3', icon: '', components: [] }
+          { uuid: Utils.getuuid(), parentId: tabs.uuid, floor: tabs.floor, label: 'Tab 1', icon: '', components: [] },
+          { uuid: Utils.getuuid(), parentId: tabs.uuid, floor: tabs.floor, label: 'Tab 2', icon: '', components: [] },
+          { uuid: Utils.getuuid(), parentId: tabs.uuid, floor: tabs.floor, label: 'Tab 3', icon: '', components: [] }
         ]
       }
       this.setState({
@@ -61,6 +63,28 @@
 
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.state), fromJS(nextState))
+  }
+
+  componentDidMount () {
+    MKEmitter.addListener('tabsChange', this.handleTabsChange)
+  }
+
+  /**
+   * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆
+   */
+  componentWillUnmount () {
+    this.setState = () => {
+      return
+    }
+    MKEmitter.removeListener('tabsChange', this.handleTabsChange)
+  }
+
+  handleTabsChange = (parentId) => {
+    const { tabs } = this.state
+
+    if (parentId === tabs.parentId) {
+      MKEmitter.emit('tabsChange', tabs.uuid)
+    }
   }
 
   updateComponent = (component) => {
@@ -93,10 +117,15 @@
   }
 
   tabAdd = (e) => {
+    const { tabs } = this.state
+
     e.stopPropagation()
+
     this.setState({
       editab: {
         uuid: '',
+        parentId: tabs.uuid,
+        floor: tabs.floor,
         label: '',
         icon: '',
         components: []
@@ -188,7 +217,7 @@
                 <span>{tab.icon ? <Icon type={tab.icon} /> : null}{tab.label}</span>
               </Popover>
             } key={tab.uuid}>
-              <TabComponents menu={menu} parentId={tabs.uuid} config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} />
+              <TabComponents menu={menu} config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} />
             </TabPane>
           ))}
           <TabPane className="tab-add" disabled tab={<Icon onClick={this.tabAdd} type="plus" />} key="add"></TabPane>
diff --git a/src/menu/components/tabs/tabcomponents/card.jsx b/src/menu/components/tabs/tabcomponents/card.jsx
index 6a79fd2..b8cdee2 100644
--- a/src/menu/components/tabs/tabcomponents/card.jsx
+++ b/src/menu/components/tabs/tabcomponents/card.jsx
@@ -8,7 +8,7 @@
 const AntvBar = asyncComponent(() => import('@/menu/components/chart/antv-bar'))
 const AntvTabs = asyncComponent(() => import('@/menu/components/tabs/antv-tabs'))
 
-const Card = ({ id, menu, card, moveCard, findCard, delCard, hasDrop, doubleClickCard, updateConfig }) => {
+const Card = ({ id, menu, card, moveCard, findCard, delCard, hasDrop, updateConfig }) => {
   const originalIndex = findCard(id).index
   const [{ isDragging }, drag] = useDrag({
     item: { type: 'menu', id, originalIndex, floor: card.floor },
diff --git a/src/menu/components/tabs/tabcomponents/index.jsx b/src/menu/components/tabs/tabcomponents/index.jsx
index 1d409e6..14b4604 100644
--- a/src/menu/components/tabs/tabcomponents/index.jsx
+++ b/src/menu/components/tabs/tabcomponents/index.jsx
@@ -2,13 +2,15 @@
 import { useDrop } from 'react-dnd'
 import { is, fromJS } from 'immutable'
 import update from 'immutability-helper'
-import { Empty, notification } from 'antd'
+import { Empty, notification, Modal } from 'antd'
 
 import Utils from '@/utils/utils.js'
 import Card from './card'
 import './index.scss'
 
-const Container = ({menu, parentId, config, handleList, deleteCard, doubleClickCard }) => {
+const { confirm } = Modal
+
+const Container = ({menu, config, handleList }) => {
   let target = null
 
   const [cards, setCards] = useState(config.components)
@@ -38,6 +40,28 @@
     handleList({...config, components: cards.map(item => item.uuid === element.uuid ? element : item)})
   }
 
+  const deleteCard = (id) => {
+    const { card } = findCard(id)
+
+    let hasComponent = false
+    if (card.type === 'tabs') {
+      card.subtabs.forEach(tab => {
+        if (tab.components.length > 0) {
+          hasComponent = true
+        }
+      })
+    }
+
+    confirm({
+      title: `纭畾鍒犻櫎銆�${card.setting.name}銆嬪悧锛焋,
+      content: hasComponent ? '褰撳墠缁勪欢涓惈鏈夊瓙缁勪欢锛�' : '',
+      onOk() {
+        handleList({...config, components: cards.filter(item => item.uuid !== card.uuid)})
+      },
+      onCancel() {}
+    })
+  }
+
   const [, drop] = useDrop({
     accept: 'menu',
     drop(item) {
@@ -55,15 +79,40 @@
           })
           return
         }
+      } else if (item.component === 'tabs' && config.floor === 3) {
+        notification.warning({
+          top: 92,
+          message: '鏍囩椤垫渶澶氫负涓夐噸缁撴瀯锛�',
+          duration: 5
+        })
+        return
+      }
+
+      let name = ''
+      let names = {
+        bar: '鏌辩姸鍥�',
+        line: '鎶樼嚎鍥�',
+        tabs: '鏍囩缁�'
+      }
+      let i = 1
+      
+      while (!name && names[item.component]) {
+        let _name = names[item.component] + i
+        if (config.components.filter(com => com.setting && com.setting.name === _name).length === 0) {
+          name = _name
+        }
+        i++
       }
       
       let newcard = {
         uuid: Utils.getuuid(),
+        tabId: config.uuid,
+        parentId: config.parentId,
         type: item.component,
         subtype: item.subtype,
-        parentId: parentId,
-        floor: 2,   // 缁勪欢鐨勫眰绾�
-        isNew: true // 鏂版坊鍔犳爣蹇楋紝鐢ㄤ簬鍒濆鍖�
+        name: name,
+        floor: config.floor ? (config.floor + 1) : 2, // 缁勪欢鐨勫眰绾�
+        isNew: true                                   // 鏂版坊鍔犳爣蹇楋紝鐢ㄤ簬鍒濆鍖�
       }
       
       let targetId = cards.length > 0 ? cards[cards.length - 1].uuid : 0
@@ -97,7 +146,6 @@
           findCard={findCard}
           hasDrop={hasDrop}
           updateConfig={updateConfig}
-          doubleClickCard={doubleClickCard}
         />
       ))}
       {cards.length === 0 ?
diff --git a/src/menu/components/tabs/tabcomponents/index.scss b/src/menu/components/tabs/tabcomponents/index.scss
index 05bb661..fa3a441 100644
--- a/src/menu/components/tabs/tabcomponents/index.scss
+++ b/src/menu/components/tabs/tabcomponents/index.scss
@@ -23,11 +23,11 @@
       transition: opacity 0.2s;
     }
   }
-  .mk-component-card:hover {
-    .remove-component {
+  >.mk-component-card:hover {
+    >.remove-component {
       opacity: 1;
     }
-    .model-datasource > .anticon-setting, .model-menu-tabs-setting > .anticon-setting {
+    > div >.model-datasource .anticon-setting, >.menu-tabs-edit-box > .model-menu-tabs-setting  .anticon-setting {
       opacity: 1;
     }
   }
diff --git a/src/menu/menushell/index.jsx b/src/menu/menushell/index.jsx
index 55b5805..79a1223 100644
--- a/src/menu/menushell/index.jsx
+++ b/src/menu/menushell/index.jsx
@@ -2,13 +2,15 @@
 import { useDrop } from 'react-dnd'
 import { is, fromJS } from 'immutable'
 import update from 'immutability-helper'
-import { Empty, notification } from 'antd'
+import { Empty, notification, Modal } from 'antd'
 
 import Utils from '@/utils/utils.js'
 import Card from './card'
 import './index.scss'
 
-const Container = ({menu, handleList, deleteCard, doubleClickCard }) => {
+const { confirm } = Modal
+
+const Container = ({menu, handleList, doubleClickCard }) => {
   let target = null
 
   const [cards, setCards] = useState(menu.components)
@@ -38,10 +40,33 @@
     handleList({...menu, components: cards.map(item => item.uuid === element.uuid ? element : item)})
   }
 
+  const deleteCard = (id) => {
+    const { card } = findCard(id)
+
+    let hasComponent = false
+    if (card.type === 'tabs') {
+      card.subtabs.forEach(tab => {
+        if (tab.components.length > 0) {
+          hasComponent = true
+        }
+      })
+    }
+
+    confirm({
+      title: `纭畾鍒犻櫎銆�${card.setting.name}銆嬪悧锛焋,
+      content: hasComponent ? '褰撳墠缁勪欢涓惈鏈夊瓙缁勪欢锛�' : '',
+      onOk() {
+        handleList({...menu, components: cards.filter(item => item.uuid !== card.uuid)})
+      },
+      onCancel() {}
+    })
+  }
+
   const [, drop] = useDrop({
     accept: 'menu',
     drop(item) {
       if (item.hasOwnProperty('originalIndex') || item.added) {
+        delete item.added // 鍒犻櫎缁勪欢娣诲姞鏍囪
         return
       }
       if (item.component === 'search') { // 鎼滅储缁勪欢涓嶅彲閲嶅娣诲姞
diff --git a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
index 0b72187..c74f855 100644
--- a/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-bar-line/index.jsx
@@ -31,12 +31,15 @@
     dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, // 瀛楀吀
     config: true,              // 鍥捐〃閰嶇疆淇℃伅
     empty: true,               // 鍥捐〃鏁版嵁涓虹┖
+    loading: false,            // 鏁版嵁鍔犺浇鐘舵��
     chartId: Utils.getuuid(),  // 鍥捐〃Id
     title: '',                 // 缁勪欢鏍囬
     sync: false,               // 鏄惁缁熶竴璇锋眰鏁版嵁
     plot: null,                // 鍥捐〃璁剧疆
     data: null,                // 鏁版嵁
     search: null,              // 鎼滅储鏉′欢
+    vFields: [],               // 鏁板�煎瓧娈�
+    vstFields: null,           // 缁熻鏁版嵁鍊煎瓧娈典俊鎭�
     chartData: [],             // 鍥捐〃鏁版嵁
     chartFields: [],           // 缁熻鍥捐〃鐢熸垚瀛楁闆�
     selectFields: [],          // 缁熻鍥捐〃閫夋嫨瀛楁
@@ -55,9 +58,54 @@
       _sync = false
     }
 
+    let vFields = []
+    let percentFields = []
+    let vstFields = null
+
+    if (_config.plot.datatype === 'statistics') {
+      let _column = _config.columns.filter(col => _config.plot.InfoValue === col.field)[0]
+      if (_column) {
+        let decimal = 0
+
+        if (/Decimal/ig.test(_column.datatype)) {
+          decimal = +_column.datatype.replace(/^Decimal\(18,/ig, '').replace(/\)/ig, '')
+        }
+
+        vstFields = {
+          label: _column.label,
+          field: _column.field,
+          show: _config.plot.show,
+          decimal
+        }
+      }
+    } else {
+      let _vFields = _config.plot.Yaxis && typeof(_config.plot.Yaxis) === 'string' ? [_config.plot.Yaxis] : _config.plot.Yaxis
+      _config.columns.forEach(col => {
+        if (_vFields.includes(col.field)) {
+          let decimal = 0
+          if (/Decimal/ig.test(col.datatype)) {
+            decimal = +col.datatype.replace(/^Decimal\(18,/ig, '').replace(/\)/ig, '')
+          }
+          vFields.push({
+            label: col.label,
+            field: col.field,
+            show: _config.plot.show,
+            decimal
+          })
+
+          if (_config.plot.show === 'percent') {
+            percentFields.push(col.label)
+          }
+        }
+      })
+    }
+
     this.setState({
       config: _config,
       data: _data,
+      vFields: vFields,
+      vstFields: vstFields,
+      percentFields: percentFields,
       arr_field: _config.columns.map(col => col.field).join(','),
       plot: _config.plot,
       sync: _sync,
@@ -66,8 +114,14 @@
     }, () => {
       if (config.setting.sync !== 'true') {
         this.loadData()
-      } else if (config.setting.sync === 'true' && _data) {
-        this.handleData()
+      } else if (config.setting.sync === 'true') {
+        if (!_data) {
+          this.setState({
+            loading: true
+          })
+        } else {
+          this.handleData()
+        }
       }
     })
   }
@@ -76,43 +130,7 @@
    * @description 鏍¢獙鍥捐〃鐨勬寜閽粍锛屽鏋滀负缁熻鍥捐〃锛岃绠楀浘琛ㄥ瓧娈�
    */
   componentDidMount () {
-    // const { plot, data, config } = this.props
-    // let _state = {}
-    // let percentFields = []
 
-    // if (plot.datatype === 'statistics' && (plot.chartType === 'line' || plot.chartType === 'bar')) {
-    //   let result = this.getStaticMsg(data)
-    //   _state.chartData = result.data
-    //   _state.chartFields = result.chartFields
-    //   _state.selectFields = result.selectFields
-
-    //   let _column = config.columns.filter(col => plot.InfoValue === col.field)[0]
-
-    //   if (_column && _column.format === 'percent') {
-    //     percentFields.push(plot.InfoValue)
-    //     _state.percentFields = percentFields
-    //   }
-
-    //   this.setState(_state, () => {
-    //     this.viewrender()
-    //   })
-    // } else {
-    //   if (plot.chartType === 'line' || plot.chartType === 'bar') {
-    //     try {
-    //       plot.Yaxis.forEach(yaxis => {
-    //         let _column = config.columns.filter(col => yaxis === col.field)[0]
-    //         if (_column && _column.format === 'percent') {
-    //           percentFields.push(_column.label)
-    //         }
-    //       })
-    //     } catch {
-    //       console.warn('Incorrect percentage setting')
-    //     }
-    //   }
-    //   this.setState({ percentFields }, () => {
-    //     this.viewrender()
-    //   })
-    // }
   }
 
   /**
@@ -127,7 +145,7 @@
         _data = nextProps.data[config.dataName] || []
       }
 
-      this.setState({sync: false, data: _data}, () => {
+      this.setState({sync: false, loading: false, data: _data}, () => {
         this.handleData()
       })
     }
@@ -154,6 +172,12 @@
         }
         this.viewrender()
       })
+    } else {
+      let _element = document.getElementById(this.state.chartId)
+      if (_element) {
+        _element.innerHTML = ''
+      }
+      this.viewrender()
     }
   }
 
@@ -201,9 +225,7 @@
    * 3銆佹煴鐘跺浘鏁版嵁琛ラ綈
    */
   getdata = () => {
-    const { data, plot, config } = this.props
-    let vFields = plot.Yaxis && typeof(plot.Yaxis) === 'string' ? [plot.Yaxis] : plot.Yaxis
-    let _columns = config.columns.filter(col => vFields.includes(col.field))
+    const { data, plot, vFields } = this.state
 
     if (!data) {
       this.setState({empty: true})
@@ -216,14 +238,14 @@
     if (plot.repeat === 'average') {
       let _mdata = new Map()
       _cdata.forEach(item => {
-        _columns.forEach(col => {
+        vFields.forEach(col => {
           if (typeof(item[col.field]) !== 'number') {
             item[col.field] = parseFloat(item[col.field])
             if (isNaN(item[col.field])) {
               item[col.field] = 0
             }
           }
-          if (col.format === 'percent') {
+          if (col.show === 'percent') {
             item[col.field] = item[col.field] * 100
           }
         })
@@ -234,8 +256,8 @@
         } else if (item[plot.Xaxis]) {
           let _item = _mdata.get(item[plot.Xaxis])
           _item.$count++
-          vFields.forEach(field => {
-            _item[field] += item[field]
+          vFields.forEach(col => {
+            _item[col.field] += item[col.field]
           })
           _mdata.set(item[plot.Xaxis], _item)
         }
@@ -243,7 +265,7 @@
 
       _data = [..._mdata.values()]
       _data = _data.map(item => {
-        _columns.forEach(col => {
+        vFields.forEach(col => {
           item[col.field] = item[col.field] / item.$count
           item[col.field] = item[col.field].toFixed(col.decimal)
           item[col.field] = +item[col.field]
@@ -253,14 +275,14 @@
     } else if (plot.repeat === 'cumsum') {
       let _mdata = new Map()
       _cdata.forEach(item => {
-        _columns.forEach(col => {
+        vFields.forEach(col => {
           if (typeof(item[col.field]) !== 'number') {
             item[col.field] = parseFloat(item[col.field])
             if (isNaN(item[col.field])) {
               item[col.field] = 0
             }
           }
-          if (col.format === 'percent') {
+          if (col.show === 'percent') {
             item[col.field] = item[col.field] * 100
           }
         })
@@ -269,8 +291,8 @@
           _mdata.set(item[plot.Xaxis], item)
         } else if (item[plot.Xaxis]) {
           let _item = _mdata.get(item[plot.Xaxis])
-          vFields.forEach(field => {
-            _item[field] += item[field]
+          vFields.forEach(col => {
+            _item[col.field] += item[col.field]
           })
           _mdata.set(item[plot.Xaxis], _item)
         }
@@ -278,7 +300,7 @@
 
       _data = [..._mdata.values()]
       _data = _data.map(item => {
-        _columns.forEach(col => {
+        vFields.forEach(col => {
           item[col.field] = item[col.field].toFixed(col.decimal)
           item[col.field] = +item[col.field]
         })
@@ -288,14 +310,14 @@
       let _mdata = new Map()
       _cdata.forEach(item => {
         if (item[plot.Xaxis] && !_mdata.has(item[plot.Xaxis])) {
-          _columns.forEach(col => {
+          vFields.forEach(col => {
             if (typeof(item[col.field]) !== 'number') {
               item[col.field] = parseFloat(item[col.field])
               if (isNaN(item[col.field])) {
                 item[col.field] = 0
               }
             }
-            if (col.format === 'percent') {
+            if (col.show === 'percent') {
               item[col.field] = item[col.field] * 100
             }
             item[col.field] = item[col.field].toFixed(col.decimal)
@@ -315,7 +337,7 @@
           let _val = Array( i + 2 ).join(' ')
           let _cell = {}
           _cell[plot.Xaxis] = _val
-          _columns.forEach(col => {
+          vFields.forEach(col => {
             _cell[col.field] = ''
           })
   
@@ -332,16 +354,16 @@
    * @description 缁熻鏁版嵁棰勫鐞嗭紝鍔ㄦ�佺敓鎴愮粺璁″瓧娈靛苟杩涜鏁版嵁杞崲
    */
   getStaticMsg = (data) => {
-    const { plot, config } = this.props
+    const { plot, vstFields } = this.state
 
-    let _column = config.columns.filter(col => plot.InfoValue === col.field)[0]
     let percent = false
     let decimal = 0
-    if (_column && _column.format === 'percent') {
+
+    if (plot.show === 'percent') {
       percent = true
     }
-    if (_column) {
-      decimal = _column.decimal
+    if (vstFields) {
+      decimal = vstFields.decimal
     }
 
     if (!data) {
@@ -468,8 +490,7 @@
    * @description 鑾峰彇缁熻鍥捐〃灞曠ず鏁版嵁锛岄�氳繃閫夋嫨绫诲瀷绛涢��
    */
   getStaticData = () => {
-    const { plot } = this.props
-    const { chartData, chartFields, selectFields } = this.state
+    const { plot, chartData, chartFields, selectFields } = this.state
 
     let _data = []
     if (selectFields.length === chartFields.length) {
@@ -486,7 +507,7 @@
    * @description 鍥捐〃娓叉煋鍒嗙粍
    */
   viewrender = () => {
-    const { plot } = this.props
+    const { plot } = this.state
 
     if (plot.chartType === 'line') {
       this.linerender()
@@ -499,8 +520,7 @@
    * @description 鎶樼嚎鍥炬覆鏌�
    */
   linerender = () => {
-    const { plot, config } = this.props
-    const { percentFields } = this.state
+    const { plot, config, percentFields } = this.state
 
     let _data = []
     let _valfield = 'value'
@@ -511,7 +531,7 @@
       _valfield = plot.InfoValue
       _typefield = plot.InfoType
 
-      if (percentFields.length > 0) {
+      if (plot.show === 'percent') {
         ispercent = true
       }
 
@@ -579,8 +599,8 @@
         formatter: (val) => {
           if (!val || /^\s*$/.test(val)) return val
           let _val = `${val}`
-          if (_val.length <= 10) return val
-          return _val.substring(0, 7) + '...'
+          if (_val.length <= 11) return val
+          return _val.substring(0, 8) + '...'
         }
       }
     })
@@ -644,8 +664,7 @@
    * @description 鑷畾涔夋覆鏌�
    */
   customrender = (data, transfield) => {
-    const { plot } = this.props
-    const { percentFields } = this.state
+    const { plot, percentFields } = this.state
 
     let barfields = []
     let fields = []
@@ -713,8 +732,8 @@
         formatter: (val) => {
           if (!val || /^\s*$/.test(val)) return val
           let _val = `${val}`
-          if (_val.length <= 10) return val
-          return _val.substring(0, 7) + '...'
+          if (_val.length <= 11) return val
+          return _val.substring(0, 8) + '...'
         }
       }
     })
@@ -820,8 +839,7 @@
    * @description 鏌辩姸鍥炬覆鏌�
    */
   barrender = () => {
-    const { plot, config } = this.props
-    const { percentFields } = this.state
+    const { plot, config, percentFields } = this.state
 
     let _data = []
     let _valfield = 'value'
@@ -832,7 +850,7 @@
       _valfield = plot.InfoValue
       _typefield = plot.InfoType
 
-      if (percentFields.length > 0) {
+      if (plot.show === 'percent') {
         ispercent = true
       }
 
@@ -883,6 +901,13 @@
 
     // dodge is not support linear attribute, please use category attribute! 鏃堕棿鏍煎紡
     if (_data[0] && _data[0][plot.Xaxis] && /^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?/.test(_data[0][plot.Xaxis])) {
+      for (let i = 1; i < 12; i++) {
+        if (_data[i] && _data[i][plot.Xaxis] === _data[0][plot.Xaxis]) {
+          _data[i][plot.Xaxis] += ' '
+        } else {
+          break;
+        }
+      }
       _data[0][plot.Xaxis] += ' '
     }
 
@@ -899,8 +924,8 @@
         formatter: (val) => {
           if (!val || /^\s*$/.test(val)) return val
           let _val = `${val}`
-          if (_val.length <= 10) return val
-          return _val.substring(0, 7) + '...'
+          if (_val.length <= 11) return val
+          return _val.substring(0, 8) + '...'
         }
       }
     })
@@ -991,12 +1016,12 @@
   }
 
   render() {
-    const { loading, config, BID, Tab } = this.props
-    const { title, plot, empty, chartFields, selectFields } = this.state
+    const { BID } = this.props
+    const { config, loading, title, plot, empty, chartFields, selectFields } = this.state
 
     return (
       <div className="custom-line-chart-plot-box">
-        <searchLine />
+        {/* <searchLine /> */}
         {title ? <p className="chart-title">{title}</p> : null}
         {loading ?
           <div className="loading-mask">
@@ -1023,7 +1048,6 @@
                   <ExcelOutButton
                     key={item.uuid}
                     BID={BID}
-                    Tab={Tab}
                     btn={item}
                     show="icon"
                     setting={config.setting}
@@ -1036,7 +1060,6 @@
                   <ExcelInButton
                     key={item.uuid}
                     BID={BID}
-                    Tab={Tab}
                     btn={item}
                     show="icon"
                     setting={config.setting}
diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 0f4623d..01d96fd 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -130,65 +130,8 @@
         }
       })
 
-      // 鏉冮檺杩囨护
-      if (this.props.menuType !== 'HS') {
-        config.components.forEach(component => {
-          if (component.action) {
-            component.action = component.action.filter(item => permAction[item.uuid])
-          }
-        })
-      }
-
       let params = []
-      config.components.forEach(component => {
-        if (!component.format) return // 娌℃湁鍔ㄦ�佹暟鎹�
-
-        let _customScript = ''
-        component.scripts && component.scripts.forEach(script => {
-          if (script.status !== 'false') {
-            _customScript += `
-            ${script.sql}
-            `
-          }
-        })
-        delete component.scripts
-
-        if (component.setting && component.setting.interType === 'system') { // 浣跨敤绯荤粺鍑芥暟
-          component.setting.execute = component.setting.execute !== 'false'  // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡
-          component.setting.laypage = component.setting.laypage === 'true'   // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡
-
-          if (!component.setting.execute) {
-            component.setting.dataresource = ''
-          }
-          if (/\s/.test(component.setting.dataresource)) {
-            component.setting.dataresource = '(' + component.setting.dataresource + ') tb'
-          }
-      
-          if (this.props.dataManager) { // 鏁版嵁鏉冮檺
-            component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*')
-            component.setting.dataresource = component.setting.dataresource.replace(/@\$/ig, '*/')
-            _customScript = _customScript.replace(/\$@/ig, '/*')
-            _customScript = _customScript.replace(/@\$/ig, '*/')
-          } else {
-            component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '')
-            _customScript = _customScript.replace(/@\$|\$@/ig, '')
-          }
-        }
-
-        if (component.setting) {
-          component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰
-        }
-
-        // format   鏁版嵁鏍煎紡 array 鎴� object
-        // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О
-        // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ
-        if (component.format && component.dataName && !component.pageable && component.setting.interType === 'system' && component.setting.onload === 'true' && component.setting.sync === 'true') {
-          let param = this.getDefaultParam(component, mainSearch)
-          params.push(param)
-        } else {
-          component.setting.sync = 'false'
-        }
-      })
+      config.components = this.formatSetting(config.components, params, mainSearch, permAction)
 
       this.setState({
         BID: param && param.BID ? param.BID : '',
@@ -211,6 +154,75 @@
         duration: 5
       })
     }
+  }
+
+  // 鏍煎紡鍖栭粯璁よ缃�
+  formatSetting = (components, params, mainSearch, permAction) => {
+    return components.map(component => {
+      if (component.type === 'tabs') {
+        component.subtabs = component.subtabs.map(tab => {
+          tab.components = this.formatSetting(tab.components, [], [], permAction)
+          return tab
+        })
+      }
+
+      // 鏉冮檺杩囨护
+      if (this.props.menuType !== 'HS') {
+        if (component.action) {
+          component.action = component.action.filter(item => permAction[item.uuid])
+        }
+      }
+
+      if (!component.format) return component // 娌℃湁鍔ㄦ�佹暟鎹�  鏁版嵁鏍煎紡 array 鎴� object
+
+      let _customScript = ''
+      component.scripts && component.scripts.forEach(script => {
+        if (script.status !== 'false') {
+          _customScript += `
+          ${script.sql}
+          `
+        }
+      })
+      delete component.scripts
+
+      if (component.setting && component.setting.interType === 'system') { // 浣跨敤绯荤粺鍑芥暟
+        component.setting.execute = component.setting.execute !== 'false'  // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡
+        component.setting.laypage = component.setting.laypage === 'true'   // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡
+
+        if (!component.setting.execute) {
+          component.setting.dataresource = ''
+        }
+        if (/\s/.test(component.setting.dataresource)) {
+          component.setting.dataresource = '(' + component.setting.dataresource + ') tb'
+        }
+    
+        if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+          component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*')
+          component.setting.dataresource = component.setting.dataresource.replace(/@\$/ig, '*/')
+          _customScript = _customScript.replace(/\$@/ig, '/*')
+          _customScript = _customScript.replace(/@\$/ig, '*/')
+        } else {
+          component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '')
+          _customScript = _customScript.replace(/@\$|\$@/ig, '')
+        }
+      }
+
+      if (component.setting) {
+        component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰
+      }
+
+      // floor    缁勪欢鐨勫眰绾�
+      // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О
+      // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ
+      if (component.floor === 1 && component.dataName && !component.pageable && component.setting.interType === 'system' && component.setting.onload === 'true' && component.setting.sync === 'true') {
+        let param = this.getDefaultParam(component, mainSearch)
+        params.push(param)
+      } else {
+        component.setting.sync = 'false'
+      }
+
+      return component
+    })
   }
 
   /**
@@ -310,7 +322,6 @@
         LText_field.push(`Select '${item.name}' as tablename,'${cell.field}' as fieldname,'${cell.datatype}' as field_type`)
       })
       return `Select '${item.name}' as tablename,'${window.btoa(window.encodeURIComponent(_sql))}' as LText,'${window.btoa(window.encodeURIComponent(_script))}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort`
-      // return `Select '${item.name}' as tablename,'${_sql}' as LText,'${_script}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort`
     })
 
     let param = {
@@ -427,7 +438,7 @@
     return config.components.map(item => {
       if (item.type === 'bar' || item.type === 'line') {
         return (
-          <Col key={item.uuid}>
+          <Col span={item.setting.span} key={item.uuid}>
             <AntvBarAndLine config={item} data={data} BID={BID} mainSearch={mainSearch} menuType={menuType} dataManager={dataManager} />
           </Col>
         )
@@ -442,9 +453,9 @@
     const { loadingview, viewlost } = this.state
 
     return (
-      <div className="calendar-page" id={this.state.ContainerId}>
+      <div className="custom-page-wrap" id={this.state.ContainerId}>
         {loadingview && <Spin size="large" />}
-        <Row>{this.getComponents()}</Row>
+        <Row gutter={8}>{this.getComponents()}</Row>
         {options.sysType !== 'cloud' ? <Button
           icon="copy"
           shape="circle"
diff --git a/src/tabviews/custom/index.scss b/src/tabviews/custom/index.scss
index b35d19b..981f835 100644
--- a/src/tabviews/custom/index.scss
+++ b/src/tabviews/custom/index.scss
@@ -1,8 +1,10 @@
-.calendar-page {
+.custom-page-wrap {
   position: relative;
   min-height: calc(100vh - 94px);
   padding-top: 16px;
   padding-bottom: 80px;
+  padding-left: 16px;
+  padding-right: 16px;
   .box404 {
     padding-top: 30px;
   }
@@ -37,22 +39,3 @@
   }
 }
 
-.menu-tree-modal {
-  .ant-modal-body {
-    min-height: 300px;
-    .menu-header {
-      text-align: center;
-      span {
-        font-weight: 600;
-        margin-right: 20px;
-      }
-      .ant-typography {
-        font-weight: 600;
-        display: inline-block;
-      }
-    }
-    .ant-tree li .ant-tree-node-content-wrapper {
-      cursor: default;
-    }
-  }
-}
diff --git a/src/tabviews/zshare/chartcomponent/index.jsx b/src/tabviews/zshare/chartcomponent/index.jsx
index f791085..85ec585 100644
--- a/src/tabviews/zshare/chartcomponent/index.jsx
+++ b/src/tabviews/zshare/chartcomponent/index.jsx
@@ -505,8 +505,8 @@
         formatter: (val) => {
           if (!val || /^\s*$/.test(val)) return val
           let _val = `${val}`
-          if (_val.length <= 10) return val
-          return _val.substring(0, 7) + '...'
+          if (_val.length <= 11) return val
+          return _val.substring(0, 8) + '...'
         }
       }
     })
@@ -639,8 +639,8 @@
         formatter: (val) => {
           if (!val || /^\s*$/.test(val)) return val
           let _val = `${val}`
-          if (_val.length <= 10) return val
-          return _val.substring(0, 7) + '...'
+          if (_val.length <= 11) return val
+          return _val.substring(0, 8) + '...'
         }
       }
     })
@@ -809,6 +809,13 @@
 
     // dodge is not support linear attribute, please use category attribute! 鏃堕棿鏍煎紡
     if (_data[0] && _data[0][plot.Xaxis] && /^\d{4}-\d{2}-\d{2}(\s\d{2}:\d{2}:\d{2})?/.test(_data[0][plot.Xaxis])) {
+      for (let i = 1; i < 12; i++) {
+        if (_data[i] && _data[i][plot.Xaxis] === _data[0][plot.Xaxis]) {
+          _data[i][plot.Xaxis] += ' '
+        } else {
+          break;
+        }
+      }
       _data[0][plot.Xaxis] += ' '
     }
 
@@ -825,8 +832,8 @@
         formatter: (val) => {
           if (!val || /^\s*$/.test(val)) return val
           let _val = `${val}`
-          if (_val.length <= 10) return val
-          return _val.substring(0, 7) + '...'
+          if (_val.length <= 11) return val
+          return _val.substring(0, 8) + '...'
         }
       }
     })
diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx
index 43a9a4e..5a1e50b 100644
--- a/src/views/menudesign/index.jsx
+++ b/src/views/menudesign/index.jsx
@@ -263,24 +263,6 @@
     })
   }
 
-  deleteCard = (id) => {
-    let _this = this
-    let config = fromJS(this.state.config).toJS()
-
-    confirm({
-      title: '纭畾鍒犻櫎鍏冪礌鍚楋紵',
-      content: '',
-      onOk() {
-        config.components = config.components.filter(item => item.uuid !== id)
-
-        _this.setState({
-          config: config
-        })
-      },
-      onCancel() {}
-    })
-  }
-
   editCard = (element) => {
     this.setState({
       editElem: element
@@ -406,8 +388,7 @@
                     <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{dict['mob.save']}</Button>
                   </div>
                 } style={{ width: '100%' }}>
-                  {/* {config && config.components ? <MenuShell menu={config} handleList={this.updateConfig} deleteCard={this.deleteCard} /> : null} */}
-                  {config && config.components ? <MenuShell name="Glass" menu={config} handleList={this.updateConfig} deleteCard={this.deleteCard} /> : null}
+                  {config && config.components ? <MenuShell menu={config} handleList={this.updateConfig} /> : null}
                 </Card>
               </div>
             </div>

--
Gitblit v1.8.0