From f9180a3ab8813c3937c7ba30750763cd693d1d37 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 05 十月 2021 12:06:36 +0800
Subject: [PATCH] 2021-10-05

---
 src/menu/components/table/edit-table/columns/index.jsx |   43 ++++++++-----------------------------------
 1 files changed, 8 insertions(+), 35 deletions(-)

diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx
index 2acb634..05b9c7b 100644
--- a/src/menu/components/table/edit-table/columns/index.jsx
+++ b/src/menu/components/table/edit-table/columns/index.jsx
@@ -56,7 +56,7 @@
         connectDropTarget(<th {...restProps} index={index} style={{ cursor: 'move', textAlign: align }} onDoubleClick={() => column && this.props.editColumn(column)}>
           <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
             <div className="mk-popover-control">
-              {column && ['custom', 'colspan', 'action'].includes(column.type) ?
+              {column && ['custom', 'action'].includes(column.type) ?
                 <Icon className="plus" title="娣诲姞" type="plus" onClick={() => this.props.addElement(column)} /> : null
               }
               <Icon className="edit" title="缂栬緫" type="edit" onClick={() => this.props.editColumn(column)} />
@@ -74,7 +74,7 @@
         <th {...restProps} key={column.uuid} onDoubleClick={() => this.props.editColumn(column)}>
           <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
             <div className="mk-popover-control">
-              {column && ['custom', 'colspan'].includes(column.type) ?
+              {column && ['custom'].includes(column.type) ?
                 <Icon className="plus" title="娣诲姞" type="plus" onClick={() => this.props.addElement(column)} /> : null
               }
               <Icon className="edit" title="缂栬緫" type="edit" onClick={() => this.props.editColumn(column)} />
@@ -257,21 +257,14 @@
     })
   }
 
-  loopCol = (columns, col) => {
-    return columns.map(column => {
-      if (column.type === 'colspan') {
-        column.subcols = this.loopCol(column.subcols, col)
-      }
+  updateCol = (col, btn) => {
+    let _columns = fromJS(this.state.columns).toJS()
+    _columns = _columns.map(column => {
       if (column.uuid === col.uuid) {
         return col
       }
       return column
     })
-  }
-
-  updateCol = (col, btn) => {
-    let _columns = fromJS(this.state.columns).toJS()
-    _columns = this.loopCol(_columns, col)
 
     this.setState({
       columns: _columns,
@@ -295,16 +288,7 @@
     const { config } = this.props
     let column = fromJS(col).toJS()
 
-    if (column.type === 'colspan') {
-      column.subcols = column.subcols || []
-      let subcol = { isSub: true, focus: true, uuid: Utils.getuuid(), label: 'label', field: '', type: 'text' }
-      column.subcols.push(subcol)
-
-      this.setState({
-        card: subcol
-      })
-      this.updateCol(column)
-    } else if (column.type === 'custom') {
+    if (column.type === 'custom') {
       let newcard = {uuid: Utils.getuuid(), focus: true, eleType: 'text', datatype: 'dynamic', style: {paddingLeft: '4px'}}
   
       // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌
@@ -336,9 +320,7 @@
     col.isSub = card.isSub === true
     col.marks = card.marks || []
     
-    if (col.type === 'colspan') {
-      col.subcols = card.subcols || []
-    } else if (col.type === 'custom') {
+    if (col.type === 'custom') {
       col.elements = card.type === 'custom' ? (card.elements || []) : []
     } else if (col.type === 'action') {
       col.elements = card.type === 'action' ? (card.elements || []) : []
@@ -376,20 +358,11 @@
     this.setState({card: null})
   }
 
-  loopDelCol = (columns, col) => {
-    return columns.filter(column => {
-      if (column.type === 'colspan') {
-        column.subcols = this.loopDelCol(column.subcols, col)
-      }
-      return column.uuid !== col.uuid
-    })
-  }
-
   deleteCol = (col) => {
     const { appType } = this.state
     let _columns = fromJS(this.state.columns).toJS()
 
-    _columns = this.loopDelCol(_columns, col)
+    _columns = _columns.filter(column => column.uuid !== col.uuid)
 
     this.setState({
       columns: _columns

--
Gitblit v1.8.0