From 5200a1f467fb29417d4b3535acc4238e6bf9df5e Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Thu, 1 Sep 2022 14:34:39 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=AE=8C=E5=96=84]=E5=8D=95=E4=BD=8D=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../unit-details/unit-details.component.html | 221 +++--- .../unit-details/unit-details.component.scss | 15 +- .../unit-details/unit-details.component.ts | 52 +- .../home/basic-info/unit/unit.component.html | 25 +- .../home/basic-info/unit/unit.component.ts | 684 +++++++++++++++++- src/app/service/cache-token.service.ts | 8 +- 6 files changed, 857 insertions(+), 148 deletions(-) diff --git a/src/app/home/basic-info/unit-details/unit-details.component.html b/src/app/home/basic-info/unit-details/unit-details.component.html index d1a05b9..a4c05d4 100644 --- a/src/app/home/basic-info/unit-details/unit-details.component.html +++ b/src/app/home/basic-info/unit-details/unit-details.component.html @@ -8,105 +8,96 @@ -
-
- -
-
-
单位信息
- + - 消防安全责任人 + 所属救援站 - - - + + + + + + 所属大队 + + + - - + - 所属救援站 + 消防责任人 - - - - - - - - - - + + + - 所属大队 + 消防责任人手机 - - - - - - - - - - + + + - + - 单位类型 + 管理员联系方式 - - - - + + + - +
+ +
@@ -208,8 +199,9 @@ -

+

@@ -218,8 +210,9 @@ -

+

@@ -228,8 +221,9 @@ -

+

@@ -341,7 +335,8 @@

+ [(ngModel)]="datas.facilities.controlPosition" style="width: 100%" nz-input + type="text">

@@ -369,8 +364,9 @@

+ style="font-family:'Times New Roman'; font-size:9pt"> +

@@ -380,8 +376,9 @@

+ style="font-family:'Times New Roman'; font-size:9pt">

@@ -404,8 +401,9 @@

+ style="font-family:'Times New Roman'; font-size:9pt">

@@ -416,7 +414,8 @@ 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; vertical-align:middle; width:112.95pt">

+ [(ngModel)]="datas.facilities.waterSourcesPosition" nz-input style="width:100%" + type="text">

@@ -496,8 +495,8 @@ 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; vertical-align:middle; width:130.4pt">

+ [(ngModel)]="datas.facilities.hydrantsNumber" nz-input style="width:100%" + type="text">

@@ -559,8 +558,9 @@

+ style="font-family:'Times New Roman'; font-size:9pt"> +

@@ -573,24 +573,26 @@ 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; vertical-align:middle; width:41.5pt">

数量:

+ style="font-family:'Times New Roman'; font-size:9pt">

扬程:m

+ [(ngModel)]="datas.facilities.SprayPumpRange" nz-input style="width: 100%" + type="text">m

流量:L/S

+ style="font-family:'Times New Roman'; font-size:9pt">L/S +

@@ -607,7 +609,8 @@ 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; vertical-align:middle; width:65.6pt">

+ [(ngModel)]="datas.facilities.SprayPumpAdapter" nz-input style="width: 100%" + type="text">

@@ -620,8 +623,9 @@ -

+

-

+

@@ -645,8 +650,9 @@ -

+

@@ -657,9 +663,10 @@ -

+

@@ -668,8 +675,10 @@ -

+

@@ -699,8 +708,8 @@

+ style="font-family:宋体; font-size:9pt">

@@ -710,8 +719,8 @@

+ style="font-family:宋体; font-size:9pt">

@@ -763,8 +772,8 @@

+ style="font-family:宋体; font-size:9pt">

@@ -774,8 +783,8 @@

+ style="font-family:宋体; font-size:9pt">

