From 1dfbdd345812e76abdeec3ee5efe9424dc13a733 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 16 六月 2020 19:13:33 +0800
Subject: [PATCH] 2020-06-16

---
 src/tabviews/subtabtable/index.jsx |   46 ++++++++++++++++++++++++++++++----------------
 1 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx
index e56bbeb..0ea607b 100644
--- a/src/tabviews/subtabtable/index.jsx
+++ b/src/tabviews/subtabtable/index.jsx
@@ -104,23 +104,35 @@
       let _hideCol = []      // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆�
       let colMap = new Map()
 
-      // 鍏煎鍥捐〃
-      let chartId = ''
-      if (!config.charts) {
-        config.expand = true
-        config.charts = [{
-          uuid: Utils.getuuid(),
-          label: '',
-          title: '',
-          chartType: 'table',
-          icon: 'table',
-          Hide: 'false',
-          blacklist: []
-        }]
-      } else if (config.charts.length === 1) {
-        config.expand = true
+      // 鏃х増鏈吋瀹�
+      if (!config.version || config.version < '1.0') {
+        // 鍏煎鍥捐〃
+        if (!config.charts) {
+          config.expand = true
+          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 => {
+                _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.fontWeight && _cell.bold === 'true') {
+                  _cell.fontWeight = 'normal'
+                }
+                _cell.height = _cell.height || 1
+  
+                return _cell
+              })
+            }
+          })
+        }
       }
-      chartId = config.charts[0].uuid
 
       // 浠呮敮鎸乪xec銆乸rompt銆乸op 涓夌绫诲瀷鎸夐挳
       config.action = config.action.filter(item => ['exec', 'prompt', 'pop'].includes(item.OpenType))
@@ -182,6 +194,8 @@
         config.expand = true
       }
 
+      let chartId = config.charts[0] ? config.charts[0].uuid : ''
+
       // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid
       config.columns.forEach(col => {
         if (col.field) {

--
Gitblit v1.8.0