更新菜单
This commit is contained in:
parent
b77b419425
commit
83573af738
|
@ -7,6 +7,7 @@ import FormItem from "../../../../components/form-item/main"
|
||||||
import "../../../../assets/comm.css"
|
import "../../../../assets/comm.css"
|
||||||
import {Select,Button,ImageUpload ,onUpload,Radio,NumberInput } from "zent"
|
import {Select,Button,ImageUpload ,onUpload,Radio,NumberInput } from "zent"
|
||||||
import Bus from "../../../../assets/eventBus.js"
|
import Bus from "../../../../assets/eventBus.js"
|
||||||
|
import _ from "lodash"
|
||||||
const RadioGroup = Radio.Group;
|
const RadioGroup = Radio.Group;
|
||||||
const RadioButton = Radio.Button;
|
const RadioButton = Radio.Button;
|
||||||
export default class adduserinfo extends React.Component{
|
export default class adduserinfo extends React.Component{
|
||||||
|
@ -24,7 +25,8 @@ export default class adduserinfo extends React.Component{
|
||||||
method:'',
|
method:'',
|
||||||
level:''
|
level:''
|
||||||
},
|
},
|
||||||
menutype:"",//菜单类型
|
menutype:"",//菜单类型
|
||||||
|
cancelInfo:{},//保存原来的值
|
||||||
menumethods:''//请求方式
|
menumethods:''//请求方式
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,9 +59,11 @@ methodsonChange = e => {
|
||||||
submit(){
|
submit(){
|
||||||
this.refs.form1.validator()
|
this.refs.form1.validator()
|
||||||
}
|
}
|
||||||
|
//重置
|
||||||
|
resetInfo(){
|
||||||
|
console.log(888,this.state.cancelInfo);
|
||||||
|
this.setState({model:this.state.cancelInfo});
|
||||||
|
}
|
||||||
cancel(){
|
cancel(){
|
||||||
let model2 = { //数据模型不可少
|
let model2 = { //数据模型不可少
|
||||||
menuname:"",
|
menuname:"",
|
||||||
|
@ -70,6 +74,7 @@ methodsonChange = e => {
|
||||||
}
|
}
|
||||||
componentWillReceiveProps(nextProps){//接收
|
componentWillReceiveProps(nextProps){//接收
|
||||||
this.setState({model:nextProps.menuList});
|
this.setState({model:nextProps.menuList});
|
||||||
|
this.setState({cancelInfo:_.cloneDeep(nextProps.menuList)});
|
||||||
}
|
}
|
||||||
render(){
|
render(){
|
||||||
|
|
||||||
|
@ -80,12 +85,11 @@ methodsonChange = e => {
|
||||||
],
|
],
|
||||||
|
|
||||||
}
|
}
|
||||||
console.log(11,this.state.model);
|
|
||||||
return(
|
return(
|
||||||
<div id="menuright">
|
<div id="menuright">
|
||||||
<p className="btnlist">
|
<p className="btnlist">
|
||||||
<Button type="primary" onClick={this.submit.bind(this)}>修改并保存</Button>
|
<Button type="primary" onClick={this.submit.bind(this)}>修改并保存</Button>
|
||||||
<Button type="normal">重置</Button>
|
<Button type="normal" onClick={this.resetInfo.bind(this)}>重置</Button>
|
||||||
</p>
|
</p>
|
||||||
<Form model={this.state.model} rules={rules} ref="form1" >
|
<Form model={this.state.model} rules={rules} ref="form1" >
|
||||||
<FormItem labelname="菜单名称" prop="menuname" id="menuname" >
|
<FormItem labelname="菜单名称" prop="menuname" id="menuname" >
|
||||||
|
@ -111,22 +115,22 @@ methodsonChange = e => {
|
||||||
|
|
||||||
<FormItem required={false} labelname="请求方式">
|
<FormItem required={false} labelname="请求方式">
|
||||||
<RadioGroup onChange={this.methodsonChange} value={this.state.model.method}>
|
<RadioGroup onChange={this.methodsonChange} value={this.state.model.method}>
|
||||||
<RadioButton value="1" >GET</RadioButton>
|
<RadioButton value={1} >GET</RadioButton>
|
||||||
<RadioButton value="5" >POST</RadioButton>
|
<RadioButton value={5} >POST</RadioButton>
|
||||||
<RadioButton value="10">PUT</RadioButton>
|
<RadioButton value={10}>PUT</RadioButton>
|
||||||
<RadioButton value="15">DELETE</RadioButton>
|
<RadioButton value={15}>DELETE</RadioButton>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem required={false} labelname="是否显示">
|
<FormItem required={false} labelname="是否显示">
|
||||||
<RadioGroup onChange={this.statusChange} value={this.state.model.status}>
|
<RadioGroup onChange={this.statusChange} value={this.state.model.status}>
|
||||||
<RadioButton value="1" >是</RadioButton>
|
<RadioButton value={1} >是</RadioButton>
|
||||||
<RadioButton value="5" >否</RadioButton>
|
<RadioButton value={5} >否</RadioButton>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem required={false} labelname="是否验证登陆">
|
<FormItem required={false} labelname="是否验证登陆">
|
||||||
<RadioGroup onChange={this.authChange} value={this.state.model.auth}>
|
<RadioGroup onChange={this.authChange} value={this.state.model.auth}>
|
||||||
<RadioButton value="1" >是</RadioButton>
|
<RadioButton value={1} >是</RadioButton>
|
||||||
<RadioButton value="5" >否</RadioButton>
|
<RadioButton value={5} >否</RadioButton>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem required={false} labelname="菜单图标">
|
<FormItem required={false} labelname="菜单图标">
|
||||||
|
|
Loading…
Reference in New Issue