From f895e8af9e6a393f71fec0dc26fdf1b9b6616cb4 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 11 十二月 2020 18:53:04 +0800
Subject: [PATCH] 2020-12-11

---
 src/templates/zshare/editTable/index.jsx |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/src/templates/zshare/editTable/index.jsx b/src/templates/zshare/editTable/index.jsx
index 4a250b5..c863a45 100644
--- a/src/templates/zshare/editTable/index.jsx
+++ b/src/templates/zshare/editTable/index.jsx
@@ -16,11 +16,10 @@
 
 class BodyRow extends React.Component {
   render() {
-    const { isOver, connectDragSource, connectDropTarget, moveRow, ...restProps } = this.props
-    const style = { ...restProps.style, cursor: 'move' }
+    const { isOver, moveAble, connectDragSource, connectDropTarget, moveRow, ...restProps } = this.props
 
     let { className } = restProps
-    if (isOver) {
+    if (isOver && moveAble) {
       if (restProps.index > dragingIndex) {
         className += ' drop-over-downward'
       }
@@ -29,9 +28,13 @@
       }
     }
 
-    return connectDragSource(
-      connectDropTarget(<tr {...restProps} className={className} style={style} />),
-    )
+    if (moveAble) {
+      return connectDragSource(
+        connectDropTarget(<tr {...restProps} className={className} style={{ ...restProps.style, cursor: 'move' }} />),
+      )
+    } else {
+      return (<tr {...restProps} className={className} style={restProps.style} />)
+    }
   }
 }
 
@@ -103,7 +106,7 @@
         </Radio.Group>
       )
     } else {
-      return <Input onPressEnter={() => this.getValue(form)} />
+      return <Input onPressEnter={() => this.getValue(form)}/>
     }
   }
 
@@ -174,7 +177,7 @@
           const { editingKey } = this.state
           const editable = this.isEditing(record)
           return editable ? (
-            <span style={{textAlign: 'center', display: 'block'}}>
+            <div style={{textAlign: 'center', minWidth: '110px'}}>
               <EditableContext.Consumer>
                 {form => (
                   <span onClick={() => this.save(form, record.uuid)} style={{ marginRight: 8 , color: '#1890ff', cursor: 'pointer'}}>
@@ -183,9 +186,9 @@
                 )}
               </EditableContext.Consumer>
               <span style={{ color: '#1890ff', cursor: 'pointer'}} onClick={() => this.cancel(record.uuid)}>{eTDict['model.cancel']}</span>
-            </span>
+            </div>
           ) : (
-            <div className={'edit-operation-btn' + (editingKey !== '' ? ' disabled' : '')}>
+            <div className={'edit-operation-btn' + (editingKey !== '' ? ' disabled' : '')} style={{minWidth: '110px'}}>
               {!actions || actions.includes('edit') ? <span className="primary" onClick={() => {editingKey === '' && this.edit(record.uuid)}}><Icon type="edit" /></span> : null}
               {(!actions || actions.includes('del')) && editingKey === '' ? <Popconfirm
                 overlayClassName="popover-confirm"
@@ -380,7 +383,7 @@
 
     return (
       <EditableContext.Provider value={this.props.form}>
-        <div className={'modal-edit-table ' + (this.state.editingKey ? 'editing' : '')}>
+        <div className="modal-edit-table">
           <DndProvider>
             <Table
               bordered
@@ -392,6 +395,7 @@
               pagination={false}
               onRow={(record, index) => ({
                 index,
+                moveAble: !this.state.editingKey,
                 moveRow: this.moveRow,
               })}
             />

--
Gitblit v1.8.0