From f6626b05f1275cc2f8ca77f773d4f6a6af1b0a89 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 21 十一月 2022 16:11:55 +0800
Subject: [PATCH] 2022-11-21

---
 src/menu/components/table/edit-table/index.jsx |   47 ++++++++++++++++++++++-------------------------
 1 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/src/menu/components/table/edit-table/index.jsx b/src/menu/components/table/edit-table/index.jsx
index d95042e..ecd404c 100644
--- a/src/menu/components/table/edit-table/index.jsx
+++ b/src/menu/components/table/edit-table/index.jsx
@@ -119,7 +119,6 @@
   }
 
   componentDidMount () {
-    MKEmitter.addListener('submitModal', this.handleSave)
     MKEmitter.addListener('completeSave', this.completeSave)
   }
 
@@ -134,7 +133,6 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('submitModal', this.handleSave)
     MKEmitter.removeListener('completeSave', this.completeSave)
   }
 
@@ -230,7 +228,7 @@
     style.fontSize = card.wrap.fontSize || 14
     style.fontWeight = card.wrap.fontWeight || 'normal'
 
-    MKEmitter.emit('changeStyle', ['font1', 'background', 'border', 'padding', 'margin', 'shadow'], style, this.getStyle)
+    MKEmitter.emit('changeStyle', ['font1', 'background', 'border', 'padding', 'margin', 'shadow', 'clear'], style, this.getStyle)
   }
 
   getStyle = (style) => {
@@ -316,26 +314,6 @@
     }
   }
 
-  handleSave = (_cards, btn, modal) => {
-    let card = fromJS(this.state.card).toJS()
-
-    if (card.uuid !== _cards.uuid) return
-
-    let _index = card.action.findIndex(cell => cell.uuid === btn.uuid)
-
-    if (_index === -1) return
-
-    card.action = card.action.map(cell => {
-      if (cell.uuid === btn.uuid) {
-        cell.modal = modal
-      }
-
-      return cell
-    })
-
-    this.updateComponent(card)
-  }
-
   getWrapForms = () => {
     const { wrap, action } = this.state.card
 
@@ -363,6 +341,25 @@
     }
     
     this.updateComponent(_card)
+  }
+
+  updatecolumn = (config) => {
+    config.absFields = []
+    config.cols.forEach(col => {
+      if (col.type === 'number') {
+        if (col.format === 'abs') {
+          config.absFields.push(col.field)
+        }
+      }
+    })
+
+    if (config.absFields.length) {
+      config.absFields = Array.from(new Set(config.absFields))
+    } else {
+      config.absFields = null
+    }
+
+    this.updateComponent(config)
   }
 
   clickComponent = (e) => {
@@ -393,7 +390,7 @@
             <NormalForm title="琛ㄦ牸璁剧疆" width={800} update={this.updateWrap} getForms={this.getWrapForms}>
               <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/>
             </NormalForm>
-            <CopyComponent type="normaltable" card={card}/>
+            <CopyComponent type="editable" card={card}/>
             <PasteComponent config={card} options={['action', 'search', 'form', 'cols']} updateConfig={this.updateComponent} />
             <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle}/>
             <UserComponent config={card}/>
@@ -405,7 +402,7 @@
         </Popover>
         <SearchComponent config={card} updatesearch={this.updateComponent}/>
         <ActionComponent config={card} setSubConfig={this.setSubConfig} updateaction={this.updateComponent}/>
-        <ColumnComponent config={card} updatecolumn={this.updateComponent}/>
+        <ColumnComponent config={card} updatecolumn={this.updatecolumn}/>
         <div className="component-name">
           <div className="center">
             <div className="title">{card.name}</div>

--
Gitblit v1.8.0