This commit is contained in:
北海一刀 2021-11-11 15:04:08 +08:00
commit 241eb68801
4 changed files with 91 additions and 97 deletions

View File

@ -86,7 +86,7 @@ import classNames from 'classnames'
}
// 焦点事件,伸展宽度
focusFn(e){
if(this.props.placeholder.length>7){
if(this.props.placeholder.length>10){
this.setState({'focus':0});
}

View File

@ -3,7 +3,7 @@
.iptfillself{
display: flex;
align-items: center;
margin-bottom: 30px;
// margin-bottom: 24px!important;
.label{
margin-right: 58px;
.warning{

View File

@ -63,14 +63,14 @@ function Adduser(){
{
return {
name: 'error',
message: '输入电话',
message: '输入电话',
};
}
else if(values.password == "")
{
return {
name: 'error',
message: '清输入电话',
message: '请输入密码',
};
}
}
@ -153,15 +153,7 @@ function Adduser(){
style={{marginLeft:'10px'}}
onSubmit={onSubmit}
>
<FormImageUploadField
name="imageUpload"
label="头像上传"
props={{
maxAmount: 1,
maxSize: 1024 * 1024 * 2,
}}
validators={[Validators.minLength(1, '请上传头像')]}
/>

View File

@ -41,95 +41,97 @@ export default class station extends React.Component{
// }
}
editFn(e,placeholder){
// let cssname=null;
// let stationame=[];
// if(placeholder=='公司'){
// cssname='companyBtn';
// stationame=this.state.company
// }else if(placeholder=='部门'){
// cssname='departmentBtn';
// stationame=this.state.department
// }else if(placeholder=='岗位'){
// cssname='postBtn';
// stationame=this.state.post
// }
// if(e.parentNode.parentNode.children[0].value){
// if( e.innerHTML=="保存"){
// if(this.hasVal(stationame,e.parentNode.parentNode.children[0].value)>-1){
// Notify.clear()
// Notify.warn(`${placeholder}已存在,请重新增加`);
// }else{
// e.parentNode.firstChild.innerHTML='删除';
// e.parentNode.parentNode.children[0].disabled="disabled";
// e.parentNode.parentNode.className=cssname+" newitem";
// Notify.clear()
// Notify.success('保存成功');
// e.innerHTML="编辑";
// if(placeholder=='公司'){
// this.setState({'companyBtn':true});
// }else if(placeholder=='部门'){
// this.setState({'departmentBtn':true});
// }else if(placeholder=='岗位'){
// this.setState({'postBtn':true});
// }
// }
// }else{
// e.parentNode.parentNode.children[0].disabled="";
// e.parentNode.parentNode.children[0].focus();
// e.parentNode.parentNode.className="newitem focusactive";
// e.innerHTML="保存";
// if(placeholder=='公司'){
// this.setState({'companyBtn':false});
// }else if(placeholder=='部门'){
// this.setState({'departmentBtn':false});
// }else if(placeholder=='岗位'){
// this.setState({'postBtn':false});
// }
// }
// }else{
// Notify.clear()
// Notify.error(`请填入${placeholder}名称`);
// e.parentNode.parentNode.children[0].focus();
// }
let cssname=null;
let stationame=[];
if(placeholder=='公司'){
cssname='companyBtn';
stationame=this.state.company
}else if(placeholder=='部门'){
cssname='departmentBtn';
stationame=this.state.department
}else if(placeholder=='岗位'){
cssname='postBtn';
stationame=this.state.post
}
if(e.parentNode.parentNode.children[0].value){
if( e.innerHTML=="保存"){
if(this.hasVal(cssname,e.parentNode.parentNode.children[0].value)>-1){
Notify.clear()
Notify.warn(`${placeholder}重复,请重新增加`);
}else{
e.parentNode.firstChild.innerHTML='删除';
e.parentNode.parentNode.children[0].disabled="disabled";
e.parentNode.parentNode.className=cssname+" newitem";
Notify.clear()
Notify.success('保存成功');
this.setState({company:[]})
e.innerHTML="编辑";
if(placeholder=='公司'){
this.setState({'companyBtn':true});
}else if(placeholder=='部门'){
this.setState({'departmentBtn':true});
}else if(placeholder=='岗位'){
this.setState({'postBtn':true});
}
}
}else{
e.parentNode.parentNode.children[0].disabled="";
e.parentNode.parentNode.children[0].focus();
e.parentNode.parentNode.className="newitem focusactive";
e.innerHTML="保存";
if(placeholder=='公司'){
this.setState({'companyBtn':false});
}else if(placeholder=='部门'){
this.setState({'departmentBtn':false});
}else if(placeholder=='岗位'){
this.setState({'postBtn':false});
}
}
}else{
Notify.clear()
Notify.error(`请填入${placeholder}名称`);
e.parentNode.parentNode.children[0].focus();
}
}
hasVal(obj,parmas){
let site=_.findIndex(obj,(o)=> {return o.name == parmas});
return site;
}
sureFn(e,placeholder){
// if(e.target.value&&e.keyCode==13){
// let cssname=null;
// let stationame=[];
// if(placeholder=='公司'){
// cssname='companyBtn';
// stationame=this.state.company
// }else if(placeholder=='部门'){
// cssname='departmentBtn';
// stationame=this.state.department
// }else if(placeholder=='岗位'){
// cssname='postBtn';
// stationame=this.state.post
// }
// if(this.hasVal(stationame,e.target.value)>-1){
// Notify.clear()
// Notify.warn(`${placeholder}已存在,请重新增加`);
// }else{
// this.parentNode.children[1].firstChild.innerHTML='删除';
// this.disabled="disabled";
// this.parentNode.className=cssname+" newitem";
// Notify.clear()
// Notify.success('保存成功');
// rp.parentNode.children[1].lastChild.innerHTML="编辑";
// if(placeholder=='公司'){
// this.setState({'companyBtn':true});
// }else if(placeholder=='部门'){
// this.setState({'departmentBtn':true});
// }else if(placeholder=='岗位'){
// this.setState({'postBtn':true});
// }
// }
// }
sureFn(e,rp,placeholder){
if(e.target.value&&e.keyCode==13){
let cssname=null;
let stationame=[];
if(placeholder=='公司'){
cssname='companyBtn';
stationame=this.state.company;
}else if(placeholder=='部门'){
cssname='departmentBtn';
stationame=this.state.department;
}else if(placeholder=='岗位'){
cssname='postBtn';
stationame=this.state.post;
}
if(this.hasVal(this.state.company,e.target.value)>-1){
Notify.clear()
Notify.warn(`${placeholder}重复,请重新增加`);
}else{
rp.parentNode.children[1].firstChild.innerHTML='删除';
rp.disabled="disabled";
rp.parentNode.className=cssname+" newitem";
Notify.clear()
Notify.success('保存成功');
rp.parentNode.children[1].lastChild.innerHTML="编辑";
if(placeholder=='公司'){
this.setState({'companyBtn':true});
}else if(placeholder=='部门'){
this.setState({'departmentBtn':true});
}else if(placeholder=='岗位'){
this.setState({'postBtn':true});
}
}
}
}
chooseFn(e,disbtn){
// let netList=document.querySelectorAll('.'+disbtn);