From 79e1455e4ba4f4a7d04a483dda1a354e53921a69 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 04 十一月 2020 19:04:14 +0800
Subject: [PATCH] 2020-11-04

---
 src/tabviews/custom/components/card/data-card/index.jsx |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx
index 9c52d9c..0efdbeb 100644
--- a/src/tabviews/custom/components/card/data-card/index.jsx
+++ b/src/tabviews/custom/components/card/data-card/index.jsx
@@ -35,10 +35,29 @@
 
   UNSAFE_componentWillMount () {
     let _config = fromJS(this.props.config).toJS()
+    let _card = _config.subcards[0]
+    let _cols = new Map()
+
+    _config.columns.forEach(item => {
+      _cols.set(item.field, item)
+    })
+
+    _card.elements = _card.elements.map(item => {
+      if (item.field && _cols.has(item.field)) {
+        item.col = _cols.get(item.field)
+      }
+      return item
+    })
+    _card.backElements = _card.backElements.map(item => {
+      if (item.field && _cols.has(item.field)) {
+        item.col = _cols.get(item.field)
+      }
+      return item
+    })
 
     this.setState({
       config: _config,
-      card: _config.subcards[0],
+      card: _card,
       arr_field: _config.columns.map(col => col.field).join(','),
     }, () => {
       this.loadData()

--
Gitblit v1.8.0