Browse Source

[bug] add groupBox delete confirm message.

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

+ 23 - 2
src/components/common/groupManageMentBox/box.jsx

@@ -1,5 +1,6 @@
 import React from 'react'
 import { Modal, Tree, Input, Icon, Row, Col, Button } from 'antd'
+import DeleteBox from '../deleteBox/deleteBox'
 import { arrayToTree, hashcode } from '../../../utils/baseUtils'
 import './box.less'
 const { TreeNode } = Tree;
@@ -18,6 +19,8 @@ class GroupBox extends React.Component {
             aGroups: [], // 新增的分组
             mGroups: [], // 修改的分组
             dGroups: [], // 删除的分组
+            willDeleteGroup: null,
+            visibleDeleteGroupBox: false
         }
     }
 
@@ -62,7 +65,14 @@ class GroupBox extends React.Component {
                             });
                         }}/>}
                         {!t.children && <Icon type='delete' onClick={() => {
-                            this.deleteGroup(t);
+                            if(t.code.startsWith('new-')) {
+                                this.deleteGroup(t);
+                            }else {
+                                this.setState({
+                                    willDeleteGroup: t,
+                                    visibleDeleteGroupBox: true
+                                });
+                            }
                         }}/>}
                     </div>
                 </div>}
@@ -231,7 +241,7 @@ class GroupBox extends React.Component {
 
     render() {
         let { visibleBox, hideBox, okHandler } = this.props;
-        let { groupData, expandedKeys, selectedGroup, autoExpandParent, aGroups, mGroups, dGroups } = this.state;
+        let { groupData, expandedKeys, selectedGroup, autoExpandParent, aGroups, mGroups, dGroups, visibleDeleteGroupBox, willDeleteGroup } = this.state;
         let treeData = arrayToTree(groupData, '-1', 'code', 'pcode', 'children');
         return <Modal
             className='groupmanagement-box'
@@ -266,6 +276,17 @@ class GroupBox extends React.Component {
                     }
                 </Tree>
             </Row>
+            {visibleDeleteGroupBox && <DeleteBox
+                visibleBox={visibleDeleteGroupBox}
+                text={<div><span>确定要删除图表【{willDeleteGroup.label}】吗?</span><br/><span style={{ color: 'red' }}>*该组所有数据源将移动到未分组</span></div>}
+                hideBox={() => {
+                    this.setState({
+                        visibleDeleteGroupBox: false
+                    })
+                }}
+                okHandler={() => {
+                    this.deleteGroup(willDeleteGroup);
+            }} />}
         </Modal>
     }
 }