|
@@ -106,7 +106,13 @@ export class PageUserComponent implements OnInit {
|
|
|
}
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
- this.activeRoute.paramMap.subscribe(async (params) => {
|
|
|
+ this.activeRoute.queryParamMap.subscribe(async (queryParams) => {
|
|
|
+ console.log(queryParams)
|
|
|
+ let page = queryParams.get("page");
|
|
|
+ if(page){
|
|
|
+ this.pageIndex = Number(page);
|
|
|
+ this.updateUrlPageIndex(Number(page));
|
|
|
+ }
|
|
|
this.getProfile();
|
|
|
this.parents = await this.getDepart();
|
|
|
});
|
|
@@ -178,8 +184,25 @@ export class PageUserComponent implements OnInit {
|
|
|
pageIndexChange(e: any) {
|
|
|
console.log(e);
|
|
|
this.pageIndex = e;
|
|
|
+ this.updateUrlPageIndex(e);
|
|
|
this.getProfile();
|
|
|
}
|
|
|
+ /** 更新页码queryParams */
|
|
|
+ updateUrlPageIndex(page:number){
|
|
|
+ let search = window.location.search;
|
|
|
+ if(!search){
|
|
|
+ search = `?page=${page}`
|
|
|
+ }else{
|
|
|
+ let pagestr = window.location.search?.replaceAll("?","").split("&").find(item=>item.indexOf("page=")>-1);
|
|
|
+ if(pagestr){
|
|
|
+ search = search.replaceAll(pagestr,`page=${page}`)
|
|
|
+ }else{
|
|
|
+ search = search + `?page=${page}`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let newHref = window.location.origin + window.location.pathname + search;
|
|
|
+ window.history.replaceState(null, "", newHref);
|
|
|
+ }
|
|
|
//筛选条件
|
|
|
onChangeFilter(data: any, type:string){
|
|
|
console.log(data);
|
|
@@ -293,7 +316,7 @@ export class PageUserComponent implements OnInit {
|
|
|
});
|
|
|
}
|
|
|
goDateil(id: string) {
|
|
|
- this.route.navigate(['/nav-admin/manage/user/edit', { id: id }]);
|
|
|
+ this.route.navigate(['/nav-admin/manage/user/edit', { id: id }],{queryParams:{page:this.pageIndex}});
|
|
|
}
|
|
|
|
|
|
/* 添加用户 */
|