diff --git a/src/app/home/basic-info/unit-details/unit-details.component.scss b/src/app/home/basic-info/unit-details/unit-details.component.scss index 9f7e868..01dfa34 100644 --- a/src/app/home/basic-info/unit-details/unit-details.component.scss +++ b/src/app/home/basic-info/unit-details/unit-details.component.scss @@ -12,9 +12,8 @@ text-align: left; margin: 20px; display: flex; - // border-bottom: 1px solid #eee; color: #000; - + margin-bottom: 0px; div { width: 50%; } @@ -51,7 +50,7 @@ background: #EFF1F5; height: 35px; line-height: 35px; - border-radius: 10px; + border-radius: 3px; padding-left: 10px; } @@ -63,6 +62,16 @@ align-items: center; form{ width: 100%; + display: flex; + flex-wrap: wrap; + box-sizing: border-box; + padding: 0 20px; + nz-form-item{ + width: 50%; + display: flex; + justify-content: center; + } + } } .mainright { diff --git a/src/app/home/basic-info/unit-details/unit-details.component.ts b/src/app/home/basic-info/unit-details/unit-details.component.ts index 2cd09f4..ece3ada 100644 --- a/src/app/home/basic-info/unit-details/unit-details.component.ts +++ b/src/app/home/basic-info/unit-details/unit-details.component.ts @@ -102,11 +102,16 @@ export class UnitDetailsComponent implements OnInit { this.disableds = true } this.validateForm = this.fb.group({ - directorName: [null], + code: [null], organizationId: [null, [Validators.required]], relatedOrganizationId: [null], - buildingTypeId: [null] - + buildingTypeId: [null], + legalPersonName: [null], + legalPersonPhone: [null], + principalName: [null], + principalPhone: [null], + adminName: [null], + adminPhone: [null] }); this.getAllOrganization() this.getCompanies() @@ -197,7 +202,7 @@ export class UnitDetailsComponent implements OnInit { //点击位置按钮 setPosition() { - if(this.disableds){ + if (this.disableds) { return } @@ -325,7 +330,7 @@ export class UnitDetailsComponent implements OnInit { } } - + listOfData: any[] = []; @@ -1016,7 +1021,6 @@ export class UnitDetailsComponent implements OnInit { } } } - for (const key in this.datas) { if (Object.prototype.hasOwnProperty.call(this.datas, key)) { const element = this.datas[key]; @@ -1045,7 +1049,7 @@ export class UnitDetailsComponent implements OnInit { } } } - let num4 = (num + num2 + num3 - 1) / 57 + let num4 = (num + num2 + num3 - 1) / 63 this.integrity = Math.floor(num4 * 100) / 100 console.log(num, num2, num3, num4); this.datas.basicInfo.positionCoordinates = { @@ -1053,23 +1057,25 @@ export class UnitDetailsComponent implements OnInit { } 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, + usci: this.validateForm.value.code, organizationId: this.validateForm.value.organizationId, relatedOrganizationId: this.validateForm.value.relatedOrganizationId, - useNature: this.datas.basicInfo.nature, buildingTypeId: this.validateForm.value.buildingTypeId, + legalPersonName: this.validateForm.value.legalPersonName, + legalPersonPhone: this.validateForm.value.legalPersonPhone, + directorName: this.validateForm.value.principalName, + directorPhone: this.validateForm.value.principalPhone, + securityAdministratorName: this.validateForm.value.adminName, + securityAdministratorPhone: this.validateForm.value.adminPhone, + companyName: this.datas.basicInfo.name, + address: this.datas.basicInfo.addr, + useNature: this.datas.basicInfo.nature, 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 @@ -1082,7 +1088,7 @@ export class UnitDetailsComponent implements OnInit { } getCompanies() { this.http.get('/api/Companies/' + this.id).subscribe((data: any) => { - console.log(data); + console.log('当前单位信息', data); if (data.data) { this.datas = JSON.parse(data.data) } @@ -1092,13 +1098,17 @@ export class UnitDetailsComponent implements OnInit { this.datas.basicInfo.nature = data.useNature this.integrity = data.integrity this.validateForm.patchValue({ - directorName: data.directorName, + code: data.usci, organizationId: data.organizationId, relatedOrganizationId: data.relatedOrganizationId, - buildingTypeId: data.buildingTypeId + buildingTypeId: data.buildingTypeId, + legalPersonName: data.legalPersonName, + legalPersonPhone: data.legalPersonPhone, + principalName: data.directorName, + principalPhone: data.directorPhone, + adminName: data.securityAdministratorName, + adminPhone: data.securityAdministratorPhone }) - - if (this.datas.basicInfo.positionCoordinates && (this.datas.basicInfo.positionCoordinates.x != 0 && this.datas.basicInfo.positionCoordinates.y != 0)) {//已标注 this.isMapLabel = true this.markerPosition = this.datas.basicInfo.positionCoordinates @@ -1126,9 +1136,9 @@ export class UnitDetailsComponent implements OnInit { } element.key = element.id element.title = element.name + element.level == 'squadron' ? element.isLeaf = true : null }); this.nodes = [...this.toTree.toTree(data.items)] - }) } } diff --git a/src/app/home/basic-info/unit/unit.component.html b/src/app/home/basic-info/unit/unit.component.html index 4c01b44..e20d5e4 100644 --- a/src/app/home/basic-info/unit/unit.component.html +++ b/src/app/home/basic-info/unit/unit.component.html @@ -18,9 +18,11 @@ - + + + @@ -34,14 +36,13 @@ - 单位名称 - 信息完整度 - 所属机构 - 单位类型 - 使用性质 - 创建时间 - 单位地址 - + 单位名称 + 信息完整度 + 所属机构 + 单位类型 + 使用性质 + 单位级别 + 单位地址 操作 @@ -57,14 +58,14 @@ {{ data.organization.name }} {{ data.buildingType ? data.buildingType.buildingTypeName : ''}} {{ data.useNature }} - {{ data.lastModificationTime ? data.lastModificationTime : data.creationTime | date:"yyyy-MM-dd hh:mm:ss"}} + + {{data.companyLevel}} {{ data.address }} - 查看 编辑 - + 下载 删除 diff --git a/src/app/home/basic-info/unit/unit.component.ts b/src/app/home/basic-info/unit/unit.component.ts index 3ed6c28..7f448c5 100644 --- a/src/app/home/basic-info/unit/unit.component.ts +++ b/src/app/home/basic-info/unit/unit.component.ts @@ -9,6 +9,9 @@ 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 { asBlob } from 'html-docx-js-typescript' +// 要保存这个docx文件推荐引入file-saver哦,你可以用npm i -D file-saver来安装 +import { saveAs } from 'file-saver' @Component({ selector: 'app-unit', templateUrl: './unit.component.html', @@ -87,7 +90,7 @@ export class UnitComponent implements OnInit { CompanyName: this.searchValue.unit, BuildingTypeId: this.searchValue.uniytype, OrganizationId: this.searchValue.or, - UseNature: this.searchValue.property, + CompanyLevel: this.searchValue.property, PageNumber: this.PageNumber, PageSize: this.PageSize } @@ -146,7 +149,7 @@ export class UnitComponent implements OnInit { } } - let integrity: number = num / 57 + let integrity: number = num / 63 let body = { companyName: instance.validateForm.value.unitname, directorName: instance.validateForm.value.person, @@ -216,4 +219,681 @@ export class UnitComponent implements OnInit { nzCancelText: '取消' }); } + + //下载 + datas + download(data) { + // console.log(data) + + if(data.data){ + this.datas = JSON.parse(data.data) + }else{ + this.message.create('warning', '该单位未保存过数据'); + return + } + + let alarm = "" + let spray = "" + let broadcast = "" + let smoke = "" + if (this.datas.facilities.system.alarm) { + alarm = "有" + } else { + alarm = "无" + } + if (this.datas.facilities.system.spray) { + spray = "有" + } else { + spray = "无" + } + if (this.datas.facilities.system.broadcast) { + broadcast = "有" + } else { + broadcast = "无" + } + if (this.datas.facilities.system.smoke) { + smoke = "有" + } else { + smoke = "无" + } + let box = ` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

