From 87ea391ffdf74a703d447cb0eedfe079b7d52983 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Wed, 22 Jun 2022 14:56:41 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E8=A7=92=E8=89=B2=E5=88=86?= =?UTF-8?q?=E9=85=8D=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy.config.json | 4 +- .../audit/audit-ing/audit-ing.component.html | 2 +- .../audit-record/audit-record.component.html | 2 +- src/app/pages/init3D.guard.ts | 2 +- .../file-license-list.component.html | 2 +- .../oil-station-list.component.html | 4 +- .../update-license-list.component.html | 2 +- .../criminal-records-admin.component.html | 2 +- .../warning-statistics-list.component.html | 2 +- .../today-warning-admin.component.html | 2 +- .../organization/organization.component.html | 10 --- .../role/addrole/addrole.component.html | 14 +++- .../role/addrole/addrole.component.ts | 26 ++++++- .../role/editrole/editrole.component.html | 18 ++++- .../role/editrole/editrole.component.ts | 28 +++++++- .../role/menus/menus.component.html | 20 ++++++ .../role/menus/menus.component.scss | 0 .../role/menus/menus.component.ts | 71 +++++++++++++++++++ .../role/role.component.html | 5 +- .../system-management/role/role.component.ts | 60 +++++++++++++++- .../system-management.module.ts | 5 +- 21 files changed, 245 insertions(+), 36 deletions(-) create mode 100644 src/app/system-management/role/menus/menus.component.html create mode 100644 src/app/system-management/role/menus/menus.component.scss create mode 100644 src/app/system-management/role/menus/menus.component.ts diff --git a/proxy.config.json b/proxy.config.json index b147575..2e74350 100644 --- a/proxy.config.json +++ b/proxy.config.json @@ -1,11 +1,11 @@ { "/api": { - "target": "http://39.106.78.171:8906", + "target": "http://121.36.37.70:8906", "secure": false, "changeOrigin": true }, "/signalr": { - "target": "http://39.106.78.171:8906", + "target": "http://121.36.37.70:8906", "secure": false, "ws": true, "logLevel": "debug" diff --git a/src/app/pages/audit/audit-ing/audit-ing.component.html b/src/app/pages/audit/audit-ing/audit-ing.component.html index 1c99130..7e7aac1 100644 --- a/src/app/pages/audit/audit-ing/audit-ing.component.html +++ b/src/app/pages/audit/audit-ing/audit-ing.component.html @@ -8,7 +8,7 @@ 审批信息 审批类型 - 加油站名称 + 油站名称 区域名称 公司名称 diff --git a/src/app/pages/audit/audit-record/audit-record.component.html b/src/app/pages/audit/audit-record/audit-record.component.html index 798b3b9..78b4492 100644 --- a/src/app/pages/audit/audit-record/audit-record.component.html +++ b/src/app/pages/audit/audit-record/audit-record.component.html @@ -94,7 +94,7 @@ 审批类型 审批信息 - 公司名称 申请人 diff --git a/src/app/pages/init3D.guard.ts b/src/app/pages/init3D.guard.ts index 2cd893b..8f46e71 100644 --- a/src/app/pages/init3D.guard.ts +++ b/src/app/pages/init3D.guard.ts @@ -26,7 +26,7 @@ export class init3DGuard implements CanActivate { if (userdata.userName == 'superadmin' || res.hasBuildingInfo) { return true } else { - this.message.info("当前油站未开通!"); + // this.message.info("当前油站未开通!"); return false } }); diff --git a/src/app/pages/plan-admin/file-license-list/file-license-list.component.html b/src/app/pages/plan-admin/file-license-list/file-license-list.component.html index d4de7c2..cbb47c7 100644 --- a/src/app/pages/plan-admin/file-license-list/file-license-list.component.html +++ b/src/app/pages/plan-admin/file-license-list/file-license-list.component.html @@ -23,7 +23,7 @@ - + diff --git a/src/app/pages/plan-admin/oil-station-list/oil-station-list.component.html b/src/app/pages/plan-admin/oil-station-list/oil-station-list.component.html index 64e407e..9756871 100644 --- a/src/app/pages/plan-admin/oil-station-list/oil-station-list.component.html +++ b/src/app/pages/plan-admin/oil-station-list/oil-station-list.component.html @@ -5,7 +5,7 @@ - + @@ -32,7 +32,7 @@
-
加油站名称 + 油站名称 区域名称 公司名称 diff --git a/src/app/pages/plan-admin/update-license-list/update-license-list.component.html b/src/app/pages/plan-admin/update-license-list/update-license-list.component.html index a1b4c24..0d4c1a8 100644 --- a/src/app/pages/plan-admin/update-license-list/update-license-list.component.html +++ b/src/app/pages/plan-admin/update-license-list/update-license-list.component.html @@ -34,7 +34,7 @@ - + diff --git a/src/app/pages/records/criminal-records-admin/criminal-records-admin.component.html b/src/app/pages/records/criminal-records-admin/criminal-records-admin.component.html index ac3eb28..54cb72c 100644 --- a/src/app/pages/records/criminal-records-admin/criminal-records-admin.component.html +++ b/src/app/pages/records/criminal-records-admin/criminal-records-admin.component.html @@ -165,7 +165,7 @@ 预警事件 公司名称 区域名称 - 加油站 + 油站名称 预警区域 摄像头名称 预警时间 diff --git a/src/app/pages/records/warning-statistics-list/warning-statistics-list.component.html b/src/app/pages/records/warning-statistics-list/warning-statistics-list.component.html index df4b7ee..784a636 100644 --- a/src/app/pages/records/warning-statistics-list/warning-statistics-list.component.html +++ b/src/app/pages/records/warning-statistics-list/warning-statistics-list.component.html @@ -115,7 +115,7 @@ 预警内容 公司名称 区域名称 - 所属油站 + 油站名称 证照/消防设施名称 有效期限 操作 diff --git a/src/app/pages/today-warning-admin/today-warning-admin.component.html b/src/app/pages/today-warning-admin/today-warning-admin.component.html index 9a9dfa4..e4f13ce 100644 --- a/src/app/pages/today-warning-admin/today-warning-admin.component.html +++ b/src/app/pages/today-warning-admin/today-warning-admin.component.html @@ -128,7 +128,7 @@ 区域名称
- 加油站 + 油站名称
预警区域 diff --git a/src/app/system-management/organization/organization.component.html b/src/app/system-management/organization/organization.component.html index 855ab28..6f29182 100644 --- a/src/app/system-management/organization/organization.component.html +++ b/src/app/system-management/organization/organization.component.html @@ -6,16 +6,6 @@ {{totalCount}}个单位
- diff --git a/src/app/system-management/role/addrole/addrole.component.html b/src/app/system-management/role/addrole/addrole.component.html index bbdb932..a986b7b 100644 --- a/src/app/system-management/role/addrole/addrole.component.html +++ b/src/app/system-management/role/addrole/addrole.component.html @@ -19,12 +19,20 @@ - +
\ No newline at end of file diff --git a/src/app/system-management/role/addrole/addrole.component.ts b/src/app/system-management/role/addrole/addrole.component.ts index 4d76d33..f2ff54e 100644 --- a/src/app/system-management/role/addrole/addrole.component.ts +++ b/src/app/system-management/role/addrole/addrole.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit, Input } from '@angular/core'; import { NzModalRef } from 'ng-zorro-antd/modal'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { HttpClient } from '@angular/common/http'; +import { TreeService } from 'src/app/service/tree.service'; @Component({ selector: 'app-addrole', templateUrl: './addrole.component.html', @@ -13,17 +14,38 @@ export class AddroleComponent implements OnInit { @Input() subtitle?: string; @Input() nodes?: any; validateForm!: FormGroup; - constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { } + constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { } ngOnInit(): void { + this.nodes.length != 0 ? null : this.getAllMenus() this.loadMore(); this.validateForm = this.fb.group({ name: [null, [Validators.required]], power: [null, [Validators.required]], - menus: [null] + // menus: [null] }); } + + totalCount + getAllMenus() { + let params = { + SkipCount: '0', + MaxResultCount: '999' + } + this.http.get('/api/services/app/Menu/GetAll', { + params: params + }).subscribe((data: any) => { + console.log(666, data) + this.totalCount = data.result.totalCount + data.result.items.forEach(element => { + element.key = element.id + element.title = element.name + element.selectable = false + }); + this.nodes = [...this.toTree.toTree(data.result.items)] + }) + } destroyModal(): void { this.modal.destroy({ data: 'this the result data' }); } diff --git a/src/app/system-management/role/editrole/editrole.component.html b/src/app/system-management/role/editrole/editrole.component.html index 9cda566..b6b040b 100644 --- a/src/app/system-management/role/editrole/editrole.component.html +++ b/src/app/system-management/role/editrole/editrole.component.html @@ -16,5 +16,21 @@ + - + \ No newline at end of file diff --git a/src/app/system-management/role/editrole/editrole.component.ts b/src/app/system-management/role/editrole/editrole.component.ts index 8213119..a215613 100644 --- a/src/app/system-management/role/editrole/editrole.component.ts +++ b/src/app/system-management/role/editrole/editrole.component.ts @@ -2,6 +2,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Component, OnInit, Input } from '@angular/core'; import { NzModalRef } from 'ng-zorro-antd/modal'; import { HttpClient } from '@angular/common/http'; +import { TreeService } from 'src/app/service/tree.service'; @Component({ selector: 'app-editrole', templateUrl: './editrole.component.html', @@ -11,21 +12,42 @@ export class EditroleComponent implements OnInit { @Input() data?: any; @Input() optionList?: any; - + @Input() nodes?: any; validateForm!: FormGroup; - constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { } + constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { } multipleValue: any ngOnInit(): void { + this.nodes.length != 0 ? null : this.getAllMenus() this.multipleValue = this.data.grantedPermissions this.validateForm = this.fb.group({ name: [null, [Validators.required]], - power: [null, [Validators.required]] + power: [null, [Validators.required]], + // menus: [null] }); if (this.optionList.length == 0) { this.loadMore() } } + totalCount + getAllMenus() { + let params = { + SkipCount: '0', + MaxResultCount: '999' + } + this.http.get('/api/services/app/Menu/GetAll', { + params: params + }).subscribe((data: any) => { + console.log(666, data) + this.totalCount = data.result.totalCount + data.result.items.forEach(element => { + element.key = element.id + element.title = element.name + element.selectable = false + }); + this.nodes = [...this.toTree.toTree(data.result.items)] + }) + } destroyModal(): void { this.modal.destroy({ data: 'this the result data' }); } diff --git a/src/app/system-management/role/menus/menus.component.html b/src/app/system-management/role/menus/menus.component.html new file mode 100644 index 0000000..21367cc --- /dev/null +++ b/src/app/system-management/role/menus/menus.component.html @@ -0,0 +1,20 @@ +
+
+ + 菜单 + + + + + + + + + + + + +
+
\ No newline at end of file diff --git a/src/app/system-management/role/menus/menus.component.scss b/src/app/system-management/role/menus/menus.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/system-management/role/menus/menus.component.ts b/src/app/system-management/role/menus/menus.component.ts new file mode 100644 index 0000000..d029e3c --- /dev/null +++ b/src/app/system-management/role/menus/menus.component.ts @@ -0,0 +1,71 @@ +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { Component, OnInit, Input, ViewChild } from '@angular/core'; +import { NzModalRef } from 'ng-zorro-antd/modal'; +import { HttpClient } from '@angular/common/http'; +import { TreeService } from 'src/app/service/tree.service'; +import { NzTreeComponent } from 'ng-zorro-antd/tree'; +@Component({ + selector: 'app-menus', + templateUrl: './menus.component.html', + styleUrls: ['./menus.component.scss'] +}) +export class MenusComponent implements OnInit { + @ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; + @Input() data?: any; + @Input() nodes?: any; + validateForm!: FormGroup; + constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { } + + ngOnInit(): void { + this.nodes.length != 0 ? null : this.getAllMenus() + this.getMenus() + this.validateForm = this.fb.group({ + menus: [] + }); + } + + getMenus() { + let params = { + Id: this.data.id, + } + this.http.get('/api/services/app/Role/Get', { + params: params + }).subscribe((data: any) => { + // console.log(666, data) + let arr = [] + data.result.menus.forEach(element => { + arr.push(element.id) + }); + this.validateForm.patchValue({ + menus: arr + }); + }) + } + + + totalCount + getAllMenus() { + let params = { + SkipCount: '0', + MaxResultCount: '999' + } + this.http.get('/api/services/app/Menu/GetAll', { + params: params + }).subscribe((data: any) => { + // console.log(666, data) + this.totalCount = data.result.totalCount + data.result.items.forEach(element => { + element.key = element.id + element.title = element.name + element.selectable = false + }); + this.nodes = [...this.toTree.toTree(data.result.items)] + }) + } + + destroyModal(): void { + this.modal.destroy({ data: 'this the result data' }); + } + + +} diff --git a/src/app/system-management/role/role.component.html b/src/app/system-management/role/role.component.html index b91e611..ef1935f 100644 --- a/src/app/system-management/role/role.component.html +++ b/src/app/system-management/role/role.component.html @@ -13,7 +13,7 @@ 角色 - 权限 + 权限 创建/修改时间 操作 @@ -29,10 +29,11 @@ 编辑 + 分配菜单 删除 - + \ No newline at end of file diff --git a/src/app/system-management/role/role.component.ts b/src/app/system-management/role/role.component.ts index 5e0642a..f390725 100644 --- a/src/app/system-management/role/role.component.ts +++ b/src/app/system-management/role/role.component.ts @@ -6,6 +6,7 @@ import { HttpClient } from '@angular/common/http'; import { AddroleComponent } from './addrole/addrole.component'; import { EditroleComponent } from './editrole/editrole.component'; import { TreeService } from 'src/app/service/tree.service'; +import { MenusComponent } from './menus/menus.component'; @Component({ selector: 'app-role', templateUrl: './role.component.html', @@ -112,7 +113,8 @@ export class RoleComponent implements OnInit { // nzOkLoading: true, nzComponentParams: { data: item, - optionList: this.optionList + optionList: this.optionList, + nodes: this.nodes }, nzMaskClosable: false, nzOnOk: async () => { @@ -148,6 +150,62 @@ export class RoleComponent implements OnInit { modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result)); } + allotMenus(item) { + // console.log(item) + const modal = this.modal.create({ + nzTitle: '分配菜单', + nzContent: MenusComponent, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 400, + nzComponentParams: { + data: item, + nodes: this.nodes + }, + nzMaskClosable: false, + nzOnOk: async () => { + await new Promise(resolve => { + console.log('表单信息', instance.validateForm) + console.log('tree', instance.nzTreeComponent.getCheckedNodeList()) + let arr = [] + let treeData = instance.nzTreeComponent.getCheckedNodeList() + treeData.forEach(element => { + arr.push(element.key) + if (element.origin.children.length != 0) { + element.origin.children.forEach(ele => { + arr.push(ele.key) + }) + } + if (element.parentNode) { + arr.push(element.parentNode.key) + } + }); + + + + + console.log(99999999999, arr) + console.log(777777777777) + return false + // let body = instance.validateForm.value.menus + // this.http.post('/api/services/app/Role/SetRoleMenus', body, { + // params: { + // roleId: item.id + // } + // }).subscribe(data => { + // resolve(data) + // this.message.create('success', '分配成功!'); + // this.getAllRoles() + // return true + // }) + }) + } + }); + const instance = modal.getContentComponent(); + // modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!')); + // modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result)); + } + + optionList = []; //获取权限列表 loadMore() { diff --git a/src/app/system-management/system-management.module.ts b/src/app/system-management/system-management.module.ts index 1f05bd9..c88a497 100644 --- a/src/app/system-management/system-management.module.ts +++ b/src/app/system-management/system-management.module.ts @@ -43,8 +43,9 @@ import { EditUpdateOfLicenseComponent } from './update-of-license/edit-update-of import { MenuComponent } from './menu/menu.component'; import { AddmenuComponent } from './menu/addmenu/addmenu.component'; import { EditmenuComponent } from './menu/editmenu/editmenu.component'; +import { MenusComponent } from './role/menus/menus.component'; @NgModule({ - declarations: [OrganizationComponent, UserComponent, RoleComponent, NavigationComponent, AdduserComponent, EdituserComponent, AddroleComponent, EditroleComponent, AddorComponent, EditorComponent, AnalysisOfTheHostComponent, AddhostComponent, EdithostComponent, AddcameraComponent, EditcameraComponent, PushComponent, EditPushItemComponent, FileOfLicenseComponent, UpdateOfLicenseComponent, AddFileOfLicenseComponent, EditFileOfLicenseComponent, AddUpdateOfLicenseComponent, EditUpdateOfLicenseComponent, MenuComponent, AddmenuComponent, EditmenuComponent], + declarations: [OrganizationComponent, UserComponent, RoleComponent, NavigationComponent, AdduserComponent, EdituserComponent, AddroleComponent, EditroleComponent, AddorComponent, EditorComponent, AnalysisOfTheHostComponent, AddhostComponent, EdithostComponent, AddcameraComponent, EditcameraComponent, PushComponent, EditPushItemComponent, FileOfLicenseComponent, UpdateOfLicenseComponent, AddFileOfLicenseComponent, EditFileOfLicenseComponent, AddUpdateOfLicenseComponent, EditUpdateOfLicenseComponent, MenuComponent, AddmenuComponent, EditmenuComponent, MenusComponent], imports: [ CommonModule, SystemRoutingModule, @@ -66,7 +67,7 @@ import { EditmenuComponent } from './menu/editmenu/editmenu.component'; NzTreeSelectModule, NzCheckboxModule ], - entryComponents: [AdduserComponent, EdituserComponent, AddroleComponent, EditroleComponent, AddorComponent, EditorComponent, AddhostComponent, EdithostComponent, AddcameraComponent, EditcameraComponent, EditPushItemComponent, AddFileOfLicenseComponent, EditFileOfLicenseComponent, AddUpdateOfLicenseComponent, EditUpdateOfLicenseComponent,AddmenuComponent,EditmenuComponent] + entryComponents: [AdduserComponent, EdituserComponent, AddroleComponent, EditroleComponent, AddorComponent, EditorComponent, AddhostComponent, EdithostComponent, AddcameraComponent, EditcameraComponent, EditPushItemComponent, AddFileOfLicenseComponent, EditFileOfLicenseComponent, AddUpdateOfLicenseComponent, EditUpdateOfLicenseComponent, AddmenuComponent, EditmenuComponent, MenusComponent] }) export class SystemManagementModule { }