diff --git a/src/components/form-item/main.js b/src/components/form-item/main.js
index 79e3aa14..e83e6319 100644
--- a/src/components/form-item/main.js
+++ b/src/components/form-item/main.js
@@ -9,26 +9,18 @@ import Menu from "../menu/main.js"
constructor(props) {
super(props);
this.state = {
- children :props.children
+
}
}
- componentDidUpdate(prevProps,prevState){
-
- if(prevState.children!=this.state.children)
- {
- console.log("更新")
- }
- }
render() {
const {labelname,prop,labelwidth,myClassName} = this.props
- console.log(222,this.state.children)
return (
{labelname}
- {this.state.children}
+ {this.props.children}
)
diff --git a/src/components/form/main.js b/src/components/form/main.js
index c383c365..7fd0ba1b 100644
--- a/src/components/form/main.js
+++ b/src/components/form/main.js
@@ -17,6 +17,10 @@ export default class form extends React.Component {
rules: props.rules
}
}
+ componentWillReceiveProps(nextProps) {
+ this.setState({children: nextProps.children});
+ this.setState({model: nextProps.model});
+ }
componentDidMount() {
const dom = ReactDom.findDOMNode(this);
let doms = dom.getElementsByClassName("form-Item");
@@ -199,33 +203,6 @@ export default class form extends React.Component {
}
-
-
- // if (formItem_com.value == "") {
- // if (rules_item[j].type == "required") {
- // this.removeClasss(item);
- // this.isRequired(formItem_com.value, o.className, item, rules_item[j].message);
- // }
- // } else {
- // console.log("规则验证")
-
- // if (rules_item[j].type == "regExp") {
-
- // var regu = rules_item[j].reg;
- // var re = new RegExp(regu);
- // let s = formItem_com.value;
- // if (re.test(s)) {
- // console.log("满足")
- // this.removeClasss(item)
- // } else {
- // console.log("不满足")
- // this.isRequired(formItem_com.value, o.className, item, rules_item[j].message);
- // }
- // } else {
- // this.removeClasss(item)
- // }
-
- // }
}
@@ -236,7 +213,7 @@ export default class form extends React.Component {
render() {
return ( <
div className = "form" > {
- this.state.children
+ this.props.children
} <
/div>
)
diff --git a/src/pages/system/account/add/adduserinfo/adduserinfo.js b/src/pages/system/account/add/adduserinfo/adduserinfo.js
index 39423075..12afd335 100644
--- a/src/pages/system/account/add/adduserinfo/adduserinfo.js
+++ b/src/pages/system/account/add/adduserinfo/adduserinfo.js
@@ -11,12 +11,13 @@ export default class adduserinfo extends React.Component{
super(props)
this.state={
model:{ //数据模型不可少
+ account:"",
+ phone:"",
+ pwd:"",
name:"",
- type:"",
- reseller:"",
- return_id:"",
- date_time:""
- }
+ post:"",
+ station:"",
+ },
}
}
@@ -29,8 +30,26 @@ export default class adduserinfo extends React.Component{
onUploadChange(files){
console.log(files);
};
- submit(){
- this.refs.form1.validator()
+
+ onChange (e) {
+ let model2 = {...this.model}
+ model2.station = e;
+ this.setState({
+ model:model2
+ });
+ };
+
+ cancel(){
+ console.log("取消")
+ let model2 = { //数据模型不可少
+ account:"",
+ phone:"",
+ pwd:"",
+ name:"",
+ post:"",
+ station:"",
+ }
+ this.setState({model:model2});
}
render(){
const options = [
@@ -124,13 +143,13 @@ export default class adduserinfo extends React.Component{
-
+
-