From 5742b70a5b0642f1c8c97cf3f8c571c10b7746b5 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 18 Apr 2024 15:50:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/pages/account/account.routes.ts | 4 +- .../account/sys-role/sys-role.component.html | 46 ++++++++++ .../account/sys-role/sys-role.component.less | 33 ++++++++ .../sys-role/sys-role.component.spec.ts | 23 +++++ .../account/sys-role/sys-role.component.ts | 83 +++++++++++++++++++ src/app/pages/body/index/index.component.html | 6 +- src/app/pages/body/index/index.component.ts | 9 +- src/app/pages/body/tab/tab.component.ts | 2 - src/app/pages/system/menu/menu.component.html | 5 +- src/app/pages/system/menu/menu.component.ts | 32 ++++--- src/app/servies/menu/menu.service.ts | 2 +- src/app/servies/role/role.service.ts | 57 +++++++++++++ 12 files changed, 282 insertions(+), 20 deletions(-) create mode 100644 src/app/pages/account/sys-role/sys-role.component.html create mode 100644 src/app/pages/account/sys-role/sys-role.component.less create mode 100644 src/app/pages/account/sys-role/sys-role.component.spec.ts create mode 100644 src/app/pages/account/sys-role/sys-role.component.ts create mode 100644 src/app/servies/role/role.service.ts diff --git a/src/app/pages/account/account.routes.ts b/src/app/pages/account/account.routes.ts index 7082a5e..86b1617 100644 --- a/src/app/pages/account/account.routes.ts +++ b/src/app/pages/account/account.routes.ts @@ -1,6 +1,8 @@ import { Routes } from '@angular/router'; import {SysAccountComponent} from "./sys-account/sys-account.component"; +import {SysRoleComponent} from "./sys-role/sys-role.component"; export const ACCOUNT_ROUTES: Routes = [ - { path: 'sys_account', component: SysAccountComponent} + { path: 'sys_account', component: SysAccountComponent}, + { path: 'sys_role', component: SysRoleComponent} ]; diff --git a/src/app/pages/account/sys-role/sys-role.component.html b/src/app/pages/account/sys-role/sys-role.component.html new file mode 100644 index 0000000..52c37e2 --- /dev/null +++ b/src/app/pages/account/sys-role/sys-role.component.html @@ -0,0 +1,46 @@ +
+
+
+ + 角色名称 + + + + +
+
+
+ + +
+
+
+
+ + + + + + 角色名称 + 角色描述 + 创建时间 + 修改时间 + 操作 + + + + + {{data.roleName}} + {{data.roleStatus}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.updateTime | date: 'yyyy-MM-dd HH:mm'}} + + + + + 总计 {{ total }} 条 + + diff --git a/src/app/pages/account/sys-role/sys-role.component.less b/src/app/pages/account/sys-role/sys-role.component.less new file mode 100644 index 0000000..6b2e550 --- /dev/null +++ b/src/app/pages/account/sys-role/sys-role.component.less @@ -0,0 +1,33 @@ +.ant-advanced-search-form { + padding: 24px; + background: #fbfbfb; + border: 1px solid #d9d9d9; + border-radius: 6px; +} + +.search-result-list { + margin-top: 16px; + border: 1px dashed #e9e9e9; + border-radius: 6px; + background-color: #fafafa; + min-height: 200px; + text-align: center; + padding-top: 80px; +} + +[nz-form-label] { + overflow: visible; +} + +button { + margin-left: 8px; +} + +.collapse { + margin-left: 8px; + font-size: 12px; +} + +.search-area { + text-align: right; +} diff --git a/src/app/pages/account/sys-role/sys-role.component.spec.ts b/src/app/pages/account/sys-role/sys-role.component.spec.ts new file mode 100644 index 0000000..b92aa28 --- /dev/null +++ b/src/app/pages/account/sys-role/sys-role.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SysRoleComponent } from './sys-role.component'; + +describe('SysRoleComponent', () => { + let component: SysRoleComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [SysRoleComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(SysRoleComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/account/sys-role/sys-role.component.ts b/src/app/pages/account/sys-role/sys-role.component.ts new file mode 100644 index 0000000..abb6644 --- /dev/null +++ b/src/app/pages/account/sys-role/sys-role.component.ts @@ -0,0 +1,83 @@ +import { Component } from '@angular/core'; +import {NzTableComponent, NzTbodyComponent, NzTheadComponent} from "ng-zorro-antd/table"; +import {NzDividerComponent} from "ng-zorro-antd/divider"; +import {NzFormDirective, NzFormModule} from "ng-zorro-antd/form"; +import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; +import { + FormGroup, + NonNullableFormBuilder, + ReactiveFormsModule, +} from "@angular/forms"; +import {NzButtonComponent} from "ng-zorro-antd/button"; +import {NzIconDirective} from "ng-zorro-antd/icon"; +import {NzInputDirective} from "ng-zorro-antd/input"; +import {NzFlexDirective} from "ng-zorro-antd/flex"; +import {DatePipe, NgForOf} from "@angular/common"; +import {RoleService} from "../../../servies/role/role.service"; + +@Component({ + selector: 'app-sys-role', + standalone: true, + imports: [ + NzTableComponent, + NzTheadComponent, + NzDividerComponent, + NzTbodyComponent, + NzFormDirective, + NzRowDirective, + ReactiveFormsModule, + NzColDirective, + NzButtonComponent, + NzIconDirective, + NzInputDirective, + NzFormModule, + NzFlexDirective, + NgForOf, + DatePipe, + ], + templateUrl: './sys-role.component.html', + styleUrl: './sys-role.component.less' +}) +export class SysRoleComponent { + // 表单数据 + tableData: any = { + total: 0, + list: [], + }; + + searchForm: FormGroup; + + constructor(private fb: NonNullableFormBuilder, + private roleService: RoleService) { + // 初始化搜索框 + this.searchForm = this.fb.group({ + roleName: [''], + }); + + this.queryData(); + } + + /** + * 获取数据 + */ + queryData() { + this.searchForm.value.pageNum = 1; + this.searchForm.value.pageSize = 10; + this.roleService.queryList(this.searchForm.value, (data: any) => { + console.log(data); + this.tableData = data['return_data']; + + if (data['return_code'] == '000000') { + + } + }); + } + + /** + * 搜索框重置 + */ + resetForm(): void { + this.searchForm.reset(); + } + +} diff --git a/src/app/pages/body/index/index.component.html b/src/app/pages/body/index/index.component.html index 54fa89b..75aa3f1 100644 --- a/src/app/pages/body/index/index.component.html +++ b/src/app/pages/body/index/index.component.html @@ -30,10 +30,10 @@