表单状态调整

This commit is contained in:
北海一刀 2021-11-15 15:43:50 +08:00
parent 7fb7dc1e52
commit 46d1b20a33
7 changed files with 110 additions and 36 deletions

View File

@ -254,6 +254,7 @@ export default class form extends React.Component {
console.log("表单验证")
let doms = document.getElementsByClassName("form-Item");
let self = this;
let validate = false;
for (let i = 0; i < doms.length; i++) {
var com = doms[i].children;
let item = com[com.length - 1]
@ -269,7 +270,9 @@ export default class form extends React.Component {
if (formItem_com.value == ""||formItem_com.value == undefined) {
self.removeClass(item)
self.isRequired(formItem_com.value, o.className, item, rules_item[j].message);
return false;
validate = false
break;
}
else{
self.removeClass(item)
@ -286,9 +289,9 @@ export default class form extends React.Component {
self.removeClass(item)
} else {
validate = false
self.isRequired(formItem_com.value, o.className, item, rules_item[j].message);
return false
break;
}
}
@ -297,10 +300,11 @@ export default class form extends React.Component {
}
}
}
return true;
return validate;
}
render() {

View File

@ -11,6 +11,7 @@ import Adddistributor from "../adddistributorinfo/adddistributorinfo"
export default class acclist extends React.Component{
constructor(props){
super(props)
console.log(props)
this.state={
}
}

View File

@ -10,6 +10,7 @@ import Bus from "../../../assets/eventBus.js"
export default class adduserinfo extends React.Component{
constructor(props){
super(props)
this.state={
model:{ //数据模型不可少
fullname:'',
@ -22,6 +23,8 @@ export default class adduserinfo extends React.Component{
}
componentDidMount(e){
}
submit(){
@ -60,14 +63,11 @@ export default class adduserinfo extends React.Component{
cancel(){
let model2 = { //数据模型不可少
account:"",
phone:"",
pwd:"",
name:"",
company:"",
deparment:"",
post:"",
station:"",
fullname:'',
account:'',
contacts:'',
contacts_phone:'',
contacts_email:''
}
this.setState({model:model2});
this.refs.form1.cancel();

View File

@ -1,10 +1,42 @@
import React from "react"
import './edit.less'
export default class edit extends React.Component{
import ReactDOM from 'react-dom';
import React, { Component } from 'react';
import { HashRouter as Router, Route, Link } from "react-router-dom";
import { Card,Button,Pagination } from 'zent';
import "./add.less"
import { Grid,Switch ,Swiper } from 'zent';
import "../../../assets/comm.css"
import Ipt from "../../../components/input/main"
import Adddistributor from "../adddistributorinfo/adddistributorinfo"
export default class acclist extends React.Component{
constructor(props){
super(props)
this.state={
}
}
//去调子组件的方法
activeFn(){
this.refs.disbutorForm.submit();
}
render(){
const { current, pageSize } = this.state;
return(
<div className="maincenter">
<Card style={{ width:'100%' }} title="新建分销商" >
<div className="adddistributor">
}
<Adddistributor ref="disbutorForm"/>
</div>
</Card>
<div className="distributorbtn">
<Button type="primary" onClick={this.activeFn.bind(this)}>
提交
</Button>
<Button type="normal">
取消
</Button>
</div>
</div>
)
}
}

View File

@ -1,9 +1,12 @@
import ReactDOM from 'react-dom';
import React, { Component } from 'react';
import { HashRouter as Router, Route, Link } from "react-router-dom";
import { Button } from 'zent';
import "./list.less"
import { Switch ,Swiper,Dropdown,DropdownPosition,DropdownClickTrigger,Icon,MenuItem,DropdownContent,Menu } from 'zent';
import { Sweetalert,Switch ,Swiper,Dropdown,DropdownPosition,DropdownClickTrigger,Icon,MenuItem,DropdownContent,Menu } from 'zent';
import "../../../assets/comm.css"
import Ipt from "../../../components/input/main"
import Grid from "../../../components/gird/main.js"
@ -55,13 +58,13 @@ const Column = [
type: "normal",
prop:'name',
defaultText: 0,
width:'auto',
width:'20%',
type: "normal",
},
{
title: '状态',
width:'auto',
width:'10%',
type: "slot",
prop:'name'
},
@ -70,7 +73,7 @@ const Column = [
prop: 'opearo',
name: 'opearo',
type: "slot",
width:'auto',
width:'10%',
defaultText: 0,
},
@ -95,6 +98,7 @@ export default class acclist extends React.Component{
clickFn(){
this.props.history.push('/distributor-add');
sessionStorage.setItem('pathname2','/system/distributor-add')
let activerou=[{items:[
{
"path": "/system/distributor-list",
@ -109,6 +113,37 @@ export default class acclist extends React.Component{
}
//表单删除
delFn(e,row){
Sweetalert.confirm({
type:'warning',
closeBtn:true,
title:'确认操作',
content: <p>是否删除此条数据</p>,
onConfirm: this.onConfirm,
onCancel: this.onCancel,
className:'questModal',
parentComponent: this
});
}
editFn(e,row){
this.props.history.push('distributor-add');
sessionStorage.setItem('pathname2','distributor-add')
sessionStorage.getItem("distributor-data")
let activerou=[{'pagetitle':'编辑',items:[
{
"path": "distributor-list",
"name": "账号管理"
},
{
"path": "distributor-add",
"name": "编辑账号"
}
]}]
sessionStorage.setItem('breaknav',JSON.stringify(activerou));
}
render(){
const { current, pageSize } = this.state;
return(
@ -144,8 +179,8 @@ export default class acclist extends React.Component{
if(com == "opearo")
{
return <span>
<a href="https://youzan.com" className="grid-link" >编辑</a>
<a href="https://youzan.com" className="grid-link" >删除</a>
<a className="grid-link" onClick={(e)=>{this.editFn(e,rowData)}} >编辑</a>
<a className="grid-link" onClick={(e)=>{this.delFn(e,rowData)}} >删除</a>
<Dropdown position={DropdownPosition.RightTop }>
<DropdownClickTrigger>
<div className="linkmore"> 更多 <Icon type={"down"} /> </div>

View File

@ -1,7 +1,7 @@
import ReactDOM from 'react-dom';
import React, { Component } from 'react';
import { HashRouter as Router, Route, Link } from "react-router-dom";
import { Button ,Tabs, CombinedDateRangePicker,Select,Input} from 'zent';
import { Button ,Tabs, CombinedDateRangePicker,Select,Input,RadioButton,RadioGroup} from 'zent';
import Ipt from "../../../components/input/main"
import Form from "../../../components/form/main"
import FormItem from "../../../components/form-item/main"
@ -90,18 +90,19 @@ export default class acclist extends React.Component{
}} value={this.state.model.name} placeholder={"请输入"} labelWidth={'0px'} maxLength={12} height={'36px'} width={'520px'} alignment={'left'}/>
</FormItem>
<FormItem labelname="计划类型" prop="type">
<Tabs
type="button">
{type}
</Tabs>
<RadioGroup onChange={this.onChange} value={this.state.type}>
<RadioButton value="1">活动</RadioButton>
<RadioButton value="2">仅兑换</RadioButton>
</RadioGroup>
</FormItem>
<FormItem labelname="分销商" prop="reseller">
<Select options={options} placeholder="选择一项" width={515} value={this.state.model.reseller} />
</FormItem>
<FormItem labelname=" 计划充值返回" prop="return_id">
<Tabs type="button">
{return_val}
</Tabs>
<RadioGroup onChange={this.onChange} value={this.state.return_id}>
<RadioButton value="1">直接返回</RadioButton>
<RadioButton value="2">卡单</RadioButton>
</RadioGroup>
</FormItem>
<FormItem labelname="开始~结束时间" prop="date_time" >

View File

@ -131,10 +131,11 @@ export default class acclist extends React.Component{
<FormItem labelname="分销商" prop="reseller">
<Select options={options} placeholder="选择一项" width={515} value={this.state.model.reseller} />
</FormItem>
<FormItem labelname=" 计划充值返回" prop="return_id">
<Tabs type="button">
{return_val}
</Tabs>
<FormItem labelname=" key方式" prop="return_id">
<RadioGroup onChange={this.onChange} value={this.state.return_id}>
<RadioButton value="1">指定数量</RadioButton>
<RadioButton value="2">不限</RadioButton>
</RadioGroup>
</FormItem>
<FormItem labelname="key数量" prop="date_time" >
<Ipt onChange={(e)=>{