From 32b755ef333e9d12792b25a1359425e7bd1f9547 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Wed, 24 Nov 2021 11:41:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=B2=97=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/api.js | 6 ++--- src/pages/system/station/main.js | 40 ++++++++++++++++++++---------- src/pages/system/station/main.less | 17 +++++++++---- 3 files changed, 42 insertions(+), 21 deletions(-) diff --git a/src/assets/api.js b/src/assets/api.js index e8d78b77..1fe0cfbb 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -365,7 +365,7 @@ export const delCompany = (id) => { } //编辑公司 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) => { - return req('post', baseurl + "/auth/department/"+id,data) + return req('put', baseurl + "/auth/department/"+id,data) } //新建岗位 export const postDepartmentJob = (data) => { @@ -391,7 +391,7 @@ export const delDepartmentJob = (id) => { } //编辑岗位 export const postDepartmentJobEdit = (id,data) => { - return req('post', baseurl + "/auth/departmentJob/"+id,data) + return req('put', baseurl + "/auth/departmentJob/"+id,data) } //枚举 diff --git a/src/pages/system/station/main.js b/src/pages/system/station/main.js index b9b430d3..2316e991 100644 --- a/src/pages/system/station/main.js +++ b/src/pages/system/station/main.js @@ -41,11 +41,16 @@ export default class station extends React.Component{ saveFn(e,placeholder){ if(e.innerHTML=="取消"){ if(placeholder=='公司'){ - this.setState({'companyBtn':true}); + this.setState({'companyBtn':true,companyName:1}); + this.getCompanyFn(); + this.getDepartmentFn(this.state.company_id); }else if(placeholder=='部门'){ this.setState({'departmentBtn':true}); + this.getDepartmentFn(this.state.company_id); + this.getDepartmentJobFn(this.state.departmentName); }else if(placeholder=='岗位'){ this.setState({'postBtn':true}); + } e.parentNode.parentNode.remove(); }else{ @@ -466,9 +471,14 @@ export default class station extends React.Component{ if(disbtn=='companyBtn'){ flag=this.state.companyBtn; place="公司" + this.setState({departmentData:[]}); + this.setState({post:[]}); + this.setState({companyName:null}); }else if(disbtn=='departmentBtn'){ flag=this.state.departmentBtn; place="部门" + this.setState({post:[]}); + this.setState({departmentName:null}); }else if(disbtn=='postBtn'){ flag=this.state.postBtn; place="岗位" @@ -485,8 +495,8 @@ export default class station extends React.Component{ let addipt=document.createElement('div'); addipt.className=disbtn+" newitem"; addipt.innerHTML=` - -

取消保存

+ +

取消保存

`; nextDom.appendChild(addipt); if(disbtn=='companyBtn'){ @@ -496,13 +506,8 @@ export default class station extends React.Component{ }else if(disbtn=='postBtn'){ this.setState({postBtn:false}); } - let netList=document.querySelectorAll('.'+disbtn); - netList.forEach((item,i)=>{ - item.className=disbtn+" newitem"; - netList.forEach((item2,i2)=>{ - netList[netList.length-1].className="newitem focusactive"; - }) - }) + nextDom.children[0].className="newitem focusactive"; + }else{ Notify.clear() Notify.warn(`请先操作新增的${place}名`); @@ -523,11 +528,14 @@ export default class station extends React.Component{

this.addItem(event,'companyBtn')}>+新建公司

+
+ +
{ this.state.company.length>0?this.state.company.map((item,key)=>{ return( -
this.itemClick(e,item,'公司')}>this.changeval(e,item,'公司')}/> +
this.itemClick(e,item,'公司')}>this.changeval(e,item,'公司')}/> { item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='公司'?(

this.cancelbtnFn(e,item,'公司')}>取消this.addItem(event,'departmentBtn')}>+新建部门

+ +
+
{ this.state.departmentData.length>0?this.state.departmentData.map((item,key)=>{ return( -
this.itemClick(e,item,'部门')}>this.changeval(e,item,'部门')}/> +
this.itemClick(e,item,'部门')}>this.changeval(e,item,'部门')}/> { item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='部门'?(

this.cancelbtnFn(e,item,'部门')}>取消this.addItem(event,'postBtn')}>+新建岗位

+ +
+
{ this.state.post.length>0?this.state.post.map((item,key)=>{ return( -
this.itemClick(e,item,'岗位')}>this.changeval(e,item,'岗位')}/> +
this.itemClick(e,item,'岗位')}>this.changeval(e,item,'岗位')}/> { item.id==this.state.visibleId&&this.state.opertip=='编辑'&&this.state.vistype=='岗位'?(

this.cancelbtnFn(e,item,'岗位')}>取消