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

---
 src/menu/components/table/normal-table/index.jsx |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx
index dcd3573..d6989a2 100644
--- a/src/menu/components/table/normal-table/index.jsx
+++ b/src/menu/components/table/normal-table/index.jsx
@@ -19,6 +19,7 @@
 const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent'))
 const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
 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 LogComponent = asyncIconComponent(() => import('@/menu/components/share/logcomponent'))
 const ColumnComponent = asyncComponent(() => import('./columns'))
@@ -53,7 +54,7 @@
         pageable: true,     // 缁勪欢灞炴�� - 鏄惁鍙垎椤�
         switchable: true,   // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹�
         dataName: card.dataName || '',
-        width: 24,
+        width: card.width || 24,
         search: [
           { origin: true, uuid: Utils.getuuid(), label: 'label', type: 'text', match: 'like' },
           { origin: true, uuid: Utils.getuuid(), label: 'label', type: 'select', match: 'equal' },
@@ -67,7 +68,7 @@
         name: card.name,
         subtype: card.subtype,
         setting: { interType: 'system' },
-        wrap: { name: card.name, width: 24, bordered: 'true', tableType: 'checkbox' },
+        wrap: { name: card.name, width: card.width || 24, bordered: 'true', tableType: 'checkbox' },
         style: { marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' },
         headerStyle: { fontSize: '16px', borderBottomWidth: '1px', borderBottomColor: '#e8e8e8' },
         columns: [],
@@ -78,6 +79,41 @@
         ],
         scripts: [],
         btnlog: [],
+      }
+
+      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.action = config.action.map(item => {
+          item.uuid = Utils.getuuid()
+          return item
+        })
+        _card.search = config.search.map(item => {
+          item.uuid = Utils.getuuid()
+          return item
+        })
+        _card.cols = config.cols.map(col => {
+          col.uuid = Utils.getuuid()
+          if (col.type === 'colspan' && col.subcols) {
+            col = this.loopCol(col)
+          } else if (col.type === 'custom' && col.elements) {
+            col.elements = col.elements.map(cell => {
+              cell.uuid = Utils.getuuid()
+              return cell
+            })
+          } else if (col.type === 'action' && col.elements) {
+            col.elements = col.elements.map(cell => {
+              cell.uuid = Utils.getuuid()
+              return cell
+            })
+          }
+          return col
+        })
       }
       
       this.setState({
@@ -111,6 +147,23 @@
     MKEmitter.removeListener('submitStyle', this.getStyle)
     MKEmitter.removeListener('submitModal', this.handleSave)
     MKEmitter.removeListener('logButton', this.logButton)
+  }
+
+  loopCol = (col) => {
+    col.subcols = col.subcols.map(c => {
+      c.uuid = Utils.getuuid()
+      if (c.type === 'colspan' && c.subcols) {
+        c = this.loopCol(c)
+      } else if (c.type === 'custom' && c.elements) {
+        c.elements = c.elements.map(cell => {
+          cell.uuid = Utils.getuuid()
+          return cell
+        })
+      }
+      return c
+    })
+
+    return col
   }
 
   /**
@@ -341,6 +394,7 @@
             <PasteComponent config={card} options={['action', 'search', 'form', 'cols']} 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