解决登录children还原child

This commit is contained in:
red-deng-deng 2021-12-10 18:01:53 +08:00
parent cc4135866d
commit 7b16816dc2
5 changed files with 51 additions and 14 deletions

View File

@ -21,7 +21,7 @@ export default class topNav extends React.Component{
showlinkmenu(e,item){ showlinkmenu(e,item){
let self=this; let self=this;
try{ try{
item.children.forEach(item=>{ item.child.forEach(item=>{
if(item.level ===5){ if(item.level ===5){
sessionStorage.setItem('pathname2',item.router); sessionStorage.setItem('pathname2',item.router);
throw '终止循环' throw '终止循环'
@ -30,11 +30,11 @@ export default class topNav extends React.Component{
}catch(e){ }catch(e){
} }
self.setState({'linkshowname':item.title}); self.setState({'linkshowname':item.title});
self.setState({'menulinklist':item.children}); self.setState({'menulinklist':item.child});
// 防止刷新页面,导航签清空 // 防止刷新页面,导航签清空
sessionStorage.setItem('menulinklist',JSON.stringify(item.children)); sessionStorage.setItem('menulinklist',JSON.stringify(item.child));
sessionStorage.setItem('showflag',true); sessionStorage.setItem('showflag',true);
sessionStorage.setItem('linkshowname',item.title); sessionStorage.setItem('linkshowname',item.title);
} }
@ -80,7 +80,7 @@ export default class topNav extends React.Component{
{ {
this.state.navlists.map((item,i)=>{ this.state.navlists.map((item,i)=>{
return ( return (
item.children&&item.children.length>0?<Link key={i} to={item.router} style={this.state.linkshowname==item.title?{width:"#100%",background:"#f2f4f7",color:'#296bef'}:null} className={this.state.linkshowname==item.title?'active':''} onClick={(e)=>this.showlinkmenu(e,item)} >{item.title}</Link>:null item.child&&item.child.length>0?<Link key={i} to={item.router} style={this.state.linkshowname==item.title?{width:"#100%",background:"#f2f4f7",color:'#296bef'}:null} className={this.state.linkshowname==item.title?'active':''} onClick={(e)=>this.showlinkmenu(e,item)} >{item.title}</Link>:null
) )
}) })
@ -95,7 +95,7 @@ export default class topNav extends React.Component{
<div className="linkmenu-row" > <div className="linkmenu-row" >
{ {
this.state.menulinklist.map((item,key)=>{ this.state.menulinklist.map((item,key)=>{
return(item.level==5?<Link key={key} to={item.router} onClick={()=>this.btnfn(item)} className={pathnameBreak==item.router&&item.children.length>=1?'menuactive':''}>{item.title}</Link>:null) return(item.level==5?<Link key={key} to={item.router} onClick={()=>this.btnfn(item)} className={pathnameBreak==item.router&&item.child.length>=1?'menuactive':''}>{item.title}</Link>:null)
}) } }) }
</div> </div>
<span>数据最后更新时间:{window.timeshow}</span> <span>数据最后更新时间:{window.timeshow}</span>

View File

@ -57,8 +57,8 @@ import keyedit from "../plan/key/edit.js"
import accountlist from '../system/account/list/list'; import accountlist from '../system/account/list/list';
import accountadd from '../system/account/add/add'; import accountadd from '../system/account/add/add';
import subaccountlist from '../system/subAccount/list/list'; // import subaccountlist from '../system/subAccount/list/list';
import subaccountadd from '../system/subAccount/add/add'; // import subaccountadd from '../system/subAccount/add/add';
import rolelist from '../system/role/list/list'; import rolelist from '../system/role/list/list';
import roleadd from '../system/role/add/add'; import roleadd from '../system/role/add/add';
import station from '../system/station/main'; import station from '../system/station/main';
@ -380,8 +380,8 @@ export default class App extends Component {
</Route> </Route>
<Route path="/home/system/account-list" exact={true} component={accountlist} /> <Route path="/home/system/account-list" exact={true} component={accountlist} />
<Route path="/home/system/account-add" exact={true} component={accountadd} /> <Route path="/home/system/account-add" exact={true} component={accountadd} />
<Route path="/home/system/subaccount-list" exact={true} component={subaccountlist} /> {/* <Route path="/home/system/subaccount-list" exact={true} component={subaccountlist} />
<Route path="/home/system/subaccount-add" exact={true} component={subaccountadd} /> <Route path="/home/system/subaccount-add" exact={true} component={subaccountadd} /> */}
<Route path="/home/system/role-list" exact={true} component={rolelist} /> <Route path="/home/system/role-list" exact={true} component={rolelist} />
<Route path="/home/system/role-add" exact={true} component={roleadd} /> <Route path="/home/system/role-add" exact={true} component={roleadd} />
<Route path="/home/system/station" exact={true} component={station} /> <Route path="/home/system/station" exact={true} component={station} />

View File

@ -57,10 +57,10 @@ function FormDom(props) {
sessionStorage.setItem('activeMenu',JSON.stringify(response.menu)); sessionStorage.setItem('activeMenu',JSON.stringify(response.menu));
try{ try{
menuList.forEach(item=>{ menuList.forEach(item=>{
if(item.children&&item.children.length>0){ if(item.child&&item.child.length>0){
let obj=item.children.filter(item=>item.level==5); let obj=item.child.filter(item=>item.level==5);
sessionStorage.setItem('pathname2',obj[0].router); sessionStorage.setItem('pathname2',obj[0].router);
sessionStorage.setItem('menulinklist',JSON.stringify(item.children)); sessionStorage.setItem('menulinklist',JSON.stringify(item.child));
if(item.id==16){ if(item.id==16){
sessionStorage.setItem('linkshowname',"营销计划管理"); sessionStorage.setItem('linkshowname',"营销计划管理");
setTimeout(()=>{ setTimeout(()=>{

View File

@ -9,6 +9,7 @@ import {getAccountList,handelResponse,getCompany,putAccountStatus,delAccount} fr
import Grid from "../../../../components/gird/main.js" import Grid from "../../../../components/gird/main.js"
import Ipt from "../../../../components/input/main" import Ipt from "../../../../components/input/main"
import Modifypwd from "./modifypwd" import Modifypwd from "./modifypwd"
import DelAuth from "./delAuth"
import _ from "lodash"; import _ from "lodash";
const Column = [ const Column = [
{ {
@ -74,11 +75,13 @@ export default class acclistDom extends React.Component{
checkedSmall: true, checkedSmall: true,
tableHeight:600, tableHeight:600,
visible: false, visible: false,
delvisible:false,
tabList:[{title:"账号列表"}], tabList:[{title:"账号列表"}],
accList:[], accList:[],
page:1, page:1,
limit:10, limit:10,
total:0, total:0,
deldata:{},
search:'', search:'',
id:'' id:''
} }
@ -150,6 +153,7 @@ export default class acclistDom extends React.Component{
//表单删除 //表单删除
delFn(e,row){ delFn(e,row){
let self=this; let self=this;
// this.setState({delvisible:true,deldata:row});
Sweetalert.confirm({ Sweetalert.confirm({
type:'warning', type:'warning',
closeBtn:true, closeBtn:true,
@ -243,6 +247,13 @@ export default class acclistDom extends React.Component{
setVisible = visible => { setVisible = visible => {
this.setState({ visible }); this.setState({ visible });
}; };
setdelVisible=visible=>{
this.setState({delvisible:visible});
}
//删除账号过继权限
delSubmit(){
}
//page //page
pageChange(e){ pageChange(e){
this.setState({page:e}); this.setState({page:e});
@ -329,7 +340,7 @@ componentDidUpdate(prevProps,prevState){
<span className="grid-link" onClick={(e)=>this.editFn(e,rowData)}>编辑</span> <span className="grid-link" onClick={(e)=>this.editFn(e,rowData)}>编辑</span>
<span className="grid-link" onClick={(e)=>this.delFn(e,rowData)}>删除</span> <span className="grid-link" onClick={(e)=>this.delFn(e,rowData)}>删除</span>
<span className="grid-link" onClick={(e)=>this.resetpwd(e,rowData)}>重置密码</span> <span className="grid-link" onClick={(e)=>this.resetpwd(e,rowData)}>重置密码</span>
<span className="grid-link" onClick={(e)=>this.subaccount(e,rowData)}>子账号管理</span> {/* <span className="grid-link" onClick={(e)=>this.subaccount(e,rowData)}>子账号管理</span> */}
</p> </p>
} }
}} }}
@ -348,7 +359,23 @@ componentDidUpdate(prevProps,prevState){
<Modifypwd visibleShow={(visible)=>this.setVisible(visible) } id={this.state.id}/> <Modifypwd visibleShow={(visible)=>this.setVisible(visible) } id={this.state.id}/>
</div> </div>
</Dialog> </Dialog>
{/* 删除账号 */}
<Dialog
visible={this.state.delvisible}
className="questModal"
onClose={() => this.setdelVisible(false)}
title="确认操作"
footer={
<div style={{ textAlign: 'right' }}>
<Button type="primary" onClick={(e) =>{this.delSubmit(e)} }>提交</Button>
<Button onClick={(e) =>{this.setdelVisible(false)} }>取消</Button>
</div>
}
>
<div>
<DelAuth deldata={this.state.deldata} visibleShow={(visible)=>this.setdelVisible(visible) } id={this.state.id}/>
</div>
</Dialog>
</div> </div>
) )
} }

View File

@ -30,3 +30,13 @@ box-sizing: border-box;
padding: 24px 0; padding: 24px 0;
box-sizing: border-box; box-sizing: border-box;
} }
#delAuth .handover{
margin-top: 15px;
display: flex;
}
#delAuth .delperson{
padding: 15px 0 24px;
}
#delAuth .tips{
color: #313233;
}