From 38c65720ee037d101c026192251c165481dca266 Mon Sep 17 00:00:00 2001 From: jingbowen <970029315@qq.com> Date: Wed, 3 Aug 2022 19:45:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../add-unit/add-unit.component.html | 74 ++++++++++++++++ .../add-unit/add-unit.component.scss | 0 .../add-unit/add-unit.component.spec.ts | 25 ++++++ .../basic-info/add-unit/add-unit.component.ts | 84 +++++++++++++++++++ .../home/basic-info/unit/unit.component.html | 54 ++++++++---- .../home/basic-info/unit/unit.component.scss | 14 +++- .../home/basic-info/unit/unit.component.ts | 59 +++++++++---- src/app/home/home.module.ts | 4 +- 8 files changed, 278 insertions(+), 36 deletions(-) create mode 100644 src/app/home/basic-info/add-unit/add-unit.component.html create mode 100644 src/app/home/basic-info/add-unit/add-unit.component.scss create mode 100644 src/app/home/basic-info/add-unit/add-unit.component.spec.ts create mode 100644 src/app/home/basic-info/add-unit/add-unit.component.ts diff --git a/src/app/home/basic-info/add-unit/add-unit.component.html b/src/app/home/basic-info/add-unit/add-unit.component.html new file mode 100644 index 0000000..52f33ad --- /dev/null +++ b/src/app/home/basic-info/add-unit/add-unit.component.html @@ -0,0 +1,74 @@ +
+
+ + 单位名称 + + + + + + + + 消防安全责任人 + + + + + + + + 联系方式 + + + + + + + + 单位地址 + + + + + + + + + + 所属救援站 + + + + + + + + + 所属大队 + + + + + + + + + 使用性质 + + + + + + + + + 建筑类型 + + + + + + + +
+
\ No newline at end of file diff --git a/src/app/home/basic-info/add-unit/add-unit.component.scss b/src/app/home/basic-info/add-unit/add-unit.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/home/basic-info/add-unit/add-unit.component.spec.ts b/src/app/home/basic-info/add-unit/add-unit.component.spec.ts new file mode 100644 index 0000000..1b4982e --- /dev/null +++ b/src/app/home/basic-info/add-unit/add-unit.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AddUnitComponent } from './add-unit.component'; + +describe('AddUnitComponent', () => { + let component: AddUnitComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ AddUnitComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(AddUnitComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/home/basic-info/add-unit/add-unit.component.ts b/src/app/home/basic-info/add-unit/add-unit.component.ts new file mode 100644 index 0000000..dfe04fe --- /dev/null +++ b/src/app/home/basic-info/add-unit/add-unit.component.ts @@ -0,0 +1,84 @@ +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-add-unit', + templateUrl: './add-unit.component.html', + styleUrls: ['./add-unit.component.scss'] +}) +export class AddUnitComponent implements OnInit { + + + @Input() title?: string; + @Input() subtitle?: string; + validateForm!: FormGroup; + constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { } + + ngOnInit(): void { + this.validateForm = this.fb.group({ + account: [null, [Validators.required]], + name: [null, [Validators.required]], + organization: [null, [Validators.required]], + role: [[], [Validators.required]], + role2: [[]], + phonenum: [null, [Validators.required]] + }); + + } + destroyModal(): void { + this.modal.destroy({ data: 'this the result data' }); + } + + listOfData: any[] = []; + listOfData2: any[] = []; + //获取角色列表 + getAllRoles() { + let params = { + SkipCount: '0', + MaxResultCount: '999' + } + this.http.get('/api/services/app/Role/GetAll', { + params: params + }).subscribe((data: any) => { + // console.log('角色列表', data.result.items) + this.listOfData = data.result.items + }) + } + //获取角色列表 + getAllRoles2() { + let params = { + SkipCount: '0', + MaxResultCount: '999', + IsViolationRoles:'true' + } + this.http.get('/api/services/app/Role/GetAll', { + params: params + }).subscribe((data: any) => { + // console.log('角色列表', data.result.items) + this.listOfData2 = data.result.items + }) + } + //获取所有组织机构 + nodes: any = [] + getAllOrganization() { + let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id + let params = { + OrganizationUnitId: OrganizationUnitId, + IsContainsChildren: "true" + } + this.http.get('/api/services/app/Organization/GetAll', { + params: params + }).subscribe((data: any) => { + data.result.items.forEach(element => { + if (element.id == OrganizationUnitId) { + element.parentId = null + } + element.key = element.id + element.title = element.displayName + }); + this.nodes = [...this.toTree.toTree(data.result.items)] + }) + } +} diff --git a/src/app/home/basic-info/unit/unit.component.html b/src/app/home/basic-info/unit/unit.component.html index e85659b..4ef2308 100644 --- a/src/app/home/basic-info/unit/unit.component.html +++ b/src/app/home/basic-info/unit/unit.component.html @@ -5,37 +5,52 @@ -->
- - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + +
+  
-
- -
+ + +
+ + +
+ 单位名称 信息完整度 所属机构 @@ -49,6 +64,9 @@ + + + {{ data.name }}
{{data.integrity}}%
diff --git a/src/app/home/basic-info/unit/unit.component.scss b/src/app/home/basic-info/unit/unit.component.scss index 4e535de..210d71a 100644 --- a/src/app/home/basic-info/unit/unit.component.scss +++ b/src/app/home/basic-info/unit/unit.component.scss @@ -29,17 +29,25 @@ .righttop { height: 36px; display: flex; - + button { margin-left: 16px; } - nz-input-group { + nz-form-item { + margin: 0 5px; height: 32px; } } } - + .translate{ + text-align: left; + // padding: 0 10px; + margin: 10px 0; + button{ + margin: 0 10px; + } + } .treeTitle { width: 700px; height: 36px; diff --git a/src/app/home/basic-info/unit/unit.component.ts b/src/app/home/basic-info/unit/unit.component.ts index 3309b62..58d2d2b 100644 --- a/src/app/home/basic-info/unit/unit.component.ts +++ b/src/app/home/basic-info/unit/unit.component.ts @@ -1,5 +1,13 @@ -import { Component, OnInit } from '@angular/core'; + import { Router } from '@angular/router'; +import { AddUnitComponent } from '../add-unit/add-unit.component'; +import { HttpClient } from '@angular/common/http'; +import { Component, OnInit, AfterViewInit, ViewChild, ViewContainerRef } from '@angular/core'; +import { TreeService } from 'src/app/service/tree.service'; +import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { NzModalService } from 'ng-zorro-antd/modal'; +import { NzMessageService } from 'ng-zorro-antd/message'; interface Person { id: string; name: string; @@ -17,6 +25,7 @@ interface Person { styleUrls: ['./unit.component.scss'] }) export class UnitComponent implements OnInit { + checked=true listOfData: Person[] = [ { id: '1', @@ -29,23 +38,24 @@ export class UnitComponent implements OnInit { addr:'单位地址', state:'' } - // { - // id: '2', - // name: 'Jim Green', - // integrity: 42, - // organization: 'London No. 1 Lake Park' - // }, - // { - // id: '3', - // name: 'Joe Black', - // integrity: 32, - // organization: 'Sidney No. 1 Lake Park' - // } + ]; - constructor(private router: Router) { } + validateForm!: FormGroup; + + ngOnInit(): void { + this.validateForm = this.fb.group({ + level: [null], + type: [null], + event: [null], + area: [null], + disposalState: [null], + + }); } + constructor(private router: Router,private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { } + searchValue = ''; next() { this.router.navigate(['/basicInfo/unit/details']); @@ -54,4 +64,25 @@ export class UnitComponent implements OnInit { console.log('删除了6666666666666') // CustomReuseStrategy.deleteRouteSnapshot('/basicInfo/unit'); } + addOr(node?: any) { + console.log(node) + const modal = this.modal.create({ + nzTitle: "新增单位", + nzContent: AddUnitComponent, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 450, + nzComponentParams: {}, + nzOnOk: async () => { + if (instance.validateForm.valid) { + console.log(1); + + } else { + this.message.create('warning', '请填写完整!'); + return false + } + } + }); + const instance = modal.getContentComponent(); + + } } diff --git a/src/app/home/home.module.ts b/src/app/home/home.module.ts index 402c78e..e270b21 100644 --- a/src/app/home/home.module.ts +++ b/src/app/home/home.module.ts @@ -35,6 +35,7 @@ import { NzTreeSelectModule } from 'ng-zorro-antd/tree-select'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { NzModalModule } from 'ng-zorro-antd/modal'; import { NzMessageModule } from 'ng-zorro-antd/message'; +import { AddUnitComponent } from './basic-info/add-unit/add-unit.component'; @NgModule({ declarations: [ NavComponent, @@ -56,7 +57,8 @@ import { NzMessageModule } from 'ng-zorro-antd/message'; StationTaskApplyComponent, StationWeeklyPlanComponent, AddroleComponent, - EditroleComponent + EditroleComponent, + AddUnitComponent ], imports: [ CommonModule,