|
@@ -22,6 +22,7 @@ class GroupBox extends React.Component {
|
|
|
willDeleteGroup: null,
|
|
willDeleteGroup: null,
|
|
|
visibleDeleteGroupBox: false,
|
|
visibleDeleteGroupBox: false,
|
|
|
validInfo: {},
|
|
validInfo: {},
|
|
|
|
|
+ saving: false,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -290,7 +291,8 @@ class GroupBox extends React.Component {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
groupData,
|
|
groupData,
|
|
|
mGroups: mGroups,
|
|
mGroups: mGroups,
|
|
|
- dGroups: dGroups.concat([{ ...group, operate: 'delete' }])
|
|
|
|
|
|
|
+ dGroups: dGroups.concat([{ ...group, operate: 'delete' }]),
|
|
|
|
|
+ selectedGroup: null
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -320,7 +322,7 @@ class GroupBox extends React.Component {
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
let { visibleBox, hideBox, okHandler } = this.props;
|
|
let { visibleBox, hideBox, okHandler } = this.props;
|
|
|
- let { groupData, expandedKeys, selectedGroup, autoExpandParent, aGroups, mGroups, dGroups, visibleDeleteGroupBox, willDeleteGroup } = this.state;
|
|
|
|
|
|
|
+ let { groupData, expandedKeys, selectedGroup, autoExpandParent, aGroups, mGroups, dGroups, visibleDeleteGroupBox, willDeleteGroup, saving } = this.state;
|
|
|
let treeData = arrayToTree(groupData, '-1', 'code', 'pcode', 'children');
|
|
let treeData = arrayToTree(groupData, '-1', 'code', 'pcode', 'children');
|
|
|
return <Modal
|
|
return <Modal
|
|
|
className='groupmanagement-box'
|
|
className='groupmanagement-box'
|
|
@@ -329,18 +331,25 @@ class GroupBox extends React.Component {
|
|
|
footer={
|
|
footer={
|
|
|
<div>
|
|
<div>
|
|
|
<Button onClick={hideBox}>取 消</Button>
|
|
<Button onClick={hideBox}>取 消</Button>
|
|
|
- <Button disabled={!this.checkValid()} type='primary' onClick={() => {
|
|
|
|
|
|
|
+ <Button disabled={!this.checkValid() || saving} type='primary' onClick={() => {
|
|
|
if(aGroups.length === 0 && mGroups.length === 0 && dGroups.length === 0) {
|
|
if(aGroups.length === 0 && mGroups.length === 0 && dGroups.length === 0) {
|
|
|
hideBox()
|
|
hideBox()
|
|
|
}else {
|
|
}else {
|
|
|
- okHandler(aGroups, mGroups, dGroups);
|
|
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ saving: true
|
|
|
|
|
+ });
|
|
|
|
|
+ okHandler(aGroups, mGroups, dGroups).then(() => {
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ saving: false,
|
|
|
|
|
+ aGroups: [],
|
|
|
|
|
+ mGroups: [],
|
|
|
|
|
+ dGroups: [],
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
}}>确 定</Button>
|
|
}}>确 定</Button>
|
|
|
</div>
|
|
</div>
|
|
|
}
|
|
}
|
|
|
- onOk={() => {
|
|
|
|
|
- okHandler(aGroups, mGroups, dGroups);
|
|
|
|
|
- }}
|
|
|
|
|
onCancel={hideBox}
|
|
onCancel={hideBox}
|
|
|
maskClosable={false}
|
|
maskClosable={false}
|
|
|
destroyOnClose={true}
|
|
destroyOnClose={true}
|
|
@@ -350,7 +359,7 @@ class GroupBox extends React.Component {
|
|
|
<Search placeholder='搜索' onChange={this.onSearch}></Search>
|
|
<Search placeholder='搜索' onChange={this.onSearch}></Search>
|
|
|
</Col>
|
|
</Col>
|
|
|
<Col span={6}>
|
|
<Col span={6}>
|
|
|
- <Button disabled={selectedGroup && selectedGroup.code && selectedGroup.code.startsWith('new-')} style={{ marginLeft: '8px' }} onClick={() => {
|
|
|
|
|
|
|
+ <Button disabled={selectedGroup && selectedGroup.code && (selectedGroup.code.startsWith('new-') || (groupData.findIndex(g => g.code === selectedGroup.code) === -1))} style={{ marginLeft: '8px' }} onClick={() => {
|
|
|
this.addGroup(selectedGroup);
|
|
this.addGroup(selectedGroup);
|
|
|
}}>添加</Button>
|
|
}}>添加</Button>
|
|
|
</Col>
|
|
</Col>
|