Browse Source

Merge branch 'master' of http://121.36.37.70:3000/shaojiahao/Jinan_project

非煤矿山灾害智能感知和预警系统
邵佳豪 3 years ago
parent
commit
443ff3d03b
  1. 19
      src/app/home/basic-info/add-unit/add-unit.component.html
  2. 42
      src/app/home/basic-info/add-unit/add-unit.component.ts
  3. 10
      src/app/home/basic-info/unit/unit.component.html
  4. 61
      src/app/home/basic-info/unit/unit.component.ts
  5. 4
      src/app/home/system-management/or/editor/editor.component.html
  6. 15
      src/app/home/system-management/or/or.component.ts

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

@ -37,8 +37,8 @@
<nz-form-item>
<nz-form-label nzRequired [nzSm]="7" [nzXs]="24" nzFor="所属救援站">所属救援站</nz-form-label>
<nz-form-control>
<nz-select formControlName="role" nzPlaceHolder="请选择所属救援站" nzMode="multiple">
<nz-option *ngFor="let item of listOfData2" [nzValue]="item.normalizedName" [nzLabel]="item.displayName">
<nz-select formControlName="role" nzPlaceHolder="请选择所属救援站">
<nz-option *ngFor="let item of jiuyuanzhan" [nzValue]="item.id" [nzLabel]="item.name">
</nz-option>
</nz-select>
</nz-form-control>
@ -46,8 +46,8 @@
<nz-form-item >
<nz-form-label [nzSm]="7" [nzXs]="24" nzFor="所属大队">所属大队</nz-form-label>
<nz-form-control>
<nz-select formControlName="role2" nzPlaceHolder="请选择所属大队" nzMode="multiple">
<nz-option *ngFor="let item of listOfData2" [nzValue]="item.normalizedName" [nzLabel]="item.displayName">
<nz-select formControlName="role2" nzPlaceHolder="请选择所属大队" >
<nz-option *ngFor="let item of dadui" [nzValue]="item.id" [nzLabel]="item.name">
</nz-option>
</nz-select>
</nz-form-control>
@ -55,17 +55,16 @@
<nz-form-item>
<nz-form-label nzRequired [nzSm]="7" [nzXs]="24" nzFor="使用性质">使用性质</nz-form-label>
<nz-form-control>
<nz-select formControlName="role3" nzPlaceHolder="请选择使用性质" nzMode="multiple">
<nz-option *ngFor="let item of listOfData2" [nzValue]="item.normalizedName" [nzLabel]="item.displayName">
</nz-option>
</nz-select>
<nz-input-group>
<input nz-input type="text" formControlName="nature" 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-select formControlName="role4" nzPlaceHolder="请选择建筑类型" nzMode="multiple">
<nz-option *ngFor="let item of listOfData2" [nzValue]="item.normalizedName" [nzLabel]="item.displayName">
<nz-select formControlName="role4" nzPlaceHolder="请选择建筑类型">
<nz-option *ngFor="let item of listOfData2" [nzValue]="item.id" [nzLabel]="item.name">
</nz-option>
</nz-select>
</nz-form-control>

42
src/app/home/basic-info/add-unit/add-unit.component.ts