`+ this.datas.basicInfo.name + `基本情况

+
+

单位基本情况

+
+

单位名称

+
+

`+ this.datas.basicInfo.name + `

+
+

单位地址

+
+

`+ this.datas.basicInfo.addr + ` +

+

联系电话

+
+

`+ this.datas.basicInfo.phone + `

+
+

人员总数

+
+

`+ this.datas.basicInfo.total + `

+
+

建筑高度

+
+

`+ this.datas.basicInfo.height + `

+
+

层数

+
+

`+ this.datas.basicInfo.layer + `

+
+

建筑结构

+
+

`+ this.datas.basicInfo.structure + `

+
+

占地面积

+
+

`+ this.datas.basicInfo.coveredArea + `

+
+

总建筑面积

+
+

`+ this.datas.basicInfo.builtUpArea + `

+
+

主要使用性质

+
+

`+ this.datas.basicInfo.nature + `

+
+

毗邻建筑

+
+

东:`+ this.datas.basicInfo.east + `

+
+

南:`+ this.datas.basicInfo.south + `

+
+

西:`+ this.datas.basicInfo.west + `

+
+

北:`+ this.datas.basicInfo.north + `

+
+

辖区中队行驶路线及时间

+
+

`+ this.datas.basicInfo.routeAndTime + `

+
+

单位内部主要消防设施

+
+

消防控制室

+
+

位置

+
+

