Skip to content

Commit 41fecda

Browse files
committed
feat: user 支持分页查询
1 parent 36e1a90 commit 41fecda

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

Diff for: src/app/pages/system/user/components/user-delete-btn/user-delete-btn.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ export class UserDeleteBtnComponent implements OnInit {
2121
try {
2222
await this.userService.removeUser(this.id);
2323
this.refresh.emit();
24-
} finally {
25-
this.loading = false;
24+
} catch (e) {
25+
// ignore
2626
}
27+
this.loading = false;
2728
}
2829

2930
cancel() {}

Diff for: src/app/pages/system/user/components/user-update-btn/user-update-btn.component.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ export class UserUpdateBtnComponent implements OnInit {
6464
}
6565
this.closeDrawer();
6666
this.refresh.emit();
67-
} finally {
68-
this.submitting = false;
67+
} catch (e) {
68+
// ignore
6969
}
70+
this.submitting = false;
7071
}
7172
}

Diff for: src/app/pages/system/user/list/list.component.html

+15-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,27 @@
77
<nz-card>
88
<form nz-form [nzLayout]="'inline'">
99
<nz-form-item>
10-
<nz-form-label>姓名</nz-form-label>
10+
<nz-form-label>登录账号</nz-form-label>
1111
<nz-form-control>
1212
<nz-input-group>
1313
<input
1414
[(ngModel)]="tableQuery.username"
1515
name="username"
1616
nz-input
17-
placeholder="请输入关键字"
17+
placeholder="请输入登录账号"
18+
/>
19+
</nz-input-group>
20+
</nz-form-control>
21+
</nz-form-item>
22+
<nz-form-item>
23+
<nz-form-label>真实姓名</nz-form-label>
24+
<nz-form-control>
25+
<nz-input-group>
26+
<input
27+
[(ngModel)]="tableQuery.realname"
28+
name="realname"
29+
nz-input
30+
placeholder="请输入真实姓名"
1831
/>
1932
</nz-input-group>
2033
</nz-form-control>

Diff for: src/app/pages/system/user/list/list.component.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import { UserRecord } from '../user.interface';
55
import { UserService } from '../user.service';
66

77
@Component({
8-
selector: 'app-list',
8+
selector: 'user-list',
99
templateUrl: './list.component.html',
1010
styleUrls: ['./list.component.less'],
1111
})
1212
export class ListComponent implements OnInit {
1313
loading: boolean = false;
1414
tableQuery = {
1515
username: '',
16+
realname: '',
1617
};
1718
tableData: IPageRes<UserRecord> = {
1819
pageIndex: 1,
@@ -23,18 +24,17 @@ export class ListComponent implements OnInit {
2324

2425
constructor(private userService: UserService) {}
2526

26-
async ngOnInit() {
27-
await this.reset();
28-
}
27+
ngOnInit() {}
2928

3029
async search() {
3130
this.loading = true;
3231
const { pageIndex, pageSize } = this.tableData;
33-
const { username } = this.tableQuery;
32+
const { username, realname } = this.tableQuery;
3433
const { total, items } = await this.userService.fetchPageList({
3534
pageIndex,
3635
pageSize,
3736
username,
37+
realname,
3838
});
3939
this.tableData.total = total;
4040
this.tableData.items = items;
@@ -46,6 +46,7 @@ export class ListComponent implements OnInit {
4646
this.tableData.pageSize = 10;
4747
this.tableQuery = {
4848
username: '',
49+
realname: '',
4950
};
5051
await this.search();
5152
}

0 commit comments

Comments
 (0)