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/edit-table/columns/index.jsx |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx
index 4ed5e10..cbf2d50 100644
--- a/src/menu/components/table/edit-table/columns/index.jsx
+++ b/src/menu/components/table/edit-table/columns/index.jsx
@@ -43,7 +43,7 @@
       return true
     }
 
-    if (!nextProps.column) return false
+    if (!nextProps.column) return true
 
     return !is(fromJS(this.props.column), fromJS(nextProps.column)) ||
       !is(fromJS(this.props.fields), fromJS(nextProps.fields)) ||
@@ -53,17 +53,23 @@
   render() {
     const { connectDragSource, connectDropTarget, moveCol, addElement, updateCol, editColumn, changeStyle, deleteCol, index, column, align, fields, children, ...restProps } = this.props
 
+    if (!column) return (
+      <th {...restProps} index={index}>
+        {children}
+      </th>
+    )
+
     return connectDragSource(
-      connectDropTarget(<th {...restProps} index={index} style={{ cursor: 'move', textAlign: align }} onDoubleClick={() => column && this.props.editColumn(column)}>
+      connectDropTarget(<th {...restProps} index={index} style={{ cursor: 'move', textAlign: align }} onDoubleClick={() => this.props.editColumn(column)}>
         <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
           <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}>
-            {column && ['custom', 'action'].includes(column.type) ?
+            {['custom', 'action'].includes(column.type) ?
               <PlusOutlined className="plus" title="娣诲姞" onClick={() => this.props.addElement(column)} /> : null
             }
             <EditOutlined className="edit" title="缂栬緫" onClick={() => this.props.editColumn(column)} />
-            {column && column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null}
+            {column.type === 'custom' ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.props.changeStyle(column)}/> : null}
             <DeleteOutlined className="close" title="鍒犻櫎" onClick={this.deleteCol} />
-            {column && ['text', 'number', 'formula'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null }
+            {['text', 'number', 'formula'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null }
           </div>
         } trigger="hover">
           {children}
@@ -405,6 +411,11 @@
       cols: columns.filter(col => !col.origin)
     }
 
+    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()
@@ -511,10 +522,17 @@
       }
     }
 
+    let rowSelection = null
+    if (config.wrap.tableType) {
+      rowSelection = {
+        type: config.wrap.tableType === 'radio' ? 'radio' : 'checkbox',
+      }
+    }
+
     const columns = this.state.columns.map((col, index) => {
       let title = col.label
       if (col.editable === 'true') {
-        title = <span>{col.label}<EditOutlined style={{position: 'absolute', bottom: 0, right: 0, color: '#1890ff'}}/></span>
+        title = <span>{col.label}<EditOutlined style={{position: 'absolute', bottom: 0, right: 0, color: '#1890ff', opacity: '0.7'}}/></span>
       }
       return {
         title: title,
@@ -573,6 +591,7 @@
             rowClassName="editable-row"
             style={style}
             bordered={config.wrap.bordered !== 'false'}
+            rowSelection={rowSelection}
             components={components}
             dataSource={this.state.data}
             columns={columns}

--
Gitblit v1.8.0