调整表单
This commit is contained in:
parent
bef5a9d95b
commit
c89f3c79bd
|
@ -127,12 +127,18 @@ export default class form extends React.Component {
|
||||||
let formItem_com = _.get(formItem, "props.children.props");
|
let formItem_com = _.get(formItem, "props.children.props");
|
||||||
|
|
||||||
let input_compontent = com[1].children[0].getElementsByTagName("input")
|
let input_compontent = com[1].children[0].getElementsByTagName("input")
|
||||||
|
if(input_compontent.length == 0)
|
||||||
|
{
|
||||||
|
input_compontent = com[1].children[0].getElementsByTagName("textarea")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let o = com[1].children[0];
|
let o = com[1].children[0];
|
||||||
|
|
||||||
let rules_item = _.get(self.props.rules, formItem.props.prop)
|
let rules_item = _.get(self.props.rules, formItem.props.prop)
|
||||||
if (input_compontent.length > 0 && rules_item) {
|
if (input_compontent.length > 0 && rules_item) {
|
||||||
input_compontent[0].oninput = function(e) {
|
input_compontent[0].oninput = function(e) {
|
||||||
|
console.log(7777777)
|
||||||
for (let j = 0; j < rules_item.length; j++) {
|
for (let j = 0; j < rules_item.length; j++) {
|
||||||
|
|
||||||
if (rules_item[j].type == "required") {
|
if (rules_item[j].type == "required") {
|
||||||
|
@ -306,9 +312,9 @@ export default class form extends React.Component {
|
||||||
item = com[1]
|
item = com[1]
|
||||||
o = com[1].children[0];
|
o = com[1].children[0];
|
||||||
|
|
||||||
console.log(com)
|
|
||||||
let formItem_com = _.get(formItem[k], "props.children.props");
|
let formItem_com = _.get(formItem[k], "props.children.props");
|
||||||
|
console.log("表单")
|
||||||
|
console.log(formItem_com)
|
||||||
|
|
||||||
//对应的验证规则
|
//对应的验证规则
|
||||||
let rules_item = _.get(this.props.rules, formItem[k].props.prop)
|
let rules_item = _.get(this.props.rules, formItem[k].props.prop)
|
||||||
|
@ -342,10 +348,6 @@ export default class form extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,10 +360,20 @@ export default class form extends React.Component {
|
||||||
//formItem对象
|
//formItem对象
|
||||||
let formItem_com = _.get(formItem, "props.children.props");
|
let formItem_com = _.get(formItem, "props.children.props");
|
||||||
|
|
||||||
console.log("没值了")
|
|
||||||
console.log(formItem)
|
|
||||||
console.log(formItem_com)
|
|
||||||
|
|
||||||
|
if(formItem_com.hasOwnProperty("children"))
|
||||||
|
{
|
||||||
|
|
||||||
|
if(_.isArray(formItem_com.children))
|
||||||
|
{
|
||||||
|
console.log(formItem)
|
||||||
|
console.log("双组件")
|
||||||
|
console.log(formItem_com)
|
||||||
|
|
||||||
|
formItem_com = formItem_com.children[0].props;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
}
|
||||||
//对应的验证规则
|
//对应的验证规则
|
||||||
let rules_item = _.get(this.props.rules, formItem.props.prop)
|
let rules_item = _.get(this.props.rules, formItem.props.prop)
|
||||||
|
|
||||||
|
|
|
@ -355,7 +355,7 @@ export default class adduserinfo extends React.Component{
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
<FormItem labelname="联系人邮箱" prop="contacts_email" id="contacts_email">
|
<FormItem labelname="联系人邮箱" prop="contacts_email" id="contacts_email">
|
||||||
<div className="phonet">
|
|
||||||
<Ipt onChange={(e)=>{
|
<Ipt onChange={(e)=>{
|
||||||
|
|
||||||
let model2 = this.state.model;
|
let model2 = this.state.model;
|
||||||
|
@ -372,7 +372,7 @@ export default class adduserinfo extends React.Component{
|
||||||
value={this.state.model.contacts_email} placeholder={"请输入联系人邮箱"} labelWidth={'0px'} maxLength={50} height={'36px'} width={'520px'} alignment={'left'}/>
|
value={this.state.model.contacts_email} placeholder={"请输入联系人邮箱"} labelWidth={'0px'} maxLength={50} height={'36px'} width={'520px'} alignment={'left'}/>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem prop="sale" labelname="销售人员" id="sale" >
|
<FormItem prop="sale" labelname="销售人员" id="sale" >
|
||||||
|
|
|
@ -173,9 +173,7 @@ export default class acclist extends React.Component{
|
||||||
codeSubmit(){
|
codeSubmit(){
|
||||||
if(this.refs.code_info.validator() && this.refs.code_rule.validator())
|
if(this.refs.code_info.validator() && this.refs.code_rule.validator())
|
||||||
{
|
{
|
||||||
console.log("提交内容")
|
|
||||||
console.log(this.state.codeInfo)
|
|
||||||
console.log(this.state.rank)
|
|
||||||
|
|
||||||
let rank = _.map(this.state.rank,(item)=>{
|
let rank = _.map(this.state.rank,(item)=>{
|
||||||
return item.text
|
return item.text
|
||||||
|
@ -365,16 +363,13 @@ export default class acclist extends React.Component{
|
||||||
|
|
||||||
//基本规则
|
//基本规则
|
||||||
const rulesInfo = {
|
const rulesInfo = {
|
||||||
code_name: [
|
date_time: [
|
||||||
{ type: "required", message: "请输入兑换码名称"},
|
{ type: "required", message: "请选择生效时间段"},
|
||||||
|
|
||||||
],
|
],
|
||||||
issued: [
|
rank: [
|
||||||
{ type: "required", message: "请输入发放总量"},
|
{ type: "required", message: "请选择商品范围"},
|
||||||
],
|
],
|
||||||
describe:[
|
|
||||||
{ type: "required", message: "请输入使用说明"},
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -516,6 +511,7 @@ export default class acclist extends React.Component{
|
||||||
<Input type="textarea" autoSize width="520px" value={this.state.codeInfo.describe} onChange={(e)=>{
|
<Input type="textarea" autoSize width="520px" value={this.state.codeInfo.describe} onChange={(e)=>{
|
||||||
let model = this.state.codeInfo;
|
let model = this.state.codeInfo;
|
||||||
model.describe = e.target.value;
|
model.describe = e.target.value;
|
||||||
|
console.log( model.describe )
|
||||||
this.setState({codeInfo:model})
|
this.setState({codeInfo:model})
|
||||||
}} />
|
}} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
@ -544,12 +540,13 @@ export default class acclist extends React.Component{
|
||||||
<Select options={this.state.rankoptions} multiple value={this.state.rank} placeholder="选择一项" width={405} onChange={(e)=>{this.onRankChange(e)}} />
|
<Select options={this.state.rankoptions} multiple value={this.state.rank} placeholder="选择一项" width={405} onChange={(e)=>{this.onRankChange(e)}} />
|
||||||
<Button className="import-btn" type="primary" onClick={()=>{this.addProduct()}}>新建商品</Button>
|
<Button className="import-btn" type="primary" onClick={()=>{this.addProduct()}}>新建商品</Button>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem labelname="">
|
<FormItem labelname="" prop="range" id="range">
|
||||||
<Grid
|
<Grid
|
||||||
headBackgroud="#f9fafc"
|
headBackgroud="#f9fafc"
|
||||||
isShowPageBar={false}
|
isShowPageBar={false}
|
||||||
spliteColor={'#fff'}
|
spliteColor={'#fff'}
|
||||||
tableData={this.state.tempdata}
|
tableData={this.state.tempdata}
|
||||||
|
value = {this.state.tempdata}
|
||||||
Column={Column2}
|
Column={Column2}
|
||||||
maxheight={200}
|
maxheight={200}
|
||||||
countbarVisible={false}
|
countbarVisible={false}
|
||||||
|
|
Loading…
Reference in New Issue