调整表单

This commit is contained in:
北海一刀 2021-11-19 18:35:32 +08:00
parent bef5a9d95b
commit c89f3c79bd
3 changed files with 31 additions and 22 deletions

View File

@ -127,12 +127,18 @@ export default class form extends React.Component {
let formItem_com = _.get(formItem, "props.children.props");
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 rules_item = _.get(self.props.rules, formItem.props.prop)
if (input_compontent.length > 0 && rules_item) {
input_compontent[0].oninput = function(e) {
console.log(7777777)
for (let j = 0; j < rules_item.length; j++) {
if (rules_item[j].type == "required") {
@ -306,9 +312,9 @@ export default class form extends React.Component {
item = com[1]
o = com[1].children[0];
console.log(com)
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)
@ -342,10 +348,6 @@ export default class form extends React.Component {
}
}
}
}
@ -358,10 +360,20 @@ export default class form extends React.Component {
//formItem对象
let formItem_com = _.get(formItem, "props.children.props");
console.log("没值了")
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)

View File

@ -355,7 +355,7 @@ export default class adduserinfo extends React.Component{
})
}
<FormItem labelname="联系人邮箱" prop="contacts_email" id="contacts_email">
<div className="phonet">
<Ipt onChange={(e)=>{
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'}/>
</div>
</FormItem>
<FormItem prop="sale" labelname="销售人员" id="sale" >

View File

@ -173,9 +173,7 @@ export default class acclist extends React.Component{
codeSubmit(){
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)=>{
return item.text
@ -365,16 +363,13 @@ export default class acclist extends React.Component{
//基本规则
const rulesInfo = {
code_name: [
{ type: "required", message: "请输入兑换码名称"},
date_time: [
{ type: "required", message: "请选择生效时间段"},
],
issued: [
{ type: "required", message: "请输入发放总量"},
rank: [
{ 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)=>{
let model = this.state.codeInfo;
model.describe = e.target.value;
console.log( model.describe )
this.setState({codeInfo:model})
}} />
</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)}} />
<Button className="import-btn" type="primary" onClick={()=>{this.addProduct()}}>新建商品</Button>
</FormItem>
<FormItem labelname="">
<FormItem labelname="" prop="range" id="range">
<Grid
headBackgroud="#f9fafc"
isShowPageBar={false}
spliteColor={'#fff'}
tableData={this.state.tempdata}
value = {this.state.tempdata}
Column={Column2}
maxheight={200}
countbarVisible={false}