From 316877c1d9e5b6d92334f30b03d97d7e833cd934 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 二月 2021 16:01:57 +0800
Subject: [PATCH] 2021-02-02

---
 src/utils/utils-update.js |  311 +++++++++++++++++++++++++--------------------------
 1 files changed, 153 insertions(+), 158 deletions(-)

diff --git a/src/utils/utils-update.js b/src/utils/utils-update.js
index 7db6fb5..8c06998 100644
--- a/src/utils/utils-update.js
+++ b/src/utils/utils-update.js
@@ -1,169 +1,164 @@
-import { fromJS } from 'immutable'
-import Utils from './utils.js'
+/**
+ * @description 鍗囩骇涓昏〃淇℃伅
+ * @param {Object}   config      椤甸潰閰嶇疆淇℃伅
+ * @return {Object}  config
+ */
+export function updateCommonTable (config) {
+  if (!config.version || config.version < '1.0') {
+    config.version = '1.0'
+    // 鍏煎鏍囩
+    if (!config.tabgroups) {
+      config.tabgroups = [{ uuid: 'tabs', sublist: [] }]
+    } else if (typeof(config.tabgroups[0]) === 'string') {
+      let _tabgroups = []
+      config.tabgroups.forEach(groupId => {
+        let _group = {
+          uuid: groupId,
+          sublist: config[groupId]
+        }
 
-export default class UpdateUtils {
-  /**
-   * @description 鍗囩骇涓昏〃淇℃伅
-   * @param {Object}   config      椤甸潰閰嶇疆淇℃伅
-   * @return {Object}  config
-   */
-  static updateCommonTable (config) {
-    if (!config.version || config.version < '1.0') {
-      config.version = '1.0'
-      // 鍏煎鏍囩
-      if (!config.tabgroups) {
-        config.tabgroups = [{ uuid: 'tabs', sublist: [] }]
-      } else if (typeof(config.tabgroups[0]) === 'string') {
-        let _tabgroups = []
-        config.tabgroups.forEach(groupId => {
-          let _group = {
-            uuid: groupId,
-            sublist: fromJS(config[groupId]).toJS()
-          }
-  
-          delete config[groupId]
-  
-          _tabgroups.push(_group)
-        })
-  
-        config.tabgroups = _tabgroups
-      }
-  
-      // 鍏煎鍥捐〃
-      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
-            })
-          }
-        })
-      }
+        delete config[groupId]
+
+        _tabgroups.push(_group)
+      })
+
+      config.tabgroups = _tabgroups
     }
 
-    if (config.version < '1.1') {
-      config.version = '1.1'
-      if (config.setting.interType === 'inner' && !config.setting.innerFunc) {
-        config.setting.interType = 'system'
-      }
-      // 鍏煎鎺ュ彛绫诲瀷
-      config.action = config.action.map(item => {
-        if (item.intertype === 'inner' && !item.innerFunc) {
-          item.intertype = 'system'
+    // 鍏煎鍥捐〃
+    if (!config.charts) {
+      config.expand = true
+      config.charts = [{ uuid: '$$normaltable', 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
+          })
         }
-        return item
       })
     }
-
-    if (config.version < '1.2') {
-      config.version = '1.2'
-      // 鍏煎鍔熻兘鎸夐挳
-      config.action = config.action.map(item => {
-        if (item.execMode) {
-          item.OpenType = 'funcbutton'
-        }
-        return item
-      })
-    }
-
-    config.Template = 'CommonTable'
-
-    return config
   }
 
-  /**
-   * @description 鍗囩骇瀛愯〃淇℃伅
-   * @param {Object}   config      椤甸潰閰嶇疆淇℃伅
-   * @return {Object}  config
-   */
-  static updateSubTable (config) {
-    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 (config.version < '1.1') {
+    config.version = '1.1'
+    if (config.setting.interType === 'inner' && !config.setting.innerFunc) {
+      config.setting.interType = 'system'
+    }
+    // 鍏煎鎺ュ彛绫诲瀷
+    config.action = config.action.map(item => {
+      if (item.intertype === 'inner' && !item.innerFunc) {
+        item.intertype = 'system'
       }
-    }
-
-    if (config.version < '1.1') {
-      config.version = '1.1'
-      if (config.setting.interType === 'inner' && !config.setting.innerFunc) {
-        config.setting.interType = 'system'
-      }
-      // 鍏煎鎺ュ彛绫诲瀷
-      config.action = config.action.map(item => {
-        if (item.intertype === 'inner' && !item.innerFunc) {
-          item.intertype = 'system'
-        }
-        return item
-      })
-    }
-
-    if (config.version < '1.2') {
-      config.version = '1.2'
-      // 鍏煎鍔熻兘鎸夐挳
-      config.action = config.action.map(item => {
-        if (item.execMode) {
-          item.OpenType = 'funcbutton'
-        }
-        return item
-      })
-    }
-    
-    config.Template = 'SubTable'
-
-    return config
+      return item
+    })
   }
+
+  if (config.version < '1.2') {
+    config.version = '1.2'
+    // 鍏煎鍔熻兘鎸夐挳
+    config.action = config.action.map(item => {
+      if (item.execMode) {
+        item.OpenType = 'funcbutton'
+      }
+      return item
+    })
+  }
+
+  config.Template = 'CommonTable'
+
+  return config
+}
+
+/**
+ * @description 鍗囩骇瀛愯〃淇℃伅
+ * @param {Object}   config      椤甸潰閰嶇疆淇℃伅
+ * @return {Object}  config
+ */
+export function updateSubTable (config) {
+  if (!config.version || config.version < '1.0') {
+    config.version = '1.0'
+    // 鍏煎鍥捐〃
+    if (!config.charts) {
+      config.expand = false
+      config.charts = [{
+        uuid: '$$normalsubtable',
+        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 (config.version < '1.1') {
+    config.version = '1.1'
+    if (config.setting.interType === 'inner' && !config.setting.innerFunc) {
+      config.setting.interType = 'system'
+    }
+    // 鍏煎鎺ュ彛绫诲瀷
+    config.action = config.action.map(item => {
+      if (item.intertype === 'inner' && !item.innerFunc) {
+        item.intertype = 'system'
+      }
+      return item
+    })
+  }
+
+  if (config.version < '1.2') {
+    config.version = '1.2'
+    // 鍏煎鍔熻兘鎸夐挳
+    config.action = config.action.map(item => {
+      if (item.execMode) {
+        item.OpenType = 'funcbutton'
+      }
+      return item
+    })
+  }
+  
+  config.Template = 'SubTable'
+
+  return config
 }
\ No newline at end of file

--
Gitblit v1.8.0