Browse Source

分组树双击进入编辑

zhuth 6 years ago
parent
commit
f3c9e1e6f1
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/components/common/groupManageMentBox/box.jsx

+ 8 - 1
src/components/common/groupManageMentBox/box.jsx

@@ -43,6 +43,7 @@ class GroupBox extends React.Component {
                 title={<div className='node-title'>
                     {t.code === editingKey ? <div className='input'>
                         <Input
+                            ref={(input) => {this['inputRef-' + t.code] = input}}
                             size="small"
                             defaultValue={t.label}
                             addonAfter={<Icon style={{ cursor: 'pointer', color: '#52C41A' }} type="check-circle" onClick={() => {
@@ -57,7 +58,13 @@ class GroupBox extends React.Component {
                             }}
                         />
                     </div> :
-                    <div className='label'>{title}</div>}
+                    <div className='label' onDoubleClick={() => {
+                        this.setState({
+                            editingKey: t.code
+                        }, () => {
+                            this['inputRef-' + t.code].focus();
+                        });
+                    }}>{title}</div>}
                     <div className='tools'>
                         {t.code !== editingKey && <Icon type='edit' onClick={() => {
                             this.setState({