This commit is contained in:
parent
eab8240c8e
commit
e939e80b76
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/marketing-system.iml" filepath="$PROJECT_DIR$/.idea/marketing-system.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -385,6 +385,10 @@ export const getAllEnum = (data) => {
|
|||
export const postCreateMenu = (data) => {
|
||||
return req('post', baseurl + "/auth/menu",data)
|
||||
}
|
||||
//编辑菜单
|
||||
export const putmodifyMenu = (id,data) => {
|
||||
return req('put', baseurl + "/auth/menu/"+id,data)
|
||||
}
|
||||
|
||||
|
||||
//获取落地页下拉菜单
|
||||
|
|
|
@ -44,7 +44,7 @@ componentWillMount(){
|
|||
this.getMenuFn();
|
||||
}
|
||||
componentWillReceiveProps(nextProps){//接收
|
||||
console.log(4788,nextProps);
|
||||
// console.log(4788,nextProps);
|
||||
// this.setState({model:nextProps.menuList});
|
||||
// this.setState({cancelInfo:_.cloneDeep(nextProps.menuList)});
|
||||
}
|
||||
|
|
|
@ -5,9 +5,10 @@ import Ipt from "../../../../components/input/main"
|
|||
import Form from "../../../../components/form/main"
|
||||
import FormItem from "../../../../components/form-item/main"
|
||||
import "../../../../assets/comm.css"
|
||||
import {Select,Button,ImageUpload ,onUpload,Radio,NumberInput } from "zent"
|
||||
import {Select,Button,ImageUpload ,Sweetalert,onUpload,Notify,Radio,NumberInput } from "zent"
|
||||
import Bus from "../../../../assets/eventBus.js"
|
||||
import _ from "lodash"
|
||||
import {putmodifyMenu,handelResponse} from "../../../../assets/api.js"
|
||||
const RadioGroup = Radio.Group;
|
||||
const RadioButton = Radio.Button;
|
||||
export default class adduserinfo extends React.Component{
|
||||
|
@ -56,14 +57,44 @@ methodsonChange = e => {
|
|||
this.setState({ model: model1 });
|
||||
}
|
||||
|
||||
submit(){
|
||||
this.refs.form1.validator()
|
||||
modifysubmit(){
|
||||
console.log(this.state.model);
|
||||
let modifyFlag=this.refs.form1.validator();
|
||||
|
||||
let self=this;
|
||||
if(modifyFlag){
|
||||
let data=_.cloneDeep(this.state.model);
|
||||
delete data.id;
|
||||
Sweetalert.confirm({
|
||||
type:'warning',
|
||||
closeBtn:true,
|
||||
title:'确认操作',
|
||||
content: <p>是否修改菜单信息?</p>,
|
||||
onConfirm:()=>{
|
||||
putmodifyMenu(this.state.model.id,data).then(res=>{
|
||||
handelResponse(res,(response,msg)=>{
|
||||
Notify.clear();
|
||||
Notify.success(msg);
|
||||
},(err)=>{
|
||||
|
||||
})
|
||||
}).catch(err=>{
|
||||
});
|
||||
},
|
||||
onCancel: this.onCancel,
|
||||
className:'questModal',
|
||||
parentComponent: this
|
||||
});
|
||||
}
|
||||
}
|
||||
//重置
|
||||
resetInfo(){
|
||||
console.log(888,this.state.cancelInfo);
|
||||
this.setState({model:this.state.cancelInfo});
|
||||
console.log('充值',this.state.cancelInfo);
|
||||
setTimeout(()=>{
|
||||
Notify.clear();
|
||||
Notify.success('重置成功');
|
||||
},500);
|
||||
|
||||
}
|
||||
cancel(){
|
||||
let model2 = { //数据模型不可少
|
||||
|
@ -75,11 +106,29 @@ methodsonChange = e => {
|
|||
this.refs.form1.cancel();
|
||||
}
|
||||
componentWillReceiveProps(nextProps){//接收
|
||||
this.setState({model:_.cloneDeep(nextProps.menuList)});
|
||||
this.setState({cancelInfo:_.cloneDeep(nextProps.menuList)});
|
||||
this.setState({cancelInfo:this.props.menuList});
|
||||
}
|
||||
// 监听组件内部状态的变化:
|
||||
componentDidUpdate(prevProps,prevState){
|
||||
// 参数分别为改变之前的数据状态对象
|
||||
if(prevState.cancelInfo!=this.state.cancelInfo){
|
||||
let menudata=_.cloneDeep(this.state.cancelInfo);
|
||||
let data={
|
||||
title:menudata.title,
|
||||
fid:menudata.fid,
|
||||
url:menudata.url,
|
||||
auth:menudata.auth,
|
||||
sort:menudata.sort,
|
||||
status:menudata.status,
|
||||
icon:menudata.icon,
|
||||
method:menudata.method,
|
||||
level:menudata.level,
|
||||
id:menudata.id
|
||||
}
|
||||
this.setState({model:data});
|
||||
}
|
||||
}
|
||||
render(){
|
||||
|
||||
//校验规则
|
||||
const rules = {
|
||||
menuname: [
|
||||
|
@ -90,7 +139,7 @@ methodsonChange = e => {
|
|||
return(
|
||||
<div id="menuright">
|
||||
<p className="btnlist">
|
||||
<Button type="primary" onClick={this.submit.bind(this)}>修改并保存</Button>
|
||||
<Button type="primary" onClick={this.modifysubmit.bind(this)}>修改并保存</Button>
|
||||
<Button type="normal" onClick={this.resetInfo.bind(this)}>重置</Button>
|
||||
</p>
|
||||
<Form model={this.state.model} rules={rules} ref="form1" >
|
||||
|
|
Loading…
Reference in New Issue