From 49f09cc6f8ff8c30a75ed1a9d6f510b69b73962a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 12 十二月 2023 21:05:37 +0800
Subject: [PATCH] 2023-12-12

---
 src/menu/components/table/normal-table/columns/index.jsx |   43 +++++++++++++++++++++++++++++++++++++------
 1 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx
index 02653b8..585012a 100644
--- a/src/menu/components/table/normal-table/columns/index.jsx
+++ b/src/menu/components/table/normal-table/columns/index.jsx
@@ -17,6 +17,7 @@
 const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent'))
 const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent'))
 const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination'))
+const ColsControl = asyncIconComponent(() => import('@/menu/components/share/colsControl'))
 const PasteComponent = asyncIconComponent(() => import('@/components/paste'))
 
 class HeaderCol extends Component {
@@ -35,6 +36,32 @@
   updateMarks = (vals) => {
     const { column } = this.props
     this.props.updateCol({...column, marks: vals})
+  }
+
+  copycolumn = () => {
+    const { column } = this.props
+
+    let oInput = document.createElement('input')
+    let val = {
+      copyType: 'cols',
+      cols: [column]
+    }
+
+    let srcid = localStorage.getItem(window.location.href.split('#')[0] + 'srcId')
+    if (srcid) {
+      val.$srcId = srcid
+    }
+
+    oInput.value = window.btoa(window.encodeURIComponent(JSON.stringify(val)))
+    document.body.appendChild(oInput)
+    oInput.select()
+    document.execCommand('Copy')
+    oInput.className = 'oInput'
+    oInput.style.display = 'none'
+
+    message.success('澶嶅埗鎴愬姛銆�')
+
+    document.body.removeChild(oInput)
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -76,6 +103,7 @@
             {column.type === 'custom' ? <PlusOutlined className="plus" title="娣诲姞鍏冪礌" onClick={() => this.props.addElement(column)} /> : null}
             {column.type === 'custom' ? <PlusSquareOutlined className="plus" title="娣诲姞鎸夐挳" onClick={() => this.props.addElement(column, 'button')} /> : null}
             <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} />
+            <CopyOutlined title="澶嶅埗鏄剧ず鍒�" style={{color: '#26C281'}} onClick={this.copycolumn} />
             {column.type === 'custom' ? <PasteComponent options={['customCardElement', 'action']} updateConfig={(res, resolve) => this.props.pasteCell(column, res, resolve)} /> : null}
             {column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null}
             <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} />
@@ -250,12 +278,7 @@
   }
 
   shouldComponentUpdate (nextProps, nextState) {
-    const { config } = this.props
-
-    return !is(fromJS(this.state), fromJS(nextState)) ||
-      !is(fromJS(config.wrap), fromJS(nextProps.config.wrap)) ||
-      !is(fromJS(config.action), fromJS(nextProps.config.action)) ||
-      config.setting.laypage !== nextProps.config.setting.laypage
+    return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props.config), fromJS(nextProps.config))
   }
 
   moveCol = (dragIndex, hoverIndex) => {
@@ -597,6 +620,12 @@
     })
   }
 
+  addColumns = () => {
+    const { config } = this.props
+
+    MKEmitter.emit('addColumns', config.uuid)
+  }
+
   /**
    * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊锛屾竻闄ゅ揩鎹烽敭璁剧疆
    */
@@ -623,8 +652,10 @@
     return (
       <div className={`normal-table-columns ${config.setting.laypage} ${config.wrap.tableType} ${config.wrap.mode || ''} table-vertical-${config.wrap.vertical || ''} table-col-${columns.length}`} id={tableId}>
         <div className="col-control">
+          <PlusOutlined style={{color: '#26C281'}} title="娣诲姞鍒�" onClick={this.addColumns}/>
           <CopyOutlined title="澶嶅埗鏄剧ず鍒�" onClick={this.copycolumn} />
           <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} />
+          {appType !== 'mob' ? <ColsControl config={config} onSubmit={this.props.updatecolumn}/> : null}
           <FileSyncOutlined title="鍚屾瀛楁闆�" onClick={this.syncfield} />
           <DeleteOutlined title="娓呯┖鏄剧ず鍒�" onClick={this.clear}/>
         </div>

--
Gitblit v1.8.0