From 76a4300654a18d228838c3f27455dc8e7a8cd616 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 15 一月 2021 17:04:42 +0800
Subject: [PATCH] Merge branch 'master' into bms

---
 src/menu/components/card/data-card/index.jsx |  106 ++++++++++++++++++++++++++++++++---------------------
 1 files changed, 64 insertions(+), 42 deletions(-)

diff --git a/src/menu/components/card/data-card/index.jsx b/src/menu/components/card/data-card/index.jsx
index ff1bd6f..37cebdb 100644
--- a/src/menu/components/card/data-card/index.jsx
+++ b/src/menu/components/card/data-card/index.jsx
@@ -18,6 +18,7 @@
 const CardComponent = asyncComponent(() => import('../cardcomponent'))
 const LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent'))
 const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
+const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent'))
 const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent'))
 const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
 const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent'))
@@ -41,24 +42,29 @@
     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 = [{
+      let _card = {
+        uuid: card.uuid,
+        type: card.type,
+        floor: card.floor,
+        tabId: card.tabId || '',
+        parentId: card.parentId || '',
+        format: 'array',   // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡
+        pageable: true,    // 缁勪欢灞炴�� - 鏄惁鍙垎椤�
+        switchable: true,  // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹�
+        dataName: card.dataName || '',
+        width: card.width || 24,
+        name: card.name,
+        subtype: card.subtype,
+        setting: { interType: 'system' },
+        wrap: { name: card.name, width: card.width || 24, title: '', pagestyle: 'page', switch: 'false' },
+        style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' },
+        headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' },
+        columns: [],
+        scripts: [],
+        action: [],
+        search: [],
+        btnlog: [],
+        subcards: [{
           uuid: Utils.getuuid(),
           setting: { width: 6, type: 'simple'},
           style: {
@@ -72,29 +78,36 @@
         }]
       }
 
-      let _card = {
-        uuid: card.uuid,
-        type: card.type,
-        floor: card.floor,
-        tabId: card.tabId || '',
-        parentId: card.parentId || '',
-        format: 'array',   // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡
-        pageable: true,    // 缁勪欢灞炴�� - 鏄惁鍙垎椤�
-        switchable: true,  // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹�
-        dataName: card.dataName || '',
-        width: 24,
-        name: card.name,
-        subtype: card.subtype,
-        setting: { interType: 'system' },
-        wrap: { name: card.name, width: 24, title: '', pagestyle: 'page', switch: 'false' },
-        style: { marginLeft: '0px', marginRight: '0px', marginTop: '8px', marginBottom: '8px' },
-        headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' },
-        columns: [],
-        scripts: [],
-        action: [],
-        btnlog: [],
-        subcards: subcards
+      if (card.config) {
+        let config = fromJS(card.config).toJS()
+
+        _card.wrap = config.wrap
+        _card.wrap.name = card.name
+        _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.action = config.action.map(col => {
+          col.uuid = Utils.getuuid()
+          return col
+        })
+        _card.search = config.search.map(col => {
+          col.uuid = Utils.getuuid()
+          return col
+        })
       }
+
       this.setState({
         card: _card
       })
@@ -102,6 +115,7 @@
     } else {
       card.action = card.action || [] // 鍏煎
       card.search = card.search || [] // 鍏煎
+
       this.setState({
         card: fromJS(card).toJS()
       })
@@ -284,7 +298,7 @@
     if (btn.OpenType === 'pop') {
       if (!btn.modal) {
         btn.modal = {
-          setting: { title: btn.label, width: 60, cols: '2', container: 'tab', focus: '', finish: 'close', clickouter: 'unclose', display: 'modal' },
+          setting: { title: btn.label, width: 60, cols: '2', container: 'view', focus: '', finish: 'close', clickouter: 'unclose', display: 'modal' },
           tables: [],
           groups: [],
           fields: []
@@ -360,6 +374,13 @@
     }
   }
 
+  clickComponent = (e) => {
+    if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') {
+      e.stopPropagation()
+      MKEmitter.emit('clickComponent', this.state.card)
+    }
+  }
+
   render() {
     const { card } = this.state
 
@@ -376,7 +397,7 @@
     }
 
     return (
-      <div className="menu-data-card-edit-box" style={{...card.style}}>
+      <div className="menu-data-card-edit-box" style={{...card.style}} onClick={this.clickComponent} id={card.uuid}>
         <NormalHeader defaultshow="hidden" config={card} updateComponent={this.updateComponent}/>
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control">
@@ -387,6 +408,7 @@
             <PasteComponent config={card} options={['action', 'search', 'form']} 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)} />
             <SettingComponent config={card} updateConfig={this.updateComponent} />
           </div>

--
Gitblit v1.8.0