Browse Source

123

非煤矿山灾害智能感知和预警系统
jingbowen 3 years ago
parent
commit
216d7343f4
  1. 2
      src/app/home/basic-info/unit/unit.component.html
  2. 54
      src/app/home/basic-info/unit/unit.component.ts

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

@ -5,7 +5,6 @@
<div class="topbox">
<input type="text" nz-input placeholder="请输入单位" />
<nz-select nzAllowClear nzPlaceHolder="单位类型">
</nz-select>
<input type="text" nz-input placeholder="请输入所属机构" />
<nz-select nzAllowClear nzPlaceHolder="使用性质">
@ -65,6 +64,5 @@
</nz-pagination>
<ng-template #totalTemplate let-total> 16条/页,共{{totalCount}}条 </ng-template>
</div>
</nz-table>
</div>

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

@ -1,4 +1,3 @@
import { Router } from '@angular/router';
import { HttpClient } from '@angular/common/http';
import { Component, OnInit, AfterViewInit, ViewChild, ViewContainerRef } from '@angular/core';
@ -8,7 +7,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { NzModalService } from 'ng-zorro-antd/modal';
import { NzMessageService } from 'ng-zorro-antd/message';
import { AddUnitComponent } from '../add-unit/add-unit.component';
import { UnitEditComponent }from '../unit-edit/unit-edit.component'
import { UnitEditComponent } from '../unit-edit/unit-edit.component'
@Component({
selector: 'app-unit',
templateUrl: './unit.component.html',
@ -16,54 +15,36 @@ import { UnitEditComponent }from '../unit-edit/unit-edit.component'
})
export class UnitComponent implements OnInit {
checked = true
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],
type: [null],
event: [null],
area: [null],
disposalState: [null],
});
this.getCompanies()
}
searchValue = '';
next() {
this.router.navigate(['/basicInfo/unit/details']);
}
totalCount
pageChange($event) {
}
nzLoading = false
getCompanies() {
this.nzLoading = true
this.http.get('/api/Companies').subscribe((data: any) => {
this.nzLoading = false
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,
@ -89,21 +70,14 @@ export class UnitComponent implements OnInit {
}
this.http.post('/api/Companies', body).subscribe({
next: (data: any) => {
this.message.create('success', '编辑成功!');
modal.destroy()
this.getCompanies()
return true
console.log(data, 80808)
},
error: (err) => {
console.log(err)
this.message.create('warning', '创建失败');
return false
}
}
)
})
} else {
this.message.create('warning', '请填写完整!');
return false
@ -111,7 +85,13 @@ export class UnitComponent implements OnInit {
}
});
const instance = modal.getContentComponent();
}
}
look(data) {
this.router.navigate(['/basicInfo/unit/details'], { queryParams: { id: data.id, pattern: 'look' } })
}
edit(data) {
this.router.navigate(['/basicInfo/unit/details'], { queryParams: { id: data.id, pattern: 'edit' } })
}
delete(data) {
}
}
Loading…
Cancel
Save