From 5046d0d13dc6a8563b8e54e31913bc44cfa1072f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 26 四月 2022 19:23:18 +0800
Subject: [PATCH] 2022-04-26

---
 src/menu/components/table/normal-table/index.jsx |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/src/menu/components/table/normal-table/index.jsx b/src/menu/components/table/normal-table/index.jsx
index f57cc32..39da770 100644
--- a/src/menu/components/table/normal-table/index.jsx
+++ b/src/menu/components/table/normal-table/index.jsx
@@ -45,7 +45,6 @@
       let _card = {
         uuid: card.uuid,
         type: card.type,
-        floor: card.floor,
         tabId: card.tabId || '',
         parentId: card.parentId || '',
         format: 'array',    // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡
@@ -151,6 +150,7 @@
     MKEmitter.addListener('submitStyle', this.getStyle)
     MKEmitter.addListener('submitModal', this.handleSave)
     MKEmitter.addListener('logButton', this.logButton)
+    MKEmitter.addListener('completeSave', this.completeSave)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -167,6 +167,22 @@
     MKEmitter.removeListener('submitStyle', this.getStyle)
     MKEmitter.removeListener('submitModal', this.handleSave)
     MKEmitter.removeListener('logButton', this.logButton)
+    MKEmitter.removeListener('completeSave', this.completeSave)
+  }
+
+  completeSave = () => {
+    const { card } = this.state
+
+    if (card.isNew) {
+      let item = fromJS(card).toJS()
+      item.search = item.search.filter(a => !a.origin)
+      item.action = item.action.filter(a => !a.origin)
+      item.cols = item.cols.filter(a => !a.origin)
+
+      delete item.isNew
+
+      this.setState({card: item}, () => { MKEmitter.emit('revert') })
+    }
   }
 
   loopCol = (col) => {
@@ -387,9 +403,16 @@
   }
 
   getWrapForms = () => {
-    const { wrap, action, columns } = this.state.card
+    const { wrap, action, columns, cols } = this.state.card
 
-    return getWrapForm(wrap, action, columns)
+    let _actions = [...action]
+
+    cols.forEach(col => {
+      if (col.type !== 'action') return
+      _actions.push(...col.elements)
+    })
+
+    return getWrapForm(wrap, _actions, columns)
   }
 
   updateWrap = (res) => {

--
Gitblit v1.8.0