Browse Source

[完善]单位列表完善

非煤矿山灾害智能感知和预警系统
邵佳豪 2 years ago
parent
commit
6b57968c62
  1. 9
      src/app/home/basic-info/unit/unit.component.html
  2. 19
      src/app/home/basic-info/unit/unit.component.ts

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

@ -49,12 +49,13 @@
<tr *ngFor="let data of basicTable.data">
<td>{{ data.companyName }}</td>
<td class="progresssquare">
<nz-progress [nzShowInfo]="false" nzStrokeLinecap="square" nzStrokeWidth="16" nzStrokeColor="#42B983" [nzPercent]="30">
<nz-progress [nzShowInfo]="false" nzStrokeLinecap="square" nzStrokeWidth="16" nzStrokeColor="#42B983"
[nzPercent]="data.integrity * 100">
</nz-progress>
<span class="num">30%</span>
<span class="num">{{data.integrity * 100}}%</span>
</td>
<td>{{ data.organization }}</td>
<td>{{ data.level }}</td>
<td>{{ data.organization.name }}</td>
<td>{{ data.buildingType ? data.buildingType.buildingTypeName : ''}}</td>
<td>{{ data.useNature }}</td>
<td>{{ data.lastModificationTime ? data.lastModificationTime : data.creationTime | date:"yyyy-MM-dd hh:mm:ss"}}
</td>

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

@ -85,6 +85,9 @@ export class UnitComponent implements OnInit {
this.nzLoading = true
let params = {
CompanyName: this.searchValue.unit,
BuildingTypeId: this.searchValue.uniytype,
OrganizationId: this.searchValue.or,
UseNature: this.searchValue.property,
PageNumber: this.PageNumber,
PageSize: this.PageSize
}
@ -133,6 +136,17 @@ export class UnitComponent implements OnInit {
nzOnOk: async () => {
if (instance.validateForm.valid) {
await new Promise((resolve, reject) => {
let num = 0
for (const key in instance.validateForm.value) {
if (Object.prototype.hasOwnProperty.call(instance.validateForm.value, key)) {
const element = instance.validateForm.value[key];
if (element) {
num += 1
}
}
}
let integrity: number = num / 56
let body = {
companyName: instance.validateForm.value.unitname,
directorName: instance.validateForm.value.person,
@ -142,7 +156,8 @@ export class UnitComponent implements OnInit {
relatedOrganizationId: instance.validateForm.value.orDa || null,
buildingTypeId: instance.validateForm.value.unittype || null,
useNature: instance.validateForm.value.nature,
data: null
data: null,
integrity: integrity.toFixed(2)
}
this.http.post('/api/Companies', body).subscribe({
next: async (data) => {
@ -193,7 +208,7 @@ export class UnitComponent implements OnInit {
nzOkText: '确定',
nzOkType: 'default',
nzOnOk: () => {
this.http.delete(`/api/Users/${item.id}`).subscribe(data => {
this.http.delete(`/api/Companies/${item.id}`).subscribe(data => {
this.message.create('success', '删除成功!');
this.getCompanies()
})

Loading…
Cancel
Save