`+ this.datas.facilities.controlPosition + `

+
+

消防水源

+
+

消防水池数量

+
+

`+ this.datas.facilities.poolNumbe + `

+
+

位置

+
+

`+ this.datas.facilities.poolPosition + `

+
+

总容量

+
+

`+ this.datas.facilities.poolCapacity + `

+
+

补给方式

+
+

+
+

室外其他水源

+
+

`+ this.datas.facilities.waterSources + `

+
+

位置

+
+

`+ this.datas.facilities.waterSourcesPosition + `

+
+

自动报警系统

+ +
+

+ `+ alarm + ` +

+
+

自动喷水系统

+
+

+ `+ spray + ` +

+
+

应急广播系统

+
+

+ `+ broadcast + ` +

+
+

防排烟系统

+
+

+ `+ smoke + ` +

+
+

室外消火栓数量

+
+

`+ this.datas.facilities.hydrantsNumber + `

+
+

室外消火栓位置分布

+
+

`+ this.datas.facilities.hydrantsPosition + `

+
+

消防泵

+
+

消火栓泵

+
+

数量:`+ this.datas.facilities.pumpNumber + `

+
+

扬程:`+ this.datas.facilities.pumpRange + `m

+
+

流量`+ this.datas.facilities.pumpFlow + `L/S

+
+

水泵接合器

+
+

数量:

+
+

`+ this.datas.facilities.pumpAdapter + `

+
+

喷淋泵

+
+

数量:`+ this.datas.facilities.SprayPumpNumber + `

+
+

扬程:`+ this.datas.facilities.SprayPumpRange + `m

+
+

流量:`+ this.datas.facilities.SprayPumpFlow + `L/S

+
+

水泵接合器

+
+

数量:

+
+

`+ this.datas.facilities.SprayPumpAdapter + `

+
+

消防电梯

+

数量及位置

+
+

`+ this.datas.facilities.elevator + ` +

+
+

疏散楼梯

+

数量及位置

+
+

`+ this.datas.facilities.stairs + `

+
+

安全出口

+

数量及位置

+
+

`+ this.datas.facilities.Export + `

+
+

室内消火栓数量

+
+

`+ this.datas.facilities.indoorHydrant + `

+
+

标准层室内消火栓数量及位置

+
+

`+ this.datas.facilities.standardIndoorHydrant + `

+
+

重点部位情况(一)

+
+

重点部位名称

+
+

`+ this.datas.KeyParts[0].keyparts + `

+
+

重点部位所在位置

+
+

`+ this.datas.KeyParts[0].keypartsposition + `

+
+

建筑结构

+
+

`+ this.datas.KeyParts[0].buildingstructure + `

+
+

使用性质

+
+

`+ this.datas.KeyParts[0].useNature + `

+
+

主要危险性

+
+

`+ this.datas.KeyParts[0].danger + `

+
+

重点部位情况(二)

+
+

重点部位名称

+
+

`+ this.datas.KeyParts[1].keyparts + `

+
+

重点部位所在位置

+
+

`+ this.datas.KeyParts[1].keypartsposition + `

+
+

建筑结构

+
+

`+ this.datas.KeyParts[1].buildingstructure + `

+
+

使用性质

+
+

`+ this.datas.KeyParts[1].useNature + `

+
+

主要危险性

+
+

`+ this.datas.KeyParts[1].danger + `

+
+

重点

+

提示

+
+

`+ this.datas.tips + `

+
+

 

` + + const htmlString = ` + + + + Document + + + `+ box + ` + +` + const fileData = asBlob(htmlString).then((data: any) => { + saveAs(data, this.datas.basicInfo.name + '基本信息.docx') // 保存为docx文件 + }) + } } diff --git a/src/app/service/cache-token.service.ts b/src/app/service/cache-token.service.ts index 2ce22d0..195e28d 100644 --- a/src/app/service/cache-token.service.ts +++ b/src/app/service/cache-token.service.ts @@ -20,11 +20,11 @@ export class CacheTokenService { token: token, refreshToken: refreshToken }).subscribe((data: any) => { - console.log('定时刷新token成功', data) - sessionStorage.setItem("token", data.token); - sessionStorage.setItem("refreshToken", data.refreshToken); + // console.log('定时刷新token成功', data) + // sessionStorage.setItem("token", data.token); + // sessionStorage.setItem("refreshToken", data.refreshToken); }) - }, 60 * 1000) + }, 60 * 3 * 1000) console.log('启动定时刷新token') }