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

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

@ -1,4 +1,3 @@
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { Component, OnInit, AfterViewInit, ViewChild, ViewContainerRef } from '@angular/core'; 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 { NzModalService } from 'ng-zorro-antd/modal';
import { NzMessageService } from 'ng-zorro-antd/message'; import { NzMessageService } from 'ng-zorro-antd/message';
import { AddUnitComponent } from '../add-unit/add-unit.component'; 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({ @Component({
selector: 'app-unit', selector: 'app-unit',
templateUrl: './unit.component.html', templateUrl: './unit.component.html',
@ -16,54 +15,36 @@ import { UnitEditComponent }from '../unit-edit/unit-edit.component'
}) })
export class UnitComponent implements OnInit { export class UnitComponent implements OnInit {
checked = true checked = true
listOfData: any = []; listOfData: any = [];
integrity = 0 integrity = 0
validateForm!: FormGroup; validateForm!: FormGroup;
constructor(private router: Router, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { } constructor(private router: Router, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef) { }
datas = "" datas = ""
ngOnInit(): void { ngOnInit(): void {
this.validateForm = this.fb.group({
level: [null],
type: [null],
event: [null],
area: [null],
disposalState: [null],
});
this.getCompanies() this.getCompanies()
} }
searchValue = ''; searchValue = '';
next() { next() {
this.router.navigate(['/basicInfo/unit/details']); this.router.navigate(['/basicInfo/unit/details']);
} }
totalCount
pageChange($event) {
}
nzLoading = false
getCompanies() { getCompanies() {
this.nzLoading = true
this.http.get('/api/Companies').subscribe((data: any) => { this.http.get('/api/Companies').subscribe((data: any) => {
this.nzLoading = false
console.log(data); console.log(data);
this.listOfData = data.items this.listOfData = data.items
this.listOfData = [...this.listOfData] this.listOfData = [...this.listOfData]
console.log(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 { ngOnDestroy(): void {
console.log('删除了6666666666666')
// CustomReuseStrategy.deleteRouteSnapshot('/basicInfo/unit'); // CustomReuseStrategy.deleteRouteSnapshot('/basicInfo/unit');
} }
addOr(node?: any) { addOr(node?: any) {
console.log(node);
const modal = this.modal.create({ const modal = this.modal.create({
nzTitle: "新增单位", nzTitle: "新增单位",
nzContent: AddUnitComponent, nzContent: AddUnitComponent,
@ -89,21 +70,14 @@ export class UnitComponent implements OnInit {
} }
this.http.post('/api/Companies', body).subscribe({ this.http.post('/api/Companies', body).subscribe({
next: (data: any) => { next: (data: any) => {
this.message.create('success', '编辑成功!'); console.log(data, 80808)
modal.destroy()
this.getCompanies()
return true
}, },
error: (err) => { error: (err) => {
console.log(err) console.log(err)
this.message.create('warning', '创建失败');
return false
} }
} }
) )
}) })
} else { } else {
this.message.create('warning', '请填写完整!'); this.message.create('warning', '请填写完整!');
return false return false
@ -111,7 +85,13 @@ export class UnitComponent implements OnInit {
} }
}); });
const instance = modal.getContentComponent(); 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