Browse Source

基本信息新增功能

非煤矿山灾害智能感知和预警系统
jingbowen 3 years ago
parent
commit
38c65720ee
  1. 74
      src/app/home/basic-info/add-unit/add-unit.component.html
  2. 0
      src/app/home/basic-info/add-unit/add-unit.component.scss
  3. 25
      src/app/home/basic-info/add-unit/add-unit.component.spec.ts
  4. 84
      src/app/home/basic-info/add-unit/add-unit.component.ts
  5. 54
      src/app/home/basic-info/unit/unit.component.html
  6. 14
      src/app/home/basic-info/unit/unit.component.scss
  7. 59
      src/app/home/basic-info/unit/unit.component.ts
  8. 4
      src/app/home/home.module.ts

74
src/app/home/basic-info/add-unit/add-unit.component.html

@ -0,0 +1,74 @@
<div class="box">
<form nz-form [formGroup]="validateForm">
<nz-form-item>
<nz-form-label [nzSm]="7" [nzXs]="24" nzRequired nzFor="单位名称">单位名称</nz-form-label>
<nz-form-control>
<nz-input-group style="width: 200px;">
<input nz-input type="text" formControlName="account" placeholder="请输入单位名称" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="7" [nzXs]="24" nzFor="消防安全责任人">消防安全责任人</nz-form-label>
<nz-form-control>
<nz-input-group style="width: 200px;">
<input nz-input type="text" formControlName="name" placeholder="请输入消防安全责任人" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="7" [nzXs]="24" nzFor="联系方式">联系方式</nz-form-label>
<nz-form-control>
<nz-input-group style="width: 200px;">
<input nz-input type="text" formControlName="iphone" placeholder="请输入联系方式" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="7" [nzXs]="24" nzFor="单位地址">单位地址</nz-form-label>
<nz-form-control>
<nz-form-control>
<nz-input-group style="width: 200px;">
<input nz-input type="text" formControlName="iphone" placeholder="请输入单位地址" />
</nz-input-group>
</nz-form-control>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label nzRequired [nzSm]="7" [nzXs]="24" nzFor="所属救援站">所属救援站</nz-form-label>
<nz-form-control>
<nz-select style="width: 200px;" formControlName="role2" nzPlaceHolder="请选择所属救援站" nzMode="multiple">
<nz-option *ngFor="let item of listOfData2" [nzValue]="item.normalizedName" [nzLabel]="item.displayName">
</nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item >
<nz-form-label [nzSm]="7" [nzXs]="24" nzFor="所属大队">所属大队</nz-form-label>
<nz-form-control>
<nz-select style="width: 200px;" formControlName="role3" nzPlaceHolder="请选择所属大队" nzMode="multiple">
<nz-option *ngFor="let item of listOfData2" [nzValue]="item.normalizedName" [nzLabel]="item.displayName">
</nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label nzRequired [nzSm]="7" [nzXs]="24" nzFor="使用性质">使用性质</nz-form-label>
<nz-form-control>
<nz-select style="width: 200px;" formControlName="role4" nzPlaceHolder="请选择使用性质" nzMode="multiple">
<nz-option *ngFor="let item of listOfData2" [nzValue]="item.normalizedName" [nzLabel]="item.displayName">
</nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="7" [nzXs]="24" nzFor="建筑类型">建筑类型</nz-form-label>
<nz-form-control>
<nz-select style="width: 200px;" formControlName="role5" nzPlaceHolder="请选择建筑类型" nzMode="multiple">
<nz-option *ngFor="let item of listOfData2" [nzValue]="item.normalizedName" [nzLabel]="item.displayName">
</nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</form>
</div>

0
src/app/home/basic-info/add-unit/add-unit.component.scss

25
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<AddUnitComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AddUnitComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AddUnitComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

84
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)]
})
}
}

54
src/app/home/basic-info/unit/unit.component.html

@ -5,37 +5,52 @@
</div> -->
<div class="righttop">
<!-- <form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
<nz-form-item>
<nz-form-control>
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入单位" formControlName="search" [(ngModel)]="searchValue"/>
<input type="text" nz-input placeholder="请输入单位" />
</nz-input-group>
</nz-form-control>
<button style="display: none;" type="submit"></button>
</nz-form-item>
</form> -->
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入单位" />
</nz-input-group>
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入单位" />
</nz-input-group>
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入单位" />
</nz-input-group>
<nz-form-item>
<nz-form-control>
<nz-select [nzMaxTagCount]="1" nzAllowClear id="area" formControlName="area"
nzPlaceHolder="单位类型">
<nz-option nzValue="出入口" nzLabel="出入口"></nz-option>
<nz-option nzValue="加油区" nzLabel="加油区"></nz-option>
<nz-option nzValue="油罐区" nzLabel="油罐区"></nz-option>
<nz-option nzValue="便利店" nzLabel="便利店"></nz-option>
<nz-option nzValue="办公区" nzLabel="办公区"></nz-option>
<nz-option nzValue="其他区域" nzLabel="其他区域"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入最小完整度值" />
</nz-input-group>
</nz-form-item>
<nz-form-item>
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入最小完整度值" />
</nz-input-group>
</nz-form-item>
</div>
<div>
<button nz-button nzType="primary"><i nz-icon nzType="plus-circle" nzTheme="outline"></i>查询</button>
&nbsp;
<button nz-button nzType="primary"><i nz-icon nzType="plus-circle" nzTheme="outline"></i>重置</button>
</div>
<div>
</div>
</div>
<div class="translate">
<button nz-button nzType="primary" (click)="addOr()">新增</button>
<button nz-button nzType="primary">修改</button>
<button nz-button nzType="primary" nzDanger>删除</button>
</div>
<nz-table [nzBordered]="true" #basicTable [nzData]="listOfData">
<thead>
<tr>
<th> </th>
<th>单位名称</th>
<th>信息完整度</th>
<th>所属机构</th>
@ -49,6 +64,9 @@
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td [nzChecked]="checked">
</td>
<td >{{ data.name }}</td>
<td ><div style="height: 20px; background: #eee; border-radius: 4px;">
<div [ngStyle]="{'width':data.integrity+'%'}" style=" height: 100%; background: #46B783; border-radius: 4px; text-align: center; color: #fff;">{{data.integrity}}%</div>

14
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;

59
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();
}
}

4
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,

Loading…
Cancel
Save