调整岗位

This commit is contained in:
red-deng-deng 2021-11-24 11:41:06 +08:00
parent 8fe5e169ba
commit 32b755ef33
3 changed files with 42 additions and 21 deletions

View File

@ -365,7 +365,7 @@ export const delCompany = (id) => {
} }
//编辑公司 //编辑公司
export const postCompanyEdit = (id,data) => { export const postCompanyEdit = (id,data) => {
return req('post', baseurl + "/auth/company/"+id,data) return req('put', baseurl + "/auth/company/"+id,data)
} }
@ -379,7 +379,7 @@ export const delDepartment = (id) => {
} }
//编辑部门 //编辑部门
export const postDepartmentEdit = (id,data) => { export const postDepartmentEdit = (id,data) => {
return req('post', baseurl + "/auth/department/"+id,data) return req('put', baseurl + "/auth/department/"+id,data)
} }
//新建岗位 //新建岗位
export const postDepartmentJob = (data) => { export const postDepartmentJob = (data) => {
@ -391,7 +391,7 @@ export const delDepartmentJob = (id) => {
} }
//编辑岗位 //编辑岗位
export const postDepartmentJobEdit = (id,data) => { export const postDepartmentJobEdit = (id,data) => {
return req('post', baseurl + "/auth/departmentJob/"+id,data) return req('put', baseurl + "/auth/departmentJob/"+id,data)
} }
//枚举 //枚举

View File

@ -41,11 +41,16 @@ export default class station extends React.Component{
saveFn(e,placeholder){ saveFn(e,placeholder){
if(e.innerHTML=="取消"){ if(e.innerHTML=="取消"){
if(placeholder=='公司'){ if(placeholder=='公司'){
this.setState({'companyBtn':true}); this.setState({'companyBtn':true,companyName:1});
this.getCompanyFn();
this.getDepartmentFn(this.state.company_id);
}else if(placeholder=='部门'){ }else if(placeholder=='部门'){
this.setState({'departmentBtn':true}); this.setState({'departmentBtn':true});
this.getDepartmentFn(this.state.company_id);
this.getDepartmentJobFn(this.state.departmentName);
}else if(placeholder=='岗位'){ }else if(placeholder=='岗位'){
this.setState({'postBtn':true}); this.setState({'postBtn':true});
} }
e.parentNode.parentNode.remove(); e.parentNode.parentNode.remove();
}else{ }else{
@ -466,9 +471,14 @@ export default class station extends React.Component{
if(disbtn=='companyBtn'){ if(disbtn=='companyBtn'){
flag=this.state.companyBtn; flag=this.state.companyBtn;
place="公司" place="公司"
this.setState({departmentData:[]});
this.setState({post:[]});
this.setState({companyName:null});
}else if(disbtn=='departmentBtn'){ }else if(disbtn=='departmentBtn'){
flag=this.state.departmentBtn; flag=this.state.departmentBtn;
place="部门" place="部门"
this.setState({post:[]});
this.setState({departmentName:null});
}else if(disbtn=='postBtn'){ }else if(disbtn=='postBtn'){
flag=this.state.postBtn; flag=this.state.postBtn;
place="岗位" place="岗位"
@ -485,8 +495,8 @@ export default class station extends React.Component{
let addipt=document.createElement('div'); let addipt=document.createElement('div');
addipt.className=disbtn+" newitem"; addipt.className=disbtn+" newitem";
addipt.innerHTML=` addipt.innerHTML=`
<input placeholder=请输入新增${place} onKeydown={window["mystation"].sureFn(event,this,'${place}')} /> <input maxLength="20" placeholder=请输入新增${place} onKeydown={window["mystation"].sureFn(event,this,'${place}')} />
<p><span className="del" onClick={window["mystation"].saveFn(this,'${place}')}>取消</span><span className="operation" onClick={window["mystation"].editFn(this,'${place}')}></span></p> <p><span class="del" onClick={window["mystation"].saveFn(this,'${place}')}>取消</span><span class="operation" onClick={window["mystation"].editFn(this,'${place}')}></span></p>
`; `;
nextDom.appendChild(addipt); nextDom.appendChild(addipt);
if(disbtn=='companyBtn'){ if(disbtn=='companyBtn'){
@ -496,13 +506,8 @@ export default class station extends React.Component{
}else if(disbtn=='postBtn'){ }else if(disbtn=='postBtn'){
this.setState({postBtn:false}); this.setState({postBtn:false});
} }
let netList=document.querySelectorAll('.'+disbtn); nextDom.children[0].className="newitem focusactive";
netList.forEach((item,i)=>{
item.className=disbtn+" newitem";
netList.forEach((item2,i2)=>{
netList[netList.length-1].className="newitem focusactive";
})
})
}else{ }else{
Notify.clear() Notify.clear()
Notify.warn(`请先操作新增的${place}`); Notify.warn(`请先操作新增的${place}`);
@ -523,11 +528,14 @@ export default class station extends React.Component{
<Card type="nested" title="公司" className="carditem"> <Card type="nested" title="公司" className="carditem">
<div> <div>
<p className="newadd" onClick={(event)=>this.addItem(event,'companyBtn')}>+新建公司</p> <p className="newadd" onClick={(event)=>this.addItem(event,'companyBtn')}>+新建公司</p>
<div className="addList">
</div>
<div className="addList"> <div className="addList">
{ {
this.state.company.length>0?this.state.company.map((item,key)=>{ this.state.company.length>0?this.state.company.map((item,key)=>{
return( return(
<div className={item.id==this.state.companyName?'selected newitem companyBtn':'newitem companyBtn'} onClick={(e)=>this.itemClick(e,item,'公司')}><input value={item.company_name} disabled={!(item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='公司')} onChange={(e)=>this.changeval(e,item,'公司')}/> <div className={item.id==this.state.companyName?'selected newitem companyBtn':'newitem companyBtn'} onClick={(e)=>this.itemClick(e,item,'公司')}><input value={item.company_name} maxLength="20" disabled={!(item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='公司')} onChange={(e)=>this.changeval(e,item,'公司')}/>
{ {
item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='公司'?( <p><span className="del item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='公司'?( <p><span className="del
" onClick={(e)=>this.cancelbtnFn(e,item,'公司')}>取消</span><span className="operation " onClick={(e)=>this.cancelbtnFn(e,item,'公司')}>取消</span><span className="operation
@ -551,10 +559,13 @@ export default class station extends React.Component{
<div> <div>
<p className="newadd" onClick={(event)=>this.addItem(event,'departmentBtn')}>+新建部门</p> <p className="newadd" onClick={(event)=>this.addItem(event,'departmentBtn')}>+新建部门</p>
<div className="addList"> <div className="addList">
</div>
<div className="addList">
{ {
this.state.departmentData.length>0?this.state.departmentData.map((item,key)=>{ this.state.departmentData.length>0?this.state.departmentData.map((item,key)=>{
return( return(
<div className={item.id==this.state.departmentName?'selected newitem departmentBtn':'newitem departmentBtn'} onClick={(e)=>this.itemClick(e,item,'部门')}><input value={item.department_name} disabled={!(item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='部门')} onChange={(e)=>this.changeval(e,item,'部门')}/> <div className={item.id==this.state.departmentName?'selected newitem departmentBtn':'newitem departmentBtn'} onClick={(e)=>this.itemClick(e,item,'部门')}><input value={item.department_name} maxLength="20" disabled={!(item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='部门')} onChange={(e)=>this.changeval(e,item,'部门')}/>
{ {
item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='部门'?( <p><span className="del item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='部门'?( <p><span className="del
" onClick={(e)=>this.cancelbtnFn(e,item,'部门')}>取消</span><span className="operation " onClick={(e)=>this.cancelbtnFn(e,item,'部门')}>取消</span><span className="operation
@ -576,10 +587,13 @@ export default class station extends React.Component{
<div> <div>
<p className="newadd" onClick={(event)=>this.addItem(event,'postBtn')}>+新建岗位</p> <p className="newadd" onClick={(event)=>this.addItem(event,'postBtn')}>+新建岗位</p>
<div className="addList"> <div className="addList">
</div>
<div className="addList">
{ {
this.state.post.length>0?this.state.post.map((item,key)=>{ this.state.post.length>0?this.state.post.map((item,key)=>{
return( return(
<div className={item.id==this.state.jobName?'selected newitem postBtn':'newitem postBtn'} onClick={(e)=>this.itemClick(e,item,'岗位')}><input value={item.job_name} disabled={!(item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='岗位')} onChange={(e)=>this.changeval(e,item,'岗位')}/> <div className={item.id==this.state.jobName?'selected newitem postBtn':'newitem postBtn'} onClick={(e)=>this.itemClick(e,item,'岗位')}><input value={item.job_name} maxLength="20" disabled={!(item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='岗位')} onChange={(e)=>this.changeval(e,item,'岗位')}/>
{ {
item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='岗位'?( <p><span className="del item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='岗位'?( <p><span className="del
" onClick={(e)=>this.cancelbtnFn(e,item,'岗位')}>取消</span><span className="operation " onClick={(e)=>this.cancelbtnFn(e,item,'岗位')}>取消</span><span className="operation

View File

@ -1,4 +1,10 @@
.del{
margin-right: 15px;
color: #f00;
cursor: pointer;
}
#station{ #station{
.zent-card-body[data-zv="9.11.0"]{ .zent-card-body[data-zv="9.11.0"]{
overflow-y: hidden; overflow-y: hidden;
} }
@ -36,6 +42,11 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
cursor: pointer; cursor: pointer;
.del{
margin-right: 15px;
color: #f00;
cursor: pointer;
}
&.focusactive{ &.focusactive{
background: #F2F4F7; background: #F2F4F7;
} }
@ -57,11 +68,7 @@
background: #F2F4F7; background: #F2F4F7;
} }
} }
.del{
margin-right: 15px;
color: #f00;
cursor: pointer;
}
.operation { .operation {
color: #2B66F2; color: #2B66F2;
cursor: pointer; cursor: pointer;