解决登录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){
let self=this;
try{
item.children.forEach(item=>{
item.child.forEach(item=>{
if(item.level ===5){
sessionStorage.setItem('pathname2',item.router);
throw '终止循环'
@ -30,11 +30,11 @@ export default class topNav extends React.Component{
}catch(e){
}
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('linkshowname',item.title);
}
@ -80,7 +80,7 @@ export default class topNav extends React.Component{
{
this.state.navlists.map((item,i)=>{
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" >
{
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>
<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 accountadd from '../system/account/add/add';
import subaccountlist from '../system/subAccount/list/list';
import subaccountadd from '../system/subAccount/add/add';
// import subaccountlist from '../system/subAccount/list/list';
// import subaccountadd from '../system/subAccount/add/add';
import rolelist from '../system/role/list/list';
import roleadd from '../system/role/add/add';
import station from '../system/station/main';
@ -380,8 +380,8 @@ export default class App extends Component {
</Route>
<Route path="/home/system/account-list" exact={true} component={accountlist} />
<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-add" exact={true} component={subaccountadd} />
{/* <Route path="/home/system/subaccount-list" exact={true} component={subaccountlist} />
<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-add" exact={true} component={roleadd} />
<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));
try{
menuList.forEach(item=>{
if(item.children&&item.children.length>0){
let obj=item.children.filter(item=>item.level==5);
if(item.child&&item.child.length>0){
let obj=item.child.filter(item=>item.level==5);
sessionStorage.setItem('pathname2',obj[0].router);
sessionStorage.setItem('menulinklist',JSON.stringify(item.children));
sessionStorage.setItem('menulinklist',JSON.stringify(item.child));
if(item.id==16){
sessionStorage.setItem('linkshowname',"营销计划管理");
setTimeout(()=>{

View File

@ -9,6 +9,7 @@ import {getAccountList,handelResponse,getCompany,putAccountStatus,delAccount} fr
import Grid from "../../../../components/gird/main.js"
import Ipt from "../../../../components/input/main"
import Modifypwd from "./modifypwd"
import DelAuth from "./delAuth"
import _ from "lodash";
const Column = [
{
@ -74,11 +75,13 @@ export default class acclistDom extends React.Component{
checkedSmall: true,
tableHeight:600,
visible: false,
delvisible:false,
tabList:[{title:"账号列表"}],
accList:[],
page:1,
limit:10,
total:0,
deldata:{},
search:'',
id:''
}
@ -150,6 +153,7 @@ export default class acclistDom extends React.Component{
//表单删除
delFn(e,row){
let self=this;
// this.setState({delvisible:true,deldata:row});
Sweetalert.confirm({
type:'warning',
closeBtn:true,
@ -243,6 +247,13 @@ export default class acclistDom extends React.Component{
setVisible = visible => {
this.setState({ visible });
};
setdelVisible=visible=>{
this.setState({delvisible:visible});
}
//删除账号过继权限
delSubmit(){
}
//page
pageChange(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.delFn(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>
}
}}
@ -348,7 +359,23 @@ componentDidUpdate(prevProps,prevState){
<Modifypwd visibleShow={(visible)=>this.setVisible(visible) } id={this.state.id}/>
</div>
</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>
)
}

View File

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