@ -14,6 +14,9 @@ export class AddUnitComponent implements OnInit {
@Input() title?: string;
@Input() subtitle?: string;
validateForm!: FormGroup;
zhidui=[]
dadui=[]
jiuyuanzhan=[]
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { }
ngOnInit(): void {
@ -22,13 +25,13 @@ export class AddUnitComponent implements OnInit {
name: [null],
iphone: [null],
addr: [null],
role: [[]],
role2: [[]],
role3: [[]],
role4: [[]],
role: [null],
role2: [null],
nature: [null],
role4: [null],
phonenum: [null]
});
this.getAllOrganization()
}
destroyModal(): void {
this.modal.destroy({ data: 'this the result data' });
@ -36,6 +39,7 @@ export class AddUnitComponent implements OnInit {
listOfData: any[] = [];
listOfData2: any[] = [];
//获取角色列表
getAllRoles() {
let params = {
@ -66,22 +70,28 @@ export class AddUnitComponent implements OnInit {
//获取所有组织机构
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"
// OrganizationUnitId: OrganizationUnitId,
// IsContainsChildren: "true"
ContainsChildren: true,
pageSize: 9999
}
this.http.get('/api/services/app/Organization/GetAll', {
this.http.get('/api/Organizations', {
params: params
}).subscribe((data: any) => {
data.result.items.forEach(element => {
if (element.id == OrganizationUnitId) {
element.parentId = null
console.log(data);
for (let index = 0; index < data.items.length; index++) {
if(data.items[index].level==1){
this.zhidui.push(data.items[index])
}else if(data.items[index].level==2){
this.dadui.push(data.items[index])
}else{
this.jiuyuanzhan.push(data.items[index])
}
element.key = element.id
element.title = element.displayName
});
this.nodes = [...this.toTree.toTree(data.result.items)]
}
console.log(this.dadui);
})
}
}

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

@ -68,18 +68,18 @@
<td [nzChecked]="checked">
</td>
<td>{{ data.name }}</td>
<td>{{ data.companyName }}</td>
<td>
<div style="height: 20px; background: #eee; border-radius: 4px;">
<div [ngStyle]="{'width':data.integrity+'%'}"
<div [ngStyle]="{'width':integrity+'%'}"
style=" height: 100%; background: #46B783; border-radius: 4px; text-align: center; color: #fff;">
{{data.integrity}}%</div>
{{integrity}}%</div>
</div>
</td>
<td>{{ data.organization }}</td>
<td>{{ data.level }}</td>
<td>{{ data.nature }}</td>
<td>{{ data.time }}</td>
<td>{{ data.useNature }}</td>
<td>{{ data.creationTime }}</td>
<td>{{ data.addr }}</td>
<td>{{ data.state }}</td>
<td>

61
src/app/home/basic-info/unit/unit.component.ts

@ -8,17 +8,7 @@ import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-
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;
integrity: number;
organization: string;
level: string;
nature:string;
time:string;
addr:string;
state:string
}
@Component({
selector: 'app-unit',
templateUrl: './unit.component.html',
@ -26,24 +16,14 @@ interface Person {
})
export class UnitComponent implements OnInit {
checked = true
listOfData: Person[] = [
{
id: '1',
name: 'John Brown',
integrity: 20,
organization: 'New York No. 1 Lake Park',
level:'重点单位',
nature:'会议中心',
time:'time',
addr:'单位地址',
state:''
}
];
listOfData: any = [];
integrity = 0
validateForm!: FormGroup;
constructor(private router: Router, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { }
datas = ""
ngOnInit(): void {
this.validateForm = this.fb.group({
level: [null],
@ -53,23 +33,33 @@ export class UnitComponent implements OnInit {
disposalState: [null],
});
this.http.get('/api/Companies').subscribe((data: any) => {
console.log(data);
})
this.getCompanies()
}
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']);
}
getCompanies() {
this.http.get('/api/Companies').subscribe((data: any) => {
console.log(data);
this.listOfData = data.items
this.listOfData = [...this.listOfData]
console.log(this.listOfData);
for (let index = 0; index < this.listOfData.length; index++) {
this.listOfData[index].creationTime=this.listOfData[index].creationTime.substring(0,10)
}
})
}
ngOnDestroy(): void {
console.log('删除了6666666666666')
// CustomReuseStrategy.deleteRouteSnapshot('/basicInfo/unit');
}
addOr(node?: any) {
console.log(node)
const modal = this.modal.create({
nzTitle: "新增单位",
nzContent: AddUnitComponent,
@ -87,10 +77,11 @@ export class UnitComponent implements OnInit {
directorName: instance.validateForm.value.name,
directorPhone: instance.validateForm.value.iphone,
address: instance.validateForm.value.addr,
organizationId:instance.validateForm.value.role.id || 0,
relatedOrganizationId:instance.validateForm.value.role2.id || 0,
buildingTypeId:instance.validateForm.value.role3.id || 0,
useNature:instance.validateForm.value.role4.id || 0,
organizationId: instance.validateForm.value.role || null,
relatedOrganizationId: instance.validateForm.value.role2 || null,
buildingTypeId: instance.validateForm.value.role4 || null,
useNature: instance.validateForm.value.nature,
data: null
}
this.http.post('/api/Companies', body).subscribe({
next: (data: any) => {

4
src/app/home/system-management/or/editor/editor.component.html

@ -15,10 +15,10 @@
</nz-input-group>
</nz-form-control>
</nz-form-item> -->
<nz-form-item>
<!-- <nz-form-item>
<nz-form-control>
<label [(ngModel)]="datacopy.isGasStation" nz-checkbox formControlName="isGasStation">是否为加油站</label>
</nz-form-control>
</nz-form-item>
</nz-form-item> -->
</form>
</div>

15
src/app/home/system-management/or/or.component.ts

@ -81,7 +81,8 @@ export class OrComponent implements OnInit {
addOr(node?: any) {
console.log(node)
console.log(node);
const modal = this.modal.create({
nzTitle: node ? '新增组织机构' : '新增一级组织机构',
nzContent: AddorComponent,
@ -93,8 +94,7 @@ export class OrComponent implements OnInit {
await new Promise(resolve => {
let body = {
name: instance.validateForm.value.name,
parentId: node ? Number(node.key) : null,
isGasStation: instance.validateForm.value.isGasStation
parentId: node ? node.key : null
}
this.http.post('/api/Organizations', body).subscribe(data => {
resolve(data)
@ -120,7 +120,7 @@ export class OrComponent implements OnInit {
}
editOr(node) {
// console.log(node)
console.log(node)
const modal = this.modal.create({
nzTitle: '编辑组织机构',
nzContent: EditorComponent,
@ -134,10 +134,9 @@ export class OrComponent implements OnInit {
await new Promise(resolve => {
let body = {
name: instance.validateForm.value.name,
isGasStation: instance.validateForm.value.isGasStation,
parentId: node.origin.parentId
}
this.http.put(`/api/Organizations/${node.origin.id}`, body).subscribe(data => {
this.http.patch(`/api/Organizations/${node.origin.id}`, body).subscribe(data => {
resolve(data)
this.message.create('success', '编辑成功!');
this.nzTreeComponent.getExpandedNodeList().forEach((item) => {
@ -194,7 +193,7 @@ export class OrComponent implements OnInit {
if (this.pos == 0) {//目标节点内部
parentId = event.node.key
} else {
if (event.node.level == 0) {
if (event.node.level == 1) {
parentId = null
} else {
parentId = event.node.origin.parentId
@ -302,7 +301,7 @@ export class OrComponent implements OnInit {
pos//放置位置
beforeDrop = (arg: NzFormatBeforeDropEvent) => {
console.log('arg', arg)
if (arg.node.level === 0) {//如果为数据节点则不允许拖到一级节点
if (arg.node.level === 1) {//如果为数据节点则不允许拖到一级节点
this.message.create('warning', '不允许拖拽到一级节点');
this.isDrag = false
return of(false);

Loading…
Cancel
Save