From 6c16e43cd6521460c804391c042348dbb14086fc Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 16 六月 2020 09:44:40 +0800
Subject: [PATCH] 2020-06-16

---
 src/templates/subtableconfig/index.jsx |   61 ++++++++++++++++++++++++------
 1 files changed, 49 insertions(+), 12 deletions(-)

diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx
index 76e676f..c3edad5 100644
--- a/src/templates/subtableconfig/index.jsx
+++ b/src/templates/subtableconfig/index.jsx
@@ -128,18 +128,55 @@
 
     let _activeKey =  editSubTab ? editSubTab.activeKey : editTab.activeKey
 
-    // 鍏煎鍥捐〃
-    if (!_config.charts) {
-      _config.expand = false
-      _config.charts = [{
-        uuid: Utils.getuuid(),
-        label: '',
-        title: '',
-        chartType: 'table',
-        icon: 'table',
-        Hide: 'false',
-        blacklist: []
-      }]
+    if (!_config.version || _config.version < '1.0') {
+      // 閰嶇疆榛樿鍊硷紝鍏煎
+      // _config.version = '1.0'
+      
+      // 鍏煎鍥捐〃
+      if (!_config.charts) {
+        _config.expand = false
+        _config.charts = [{
+          uuid: Utils.getuuid(),
+          label: '',
+          title: '',
+          chartType: 'table',
+          icon: 'table',
+          Hide: 'false',
+          blacklist: []
+        }]
+      } else {
+        _config.charts.forEach(card => {
+          if (card.chartType === 'card') {
+            card.details = card.details.map(_cell => {
+              if (!_cell.fontSize) {
+                _cell.fontSize = 14
+              }
+              if (!_cell.width) {
+                _cell.width = 100
+              } else if (_cell.width === 'helf') {
+                _cell.width = 50
+              } else if (_cell.width === 'third') {
+                _cell.width = 33
+              }
+        
+              if (_cell.bold === 'true') {
+                _cell.fontWeight = 'normal'
+              }
+
+              if (!_cell.height) {
+                _cell.height = 1
+              }
+
+              return _cell
+            })
+
+            if (card.widthType === 'ratio' && card.avatar && card.avatar.widthType !== 'ratio') {
+              card.avatar.widthType = 'ratio'
+              card.avatar.width = 32
+            }
+          }
+        })
+      }
     }
 
     this.setState({

--
Gitblit v1.8.0