|
|
|
@ -1,7 +1,9 @@
|
|
|
|
|
import { Component, Renderer2, OnDestroy, AfterViewInit, ElementRef, OnInit, ViewChild } from '@angular/core'; |
|
|
|
|
import { Component, Input, Renderer2, OnDestroy, AfterViewInit, ElementRef, OnInit, ViewChild } from '@angular/core'; |
|
|
|
|
import { CustomReuseStrategy } from 'src/app/CustomReuseStrategy'; |
|
|
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
|
|
|
import { NzMessageService } from 'ng-zorro-antd/message'; |
|
|
|
|
import { Router } from '@angular/router'; |
|
|
|
|
import { TreeService } from 'src/app/service/tree.service'; |
|
|
|
|
import { HttpClient } from '@angular/common/http'; |
|
|
|
|
import { asBlob } from 'html-docx-js-typescript' |
|
|
|
|
// 要保存这个docx文件推荐引入file-saver哦,你可以用npm i -D file-saver来安装
|
|
|
|
@ -14,9 +16,10 @@ import { saveAs } from 'file-saver'
|
|
|
|
|
|
|
|
|
|
export class UnitDetailsComponent implements OnInit { |
|
|
|
|
@ViewChild('box') box: ElementRef; |
|
|
|
|
constructor(private router: Router,private fb: FormBuilder, private http: HttpClient, private renderer: Renderer2, private el: ElementRef) { |
|
|
|
|
constructor(private message:NzMessageService, private router: Router, private toTree: TreeService, private fb: FormBuilder, private http: HttpClient, private renderer: Renderer2, private el: ElementRef) { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
disableds=false |
|
|
|
|
datas = { |
|
|
|
|
basicInfo: { |
|
|
|
|
name: "", |
|
|
|
@ -44,10 +47,12 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
supplyMode: "", |
|
|
|
|
waterSources: "", |
|
|
|
|
waterSourcesPosition: "", |
|
|
|
|
system:{ |
|
|
|
|
alarm: false, |
|
|
|
|
spray: false, |
|
|
|
|
broadcast: false, |
|
|
|
|
smoke: false, |
|
|
|
|
}, |
|
|
|
|
hydrantsNumber: "", |
|
|
|
|
hydrantsPosition: "", |
|
|
|
|
pumpNumber: "", |
|
|
|
@ -66,39 +71,42 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
}, |
|
|
|
|
KeyParts: [ |
|
|
|
|
{ |
|
|
|
|
keyparts:"222", |
|
|
|
|
keypartsposition:"333", |
|
|
|
|
keyparts: "", |
|
|
|
|
keypartsposition: "", |
|
|
|
|
buildingstructure: "", |
|
|
|
|
useNature: "", |
|
|
|
|
danger: "" |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
keyparts:"222", |
|
|
|
|
keypartsposition:"333", |
|
|
|
|
keyparts: "", |
|
|
|
|
keypartsposition: "", |
|
|
|
|
buildingstructure: "", |
|
|
|
|
useNature: "", |
|
|
|
|
danger: "" |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
tips: "" |
|
|
|
|
} |
|
|
|
|
aaa = true |
|
|
|
|
list={} |
|
|
|
|
validateForm!: FormGroup; |
|
|
|
|
zhidui=[] |
|
|
|
|
dadui=[] |
|
|
|
|
jiuyuanzhan=[] |
|
|
|
|
id = "" |
|
|
|
|
integrity = 0 |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
console.log(this.datas.KeyParts); |
|
|
|
|
|
|
|
|
|
console.log(this.router); |
|
|
|
|
this.id = this.router['browserUrlTree'].queryParams.id |
|
|
|
|
if(this.router['browserUrlTree'].queryParams.pattern!="edit"){ |
|
|
|
|
this.disableds=true |
|
|
|
|
} |
|
|
|
|
this.validateForm = this.fb.group({ |
|
|
|
|
companyName: [null, [Validators.required]], |
|
|
|
|
directorName: [null], |
|
|
|
|
directorPhone: [null], |
|
|
|
|
address: [null], |
|
|
|
|
organizationId: [null], |
|
|
|
|
organizationId: [null, [Validators.required]], |
|
|
|
|
relatedOrganizationId: [null], |
|
|
|
|
useNature: [null], |
|
|
|
|
buildingTypeId: [null] |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
console.log(this.validateForm); |
|
|
|
|
this.getAllOrganization() |
|
|
|
|
this.getCompanies() |
|
|
|
|
this.getBuildingTypes() |
|
|
|
|
} |
|
|
|
|
listOfData: any[] = []; |
|
|
|
|
listOfData2: any[] = []; |
|
|
|
@ -109,22 +117,22 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
let spray = "" |
|
|
|
|
let broadcast = "" |
|
|
|
|
let smoke = "" |
|
|
|
|
if(this.datas.facilities.alarm){ |
|
|
|
|
if (this.datas.facilities.system.alarm) { |
|
|
|
|
alarm = "有" |
|
|
|
|
} else { |
|
|
|
|
alarm = "无" |
|
|
|
|
} |
|
|
|
|
if(this.datas.facilities.spray){ |
|
|
|
|
if (this.datas.facilities.system.spray) { |
|
|
|
|
spray = "有" |
|
|
|
|
} else { |
|
|
|
|
spray = "无" |
|
|
|
|
} |
|
|
|
|
if(this.datas.facilities.broadcast){ |
|
|
|
|
if (this.datas.facilities.system.broadcast) { |
|
|
|
|
broadcast = "有" |
|
|
|
|
} else { |
|
|
|
|
broadcast = "无" |
|
|
|
|
} |
|
|
|
|
if(this.datas.facilities.smoke){ |
|
|
|
|
if (this.datas.facilities.system.smoke) { |
|
|
|
|
smoke = "有" |
|
|
|
|
} else { |
|
|
|
|
smoke = "无" |
|
|
|
@ -611,7 +619,7 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
<td |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:35.45pt"> |
|
|
|
|
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span |
|
|
|
|
style="font-family:宋体; font-size:9pt">物质存储仓库</span></p> |
|
|
|
|
style="font-family:宋体; font-size:9pt">`+this.datas.KeyParts[0].keyparts+`</span></p> |
|
|
|
|
</td> |
|
|
|
|
<td colspan="3" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:54.8pt"> |
|
|
|
@ -621,7 +629,7 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
<td colspan="3" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:42.15pt"> |
|
|
|
|
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span |
|
|
|
|
style="font-family:宋体; font-size:9pt">厂区东侧厂房</span></p> |
|
|
|
|
style="font-family:宋体; font-size:9pt">`+this.datas.KeyParts[0].keypartsposition+`</span></p> |
|
|
|
|
</td> |
|
|
|
|
<td colspan="4" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:34.55pt"> |
|
|
|
@ -631,7 +639,7 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
<td colspan="3" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:43.15pt"> |
|
|
|
|
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span |
|
|
|
|
style="font-family:宋体; font-size:9pt">钢结构</span></p> |
|
|
|
|
style="font-family:宋体; font-size:9pt">`+this.datas.KeyParts[0].buildingstructure+`</span></p> |
|
|
|
|
</td> |
|
|
|
|
<td colspan="2" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:36.55pt"> |
|
|
|
@ -641,7 +649,7 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
<td colspan="2" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:65.6pt"> |
|
|
|
|
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span |
|
|
|
|
style="font-family:宋体; font-size:9pt">存储漆类,油类</span></p> |
|
|
|
|
style="font-family:宋体; font-size:9pt">`+this.datas.KeyParts[0].useNature+`</span></p> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
<tr style="height:31.75pt"> |
|
|
|
@ -653,7 +661,7 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
<td colspan="18" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:1pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.4pt; padding-right:4.9pt; vertical-align:middle; width:377.05pt"> |
|
|
|
|
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span |
|
|
|
|
style="font-family:宋体; font-size:9pt">油类,漆类易燃,有毒</span></p> |
|
|
|
|
style="font-family:宋体; font-size:9pt">`+this.datas.KeyParts[0].danger+`</span></p> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
<tr style="height:35.1pt"> |
|
|
|
@ -670,7 +678,7 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
<td |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:35.45pt"> |
|
|
|
|
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span |
|
|
|
|
style="font-family:宋体; font-size:9pt">淬火油池</span></p> |
|
|
|
|
style="font-family:宋体; font-size:9pt">`+this.datas.KeyParts[1].keyparts+`</span></p> |
|
|
|
|
</td> |
|
|
|
|
<td colspan="3" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:54.8pt"> |
|
|
|
@ -680,7 +688,7 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
<td colspan="3" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:42.15pt"> |
|
|
|
|
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span |
|
|
|
|
style="font-family:宋体; font-size:9pt">厂区中部</span></p> |
|
|
|
|
style="font-family:宋体; font-size:9pt">`+this.datas.KeyParts[1].keypartsposition+`</span></p> |
|
|
|
|
</td> |
|
|
|
|
<td colspan="4" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:34.55pt"> |
|
|
|
@ -690,7 +698,7 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
<td colspan="3" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:43.15pt"> |
|
|
|
|
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span |
|
|
|
|
style="font-family:宋体; font-size:9pt">钢结构</span></p> |
|
|
|
|
style="font-family:宋体; font-size:9pt">`+this.datas.KeyParts[1].buildingstructure+`</span></p> |
|
|
|
|
</td> |
|
|
|
|
<td colspan="2" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:36.55pt"> |
|
|
|
@ -700,7 +708,7 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
<td colspan="2" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.4pt; padding-right:5.03pt; vertical-align:middle; width:65.6pt"> |
|
|
|
|
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span |
|
|
|
|
style="font-family:宋体; font-size:9pt">淬火</span></p> |
|
|
|
|
style="font-family:宋体; font-size:9pt">`+this.datas.KeyParts[1].useNature+`</span></p> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
<tr style="height:31.75pt"> |
|
|
|
@ -712,7 +720,7 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
<td colspan="18" |
|
|
|
|
style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:1pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.4pt; padding-right:4.9pt; vertical-align:middle; width:377.05pt"> |
|
|
|
|
<p style="line-height:12pt; margin:0pt; orphans:0; text-align:center; widows:0"><span |
|
|
|
|
style="font-family:宋体; font-size:9pt">高温</span></p> |
|
|
|
|
style="font-family:宋体; font-size:9pt">`+this.datas.KeyParts[1].danger+`</span></p> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
<tr style="height:56pt"> |
|
|
|
@ -774,50 +782,122 @@ export class UnitDetailsComponent implements OnInit {
|
|
|
|
|
back() { |
|
|
|
|
window.history.back() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
edit() { |
|
|
|
|
let num = 0 |
|
|
|
|
let num2 = 0 |
|
|
|
|
let num3 = 0 |
|
|
|
|
console.log(this.validateForm.value); |
|
|
|
|
for (const key in this.validateForm.value) { |
|
|
|
|
if (Object.prototype.hasOwnProperty.call(this.validateForm.value, key)) { |
|
|
|
|
const element = this.validateForm.value[key]; |
|
|
|
|
if (element) { |
|
|
|
|
num3 += 1 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (const key in this.datas) { |
|
|
|
|
if (Object.prototype.hasOwnProperty.call(this.datas, key)) { |
|
|
|
|
const element = this.datas[key]; |
|
|
|
|
for (const key in element) { |
|
|
|
|
if (Object.prototype.hasOwnProperty.call(element, key)) { |
|
|
|
|
const element2 = element[key]; |
|
|
|
|
if (element2) { |
|
|
|
|
// console.log(element2);
|
|
|
|
|
num += 1 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (const key in this.datas.KeyParts) { |
|
|
|
|
if (Object.prototype.hasOwnProperty.call(this.datas.KeyParts, key)) { |
|
|
|
|
const element = this.datas.KeyParts[key] |
|
|
|
|
for (const key in element) { |
|
|
|
|
if (Object.prototype.hasOwnProperty.call(element, key)) { |
|
|
|
|
const element2 = element[key] |
|
|
|
|
// console.log(element2);
|
|
|
|
|
if (element2) { |
|
|
|
|
num2 += 1 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
let num4=(num+num2+num3-1)/56 |
|
|
|
|
this.integrity = Math.floor(num4*100)/100 |
|
|
|
|
console.log(num,num2,num3,num4); |
|
|
|
|
let body = { |
|
|
|
|
id: this.id, |
|
|
|
|
companyName: this.datas.basicInfo.name, |
|
|
|
|
directorName: this.validateForm.value.directorName, |
|
|
|
|
directorPhone: this.datas.basicInfo.phone, |
|
|
|
|
address: this.datas.basicInfo.addr, |
|
|
|
|
organizationId: this.validateForm.value.organizationId, |
|
|
|
|
relatedOrganizationId: this.validateForm.value.relatedOrganizationId, |
|
|
|
|
useNature: this.datas.basicInfo.nature, |
|
|
|
|
buildingTypeId: this.validateForm.value.buildingTypeId, |
|
|
|
|
integrity: this.integrity, |
|
|
|
|
data:JSON.stringify(this.datas) |
|
|
|
|
} |
|
|
|
|
this.http.patch('/api/Companies/' + this.id, body).subscribe(data => {
|
|
|
|
|
console.log(data); |
|
|
|
|
|
|
|
|
|
this.message.create('success', '保存成功!'); |
|
|
|
|
this.getCompanies() |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
BuildingTypes |
|
|
|
|
getBuildingTypes() { |
|
|
|
|
this.http.get('/api/BuildingTypes').subscribe((data: any) => { |
|
|
|
|
console.log(data); |
|
|
|
|
|
|
|
|
|
this.BuildingTypes = data |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
getCompanies() { |
|
|
|
|
|
|
|
|
|
this.http.get('/api/Companies/' + this.id).subscribe((data: any) => { |
|
|
|
|
console.log(data); |
|
|
|
|
if(data.data){ |
|
|
|
|
this.datas=JSON.parse(data.data) |
|
|
|
|
} |
|
|
|
|
this.datas.basicInfo.name = data.companyName |
|
|
|
|
this.datas.basicInfo.addr = data.address |
|
|
|
|
this.datas.basicInfo.phone = data.directorPhone |
|
|
|
|
this.datas.basicInfo.nature = data.useNature |
|
|
|
|
this.integrity = data.integrity |
|
|
|
|
this.validateForm.patchValue({ |
|
|
|
|
companyName: [data.companyName, [Validators.required]], |
|
|
|
|
directorName: [data.directorName], |
|
|
|
|
directorPhone: [data.directorPhone], |
|
|
|
|
address: [data.address], |
|
|
|
|
organizationId: [data.organizationId], |
|
|
|
|
relatedOrganizationId: [data.relatedOrganizationId], |
|
|
|
|
useNature: [data.useNature], |
|
|
|
|
buildingTypeId: [data.buildingTypeId]}) |
|
|
|
|
directorName: data.directorName, |
|
|
|
|
organizationId: data.organizationId, |
|
|
|
|
relatedOrganizationId: data.relatedOrganizationId, |
|
|
|
|
buildingTypeId: data.buildingTypeId |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
nodes: any = [] |
|
|
|
|
getAllOrganization() { |
|
|
|
|
let organizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId |
|
|
|
|
let params = { |
|
|
|
|
// OrganizationUnitId: OrganizationUnitId,
|
|
|
|
|
// IsContainsChildren: "true"
|
|
|
|
|
ContainsChildren: true, |
|
|
|
|
pageSize: 9999 |
|
|
|
|
OrganizationId: organizationId || '', |
|
|
|
|
ContainsChildren: "true", |
|
|
|
|
PageNumber: 1, |
|
|
|
|
PageSize: 9999 |
|
|
|
|
} |
|
|
|
|
this.http.get('/api/Organizations', { |
|
|
|
|
params: params |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
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]) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
data.items.forEach(element => { |
|
|
|
|
if (element.id == organizationId) { |
|
|
|
|
element.parentId = null |
|
|
|
|
} |
|
|
|
|
console.log(this.dadui); |
|
|
|
|
element.key = element.id |
|
|
|
|
element.title = element.name |
|
|
|
|
}); |
|
|
|
|
this.nodes = [...this.toTree.toTree(data.items)] |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|