From c5e5a7580632bc39a9e0c78d548f22a8be5f2019 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 18 十月 2023 18:04:51 +0800
Subject: [PATCH] 2023-10-18

---
 src/menu/components/table/base-table/columns/index.jsx |   53 +++++++++++++++++++++++++++++++----------------------
 1 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/src/menu/components/table/base-table/columns/index.jsx b/src/menu/components/table/base-table/columns/index.jsx
index d1da3b4..aad0434 100644
--- a/src/menu/components/table/base-table/columns/index.jsx
+++ b/src/menu/components/table/base-table/columns/index.jsx
@@ -2,8 +2,8 @@
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
 import { DndProvider, DragSource, DropTarget } from 'react-dnd'
-import { Table, Popover, Modal, message, notification } from 'antd'
-import { PlusOutlined, PlusSquareOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined, InfoOutlined } from '@ant-design/icons'
+import { Table, Popover, Modal, message, notification, Typography } from 'antd'
+import { PlusOutlined, PlusSquareOutlined, EditOutlined, CopyOutlined, DeleteOutlined, FontColorsOutlined, CloseCircleOutlined, AntDesignOutlined } from '@ant-design/icons'
 
 import asyncComponent from '@/utils/asyncComponent'
 import asyncIconComponent from '@/utils/asyncIconComponent'
@@ -12,6 +12,7 @@
 import './index.scss'
 
 const { confirm } = Modal
+const { Paragraph } = Typography
 const EditColumn = asyncComponent(() => import('./editColumn'))
 const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent'))
 const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent'))
@@ -199,7 +200,7 @@
       }
       return (
         <td style={{...style}} className={className}>
-          {val}
+          {column.field ? <Paragraph className="col-copy" copyable={{ text: column.field }}>{val}</Paragraph> : val}
           {column.Hide === 'true' ? <CloseCircleOutlined style={{marginLeft: '5px', color: 'orange', fontSize: '12px'}}/> : null}
           {column.marks && column.marks.length ? <AntDesignOutlined className="profile"/> : null}
         </td>
@@ -324,9 +325,17 @@
       col.subcols = []
     } else if (col.type === 'index') {
       col.label = '搴忓彿'
+    } else if (col.type === 'number') {
+      col.Width = 80
     }
 
-    _columns.splice(hoverIndex, 0, col)
+    let hIndex = +hoverIndex
+
+    if (_columns.length > 0 && hIndex + 1 === _columns.length) {
+      _columns.push(col)
+    } else {
+      _columns.splice(hIndex, 0, col)
+    }
 
     this.setState({
       columns: _columns
@@ -607,26 +616,26 @@
     })
   }
 
-  copyFields = () => {
-    const { config } = this.props
-    let m = []
-    let n = []
+  // copyFields = () => {
+  //   const { config } = this.props
+  //   let m = []
+  //   let n = []
 
-    config.columns.forEach(col => {
-      m.push(`${col.field} ${col.datatype}`)
-      n.push(col.field)
-    })
+  //   config.columns.forEach(col => {
+  //     m.push(`${col.field} ${col.datatype}`)
+  //     n.push(col.field)
+  //   })
 
-    let oInput = document.createElement('input')
-    oInput.value = `/*${m.join(',')}*/
-      ${n.join(',')}`
-    document.body.appendChild(oInput)
-    oInput.select()
-    document.execCommand('Copy')
-    document.body.removeChild(oInput)
+  //   let oInput = document.createElement('input')
+  //   oInput.value = `/*${m.join(',')}*/
+  //     ${n.join(',')}`
+  //   document.body.appendChild(oInput)
+  //   oInput.select()
+  //   document.execCommand('Copy')
+  //   document.body.removeChild(oInput)
 
-    message.success('澶嶅埗鎴愬姛銆�')
-  }
+  //   message.success('澶嶅埗鎴愬姛銆�')
+  // }
 
   componentDidMount () {
     MKEmitter.addListener('plusColumns', this.plusColumns)
@@ -672,7 +681,7 @@
           <FieldsComponent config={config} type="columns" />
           <CopyOutlined title="澶嶅埗鏄剧ず鍒�" onClick={this.copycolumn} />
           <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} />
-          <InfoOutlined title="澶嶅埗瀛楁" style={{color: 'orange'}} onClick={this.copyFields}/>
+          {/* <InfoOutlined title="澶嶅埗瀛楁" style={{color: 'orange'}} onClick={this.copyFields}/> */}
         </div>
         <DndProvider>
           {groups ? groups.map((group, i) => {

--
Gitblit v1.8.0