|
@@ -50,13 +50,15 @@ const Newrole = Form.create()(React.createClass({
|
|
|
handleSubmit(e) {
|
|
|
e.preventDefault();
|
|
|
this.props.form.validateFields((err, values) => {
|
|
|
- let selectAllId = this.state.checkedKeys;
|
|
|
+ let selectAllId = this.state.checkedKeys||[];
|
|
|
if(!err) {
|
|
|
this.setState({
|
|
|
loading: true
|
|
|
});
|
|
|
- if(selectAllId[selectAllId.length-1]==null){
|
|
|
- selectAllId.splice(selectAllId.length-1,1)
|
|
|
+ if(selectAllId.checked){
|
|
|
+ if(selectAllId.checked[0]==null){
|
|
|
+ selectAllId.checked.splice(0,1)
|
|
|
+ }
|
|
|
}
|
|
|
$.ajax({
|
|
|
method: "POST",
|
|
@@ -67,7 +69,7 @@ const Newrole = Form.create()(React.createClass({
|
|
|
data:JSON.stringify({
|
|
|
'id':this.state.ids?this.state.ids:null,
|
|
|
'roleName': this.state.roleName,
|
|
|
- 'permissions': selectAllId
|
|
|
+ 'permissions': selectAllId.checked?selectAllId.checked:selectAllId
|
|
|
})
|
|
|
}
|
|
|
}).done(function(data) {
|
|
@@ -77,7 +79,6 @@ const Newrole = Form.create()(React.createClass({
|
|
|
if(!data.error.length) {
|
|
|
message.success('保存成功!');
|
|
|
this.handleOk()
|
|
|
-
|
|
|
} else {
|
|
|
message.warning(data.error[0].message);
|
|
|
}
|
|
@@ -215,6 +216,7 @@ const Newrole = Form.create()(React.createClass({
|
|
|
<Tree
|
|
|
checkable
|
|
|
onExpand={this.onExpand}
|
|
|
+ checkStrictly={true}
|
|
|
expandedKeys={this.state.expandedKeys}
|
|
|
autoExpandParent={this.state.autoExpandParent}
|
|
|
onCheck={this.onCheck}
|