From 455bdae0e5e1d9f66a552f74707f825c8b49ee5a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 15 一月 2021 00:35:22 +0800
Subject: [PATCH] 2021-01-15

---
 src/menu/components/card/prop-card/index.jsx |   76 ++++++++++++++++++++++----------------
 1 files changed, 44 insertions(+), 32 deletions(-)

diff --git a/src/menu/components/card/prop-card/index.jsx b/src/menu/components/card/prop-card/index.jsx
index d04fe68..9b0e60f 100644
--- a/src/menu/components/card/prop-card/index.jsx
+++ b/src/menu/components/card/prop-card/index.jsx
@@ -19,6 +19,7 @@
 const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
 const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent'))
 const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent'))
+const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent'))
 const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
 
 const { confirm } = Modal
@@ -40,37 +41,6 @@
     const { card } = this.props
 
     if (card.isNew) {
-      let subcards = null
-
-      if (card.config) {
-        subcards = JSON.parse(card.config)
-        subcards = subcards.map(scard => {
-          scard.uuid = Utils.getuuid()
-          scard.elements = scard.elements.map(elem => {
-            elem.uuid = Utils.getuuid()
-            return elem
-          })
-          scard.backElements = scard.backElements.map(elem => {
-            elem.uuid = Utils.getuuid()
-            return elem
-          })
-          return scard
-        })
-      } else {
-        subcards = [{
-          uuid: Utils.getuuid(),
-          setting: { width: 6, type: 'simple'},
-          style: {
-            borderWidth: '1px', borderColor: '#e8e8e8',
-            paddingTop: '15px', paddingBottom: '15px', paddingLeft: '15px', paddingRight: '15px',
-            marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px'
-          },
-          backStyle: {},
-          elements: [],
-          backElements: []
-        }]
-      }
-
       let _card = {
         uuid: card.uuid,
         type: card.type,
@@ -90,8 +60,49 @@
         headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' },
         columns: [],
         scripts: [],
-        subcards: subcards,
+        subcards: [{
+          uuid: Utils.getuuid(),
+          setting: { width: 6, type: 'simple'},
+          style: {
+            borderWidth: '1px', borderColor: '#e8e8e8',
+            paddingTop: '15px', paddingBottom: '15px', paddingLeft: '15px', paddingRight: '15px',
+            marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px'
+          },
+          backStyle: {},
+          elements: [],
+          backElements: []
+        }],
         btnlog: [],
+      }
+
+      if (card.config) {
+        let config = fromJS(card.config).toJS()
+
+        _card.setting = config.setting
+        _card.wrap = config.wrap
+        _card.style = config.style
+        _card.headerStyle = config.headerStyle
+
+        _card.subcards = config.subcards.map(scard => {
+          scard.uuid = Utils.getuuid()
+          scard.elements = scard.elements.map(elem => {
+            elem.uuid = Utils.getuuid()
+            return elem
+          })
+          scard.backElements = scard.backElements.map(elem => {
+            elem.uuid = Utils.getuuid()
+            return elem
+          })
+          return scard
+        })
+        _card.columns = config.columns.map(col => {
+          col.uuid = Utils.getuuid()
+          return col
+        })
+        _card.scripts = config.scripts.map(col => {
+          col.uuid = Utils.getuuid()
+          return col
+        })
       }
       this.setState({
         card: _card
@@ -378,6 +389,7 @@
             <PasteComponent config={card} options={['cardcell']} updateConfig={this.updateComponent} />
             <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" />
             <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} />
+            <UserComponent config={card}/>
             <Icon className="close" title="鍒犻櫎缁勪欢" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} />
             {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null}
             {card.wrap.datatype === 'static' ? <Icon style={{color: '#eeeeee', cursor: 'not-allowed'}} type="setting"/> : null}

--
Gitblit v1.8.0