diff --git a/proxy.config.json b/proxy.config.json index b28a11f..1898eac 100644 --- a/proxy.config.json +++ b/proxy.config.json @@ -1,6 +1,6 @@ { "/api": { - "target": "http://121.37.20.190:8000", + "target": "http://39.106.78.171:8000", "secure": false, "changeOrigin": true } diff --git a/src/app/key-unit/actual-combat-drill/actual-combat-drill.component.html b/src/app/key-unit/actual-combat-drill/actual-combat-drill.component.html new file mode 100644 index 0000000..fb07228 --- /dev/null +++ b/src/app/key-unit/actual-combat-drill/actual-combat-drill.component.html @@ -0,0 +1,3 @@ +
+ 实战演练记录 +
\ No newline at end of file diff --git a/src/app/key-unit/actual-combat-drill/actual-combat-drill.component.scss b/src/app/key-unit/actual-combat-drill/actual-combat-drill.component.scss new file mode 100644 index 0000000..7550013 --- /dev/null +++ b/src/app/key-unit/actual-combat-drill/actual-combat-drill.component.scss @@ -0,0 +1,7 @@ +.content { + width: 100%; + height: 100%; + box-sizing: border-box; + padding: 1px; + overflow: hidden; +} \ No newline at end of file diff --git a/src/app/key-unit/actual-combat-drill/actual-combat-drill.component.spec.ts b/src/app/key-unit/actual-combat-drill/actual-combat-drill.component.spec.ts new file mode 100644 index 0000000..5ab28d0 --- /dev/null +++ b/src/app/key-unit/actual-combat-drill/actual-combat-drill.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ActualCombatDrillComponent } from './actual-combat-drill.component'; + +describe('ActualCombatDrillComponent', () => { + let component: ActualCombatDrillComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ActualCombatDrillComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ActualCombatDrillComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/key-unit/actual-combat-drill/actual-combat-drill.component.ts b/src/app/key-unit/actual-combat-drill/actual-combat-drill.component.ts new file mode 100644 index 0000000..83cb906 --- /dev/null +++ b/src/app/key-unit/actual-combat-drill/actual-combat-drill.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-actual-combat-drill', + templateUrl: './actual-combat-drill.component.html', + styleUrls: ['./actual-combat-drill.component.scss'] +}) +export class ActualCombatDrillComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/key-unit/basicinfo-look/basicinfo.component.html b/src/app/key-unit/basicinfo-look/basicinfo.component.html index 1ac8f54..a35c152 100644 --- a/src/app/key-unit/basicinfo-look/basicinfo.component.html +++ b/src/app/key-unit/basicinfo-look/basicinfo.component.html @@ -66,7 +66,7 @@
* - 消防救援站: + 辖区中队:
-
+
diff --git a/src/app/key-unit/basicinfo-look/basicinfo.component.scss b/src/app/key-unit/basicinfo-look/basicinfo.component.scss index d3562f7..720063f 100644 --- a/src/app/key-unit/basicinfo-look/basicinfo.component.scss +++ b/src/app/key-unit/basicinfo-look/basicinfo.component.scss @@ -157,7 +157,7 @@ margin-left: 203px; } .mat-table{ - width: 100%; + width: 99%; } table{ diff --git a/src/app/key-unit/edit-plan-info/edit-plan-info.component.html b/src/app/key-unit/edit-plan-info/edit-plan-info.component.html index 2150dc9..ef843ae 100644 --- a/src/app/key-unit/edit-plan-info/edit-plan-info.component.html +++ b/src/app/key-unit/edit-plan-info/edit-plan-info.component.html @@ -1,7 +1,7 @@ - + @@ -9,7 +9,8 @@ - + + @@ -44,7 +45,7 @@ - 功能开发中~~ + diff --git a/src/app/key-unit/find-problem/find-problem.component.html b/src/app/key-unit/find-problem/find-problem.component.html new file mode 100644 index 0000000..171eea9 --- /dev/null +++ b/src/app/key-unit/find-problem/find-problem.component.html @@ -0,0 +1,39 @@ +
+ +
+
+
+
+ +
+
+ +
+
+
问题{{item.index}}:
+
+
+
+
+ +
+
+ + +
+ +
+ +
+
+
+
暂无数据
+ +
+
+ +
\ No newline at end of file diff --git a/src/app/key-unit/find-problem/find-problem.component.scss b/src/app/key-unit/find-problem/find-problem.component.scss new file mode 100644 index 0000000..b5a1663 --- /dev/null +++ b/src/app/key-unit/find-problem/find-problem.component.scss @@ -0,0 +1,134 @@ +.content { + width: 100%; + height: 100%; + box-sizing: border-box; + background: #F4F5F9; + padding: 5px; + overflow: hidden; + display: flex; + flex-direction: column; + .center { + flex: 1; + overflow: hidden; + .fatherDiv { + width: 100%; + height: 100%; + overflow-x: hidden; + overflow-y: auto; + box-sizing: border-box; + padding: 10px + } + } + .addBox { + margin-top: 15px; + >div { + display: inline-block; + width: 50%; + } + button { + width: 15%; + height: 36px; + line-height: 36px; + color: #fff; + background: #4582FC; + border-radius: 30px; + outline: none; + border: none; + display: block; + margin: 0 auto; + } + } +} + +.noData { + width: 100%; + text-align: center; + font-size: 16px; + margin-top: 30px; +} +//问题div +.matterDiv { + width: 100%; + height: 180px; + box-sizing: border-box; + padding: 5px; + margin-top: 10px; + background-color: #fff; + border-radius: 20px; + display: flex; + .leftDiv { + width: 70px; + text-align: center; + height: 100%; + margin-right: 5px; + >div {font-size: 16px;} + button { + height: 22px; + background-color:#fff; + border-radius: 10px; + border: 1px solid red; + color: red; + font-size: 12px; + } + } + .rightDiv { + flex: 1; + overflow: hidden; + } +} + +textarea { + vertical-align: middle; + border-radius: 10px; + background-color: #F4F5F9; + box-sizing: border-box; + padding: 5px; + width: 100%; + height: 100%; + resize: none; + border: none; + outline: none; +} +.imagesBox::-webkit-scrollbar {display:none} +.imagesBox { + overflow-x: auto; + overflow-y: hidden; + display: flex; + align-items: center; + box-sizing: border-box; + padding: 5px; + .everyImg { + width: 100px; + min-width: 100px; + max-width: 100px; + max-height: 90px; + height: 100%; + border: 1px dashed #c5c7cc; + margin-right: 10px; + //上传CAD弹窗 inputfile + .a-upload { + width: 100%; + height: 100%; + position: relative; + cursor: pointer; + color: #888; + text-align: center; + font-size: 70px; + overflow: hidden; + display: inline-block; + } + .a-upload input { + position: absolute; + width: 100%; + height: 100%; + right: 0; + top: 0; + opacity: 0; + cursor: pointer; + } + img { + width: 100%; + height: 100%; + } + } +} \ No newline at end of file diff --git a/src/app/key-unit/find-problem/find-problem.component.spec.ts b/src/app/key-unit/find-problem/find-problem.component.spec.ts new file mode 100644 index 0000000..3f86382 --- /dev/null +++ b/src/app/key-unit/find-problem/find-problem.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FindProblemComponent } from './find-problem.component'; + +describe('FindProblemComponent', () => { + let component: FindProblemComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ FindProblemComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(FindProblemComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/key-unit/find-problem/find-problem.component.ts b/src/app/key-unit/find-problem/find-problem.component.ts new file mode 100644 index 0000000..771cbf8 --- /dev/null +++ b/src/app/key-unit/find-problem/find-problem.component.ts @@ -0,0 +1,103 @@ +import { Component, OnInit } from '@angular/core'; +import { HttpClient,HttpHeaders, HttpEventType } from '@angular/common/http'; +import { MatSnackBar ,MatSnackBarConfig} from '@angular/material/snack-bar'; +import Viewer from 'viewerjs'; + +@Component({ + selector: 'app-find-problem', + templateUrl: './find-problem.component.html', + styleUrls: ['./find-problem.component.scss'] +}) +export class FindProblemComponent implements OnInit { + + constructor(public snackBar: MatSnackBar,private http: HttpClient) { } + + ngOnInit(): void { + this.imagesData = JSON.parse ( JSON.parse(JSON.stringify(localStorage.getItem('matterData'))) || '[]' ) + this.isLook = sessionStorage.getItem('six') + window.setTimeout(()=>{ + this.updateIMG() + },0) + } + + isLook:string//查看模式 + imagesData = [] + templateData = {index: 1, matter: '', imgURL:[]} //模板数据 + + //刷新图片 大图 + updateIMG () { + this.imagesData.forEach((item,index)=>{ + item.imgURL.forEach((element,indexs) => { + new Viewer(document.getElementById(`viewerjs${index}${indexs}`),{ + url: 'data-original' + }); + }); + }) + } + + //获取问题个数 + matterIndex () { + let index + if (this.imagesData.length) { + index = this.imagesData[this.imagesData.length-1].index+1 + return index + } else { + return 1 + } + } + + //上传文件 + selectFile (e,item) { + let file = e.target.files[0] || null //获取上传的文件 + let fileSize = file.size || null //上传文件的总大小 + let shardSize = 5 * 1024 * 1024 //5MB一个分片 + + if (file && fileSize<=shardSize) { //上传文件<=5MB时 + let formData = new FormData() + formData.append("file",file) + this.http.post(`/api/Objects/PlanPlatform/${sessionStorage.getItem('companyId')}`,formData).subscribe((data:any)=>{ + item.imgURL.push(`/api/Objects/PlanPlatform/${data.objectName}?x-oss-process=image/resize,m_fill,h_90,w_100`) + window.setTimeout(()=>{ + this.updateIMG() + },0) + }) + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请上传小于5M图片','确定',config); + } + } + + //新增 + add () { + let data = JSON.parse(JSON.stringify( this.templateData )); + data.index = this.matterIndex() + this.imagesData.push(data) + } + + //删除 + delete (index) { + let isTrue = confirm('您确定要删除吗?') + if (isTrue) { + this.imagesData.splice(index,1) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('删除成功','确定',config); + } + } + + //保存 + keep () { + let data = JSON.stringify ( JSON.parse(JSON.stringify( this.imagesData )) ) + localStorage.setItem('matterData',data) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + + + +} diff --git a/src/app/key-unit/fire-fighting-device-look/fire-fighting-device.component.ts b/src/app/key-unit/fire-fighting-device-look/fire-fighting-device.component.ts index cf62564..ddaae08 100644 --- a/src/app/key-unit/fire-fighting-device-look/fire-fighting-device.component.ts +++ b/src/app/key-unit/fire-fighting-device-look/fire-fighting-device.component.ts @@ -52,6 +52,13 @@ export class FireFightingDeviceLookComponent implements OnInit { elements.total = element.facilityCount[index] elements.expanded = false}); }); + if(sessionStorage.getItem("tabsindex") == "4"){ + this.companyBuiltInGrouping = [this.companyBuiltInGrouping[1]] + this.companyOptionalGrouping = [] + } + if(sessionStorage.getItem("tabsindex") == "5"){ + this.companyBuiltInGrouping.splice(1,1) + } }) //http } //if @@ -247,6 +254,14 @@ export class FireFightingDeviceLookComponent implements OnInit { newElement.total = elements.facilityCount[index] newElement.expanded = false }); }); + + if(sessionStorage.getItem("tabsindex") == "4"){ + element.buildingFacilityGroups = [element.buildingFacilityGroups[1]] + element.buildingOptionalGroups = [] + } + if(sessionStorage.getItem("tabsindex") == "5"){ + element.buildingFacilityGroups.splice(1,1) + } }) }); diff --git a/src/app/key-unit/key-unit-management/key-unit-management.component.scss b/src/app/key-unit/key-unit-management/key-unit-management.component.scss index 609991d..c261899 100644 --- a/src/app/key-unit/key-unit-management/key-unit-management.component.scss +++ b/src/app/key-unit/key-unit-management/key-unit-management.component.scss @@ -146,7 +146,6 @@ } .integrityColorDiv{ height: 100%; - // background-color: #32cd32; } .integrityDetails{ position: absolute; diff --git a/src/app/key-unit/key-unit.module.ts b/src/app/key-unit/key-unit.module.ts index 6bc8ca4..f84d6ad 100644 --- a/src/app/key-unit/key-unit.module.ts +++ b/src/app/key-unit/key-unit.module.ts @@ -74,11 +74,19 @@ import { FireFightingDeviceLookComponent } from './fire-fighting-device-look/fir import { ImagesData2, previewBigImg2 } from './fire-fighting-device-look/imagesdata.component'; import { ImgsDataDetail2 } from './fire-fighting-device-look/addGrouping.component'; import { LookMaster2 } from './basicinfo-look/lookmaster.component'; -// import { LookMaster2 } from './basicinfo-look/lookmaster.component'; -import { UiModule } from '../../app/ui/ui.module' +import { UiModule } from '../../app/ui/ui.module'; +import { SixFamiliarityComponent,routerMapComponent } from './six-familiarity/six-familiarity.component'; +import { ActualCombatDrillComponent } from './actual-combat-drill/actual-combat-drill.component'; +import { SixFamiliarListComponent } from './six-familiar-list/six-familiar-list.component' +import { TrainingRecordinfoComponent } from './training-recordinfo/training-recordinfo.component'; +import { RouterGISComponent } from './router-gis/router-gis.component'; +import { EditText, WaterRoadComponent } from './water-road/water-road.component'; +import { PhotoofthesceneComponent } from './photoofthescene/photoofthescene.component'; +import { KnowRouteComponent } from './know-route/know-route.component'; +import { FindProblemComponent } from './find-problem/find-problem.component'; @NgModule({ - declarations: [KeyUnitManagementComponent, EditUnitInfoComponent, ViewUnitDetailsComponent,CreateUnit,BasicinfoComponent,LookMaster,AddHouseInfo, EditPlanInfoComponent,BasicinfoLookComponent, ViewUnitDetailsPlanComponent,FunctionDivisionComponent,addPartition,addPartitionAttribute,AllaroundComponent,ImgDetails,RealisticPictureComponent,previewImg,addRealPicture,editRealPicture,KeySiteComponent,KeyImgDetail,KeySiteImgs,UploadingCADComponent,readFile,editFile,KeySiteLookComponent,KeySiteImgs2,FunctionDivisionLookComponent,RealisticPictureLookComponent,previewImg3,UploadingCADLookComponent,FireFightingDeviceComponent,ImagesData,previewBigImg,ImgsDataDetail,FireFightingDeviceLookComponent,ImagesData2,ImgsDataDetail2,previewBigImg2,LookMaster2,addPartitionAttribute2], + declarations: [KeyUnitManagementComponent, EditUnitInfoComponent, ViewUnitDetailsComponent,CreateUnit,BasicinfoComponent,LookMaster,AddHouseInfo, EditPlanInfoComponent,BasicinfoLookComponent, ViewUnitDetailsPlanComponent,FunctionDivisionComponent,addPartition,addPartitionAttribute,AllaroundComponent,ImgDetails,RealisticPictureComponent,previewImg,addRealPicture,editRealPicture,KeySiteComponent,KeyImgDetail,KeySiteImgs,UploadingCADComponent,readFile,editFile,KeySiteLookComponent,KeySiteImgs2,FunctionDivisionLookComponent,RealisticPictureLookComponent,previewImg3,UploadingCADLookComponent,FireFightingDeviceComponent,ImagesData,previewBigImg,ImgsDataDetail,FireFightingDeviceLookComponent,ImagesData2,ImgsDataDetail2,previewBigImg2,LookMaster2,addPartitionAttribute2, SixFamiliarityComponent, ActualCombatDrillComponent,routerMapComponent, SixFamiliarListComponent,TrainingRecordinfoComponent,RouterGISComponent,WaterRoadComponent,EditText,PhotoofthesceneComponent,KnowRouteComponent,FindProblemComponent], exports:[ViewUnitDetailsPlanComponent], imports: [ CommonModule, diff --git a/src/app/key-unit/know-route/know-route.component.html b/src/app/key-unit/know-route/know-route.component.html new file mode 100644 index 0000000..afc0637 --- /dev/null +++ b/src/app/key-unit/know-route/know-route.component.html @@ -0,0 +1,37 @@ + +
+
+ 添加熟悉部位: + + +
+
+ 添加路线: + +
+ {{item.name}}-> +
+
+
+
+
+ +
+
+ +
+
+ +
+
备注:
+ +
+
+
\ No newline at end of file diff --git a/src/app/key-unit/know-route/know-route.component.scss b/src/app/key-unit/know-route/know-route.component.scss new file mode 100644 index 0000000..d3089b5 --- /dev/null +++ b/src/app/key-unit/know-route/know-route.component.scss @@ -0,0 +1,114 @@ +.box{ + width: 100%; + height: 100%; + //添加熟悉部位 + .addbw{ + height: 100px; + line-height: 100px; + width: 100%; + font-size: 18px; + button{ + margin-left:8px; + } + .button { + background-color: #4CAF50; /* Green */ + border: 1px; + color: white; + padding:3px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size:18px; + margin-left: 30px; + cursor: pointer; + } + } + //添加路线 + .addRoute{ + height:100px; + line-height: 100px; + position:relative; + white-space: nowrap; + input{ + width:60%; + margin-left: 8px; + border-top: none; + border-left: none; + border-right: none; + font-size: 0.15625rem; + outline: none; + background-color: transparent; + } + hr{ + width: 5.859375rem; + margin-left: 0.78125rem + + } + .xxx{ + display: inline-block; + position: absolute; + left: 15%; + bottom: 5px; + } + .floot{ + cursor: pointer; + } + } + span{ + font-size:18px; + } + //底部div + .bottomAll{ + width: 100%; + height: 230px; + margin-top: 0.488281rem; + display: flex; + .upload{ + position: relative; + flex: 1; + display: flex; + justify-content: center; + .uploadingimg{ + width: 45%; + height: 75%; + top: 0.058594rem; + position: absolute; + left: 15%; + border-radius:3px; + img{ + width: 100%; + height: 100%; + } + } + .image{ + width: 45%; + height: 75%; + left: 15%; + top: 0.058594rem; + position: absolute; + border-radius:3px; + input{ + width: 100%; + height: 100%; + opacity: 0; + cursor: pointer; + } + } + } + + .remarks{ + flex: 1; + input{ + width: 30%; + height: 30%; + } + textarea{ + + } + } + } + //熟悉路线选中样式 + .beijicolor{ + border: 1px solid #000000; + } +} diff --git a/src/app/key-unit/know-route/know-route.component.spec.ts b/src/app/key-unit/know-route/know-route.component.spec.ts new file mode 100644 index 0000000..45f876b --- /dev/null +++ b/src/app/key-unit/know-route/know-route.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { KnowRouteComponent } from './know-route.component'; + +describe('KnowRouteComponent', () => { + let component: KnowRouteComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ KnowRouteComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(KnowRouteComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/key-unit/know-route/know-route.component.ts b/src/app/key-unit/know-route/know-route.component.ts new file mode 100644 index 0000000..af22b8b --- /dev/null +++ b/src/app/key-unit/know-route/know-route.component.ts @@ -0,0 +1,157 @@ +/* + * @Descripttion: + * @version: + * @Author: sueRimn + * @Date: 2020-11-05 15:27:58 + * @LastEditors: sueRimn + * @LastEditTime: 2020-11-07 20:00:19 + */ +import { Component, OnInit } from '@angular/core'; +import { HttpClient,HttpHeaders, HttpEventType } from '@angular/common/http'; +import { MatSnackBar ,MatSnackBarConfig} from '@angular/material/snack-bar'; +import { FileUploader, FileItem } from 'ng2-file-upload' +import Viewer from 'viewerjs'; +@Component({ + selector: 'app-know-route', + templateUrl: './know-route.component.html', + styleUrls: ['./know-route.component.scss'] +}) +export class KnowRouteComponent implements OnInit { + + constructor(public snackBar: MatSnackBar,private http: HttpClient) { } + + + pattern:any = sessionStorage.getItem("six")//模式 + ngOnInit(): void { + + } + + + + //input框显隐 + inputShow=true + //控制底部div显隐 + showorfalse="www" + //判断选中路线的值 + chooseid:any + //熟悉路线对象 + knowRoute=[{name:``,idnum:""}] + //熟悉部位对象 + knowBw=[{name:"消控室"},{name:"水泵房"},{name:"疏散楼梯"},{name:"各楼层"},{name:"楼层消火栓"},{name:"水泵结合器"},{name:"室外消防水源"}] + textareazhi:"" + //没有上传图片时显示的图片,当上传后就会被替换,即保存时需要传的图片地址参数 + imgsrc = "../../../assets/images/upload.jpg" + imgUrl = ""//返回来的图片地址后缀 + file: any; //上传的文件 + objectName: any; //上传对象名 + uploadId: any; //上传分块上传事件编号 + isspinner:boolean=false //控制进度圈的显示隐藏 + PartNumberETag: any = []; //分块上传每次返回需要保存的信息 + //change选择文件 + filechange(e) { + this.file = e.target.files[0] || null //上传的文件 + var reader = new FileReader(); + reader.readAsDataURL(this.file); + var image:any = new Image(); + reader.onload = function(){ + image.src = reader.result + } + setTimeout(() => { + if(image.width>=4096 || image.height>=5000 ){ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请选择分辨率小于4096*5000的图片','确定',config); + }else{ + if(this.file){ + this.startUploading() + } + } + + }, 500); + } + //上传文件 + startUploading() { + this.isspinner = true + let file = this.file || null //获取上传的文件 + let fileSize = file.size || null //上传文件的总大小 + let shardSize = 5 * 1024 * 1024 //5MB一个分片 + + if (file && fileSize <= shardSize) { //上传文件<=5MB时 + // this.upload() + let formData = new FormData() + formData.append("file",file) + this.http.post(`/api/Objects/PlanPlatform/${sessionStorage.getItem('companyId')}`,formData).subscribe((data:any)=>{ + this.isspinner = false + this.imgUrl = data.objectName + this.imgsrc = `/api/Objects/PlanPlatform/${this.imgUrl}?x-oss-process=image/resize,m_fill,h_170,w_299` + console.log(this.imgsrc) + this.uploadSucced[this.chooseid].src=this.imgsrc + this.inputShow=false + + console.log(this.uploadSucced) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('上传成功','确定',config); + }) + } else if (file && fileSize >= shardSize) { //上传文件>5MB时,分块上传 + + } + } + + + //熟悉部位点击事件 + addRoute(event,item){ + if(this.pattern == 'edit'){ + + this.knowRoute.push({name:event.target.innerHTML,idnum:"🠖"}) + this.uploadSucced.push({name:item.name,src:"",smark:""}) + }else{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('处于查看模式','确定',config); + } + + } + + savekey + uploadSucced:any = JSON.parse(localStorage.getItem(sessionStorage.getItem("companyId")+"xxx")) || []//上传成功暂存对象 + gallery + //熟悉路线点击事件 + knowroutwClick(key,item){ + this.showorfalse = "show" + this.chooseid=key + setTimeout(() => { + if(document.getElementById('viewerjs')){ + this.gallery = new Viewer(document.getElementById('viewerjs'),{ + url: 'data-original' + }); + } + }, 0); + if( JSON.parse(localStorage.getItem(sessionStorage.getItem("companyId")+"xxx")) + && JSON.parse(localStorage.getItem(sessionStorage.getItem("companyId")+"xxx"))[key] + && JSON.parse(localStorage.getItem(sessionStorage.getItem("companyId")+"xxx"))[key].src!=""){ + this.imgsrc=JSON.parse(localStorage.getItem(sessionStorage.getItem("companyId")+"xxx"))[key].src + this.textareazhi=JSON.parse(localStorage.getItem(sessionStorage.getItem("companyId")+"xxx"))[key].smark + this.inputShow=false + }else if(this.uploadSucced[key].src!=""){ + this.imgsrc=this.uploadSucced[key].src + this.inputShow=false + }else{ + this.imgsrc="../../../assets/images/upload.jpg" + this.textareazhi="" + this.inputShow=true + } + } + //保存点击事件 + savaClick(){ + localStorage.setItem(sessionStorage.getItem("companyId")+"xxx",JSON.stringify(this.uploadSucced)) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + +} diff --git a/src/app/key-unit/photoofthescene/photoofthescene.component.html b/src/app/key-unit/photoofthescene/photoofthescene.component.html new file mode 100644 index 0000000..b68cee1 --- /dev/null +++ b/src/app/key-unit/photoofthescene/photoofthescene.component.html @@ -0,0 +1,96 @@ + + + + + + + + + + + +
+
+
+ +
+

熟悉单位照片

+
+ 单位整体建筑或大门照片,要求照拍照时要求设置拍照日期 +
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+

领导带队现场熟悉照片

+
+ 人员现场熟悉照片,要求有带队领导及熟悉人员现场熟悉场景,拍照时要求设置拍照日期 +
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+

人员现场熟悉照片

+
+ 人员现场熟悉照片,要求有熟悉人员现场熟悉场景,拍照时要求设置拍照日期 +
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+

单位重点部位照片

+
+ 重点部位照片,拍照时要求设置拍照日期 +
+
+
+ +
+
+ +
+
+ +
+
\ No newline at end of file diff --git a/src/app/key-unit/photoofthescene/photoofthescene.component.scss b/src/app/key-unit/photoofthescene/photoofthescene.component.scss new file mode 100644 index 0000000..f477f3f --- /dev/null +++ b/src/app/key-unit/photoofthescene/photoofthescene.component.scss @@ -0,0 +1,39 @@ +table{ + margin: 0 auto; + width: 85%; + height: 80%; + margin-top: 3%; + border-collapse: collapse; + td{ + position: relative; + width: 50%; + height: 50%; + p{ + font-size: 20px; + margin: 8px 0; + } + span{ + font-size: 15px; + font-weight: 500; + color: gray; + } + input{ + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + opacity: 0; + } + .image{ + height: 100%; + width: 299px; + } + .deleteicon{ + position: absolute; + right: 50px; + top: 50px; + } + } +} +table,table tr th, table tr td { border:1px solid black;text-align: center; } \ No newline at end of file diff --git a/src/app/key-unit/photoofthescene/photoofthescene.component.spec.ts b/src/app/key-unit/photoofthescene/photoofthescene.component.spec.ts new file mode 100644 index 0000000..b2b65fe --- /dev/null +++ b/src/app/key-unit/photoofthescene/photoofthescene.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PhotoofthesceneComponent } from './photoofthescene.component'; + +describe('PhotoofthesceneComponent', () => { + let component: PhotoofthesceneComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ PhotoofthesceneComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PhotoofthesceneComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/key-unit/photoofthescene/photoofthescene.component.ts b/src/app/key-unit/photoofthescene/photoofthescene.component.ts new file mode 100644 index 0000000..caa580f --- /dev/null +++ b/src/app/key-unit/photoofthescene/photoofthescene.component.ts @@ -0,0 +1,180 @@ +import { HttpClient } from '@angular/common/http'; +import { Component, OnInit } from '@angular/core'; +import { MatSnackBar ,MatSnackBarConfig} from '@angular/material/snack-bar'; +import Viewer from 'viewerjs'; +@Component({ + selector: 'app-photoofthescene', + templateUrl: './photoofthescene.component.html', + styleUrls: ['./photoofthescene.component.scss'] +}) +export class PhotoofthesceneComponent implements OnInit { + + constructor(private http: HttpClient,public snackBar: MatSnackBar) { } + gallery//viewerJs实例 + isEditPattern = true + + iseditsix = true + ngOnInit(): void { + if(sessionStorage.getItem("six") == "look"){ + this.iseditsix = false + }else if(sessionStorage.getItem("six") == "edit"){ + this.iseditsix = true + } + setTimeout(() => { + if(document.getElementById('viewerjs1')){ + this.gallery = new Viewer(document.getElementById('viewerjs1'),{ + url: 'data-original' + }); + } + if(document.getElementById('viewerjs2')){ + this.gallery = new Viewer(document.getElementById('viewerjs2'),{ + url: 'data-original' + }); + } + if(document.getElementById('viewerjs3')){ + this.gallery = new Viewer(document.getElementById('viewerjs3'),{ + url: 'data-original' + }); + } + if(document.getElementById('viewerjs4')){ + this.gallery = new Viewer(document.getElementById('viewerjs4'),{ + url: 'data-original' + }); + } + }, 0); + + if(localStorage.getItem("pattern")=="edit"){ + this.isEditPattern = true + }else if(localStorage.getItem("pattern") == "look"){ + this.isEditPattern = false + } + } + + unitImg:any = localStorage.getItem(sessionStorage.getItem("companyId") + "1") || "" + lingdaoImg:any = localStorage.getItem(sessionStorage.getItem("companyId") + "2") || "" + peopleImg:any = localStorage.getItem(sessionStorage.getItem("companyId") + "3") || "" + keysiteImg:any = localStorage.getItem(sessionStorage.getItem("companyId") + "4") || "" + + //删除照片 + deleteimg(num){ + var msg = "您真的确定要删除吗?"; + if (confirm(msg)==true){ + localStorage.removeItem(sessionStorage.getItem('companyId')+num) + if(num == "1"){ + this.unitImg = "" + } + if(num == "2"){ + this.lingdaoImg = "" + } + if(num == "3"){ + this.peopleImg = "" + } + if(num == "4"){ + this.keysiteImg = "" + } + + }else{ + return false; + } + } + //熟悉单位照片上传 + file:any + filechange1(e,index){ + this.file = e.target.files[0] || null //上传的文件 + var reader = new FileReader(); + reader.readAsDataURL(this.file); + var image:any = new Image(); + reader.onload = function(){ + image.src = reader.result + } + setTimeout(() => { + if(image.width>=4096 || image.height>=5000 ){ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请选择分辨率小于4096*5000的图片','确定',config); + }else{ + if(this.file){ + this.startUploading(index) + } + } + }, 500); + } + + + isspinner:any //进度圈 + imgUrl:any //上传后的图片地址 + imgsrc:any //上传后的缩略图地址 + + //上传文件 + startUploading(type) { + this.isspinner = true + let file = this.file || null //获取上传的文件 + let fileSize = file.size || null //上传文件的总大小 + let shardSize = 5 * 1024 * 1024 //5MB一个分片 + + if (file && fileSize <= shardSize) { //上传文件<=5MB时 + // this.upload() + let formData = new FormData() + formData.append("file",file) + this.http.post(`/api/Objects/PlanPlatform/${sessionStorage.getItem('companyId')}`,formData).subscribe((data:any)=>{ + this.isspinner = false + this.imgUrl = data.objectName + this.imgsrc = `/api/Objects/PlanPlatform/${this.imgUrl}?x-oss-process=image/resize,m_fill,h_170,w_299` + localStorage.setItem(sessionStorage.getItem("companyId") + type, this.imgsrc) + if(type == '1'){ + this.unitImg = this.imgsrc + setTimeout(() => { + this.gallery = new Viewer(document.getElementById('viewerjs1'),{ + url: 'data-original' + }); + }, 0); + } + if(type == '2'){ + this.lingdaoImg = this.imgsrc + setTimeout(() => { + this.gallery = new Viewer(document.getElementById('viewerjs2'),{ + url: 'data-original' + }); + }, 0); + } + if(type == '3'){ + this.peopleImg = this.imgsrc + setTimeout(() => { + this.gallery = new Viewer(document.getElementById('viewerjs3'),{ + url: 'data-original' + }); + }, 0); + } + if(type == '4'){ + this.keysiteImg = this.imgsrc + setTimeout(() => { + this.gallery = new Viewer(document.getElementById('viewerjs4'),{ + url: 'data-original' + }); + }, 0); + } + + + + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('上传成功','确定',config); + + + }) + } else if (file && fileSize >= shardSize) { //上传文件>5MB时,分块上传 + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('请上传小于5M图片','确定',config); + // let data = { filename: file.name } + // this.http.post(`/api/NewMultipartUpload/PlanPlatform/${this.unitinfo.id}`, {}, { params: data }).subscribe((data: any) => { //初始化分段上传 + // this.objectName = data.objectName + // this.uploadId = data.uploadId + // this.subsectionUploading() + // }) + } + } +} diff --git a/src/app/key-unit/router-gis/router-gis.component.html b/src/app/key-unit/router-gis/router-gis.component.html new file mode 100644 index 0000000..5890b79 --- /dev/null +++ b/src/app/key-unit/router-gis/router-gis.component.html @@ -0,0 +1,7 @@ +
+
+
+
已到达熟悉单位
+
取消本次任务
+
+
diff --git a/src/app/key-unit/router-gis/router-gis.component.scss b/src/app/key-unit/router-gis/router-gis.component.scss new file mode 100644 index 0000000..744b8dd --- /dev/null +++ b/src/app/key-unit/router-gis/router-gis.component.scss @@ -0,0 +1,35 @@ +.content { + width: 100%; + height: 100%; + box-sizing: border-box; + padding: 3px; + overflow: hidden; + position: relative; + .center { + width: 100%; + height: 740px; + } + .btnbox{ + position: absolute; + left: 50%; + bottom: 7%;; + transform: translateX(-50%); + display: flex; + div{ + text-align: center; + width:130px; + height: 48px; + line-height: 48px; + opacity: 1; + border-radius: 30px; + font-size: 16px; + margin: 0 12px; + background: #E9EAF3; + cursor: pointer; + } + .btn{ + background: linear-gradient(337deg, #FC7045 0%, #FF4923 100%); + color: #fff; + } + } +} \ No newline at end of file diff --git a/src/app/key-unit/router-gis/router-gis.component.spec.ts b/src/app/key-unit/router-gis/router-gis.component.spec.ts new file mode 100644 index 0000000..5ab8e67 --- /dev/null +++ b/src/app/key-unit/router-gis/router-gis.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RouterGISComponent } from './router-gis.component'; + +describe('RouterGISComponent', () => { + let component: RouterGISComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ RouterGISComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RouterGISComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/key-unit/router-gis/router-gis.component.ts b/src/app/key-unit/router-gis/router-gis.component.ts new file mode 100644 index 0000000..b797115 --- /dev/null +++ b/src/app/key-unit/router-gis/router-gis.component.ts @@ -0,0 +1,60 @@ +import { Component, EventEmitter, OnInit, Output } from '@angular/core'; +declare var AMap: any; + +@Component({ + selector: 'app-router-gis', + templateUrl: './router-gis.component.html', + styleUrls: ['./router-gis.component.scss'] +}) +export class RouterGISComponent implements OnInit { + @Output() onCustomEvent: EventEmitter = new EventEmitter();//创建实力 + constructor() { } + + ngOnInit(): void { + window.setTimeout(()=>{ + this.mapInit() + },0) + } + + ngAfterViewInit(): void { + + } + + //地图初始化 + mapInit () { + console.log("ditu") + //创建地图 + let map = new AMap.Map('center', { + resizeEnable: true, + cursor: 'default', + zooms:[6,18], + }); + //构造路线导航类 实际路线 + let driving = new AMap.Driving({ + map: map, + showTraffic: true, + isOutline: true, + }); + driving.search( [{keyword: '广西消防总队',city:'广西'},{keyword: '万科公园里',city:'广西'},{keyword: '南宁明安医院',city:'广西'}], ); + //构造路线导航类 导航路线 + let drivingTwo = new AMap.Driving({ + map: map, + showTraffic: false, + }); + drivingTwo.search( [{keyword: '广西消防总队',city:'广西'},{keyword: '南宁明安医院',city:'广西'}], ); + //function (status,result) { console.log(status,result) } //地图路线 匹配起始点回调函数 + //new AMap.LngLat(116.379028, 39.865042), new AMap.LngLat(116.427281, 39.903719) / [{keyword: '淄博站',city:'山东'},{keyword: '淄博北站',city:'山东'}], //路线可搜索, 可用坐标 + } + + //下一步 + next(){ + this.emitEvent() + } + private emitEvent(){ + this.onCustomEvent.emit('data from child');//通过emit可将需要传递的数据发送给父组件 + } + //取消 + back(){ + window.history.back(); + } +} diff --git a/src/app/key-unit/six-familiar-list/six-familiar-list.component.html b/src/app/key-unit/six-familiar-list/six-familiar-list.component.html new file mode 100644 index 0000000..c2653d8 --- /dev/null +++ b/src/app/key-unit/six-familiar-list/six-familiar-list.component.html @@ -0,0 +1,25 @@ +
+
+ + + + + + + + + + + + + + + + + +
熟悉记录记录时间带队领导上传人员操作
{{item.target}}{{item.time}}{{item.leadTheTeam}}{{item.updateStaff}}查看详情
+
+
+ +
+
\ No newline at end of file diff --git a/src/app/key-unit/six-familiar-list/six-familiar-list.component.scss b/src/app/key-unit/six-familiar-list/six-familiar-list.component.scss new file mode 100644 index 0000000..af3a6a4 --- /dev/null +++ b/src/app/key-unit/six-familiar-list/six-familiar-list.component.scss @@ -0,0 +1,37 @@ +.box { + box-sizing: border-box; + padding: 5px; + overflow: hidden; + .table { + width: 100%; + max-height: 100%; + overflow-y: auto; + } + table { + width: 100%; + background: #2196f3; + text-align: center; + border-collapse:collapse; + word-break:break-all; + word-wrap:break-all; + table-layout:fixed; + .firstContent { width:50px; } + th { + height: 50px; + font-weight: normal; + font-size: 18px; + color: #fff; + // border-bottom: 1px solid rgb(211, 207, 207); + } + td { + height: 50px; + font-size: 15px; + background-color: #fff; + border-top: 1px solid rgb(211, 207, 207); + } + } + } + .fontColor{ + cursor: pointer; + color: #2196f3; + } \ No newline at end of file diff --git a/src/app/key-unit/six-familiar-list/six-familiar-list.component.spec.ts b/src/app/key-unit/six-familiar-list/six-familiar-list.component.spec.ts new file mode 100644 index 0000000..a4e10d0 --- /dev/null +++ b/src/app/key-unit/six-familiar-list/six-familiar-list.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SixFamiliarListComponent } from './six-familiar-list.component'; + +describe('SixFamiliarListComponent', () => { + let component: SixFamiliarListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SixFamiliarListComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SixFamiliarListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/key-unit/six-familiar-list/six-familiar-list.component.ts b/src/app/key-unit/six-familiar-list/six-familiar-list.component.ts new file mode 100644 index 0000000..4d4cd32 --- /dev/null +++ b/src/app/key-unit/six-familiar-list/six-familiar-list.component.ts @@ -0,0 +1,31 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-six-familiar-list', + templateUrl: './six-familiar-list.component.html', + styleUrls: ['./six-familiar-list.component.scss'] +}) +export class SixFamiliarListComponent implements OnInit { + + constructor() { } + tableData :any = [ + {target: '记录1', time: '2020-10-29 07:19', leadTheTeam: '郑子墨', updateStaff: '赵竹林', }, + {target: '记录2', time: '2020-11-02 07:19', leadTheTeam: '何先超', updateStaff: '何晨', }, + {target: '记录3', time: '2020-11-02 11:19', leadTheTeam: '吴洁丽', updateStaff: '赵玉', }, + {target: '记录4', time: '2020-11-03 07:19', leadTheTeam: '吴毅溪', updateStaff: '赵晓慧', }, + {target: '记录5', time: '2020-11-07 07:19', leadTheTeam: '周伟林', updateStaff: '李英顺', }, + {target: '记录6', time: '2020-11-11 07:19', leadTheTeam: '李林颖', updateStaff: '吴思怡', }, + {target: '记录7', time: '2020-11-12 07:19', leadTheTeam: '李双杆', updateStaff: '钱浩宇', }, + {target: '记录8', time: '2020-11-14 11:19', leadTheTeam: '孙正荣', updateStaff: '孙正云', }, + {target: '记录9', time: '2020-11-17 07:19', leadTheTeam: '赵虎林', updateStaff: '冯燕', }, + {target: '记录10', time: '2020-11-20 07:19', leadTheTeam: '周伟林', updateStaff: '李英顺', }, + {target: '记录11', time: '2020-11-22 07:19', leadTheTeam: '冯燕', updateStaff: '冯靖宇', }, + ] + ngOnInit(): void { + } + //点击查看详情 + isnext = false + viewDetails(){ + this.isnext = true + } +} diff --git a/src/app/key-unit/six-familiarity/routerMap.html b/src/app/key-unit/six-familiarity/routerMap.html new file mode 100644 index 0000000..7b7c5fa --- /dev/null +++ b/src/app/key-unit/six-familiarity/routerMap.html @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file diff --git a/src/app/key-unit/six-familiarity/six-familiarity.component.html b/src/app/key-unit/six-familiarity/six-familiarity.component.html new file mode 100644 index 0000000..4217209 --- /dev/null +++ b/src/app/key-unit/six-familiarity/six-familiarity.component.html @@ -0,0 +1,6 @@ +
+ +
+ +
+
\ No newline at end of file diff --git a/src/app/key-unit/six-familiarity/six-familiarity.component.scss b/src/app/key-unit/six-familiarity/six-familiarity.component.scss new file mode 100644 index 0000000..ebbc4ce --- /dev/null +++ b/src/app/key-unit/six-familiarity/six-familiarity.component.scss @@ -0,0 +1,21 @@ +.content { + width: 100%; + height: 100%; + box-sizing: border-box; + padding: 1px; + overflow: hidden; +} + +//地图div +.mapCenter { + width: 700px; + height: 500px; + margin: 100px auto; + border: 1px solid #000; +} + +//地图组件 +.contentMap { + width: 100%; + height: 100%; +} \ No newline at end of file diff --git a/src/app/key-unit/six-familiarity/six-familiarity.component.spec.ts b/src/app/key-unit/six-familiarity/six-familiarity.component.spec.ts new file mode 100644 index 0000000..07ae34e --- /dev/null +++ b/src/app/key-unit/six-familiarity/six-familiarity.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SixFamiliarityComponent } from './six-familiarity.component'; + +describe('SixFamiliarityComponent', () => { + let component: SixFamiliarityComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SixFamiliarityComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SixFamiliarityComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/key-unit/six-familiarity/six-familiarity.component.ts b/src/app/key-unit/six-familiarity/six-familiarity.component.ts new file mode 100644 index 0000000..9f36c2b --- /dev/null +++ b/src/app/key-unit/six-familiarity/six-familiarity.component.ts @@ -0,0 +1,74 @@ +import { Component, OnInit } from '@angular/core'; +declare var AMap: any; + +@Component({ + selector: 'app-six-familiarity', + templateUrl: './six-familiarity.component.html', + styleUrls: ['./six-familiarity.component.scss'] +}) +export class SixFamiliarityComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + + } + + ngAfterViewInit(): void { + + } + + + +} + + + +//地图组件 +@Component({ + selector: 'app-routerMap', + templateUrl: './routerMap.html', + styleUrls: ['./six-familiarity.component.scss'] +}) +export class routerMapComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + + } + + ngAfterViewInit(): void { + window.setTimeout(()=>{ + this.mapInit() + },0) + } + + //地图初始化 + mapInit () { + //创建地图 + let map = new AMap.Map('contentMap', { + resizeEnable: true, + cursor: 'default', + zooms:[6,18], + }); + //构造路线导航类 实际路线 + let driving = new AMap.Driving({ + map: map, + showTraffic: true, + isOutline: true, + }); + driving.search( [{keyword: '广西消防总队',city:'广西'},{keyword: '万科公园里',city:'广西'},{keyword: '南宁明安医院',city:'广西'}], ); + //构造路线导航类 导航路线 + let drivingTwo = new AMap.Driving({ + map: map, + showTraffic: false, + }); + drivingTwo.search( [{keyword: '广西消防总队',city:'广西'},{keyword: '南宁明安医院',city:'广西'}], ); + //function (status,result) { console.log(status,result) } //地图路线 匹配起始点回调函数 + //new AMap.LngLat(116.379028, 39.865042), new AMap.LngLat(116.427281, 39.903719) / [{keyword: '淄博站',city:'山东'},{keyword: '淄博北站',city:'山东'}], //路线可搜索, 可用坐标 + } + + + +} diff --git a/src/app/key-unit/training-recordinfo/training-recordinfo.component.html b/src/app/key-unit/training-recordinfo/training-recordinfo.component.html new file mode 100644 index 0000000..449820a --- /dev/null +++ b/src/app/key-unit/training-recordinfo/training-recordinfo.component.html @@ -0,0 +1,79 @@ + +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
\ No newline at end of file diff --git a/src/app/key-unit/training-recordinfo/training-recordinfo.component.scss b/src/app/key-unit/training-recordinfo/training-recordinfo.component.scss new file mode 100644 index 0000000..a1b87fa --- /dev/null +++ b/src/app/key-unit/training-recordinfo/training-recordinfo.component.scss @@ -0,0 +1,31 @@ +.bigbox{ + width: 100%; + height: 100%; + background: #F4F5F9; + display: flex; + flex-direction: column; + overflow: hidden; + .title{ + width: 100%; + height: 0.585938rem; + } + .content{ + flex: 1; + overflow: hidden; + .cardbox{ + margin: 0 auto; + margin-top:0.195313rem; + background-color: #fff; + border-radius: 0.048828rem; + width:100%; + height: 100%; + } + } +} +.mat-tab-body-wrapper { + height: 100%; + overflow: hidden; +} +.mat-tab-body-wrapper{ + height: 100%!important; +} \ No newline at end of file diff --git a/src/app/key-unit/training-recordinfo/training-recordinfo.component.spec.ts b/src/app/key-unit/training-recordinfo/training-recordinfo.component.spec.ts new file mode 100644 index 0000000..523082c --- /dev/null +++ b/src/app/key-unit/training-recordinfo/training-recordinfo.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TrainingRecordinfoComponent } from './training-recordinfo.component'; + +describe('TrainingRecordinfoComponent', () => { + let component: TrainingRecordinfoComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TrainingRecordinfoComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TrainingRecordinfoComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/key-unit/training-recordinfo/training-recordinfo.component.ts b/src/app/key-unit/training-recordinfo/training-recordinfo.component.ts new file mode 100644 index 0000000..5c4e584 --- /dev/null +++ b/src/app/key-unit/training-recordinfo/training-recordinfo.component.ts @@ -0,0 +1,29 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-training-recordinfo', + templateUrl: './training-recordinfo.component.html', + styleUrls: ['./training-recordinfo.component.scss'] +}) +export class TrainingRecordinfoComponent implements OnInit { + tabsSelectedIndex:any = 0//当前选项卡值 + constructor() { } + title:any = "训练记录信息" + + sixeditpattern = true + ngOnInit(): void { + if(sessionStorage.getItem("six") == "edit"){ + this.sixeditpattern = true + }else{ + this.sixeditpattern = false + } + } + onCustom($event){ + console.log($event);//data from child + this.tabsSelectedIndex = 1 + } + selectedtab(e){ + sessionStorage.setItem("tabsindex",e.index) + // console.log(e.index) + } +} diff --git a/src/app/key-unit/view-unit-details-plan/view-unit-details-plan.component.html b/src/app/key-unit/view-unit-details-plan/view-unit-details-plan.component.html index da9df8b..8e8a67a 100644 --- a/src/app/key-unit/view-unit-details-plan/view-unit-details-plan.component.html +++ b/src/app/key-unit/view-unit-details-plan/view-unit-details-plan.component.html @@ -46,7 +46,8 @@
- + +
diff --git a/src/app/key-unit/view-unit-details/view-unit-details.component.html b/src/app/key-unit/view-unit-details/view-unit-details.component.html index 8be167f..3822365 100644 --- a/src/app/key-unit/view-unit-details/view-unit-details.component.html +++ b/src/app/key-unit/view-unit-details/view-unit-details.component.html @@ -1,4 +1,4 @@ - + @@ -6,7 +6,8 @@ - + + @@ -41,12 +42,12 @@ - 功能开发中~~ + - 功能开发中~~ + 功能开发中~~ diff --git a/src/app/key-unit/view-unit-details/view-unit-details.component.ts b/src/app/key-unit/view-unit-details/view-unit-details.component.ts index f222e56..1a874db 100644 --- a/src/app/key-unit/view-unit-details/view-unit-details.component.ts +++ b/src/app/key-unit/view-unit-details/view-unit-details.component.ts @@ -11,5 +11,8 @@ export class ViewUnitDetailsComponent implements OnInit { ngOnInit(): void { } - + + selectedtab(e){ + sessionStorage.setItem("tabsindex",e.index) + } } diff --git a/src/app/key-unit/water-road/edittext.html b/src/app/key-unit/water-road/edittext.html new file mode 100644 index 0000000..823d445 --- /dev/null +++ b/src/app/key-unit/water-road/edittext.html @@ -0,0 +1,14 @@ +
+
+ 说明: + 水源情况主要包括消火栓位置、管径、外观完好情况、停车取水位置试水情况,消防水池位置、容量、停车取水位置、取水测试情况,取消码头位置、水位、停车取水位置等;道路情况主要包括道路长度、宽度、起始点、沿线重点单位、立交、桥梁、涵洞及其通车能力。 + 【该项主要在道路水源熟悉时填写】 +
+
+ +
+
+
确认
+
取消
+
+
\ No newline at end of file diff --git a/src/app/key-unit/water-road/water-road.component.html b/src/app/key-unit/water-road/water-road.component.html new file mode 100644 index 0000000..9487820 --- /dev/null +++ b/src/app/key-unit/water-road/water-road.component.html @@ -0,0 +1,19 @@ +
+
+ +
+

create

+

编辑

+
+
+ \ No newline at end of file diff --git a/src/app/key-unit/water-road/water-road.component.scss b/src/app/key-unit/water-road/water-road.component.scss new file mode 100644 index 0000000..8685767 --- /dev/null +++ b/src/app/key-unit/water-road/water-road.component.scss @@ -0,0 +1,81 @@ +.content { + width: 100%; + height: 100%; + box-sizing: border-box; + padding: 0.244141rem; + overflow: hidden; + position: relative; + .center { + width: 100%; + height: 100%; + } + .textbox{ + position: absolute; + z-index: 999; + right: 0.244141rem; + top:0.244141rem; + .btn{ + text-align: right; + } + } + .editbtn{ + text-align: center; + position: absolute; + right: 50px; + bottom: 50px; + width: 80px; + height: 80px; + background: linear-gradient(360deg, #FC7045 0%, #FF4923 100%); + box-shadow: 0px 2px 10px #D8A798; + border-radius: 50%; + opacity: 1; + p{ + color: #fff; + } + } + } + + + .dialogbox{ + width: 800px; + height: 600px; + .title{ + span{ + font-size: 16px; + } + } + .text{ + width: 97%; + height: 420px; + margin-top:30px; + background: #F4F5F9; + + border-radius: 10px; + textarea{ + width: 100%; + height: 100%; + font-size: 16px; + } + } + .btnbox{ + display: flex; + margin-top: 30px; + justify-content: center; + div{ + cursor: pointer; + font-size: 16px; + width: 180px; + height: 48px; + line-height: 48px; + text-align: center; + background: #E9EAF3; + opacity: 1; + border-radius: 30px; + margin: 0 10px; + } + div:nth-child(1){ + color: #fff; + background: linear-gradient(337deg, #FC7045 0%, #FF4923 100%); + } + } + } \ No newline at end of file diff --git a/src/app/key-unit/water-road/water-road.component.spec.ts b/src/app/key-unit/water-road/water-road.component.spec.ts new file mode 100644 index 0000000..63c4edb --- /dev/null +++ b/src/app/key-unit/water-road/water-road.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { WaterRoadComponent } from './water-road.component'; + +describe('WaterRoadComponent', () => { + let component: WaterRoadComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ WaterRoadComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(WaterRoadComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/key-unit/water-road/water-road.component.ts b/src/app/key-unit/water-road/water-road.component.ts new file mode 100644 index 0000000..6d17050 --- /dev/null +++ b/src/app/key-unit/water-road/water-road.component.ts @@ -0,0 +1,148 @@ +import { Component, Inject, OnInit } from '@angular/core'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +declare var AMap: any; +import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; + +@Component({ + selector: 'app-water-road', + templateUrl: './water-road.component.html', + styleUrls: ['./water-road.component.scss'] +}) +export class WaterRoadComponent implements OnInit { + + constructor(public snackBar: MatSnackBar,public dialog: MatDialog) { } + isshow:boolean = true + textcontant:any = localStorage.getItem(sessionStorage.getItem("companyId") + "waterroad") || "" + clickicon(){ + this.isshow = !this.isshow + } + save(){ + localStorage.setItem(sessionStorage.getItem("companyId") + "waterroad",this.textcontant) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + map:any //地图 + + + ngOnInit(): void { + + setTimeout(() => { + this.creatMap() + + }, 0); + } + + + creatMap(){ + var satellite = new AMap.TileLayer.Satellite(); + var roadNet = new AMap.TileLayer.RoadNet(); + + // 创建一个 icon + var startIcon = new AMap.Icon({ + image: '../../../assets/images/fireHydrant.png', + // // 图标所用图片大小 + imageSize: new AMap.Size(20, 20), + // // 图标取图偏移量 + // imageOffset: new AMap.Pixel(-9, -3) + }); + let arr = [{lng:108.299405,lat: 22.894884}, + {lng:108.597409,lat: 22.80883}, + {lng:108.689419,lat: 23.061775}, + {lng:107.971188,lat: 22.950537}, + {lng:107.847592,lat: 23.090833}, + {lng:108.176374,lat: 22.790585}, + {lng:108.407087,lat: 22.671522}, + {lng:108.158521,lat: 22.61322}, + {lng:107.925062,lat: 22.565038}, + {lng:108.180494,lat: 22.501616}, + {lng:107.743222,lat: 22.535121}, + {lng:108.373809,lat: 22.764746}, + {lng:108.378895,lat: 22.761877}, + {lng:108.383337,lat: 22.766467}, + {lng:108.37647,lat: 22.763341}, + {lng:108.37662,lat: 22.767397}, + {lng:108.378916,lat: 22.758513}, + {lng:108.379045,lat: 22.765695}, + {lng:108.384731,lat: 22.760096},] + let Arr = [] + arr.forEach(item=>{ + let viaMarker = new AMap.Marker({ + position: new AMap.LngLat(item.lng, item.lat), + icon: startIcon, + offset: new AMap.Pixel(-10, -10) + }) + Arr.push(viaMarker) + }) + var markerIcon = new AMap.Icon({ + image:"//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png", + size: new AMap.Size(52, 52), //图标大小 + imageSize: new AMap.Size(26,36) + }) + let marker1 = new AMap.Marker({ + icon: markerIcon, + position: [108.377865, 22.763499], + offset: new AMap.Pixel(-4, -50) + }); + + this.map = new AMap.Map('map',{ + center: [108.377865, 22.763499], //初始地图中心点 + zoom: 16 + }); + marker1.setMap(this.map); + this.map.on('click', (e) => { + console.log(e.lnglat.getLng() + ',' + e.lnglat.getLat()) + }); + + // this.map.setCity('南宁市') + this.map.add(Arr);//火源标点 + + + } + + opendialog(){ + let dialogRef = this.dialog.open(EditText); + dialogRef.afterClosed().subscribe(data=>{ + if(data){ + + } + }); + } +} + + +//编辑水源道路情况 +@Component({ + selector: 'app-editBuilding', + templateUrl: './edittext.html', + styleUrls: ['./water-road.component.scss'] +}) +export class EditText { + + constructor(public snackBar: MatSnackBar,public dialog: MatDialog,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) { } + textcontant:any = localStorage.getItem(sessionStorage.getItem("companyId") + "waterroad") || ""//输入内容 + iseditsix = true + ngOnInit(): void { + if(sessionStorage.getItem("six") == "look"){ + this.iseditsix = false + }else if(sessionStorage.getItem("six") == "edit"){ + this.iseditsix = true + } + } + + + //确定 + ok(){ + localStorage.setItem(sessionStorage.getItem("companyId") + "waterroad",this.textcontant) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + this.dialogRef.close(); + } + //取消 + cancel(){ + this.dialogRef.close(); + } +} \ No newline at end of file diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index 6aff5b7..50437b5 100644 --- a/src/app/pages/home/home.component.ts +++ b/src/app/pages/home/home.component.ts @@ -889,7 +889,7 @@ export class HomeComponent implements OnInit { //初始化地图 - adcode:any = 450000 //行政编码 + adcode:any = 310000 //行政编码 mapInit () { //创建地图 this.map = new AMap.Map('chartMap', { @@ -1029,7 +1029,7 @@ export class HomeComponent implements OnInit { districtExplorer.on('outsideClick', (e) => { // console.log('区域外点击'); this.chartsSetOption('','province') - adcode = 450000 + adcode = 310000 districtExplorer.loadAreaNode(adcode, (error, areaNode)=> { //更新地图视野 // this.map.setBounds(areaNode.getBounds(), null, null, true); diff --git a/src/app/ui/collection-tools-plan/addDisposalNode.html b/src/app/ui/collection-tools-plan/addDisposalNode.html new file mode 100644 index 0000000..27654e8 --- /dev/null +++ b/src/app/ui/collection-tools-plan/addDisposalNode.html @@ -0,0 +1,24 @@ +
+
+ + +
+ +
+ +
+ + + +
+ +
+ + +
+ +
+ +
\ No newline at end of file diff --git a/src/app/ui/collection-tools-plan/addPlaneFigure.html b/src/app/ui/collection-tools-plan/addPlaneFigure.html new file mode 100644 index 0000000..930bf81 --- /dev/null +++ b/src/app/ui/collection-tools-plan/addPlaneFigure.html @@ -0,0 +1,38 @@ +
+
+ + +
+ +
+ +
+ + + +
+ +
+ 是否为避难层 +
+ +
+ + + +
+ +
+ +
+ +
+ + +
+ +
+ +
\ No newline at end of file diff --git a/src/app/ui/collection-tools-plan/collection-tools.component.html b/src/app/ui/collection-tools-plan/collection-tools.component.html new file mode 100644 index 0000000..7fcb68b --- /dev/null +++ b/src/app/ui/collection-tools-plan/collection-tools.component.html @@ -0,0 +1,454 @@ +
+ +
+ + + 图标大小 + + + 正常 + 放大2倍 + 放大4倍 + + + + + + + + 基本信息名称 + visibility + + + 想定作业名称 + visibility + +
+ + 基本信息编辑 + + +
+ + tv + create + description + +
+ + +
+ + + + +
+
+ keyboard_arrow_right + keyboard_arrow_left + 天气 + + 气温 +
+ + +
+ 风力 + + 风向 + +
+
+
+ + +
+
+ + + + +
+
+ +
+
+ keyboard_arrow_up + keyboard_arrow_down + + +
+
+
+ broken_image + + + + + + + + + + photo_size_select_actual + + + + + + +
+

+ keyboard_arrow_up +

+

+ edit + delete +

+

+ cached + library_books +

+

+ keyboard_arrow_down +

+
+ +
+
+
+ + +
+
+ keyboard_arrow_up + keyboard_arrow_down + +
+
+ + + + + + +
+
+ +

{{items.name}}

+
+
+ +
+
+
+
+ + +
+
+ keyboard_arrow_up + keyboard_arrow_down + + +
+
+ + + +
+ +
+ edit + add + library_books + delete_forever +
+
+
+ +
+
+ + +
+ +
+ +
+ +
+
+
+ 属性 +
+
+ +
+

面积(平方米)

+
{{canvasData.selectStorey.area}}
+

详情

+
+ {{canvasData.selectStorey.details}} +
+
+ +
+

{{assetName}}

+ +
+

宽度(像素)

+ +

高度(像素)

+ +

角度

+
+ + +
+
+ +
+

厚度

+
+ + +
+
+ +

是否高亮

+
+ + 选中高亮 +
+
+
+ 颜色 +
+ +
+
+
+
    +
  • +
+
+ 透明度 + + {{colorDivSliderValue}}% +
+
+ +
+

{{item.PropertyName}}({{item.PhysicalUnit}})

+ +
+ +
+

{{item.PropertyName}}({{item.PhysicalUnit}})

+ +
+ +
+

{{item.PropertyName}}({{item.PhysicalUnit}})

+ +
+ +
+
+

{{item.PropertyName}}

+ {{imagesArr.length ? imagesArr.length : 0}} / {{item.PropertyValue}} + +
添加
+ + +
+
+
+
+ +
+
+ + delete + +
+
+
+ +
+

{{item.PropertyName}}

+ +
+ +
+

{{item.PropertyName}}

+ + +
+ +
+

{{item.PropertyName}}

+ +
+ +
+

{{item.PropertyName}}

+ +
+
+
+ +
+ +
+ +
+ +
+
+ 消防要素 +
+
+ +
+ + + + + + + {{node.name}} + + ({{node.children.length}}) + visibility + + + + + + + {{node.name}} + + ({{node.children.length}}) + visibility + + + +
+
+
+ +
+
+
+
+ 节点详情 +
+
+ 注意事项 +
+
+
+ + +
+
+
+
+ +
\ No newline at end of file diff --git a/src/app/ui/collection-tools-plan/collection-tools.component.scss b/src/app/ui/collection-tools-plan/collection-tools.component.scss new file mode 100644 index 0000000..06f15a5 --- /dev/null +++ b/src/app/ui/collection-tools-plan/collection-tools.component.scss @@ -0,0 +1,446 @@ +@import './panel.scss'; +.icongray{ + color: #D9D0DC; +} +.content { + width: 100%; + height: 93%; + overflow: hidden; + box-sizing: border-box; + padding: 1px; + display: flex; + flex-direction: column; + + .buildingbtnchecked{ + background-color: #34A6FD; + color: white; + } +} + +//header头部 +.header { + position: relative; + flex: 5%; + display: flex; + align-items:center; + min-height: 40px; + background-color: #fff; + .nameShow{ + cursor: pointer; + user-select: none; + } + .copytobutn{ + width: 33px; + min-width: 33px; + display: flex; + justify-content: center; + } + font-size: 18px; + mat-icon{ + font-size: 26px; + vertical-align: text-top; + } + span{ + height: 24px; + line-height: 24px; + } + .patternSwitch{ + position: absolute; + right: 140px; + span{ + font-size: 18px; + cursor: pointer; + margin: 0 3px; + display: inline-block; + border: 1px solid gray; + border-radius: 3px; + padding: 0 5px; + } + .selectedPattern{ + background-color: #2196f3; + color: white; + } + } +} + +//头部操作栏 +.headerOperate { + img { + width: 24px; + height: 24px; + vertical-align: middle; + margin-left: 1px; + } + span{ + font-size: 18px; + } + flex: 5%; + display: flex; + align-items:center; + min-height: 40px; + box-sizing: border-box; + margin: 3px 0; + background-color: white; + button{ + border: 0.5px solid rgb(208, 211, 214); + margin: 0 2px; + } + .editdeletebtn{ + display: none; + } + .bigeditdeletebtn:hover{ + .editdeletebtn{ + display: inline-block; + } + } +} + +//功能区 +// icon统一样式 +.mat-icon { + cursor:pointer; + vertical-align: middle; +} +//左右两侧功能栏 统一样式 +.publicCss { + border-radius: 5px; + position: absolute; + height: 100%; + top: 0; +} +.functionalDomain { + flex: 90%; + overflow: hidden; + .functionalDomainContent { + position: relative; + width: 100%; + height: 100%; + } + .functionalDomainLeft { + background-color: #fff; + display: flex; + flex-direction: column; + margin-left: 0px; + transition: margin-left 0.5s; + min-width: 235px; + border: 1px solid #E6EAEE; + width: 235px; + left: 0; + z-index: 111; + .leftDragDiv{ + position: absolute; + right: 0; + height: 100%; + width: 3px; + z-index: 1000; + cursor: e-resize; + } + } + .functionalDomainRight { + z-index: 1001; + margin-right: 0px; + transition: margin-right 0.5s; + border: 1px solid #464646; + width: 235px; + right: 0; + + } + //右边导航栏显示隐藏 + .togglePanel2 { + margin-right: -2000px; + transition: margin-right 1s; + } + //左侧导航栏显示隐藏 + .togglePanel { + margin-left: -2000px; + transition: margin-left 1s; + } + +} + +//右边操作栏 +.title{ + width: 100%; + height: 35px; + background-color: #464646; + div{ + width: 50%; + height: 35px; + line-height: 35px; + background-color: #595959; + border-radius: 5px; + span{ + color: white; + font-size: 14px; + font-weight: 400; + padding-left: 5px; + } + } +} + + +//右侧属性 +.property{ + display: flex; + flex-flow: column; + .siteproperty{ + height: 100%; + overflow-y: auto; + p{ + color: #9c9fa5; + padding-left: 5px; + } + .siteproperty_size{ + background-color: #e3e3e3; + width: 93%; + margin: 0 auto; + border-radius: 3px; + min-height: 21px; + } + .rightAttribute{ + width: 12%; + height: 99.5%; + position: absolute; + top: 0; + right: 0; + bottom: 0; + border: 2px solid #464646; + } + } + .assetsproperty{ + overflow-y: auto; + height: 100%; + p{ + color: #9c9fa5; + margin:1px 0 3px 8px; + font-size: 14px; + } + span{ + font-size: 15px; + } + input{ + height: 18px; + } + .biginput{ + display: block; + width: 88%; + margin: 0 auto; + } + .smallinput{ + display: block; + width: 19%; + margin-left: 8px; + } + .textarea{ + display: block; + width: 88%; + height: 50px; + margin: 0 auto; + } + .swiper-button-next{ + right: 6px; + } + .swiper-button-prev{ + left: 6px; + } + .swiper-container{ + // --swiper-theme-color: #ff6600;/* 设置Swiper风格 */ + // --swiper-navigation-color: #00ff33;/* 单独设置按钮颜色 */ + --swiper-navigation-size:20px;/* 设置按钮大小 */ + } + .hoverred:hover{ + color: rgb(187, 28, 28); + } + .selectDiv{ + height: 21px; + position: relative; + margin-bottom: 5px; + select{ + width: 98px; + height: 22px; + vertical-align: middle; + position: absolute; + right: 10px; + top: 1px; + border: 1px solid rgb(208, 211, 214); + border-radius: 2px; + } + } + .colorBigDiv{ + width: 88%; + margin-left: 8px; + .colorBigTemplateDiv{ + span{ + color: #9c9fa5; + font-size: 14px; + height: 26px; + line-height: 26px; + } + .colorTemplateDiv{ + width: 65%; + height: 22px; + display: inline-block; + vertical-align: middle; + margin-left: 26px; + } + } + + .colorDiv{ + .colorLi{ + width: 24px; + height: 24px; + list-style: none; + float: left; + border: 2px solid white; + } + .coloractive{ + border: 2px solid black; + } + } + } + + } +} +//右侧消防要素 +.firecategories{ + background-color: #fff; + position: relative; + display: flex; + flex-flow: column; + .firecategoriesTree{ + overflow-y: auto; + height: 100%; + mat-tree-node{ + position: relative; + } + .isLookCss{ + position: absolute; + right: 6px; + } + } +} + +// 解决轮播图蓝框问题 +div:focus { + outline: none; +} + +//没有图片时显示无图片背景图 +.noImgCss{ + background: url(../../../assets/images/noImg.png) no-repeat center center; + background-size: 88% 100%;/*按比例缩放*/ +} +.input{ + width: 18px; + height: 18px; + vertical-align: middle; + margin-left: 9px; + margin-right: 3px; +} + + +// tree +.mat-tree-node{ + min-height: 0; + height: 32px; + line-height: 32px; + font-size: 13px; + cursor: pointer; +} +.treeNode:hover{ + background-color: #ccebf8; +} +.isLookPattern{ + display: none; +} +.treeText{ + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + display: inline-block; + width: 65px; +} + +.bigBox{ + width: 700px; + height: 40px; + position: absolute; + overflow: hidden; + right: 0; +} +.weatherBox{ + height: 40px; + width: 700px; + line-height: 40px; + position: absolute; + right: 0; + transition: right linear .5s; + .openbtn{ + font-size: 45px; + height: 45px; + width: 40px; + } + .name{ + font-size: 16px; + vertical-align: middle; + margin-left: 3px; + } + input{ + width: 140px; + height: 22px; + margin-left: 3px; + } + select{ + width: 96px; + height: 25px; + margin-left: 3px; + vertical-align: middle; + } +} +.open{ + right: 0px; +} +.close{ + right:-622px; +} +.bottomCss{ + position: absolute; + left: 232px; + right: 0px; + bottom: 0; + height: 158px; + width: auto; + z-index: 100; + background-color: white; + border: 1px solid #464646; + .dragDiv{ + width: 100%; + height: 3px; + position: absolute; + top: 0; + z-index: 1000; + cursor: n-resize; + } + .title{ + height: 35px; + background-color: #464646; + div{ + background-color: #464646; + float: left; + width: 80px; + color: white; + font-size: 13px; + padding-left: 5px; + cursor: pointer; + } + .detailsAndattentBtn{ + background-color: #595959; + } + } + .body{ + textarea{ + width: 100%; + border-radius: 0px; + } + } +} \ No newline at end of file diff --git a/src/app/ui/collection-tools-plan/collection-tools.component.spec.ts b/src/app/ui/collection-tools-plan/collection-tools.component.spec.ts new file mode 100644 index 0000000..acc7d5e --- /dev/null +++ b/src/app/ui/collection-tools-plan/collection-tools.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CollectionToolsComponent } from './collection-tools.component'; + +describe('CollectionToolsComponent', () => { + let component: CollectionToolsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CollectionToolsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CollectionToolsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/ui/collection-tools-plan/collection-tools.component.ts b/src/app/ui/collection-tools-plan/collection-tools.component.ts new file mode 100644 index 0000000..9234ef4 --- /dev/null +++ b/src/app/ui/collection-tools-plan/collection-tools.component.ts @@ -0,0 +1,2291 @@ +import { Component, OnInit, Inject, ViewChild,ElementRef,Renderer2, ViewContainerRef } from '@angular/core'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; +import {leftFunctionalDomainComponentPlan,editPlaneFigureComponentPlan,editDisposalNodeComponentPlan,addDisposalNodeComponentPlan} from './leftFunctionalDomain' +import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree'; +import {FlatTreeControl} from '@angular/cdk/tree'; +import {WorkingAreaComponent} from '../../working-area/working-area.component' +import {CanvasShareDataService, DisposalNodeData} from '../../canvas-share-data.service' //引入服务 +import Viewer from 'viewerjs'; +import Swiper from 'swiper'; +import { saveOneDialogPlan } from './save'; +import { NzFormatBeforeDropEvent, NzFormatEmitEvent,NzTreeComponent } from 'ng-zorro-antd/tree'; +import { Observable, of } from 'rxjs'; +import { delay } from 'rxjs/operators'; +import { windows } from 'src/app/interface'; +import { GameMode } from 'src/app/working-area/model/gameMode'; +import { ActivatedRoute, Router } from '@angular/router'; + + + +@Component({ + selector: 'app-collection-tools-plan', + templateUrl: './collection-tools.component.html', + styleUrls: ['./collection-tools.component.scss'] +}) +export class CollectionToolsPlanComponent implements OnInit { + + @ViewChild('canvas',{static: true}) canvas:WorkingAreaComponent; //父组件中获得子组件的引用 + + constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,private element: ElementRef,public canvasData: CanvasShareDataService,private router:Router,private route:ActivatedRoute) { } + @ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; + // tree配置 + private _transformer = (node, level: number) => {//要给渲染节点传那些属性参数 + return { + expandable: !!node.children && node.children.length > 0, + name: node.name || node.Name, + level: level, + id: node.id || node.Id, + children:node.children, + isTemplate:node.isTemplate, + isNewElement:node.isNewElement, + isLook:node.isLook, + isLookPattern:node.isLookPattern || null + }; + } + treeControl = new FlatTreeControl(node => node.level, node => node.expandable); + + treeFlattener = new MatTreeFlattener(this._transformer, node => node.level, node => node.expandable, node => node.children); + dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener); + hasChild = (_: number, node: any) => node.expandable; + + colors = ['#076eec','#4dd0e1','#00ee76','#ffff00','#eeb422', + '#FF6A6A','#ff0000','#ff6eb4','#00bfff','#54ff9f', + '#009688','#836fff','#ff8c00','#ee00ee','#ffa07a', + '#00C500','#00ffff','#6495ed','#ffdAb9','#AA00FF'] + selected = "1" //图标大小选择框 + + allBuildings //该单位所有建筑 + beforeOneCheckedBuilding:any = {name:"总平面图"}; //当前点击选择的建筑 + checkedBuildingIndex:number = -1 //当前点击选择的建筑index + isEditPat:boolean = true //当前是否是编辑模式 + + assetName:String//素材名称 + assetWidth:number//素材宽度 + assetHeight:number//素材高度 + sliderValue:number = 0//角度滑竿的值 + sliderValueThickness:number = 0//厚度滑竿的值 + isHighLight:boolean = false//是否高亮选择框 + PropertyInfos = [] //去除图片链接真正用于循环的内容 + imagesArrNum //素材属性图片数量上限 + imagesArr = [] //属性中的图片链接集合 + clickedIndex //点击图片时的索引值 + + //传入素材对象,设置右侧属性栏内容 + canvasAssetObj //传入的素材属性对象 + isImgNumCss = false //控制上传文件input显隐 + mySwiper:any //轮播图实例 + + gallery//viewerJs实例 + //设置属性框 + setAssetsProperty(obj){ + //初始化viewerJs实例 + setTimeout(() => { + obj.PropertyInfos.forEach(item => { + if(item.PropertyType == 4){ + this.gallery = new Viewer(document.getElementById('viewerjs'),{ + url: 'data-original' + }); + } + }) + }, 0); + + //从颜色中取出透明度 + let color = obj.Color + let strh = color.substring(color.length -2,color.length) + let opacity = Math.round(parseInt(strh,16)/255 * 100) + this.colorDivSliderValue = opacity + + this.isShowProperty = true + this.isShowAttribute = false + let _this = this + this.imagesArr = [] + this.imagesArrNum = "" + + this.canvasAssetObj = obj //将选中素材对象存到本地变量 + + this.assetName = obj.Name + this.assetWidth = obj.Width + this.assetHeight = obj.Height + this.sliderValue = obj.Angle + this.selectedcolor = obj.Color + this.PropertyInfos = obj.PropertyInfos + this.sliderValueThickness = obj.Thickness + this.PropertyInfos.forEach(item => { + if(item.PropertyType == 3){ //如果是图片链接类型 + this.imagesArr.push(item) + } + if(item.PropertyType == 4){//图片数值上线 + this.imagesArrNum = item.PropertyValue + } + }) + + //如果存在图片则加载轮播图 + if(this.imagesArr.length){ + setTimeout(() => { + this.mySwiper = new Swiper('.swiper-container',{ + loop: false, + // grabCursor: true, + // 如果需要前进后退按钮 + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev', + }, + on:{ + click: function(){ + _this.clickedIndex = this.clickedIndex + }, + } + }); + }, 0); + } + //判断此时图片数量是否达到上限 + if(this.imagesArr.length < this.imagesArrNum){//如果不超出 + this.isImgNumCss = true + }else{ + this.isImgNumCss = false + } + } + pattern:boolean = true//默认为基本信息编辑 + + + yyy(){ + console.log(this.canvasData.selectPanelPoint) + } + //基本信息编辑模式 + baseInfo(){ + if (!this.pattern) { + this.pattern = true + this.canvasData.gameMode = GameMode.BasicInformation + this.canvasData.selectPanelPoint = new DisposalNodeData(); + this.mateDeleteCustomize() + this.getAllLibrary() + this.checkedBuildingIndex = -1 + this.getSitePlan() //总平面图一层 + } + } + + //想定作业编辑模式 + wantWork(){ + if (this.pattern) { + this.pattern = false + this.canvasData.gameMode = GameMode.Assignment + this.getAllLibrary('plan') + this.getDisposalNode() + } + } + + //ngzorro tree 拖拽 + nzEvent(event: NzFormatEmitEvent): void { + if(this.isDrag){ + let parentId + if(this.pos == 0){ + parentId = event.node.key + }else{ + if(event.node.level == 0){ + parentId = null + }else{ + parentId = event.node.origin.parentId + } + } + + + let orders = {} + let originalData = JSON.parse(JSON.stringify( this.canvasData.allDisposalNode || [] )) //tree原始数据 + let targetNodeData = []//拖动移入节点的数据,用于遍历求出放在该数组的第几位 + + //找到需要重新排序的数组 + if(this.pos == 0){ + originalData.forEach(item => { + if(item.parentId == event.node.key){ + targetNodeData.push(item) + } + }) + }else{ + if(event.node.origin.parentId){//如果拖动目标为非一级节点 + originalData.forEach(item => { + if(item.parentId == event.node.origin.parentId){ + targetNodeData.push(item) + } + }) + }else{//如果拖动目标为一级节点 + originalData.forEach(item => { + if(!item.parentId){ + targetNodeData.push(item) + } + }) + } + } + + + let idArr = [] + targetNodeData.forEach(i => { + idArr.push(i.id) + }) + console.log(6666666666666,event); + if(this.pos == 0 && event.node.origin.children.length == 1){ + console.log("移入,没有兄弟") + let key = event.dragNode.key + orders[key] = 0 + parentId = event.node.key + }else{ + console.log("移入,多个兄弟") + let array = [] + targetNodeData.forEach(item => { + if(item.id != event.dragNode.key){ //将拖动项先移除掉 + array.push(item) + } + }) + if(event.dragNode.isEnd[event.dragNode.isEnd.length - 1]){ //如果移入到最后一个 + console.log("最后") + array.push(event.dragNode.origin) + }else if(event.dragNode.isStart[event.dragNode.isStart.length - 1]){//如果移入到第一个 + console.log("第一") + array.unshift(event.dragNode.origin) + }else{//如果移入中间位置 + console.log("中间") + array.splice(event.node.origin.order, 0, event.dragNode.origin) + } + array.forEach((item,key) => { + orders[item.id] = key + }) + } + + let obj ={ + id : event.dragNode.origin.id, + parentId : parentId, + orders : orders + } + + this.http.put("/api/DisposalNodes/Sort",obj).subscribe(data => { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('排序成功','确定',config) + this.refurbishTreeData() + }) + } + } + + isDrag //是否可以拖动 + pos//放置位置 + beforeDrop = (arg: NzFormatBeforeDropEvent) => { + if(arg.dragNode.origin.isDataNode && arg.node.level === 0){//如果为数据节点则不允许拖到一级节点 + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('数据节点不允许拖拽到一级节点','确定',config) + this.isDrag = false + return of(false); + }else if(!arg.dragNode.origin.isDataNode && arg.node.level === 2){ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('处置节点不允许拖拽到三级节点','确定',config) + this.isDrag = false + return of(false); + }else{ + this.isDrag = true + this.pos = arg.pos + return of(true) + } + } + //ngzorro tree 拖拽 + + //天气栏目 + weatherBtn = true + weatherBtnShow(){ + this.weatherBtn = !this.weatherBtn + } + weatherBtnHidden(){ + this.weatherBtn = !this.weatherBtn + } + + //底部切换按钮div + detailsAndattentBtn = true + //节点详情 + details(){ + this.detailsAndattentBtn = true + } + //注意事项 + attent(){ + this.detailsAndattentBtn = false + } + + //消防要素div边框高度调节 + firecategoriesDivMouseDown(e){ + document.onmousemove = (ev) => { + let bodyHeight = document.body.clientHeight //网页宽度 + let maxHeight = this.element.nativeElement.querySelector('#rightDiv').clientHeight - 35 //最大宽度 + if(bodyHeight - ev.clientY >= maxHeight){ + this.element.nativeElement.querySelector('#firecategories').style.height = maxHeight+ 'px' + this.element.nativeElement.querySelector('#property').style.height = 35+ 'px' + }else{ + this.element.nativeElement.querySelector('#firecategories').style.height = (bodyHeight - ev.clientY) + 'px' ; + this.element.nativeElement.querySelector('#property').style.height = (this.element.nativeElement.querySelector('#rightDiv').clientHeight - this.element.nativeElement.querySelector('#firecategories').clientHeight) + 'px' + } + } + document.onmouseup = () => { + document.onmousemove = null; + document.onmouseup = null; + } + } + + //左侧div边框宽度调节 + leftDivMouseDown(e){ + document.onmousemove = (ev) => { + let bodyWidth = document.body.clientWidth //网页宽度 + let maxWidth = bodyWidth - 260 - this.element.nativeElement.querySelector('#rightDiv').clientWidth //最大宽度 + if(ev.clientX - 240 >= maxWidth){ + this.element.nativeElement.querySelector('#leftDiv').style.width = maxWidth + 'px' + }else{ + this.element.nativeElement.querySelector('#leftDiv').style.width = ev.clientX - 260 + 'px'; + } + } + document.onmouseup = () => { + document.onmousemove = null; + document.onmouseup = null; + } + } + + //底部div高度调节 + bottomDivMouseDown(e){ + document.onmousemove = (ev) => { + let bodyHeight = document.body.clientHeight //网页高度 + let maxHeight = this.element.nativeElement.querySelector('#rightDiv').clientHeight //最大高度 + if(bodyHeight - ev.clientY >= maxHeight){ + this.element.nativeElement.querySelector('#bottomDiv').style.height = maxHeight + 'px' + }else{ + this.element.nativeElement.querySelector('#bottomDiv').style.height = (bodyHeight - ev.clientY) + 'px' ; + } + } + document.onmouseup = () => { + document.onmousemove = null; + document.onmouseup = null; + } + } + + //右侧div边框宽度调节 + rightDivMouseDown(e){ + document.onmousemove = (ev) => { + let bodyWidth = document.body.clientWidth //网页宽度 + let maxWidth = bodyWidth - 240 - this.element.nativeElement.querySelector('#leftDiv').clientWidth //最大宽度 + if(bodyWidth - ev.clientX >= maxWidth){ + this.element.nativeElement.querySelector('#rightDiv').style.width = maxWidth + 'px' + }else{ + this.element.nativeElement.querySelector('#rightDiv').style.width = bodyWidth - ev.clientX + 'px'; + } + } + document.onmouseup = () => { + document.onmousemove = null; + document.onmouseup = null; + } + } + + //放大图标 + iconScale(){ + let number = Number(this.selected) + this.canvas.setIconScale(number) + } + + //素材宽度输入框改变 + assetWidthIunput(){ + this.canvasAssetObj.Width = this.assetWidth + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + + //素材高度输入框改变 + assetHeightIunput(){ + this.canvasAssetObj.Height = this.assetHeight + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + + //素材角度输入框改变 + assetAngleIunput(){ + this.canvasAssetObj.Angle = this.sliderValue + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + + //素材厚度输入框改变 + assetThicknessIunput(){ + this.canvasAssetObj.Thickness = this.sliderValueThickness + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + + //素材是否高亮改变----->本地操作行为 + assetHighLightIunput(){ + + } + + //动态属性素材input框值改变 + assetInputChange(i,e){ + let index = this.canvasAssetObj.PropertyInfos.findIndex((item)=>{ + return i.PropertyName == item.PropertyName + }) + this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + + //动态属性素材布尔值框改变radio + assetRadioChange(i,boolean){ + let index = this.canvasAssetObj.PropertyInfos.findIndex((item)=>{ + return i.PropertyName == item.PropertyName + }) + this.canvasAssetObj.PropertyInfos[index].PropertyValue = boolean + this.canvasData.isChange = true + } + + colorIndex//默认素材颜色 + selectedcolor//点击选择的颜色 + //选择素材颜色 + selectcolor(item,key){ + //在当前透明度基础上改变颜色 + this.selectedcolor = item + this.selectedcolor.substring(this.selectedcolor.length-2) + this.canvasAssetObj.Color = this.selectedcolor + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + //颜色选择滑竿的值 + colorDivSliderValue + colorDivSliderChange(){ + let colorOpacity = Math.round(255 * this.colorDivSliderValue * 0.01) + //根据滑竿值改变16进制颜色后两位 + function replacepos(text,start,stop,replacetext){ + let mystr = text.substring(0,stop-1)+replacetext+text.substring(stop+1); + return mystr; + } + this.selectedcolor = replacepos(this.selectedcolor,7,8,colorOpacity.toString(16)) + this.canvasAssetObj.Color = this.selectedcolor + this.canvasData.isChange = true + this.canvas.refreshIcon(this.canvasAssetObj.Id) + } + + //查看图片详情 + lookImg(){ + const dialogRef = this.dialog.open(ViewDetailsPlan, {//调用open方法打开对话框并且携带参数过去 + data: {imagesArr:this.imagesArr,index:this.clickedIndex} + }); + dialogRef.afterClosed().subscribe(data=>{ }); + } + + //上传素材图片 + selectFile(e){ + let imgFile = e.target.files[0] || null //上传的文件 + this.startUploading(imgFile) + } + objectName:any //上传对象名 + startUploading (imgFile) { + let _this = this + let file = imgFile || null //获取上传的文件 + let fileSize = file.size || null //上传文件的总大小 + let shardSize = 5 * 1024 * 1024 //5MB一个分片 + let companyId = sessionStorage.getItem("companyId") + if (file && fileSize <= shardSize) { //上传文件<=5MB时 + let formData = new FormData() + formData.append("file",file) + this.http.post(`api/Objects/WebPlan2D/${companyId}`,formData).subscribe((data:any)=>{ + this.objectName = data.objectName + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('上传成功','确定',config) + + //在原始素材对象和需要循环图片的对象中分别push最新上传的图片 + let imgObj = { + "Tag": null, + "Order": 0, + "Enabled": false, + "Visible": false, + "Required": false, + "RuleName": null, + "RuleValue": null, + "PhysicalUnit": null, + "PropertyName": "图片", + "PropertyType": 3, + "PropertyValue": "/api/Objects/WebPlan2D/" + this.objectName + } + + this.imagesArr.push(imgObj) + this.canvasAssetObj.PropertyInfos.push(imgObj) + + setTimeout(() => { + this.mySwiper = new Swiper('.swiper-container',{ + loop: false, + // grabCursor: true, + // 如果需要前进后退按钮 + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev', + }, + on:{ + click: function(){ + _this.clickedIndex = this.clickedIndex + }, + } + }); + + this.mySwiper.slideTo(this.imagesArr.length - 1) + this.gallery.update() + }, 0); + + //判断上传素材属性图片是否超出数量 超出数量则隐藏input框 + if(this.imagesArr.length < this.imagesArrNum){//不超出input才会显示 + this.isImgNumCss = true + }else{ + this.isImgNumCss = false + } + + this.canvasData.isChange = true + }) + } else if (file && fileSize>shardSize) { //上传文件>5MB时,分块上传 + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('上传图片文件不允许大于5mb','确定',config); + } + + } + + //不能上传图片提示 + imgNumBeyond(){ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('图片数量已达上限','确定',config); + } + + //删除素材属性图片 + deleteImg(){ + if(this.imagesArr.length == 0){ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('没有可删除的图片,请先上传','确定',config) + }else{ + // 在素材原始对象中将删除的图片去掉 + this.canvasAssetObj.PropertyInfos = [...this.canvasAssetObj.PropertyInfos.filter((item)=>{ + return item.PropertyValue != this.imagesArr[this.mySwiper.activeIndex].PropertyValue + })] + //在图片循环数组中将图片去掉 + this.imagesArr.splice(this.mySwiper.activeIndex, 1); + //更新swiper视图 + setTimeout(() => { + this.mySwiper.update(); + this.gallery.update() + }, 0); + + this.canvasData.isChange = true + } + } + + //动态属性方向select选择框 + direction(i,e){ + let index = this.canvasAssetObj.PropertyInfos.findIndex((item)=>{ + return i.PropertyName == item.PropertyName + }) + this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value + this.canvasData.isChange = true + } + + //动态属性供给区域select选择框 + supplyArea(i,e){ + let index = this.canvasAssetObj.PropertyInfos.findIndex((item)=>{ + return i.PropertyName == item.PropertyName + }) + this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value + this.canvasData.isChange = true + } + + //动态属性供给类型select选择框 + supplyType(i,e){ + let index = this.canvasAssetObj.PropertyInfos.findIndex((item)=>{ + return i.PropertyName == item.PropertyName + }) + this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value + this.canvasData.isChange = true + } + + + isSixShow = true + isSixbtn = true //控制想定作业编辑按钮 + isxxx = true //控制查看编辑模式的编辑模式按钮 + ngOnInit(): void { + + console.log(this.route,2,this.router.url) + + if(this.router.url.indexOf("keyUnit/viewunitinfo") != -1 || this.router.url.indexOf("keyUnit/editplaninfo")!= -1){ + this.isSixbtn = false + } + + if(!this.isSixbtn && sessionStorage.getItem("six") == "edit"){ + this.isSixShow = true + } + if(!this.isSixbtn && sessionStorage.getItem("six") == "look"){ + this.isEditPattern = false + this.isxxx = false + } + + this.getAllLibrary() //获取素材库 + this.getAllBuildings() //获取所有建筑 + // this.getAllFirePlan() //获取当前单位灾情 + + let that = this + window.setTimeout(()=>{ + document.getElementById("functionalDomainContent").oncontextmenu = function (event) { + that.canvas.cancelPaint() + that.selectImageIndex = -1 + event.preventDefault(); + }; + }) + + this.canvasData.getMessage().subscribe((message: any)=>{ + if(message == "send a message"){ + this.refurbishTreeData() + } + }) + } + + + + ngAfterViewInit(): void { + this.getSitePlan() + // 监听canvas组件选中素材事件 + this.canvas.on("select",obj=>{ + //选中素材属性注入函数 + this.setAssetsProperty(obj.assetData) + }) + // 监听canvas组件取消选中素材事件 + this.canvas.on("deselect",obj=>{ + this.isShowProperty = false + }) + // 监听canvas组件新增素材事件 + this.canvas.on("createIcon",obj=>{ + this.renovateTreeData(false) + }) + // 监听canvas组件删除素材事件 + this.canvas.on("deleteIcon",obj=>{ + this.renovateTreeData(false) + }) + } + + copyAssetData:any //存储用于复制的素材 + //复制素材 + copyAsset(){ + this.canvas.copy() + } + //粘贴素材 + pasteAsset(){ + let companyId = sessionStorage.getItem("companyId") + let buildingId = this.beforeOneCheckedBuilding.id + let floorId = this.selectingSitePlan.id + this.canvas.paste(companyId,buildingId,floorId) + } + + basicInfo:boolean = true //基本信息名称显隐 + wantToWork:boolean = true //想定作业名称显隐 + //点击基本信息名称 + basicInfoClick(){ + this.basicInfo = !this.basicInfo + this.canvas.setNameVisible(this.basicInfo,0) + } + + //点击想定作业名称 + wantToWorkClick(){ + this.wantToWork = !this.wantToWork + this.canvas.setNameVisible(this.wantToWork,1) + } + + isEditPattern:boolean = true //是否为编辑模式 + //进入编辑模式 + editpat(){ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('进入编辑模式','确定',config); + this.isEditPattern = true + } + + //进入查看模式 + lookpat(){ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('进入查看模式','确定',config); + this.isEditPattern = false + } + + //保存平面图 + saveNum :any = [] + saveSite(){ + console.log(this.beforeOneCheckedBuilding) + this.saveNum = [] + let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData)); + SitePlanData.data = JSON.stringify(SitePlanData.data) + let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData)); + CompanyData.data = JSON.stringify(CompanyData.data) + + let object = this.canvasData.originalcompanyBuildingData.data + let adjoinArr = [] //毗邻数组 + + if(this.pattern){//如果是基本信息编辑模式 + for (const key in object) { + if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻 + + object[key].PropertyInfos.forEach(element => { + if(element.PropertyName == "方向"){ + adjoinArr.push(element.PropertyValue) + } + }); + } + } + + if((new Set(adjoinArr)).size != adjoinArr.length){ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存失败,毗邻存在相同方向','确定',config); + return false + }else{ + //如果是单位 总平面图 + if(this.checkedBuildingIndex==-1){ + //保存平面图数据 + this.http.post("/api/SitePlanData",SitePlanData,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('平面图数据保存失败','确定',config); + }) + + //保存建筑数据 + this.http.post("/api/CompanyData",CompanyData,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('单位数据保存失败','确定',config); + }) + + //批量保存单位毗邻 + let CompanyAdjoins = this.canvasData.getCompanyAdjoinInfo() + this.http.post("/api/CompanyAdjoins/Batch",CompanyAdjoins,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('单位毗邻保存失败','确定',config); + }) + + //批量保存单位重点部位 + let CompanyImportantLocations = this.canvasData.getCompanyImportantLocations() + this.http.post("/api/CompanyImportantLocations/Batch",CompanyImportantLocations,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('单位重点部位保存失败','确定',config); + }) + + //批量保存单位消防设施素材 + let CompanyFacilityAssets = this.canvasData.getAllCompanyFacilityAssetInfo() + this.http.post("/api/CompanyFacilityAssets/Batch",CompanyFacilityAssets,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('单位消防设施素材保存失败','确定',config); + }) + + }else{ //如果是建筑 + + //建筑平面图数据 + this.http.post("/api/BuildingAreaData",SitePlanData,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('平面图数据保存失败','确定',config); + }) + + //建筑数据 + this.http.post("/api/BuildingData",CompanyData,{ + params:{ + companyId:this.params.companyId + } + }).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('单位数据保存失败','确定',config); + }) + + //批量保存建筑毗邻 + let buildingAdjoins = this.canvasData.getBuildingAdjoinInfo() + this.http.post(`/api/BuildingAdjoins/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingAdjoins).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('建筑毗邻保存失败','确定',config); + }) + + //批量保存建筑重点部位 + let buildingImportantLocations = this.canvasData.getBuildingImportantLocations() + this.http.post(`/api/BuildingImportantLocations/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingImportantLocations).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('建筑重点部位保存失败','确定',config); + }) + + //批量保存建筑消防设施素材 + let buildingFacilityAssets = this.canvasData.getAllBuildingFacilityAssetInfo() + this.http.post(`/api/BuildingFacilityAssets/Batch?companyId=${this.params.companyId}&buildingId=${this.canvasData.selectStorey.buildingId}`,buildingFacilityAssets).subscribe(data => { + this.saveNum.push("1") + if(this.saveNum.length == 5){ + this.canvasData.isChange = false + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config); + } + },err=>{ + let config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.canvasData.isChange = true + this.snackBar.open('建筑消防设施素材保存失败','确定',config); + }) + + } + } + }else{//如果是想定作业编辑模式 + const dialogRef = this.dialog.open(saveOneDialogPlan, { + data: {allDisposalNode: this.canvasData.allDisposalNode, + selectedBuildingData:this.beforeOneCheckedBuilding, + selectedSiteData:this.selectingSitePlan, + siteOrbuilding:this.checkedBuildingIndex, + disasterId: this.allFirePlan[0].id || '' + } + }); + + dialogRef.afterClosed().subscribe(result => { + console.log('The dialog was closed'); + }); + } + } + + //获得所有的建筑物 + getAllBuildings(){ + this.http.get("/api/Buildings",{ + params:{ + companyId : this.params.companyId + } + }).subscribe(data=>{ + this.allBuildings = data + }) + } + + //拖拽tree + drop(e){ + console.log(1111,e) + } + drop2(e){ + console.log(222,e) + } + + //创建建筑 + createBuilding(){ + let data = { + allBuildings:this.allBuildings, + companyId :this.params.companyId + } + let dialogRef = this.dialog.open(CreateBuildingPlan,{data}); + dialogRef.afterClosed().subscribe(data=>{ + if (data == "创建成功") { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('创建成功','确定',config); + this.getAllBuildings() + }else if (data == "创建失败") { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('创建失败','确定',config); + } + }); + } + + //选择建筑 + checkedBuilding(item,index){ + if (this.checkedBuildingIndex!=index) { + this.beforeOneCheckedBuilding = item + this.checkedBuildingIndex = index + if (index==-1) { //总平面图数据 + this.getSitePlan() + } else { //建筑楼层/区域数据 + this.getBuildingSitePlan(item) + } + } + } + + //编辑建筑 + editBuilding(e,item){ + e.stopPropagation(); + let dialogRef = this.dialog.open(EditBuildingPlan,{data: {item:item}}); + dialogRef.afterClosed().subscribe(data=>{ + if (data == "修改成功") { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('修改成功','确定',config); + this.getAllBuildings() + }else if (data == "修改失败") { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('修改失败','确定',config); + } + }); + } + + //删除建筑 + deleteBuilding(e,item){ + e.stopPropagation(); + if(confirm("是否删除该建筑") == true){ + let isHave = this.canvasData.allDisposalNode.find(items=>{ return items.buildingId === item.id }) + if (isHave == undefined) { + this.http.delete(`/api/Buildings/${item.id}`).subscribe(data=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('删除成功','确定',config); + this.http.get("/api/Buildings",{ + params:{ + companyId :this.params.companyId + } + }).subscribe(data=>{ + this.allBuildings = data + this.beforeOneCheckedBuilding = {name:"总平面图"} + this.checkedBuildingIndex = -1 + this.getSitePlan() + }) + },err=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('删除失败','确定',config); + this.getAllBuildings() + }) + } else { //建筑 含有数据节点时 + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('含有数据节点的建筑不允许删除','确定',config); + } + } + } + + storeyData //将建筑素材和当前楼层素材合二为一 + + //处理 tree 数据结构 + handleTreeData (storeyData) { + + this.storeyData = storeyData + let data = this.allFireElements //所有消防要素模板 + let treeData = [] //tree型 处理完成后的数据 + data.forEach(element => { + element.isTemplate = true //添加模板标识 + element.isLook = true //添加是否可见标识 + element.name!='其他'? element.children = [] : null + + if(storeyData){ + for(let key in storeyData.data){ + storeyData.data[key].isLookPattern = true + if(element.id == storeyData.data[key].FireElementId){ + storeyData.data[key].isTemplate = false + storeyData.data[key].isLook = true + + element.isNewElement = true //该节点children是否存在新添加的真实素材 标识 + + //定义查看模式下能看到的元素 + element.isLookPattern = true + if(element.parentId){ + data.forEach(i => { + if(i.id == element.parentId){ + i.isLookPattern = true + } + }) + } + // + + element.children.push(storeyData.data[key]) + } + } + } + data.forEach(item => { if (item.parentId == element.id) {element.children.push(item)} }); + }); + data.forEach(element => { + if (!element.parentId) { treeData.push(element) } + }); + this.dataSource.data = treeData + this.treeControl.expandAll() + + } + + //点击树节点 + clickTreeNode(node){ + if(this.canvasData.originalcompanyBuildingData.data[node.id]){ + this.setAssetsProperty(this.canvasData.originalcompanyBuildingData.data[node.id]) + }else if(this.canvasData.originaleveryStoreyData.data[node.id]){ + this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[node.id]) + } + + //canvas上的素材高亮 + let iconHighLightArr:any = [] + if(node.isTemplate){//如果是模板,则开始向下找 + node.children.forEach(item => { + if(item.isTemplate){//如果子节点依旧是模板,则继续开始向下找 + item.children.forEach(i => { + iconHighLightArr.push(i.Id) + }) + }else{ + iconHighLightArr.push(item.Id) + } + }) + }else{ + iconHighLightArr.push(node.id) + } + this.canvas.setHighlight(iconHighLightArr) + } + + //点击数节点的显示隐藏icon + clickLookItem(node){ + + //修改真实素材islook属性 + for(let key in this.storeyData.data){ + if(key == node.id){ + this.storeyData.data[key].isLook = !this.storeyData.data[key].isLook + } + } + + //所有消防要素模板变化islook值 + if(node.isTemplate){ + this.allFireElements.forEach(item=>{ + if(item.id == node.id || item.name == "其他"){ + item.isLook = !item.isLook + } + }) + } + + + //子节点跟随父节点的islook变化 +   if(node.children && node.children.length != 0){ +      node.children.forEach(item=>{ +        item.isLook = !node.isLook  +        if(item.children && item.children.length != 0){ +          item.children.forEach(i=>{ +            i.isLook =  !node.isLook  +          }) +        } +      }) +     } + + + this.dataSource.data = [...this.dataSource.data] + this.treeControl.expandAll() + + //canvas上的素材显隐 + let iconVisibleArr:any = [] + if(node.isTemplate){//如果是模板,则开始向下找 + node.children.forEach(item => { + if(item.isTemplate){//如果子节点依旧是模板,则继续开始向下找 + item.children.forEach(i => { + iconVisibleArr.push(i.Id) + }) + }else{ + iconVisibleArr.push(item.Id) + } + }) + }else{ + iconVisibleArr.push(node.id) + } + this.canvas.setIconVisible(iconVisibleArr,!node.isLook) + } + + //计算 可视区域内宽度, 是否缩放背景图 + backGroundScale () { + // let that = this + // let dad = this.element.nativeElement.querySelector('.functionalDomainContent').clientWidth + // let dadHeight = this.element.nativeElement.querySelector('.functionalDomainContent').clientHeight + // let left = this.element.nativeElement.querySelector('.functionalDomainLeft').clientWidth + // let right = this.element.nativeElement.querySelector('.functionalDomainRight').clientWidth + // let imgWidth = dad - left - right//可视区域内 宽度 + // let img = new Image() + // img.src = this.selectingSitePlan.imageUrl; + // img.onload = function(){ + // if (img.height > dadHeight && img.width > imgWidth) { + // let width = imgWidth/img.width + // let height = dadHeight/img.height + // that.canvas.setBackgroundScale((width>height? height : width)-0.005) + // return + // } else if (img.height > dadHeight) { + // that.canvas.setBackgroundScale((dadHeight/img.height)-0.005) + // return + // } else if (img.width > imgWidth) { + // that.canvas.setBackgroundScale((imgWidth/img.width)-0.005) + // return + // } + // }; + } + + //封装 刷新 tree 数据 + async renovateTreeData (isRefresh:boolean = true) { + this.allFireElements[this.allFireElements.length-1].children = [] + isRefresh? await this.canvas.refresh() : null + this.canvas.setNameVisible(this.basicInfo,0) + this.canvas.setNameVisible(this.wantToWork,1) + isRefresh? this.canvasData.isChange = false : null //服务中 数据是否改动 改为false + isRefresh? this.isShowProperty = true : null + isRefresh? this.isShowAttribute = true : null + !this.pattern? this.mateFireForce() : null //刷新 建筑楼层 火源/力量图标 + + let beforeOneId = this.selectingSitePlan.id || '' //当前 选中 平面图 楼层/区域 id + let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 当前 单位/建筑 数据 + let storeyData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData || {} )) //当前 楼层 数据 + + for(let key in companyBuildingData.data){ + if (companyBuildingData.data[key].FloorId === beforeOneId) { //处理 单位/建筑 数据是否归于当前楼层下 + storeyData.data[key] = companyBuildingData.data[key] + } + } + for(let key in storeyData.data){ //筛选数据 没有匹配全部放入到 其他 数组 + let noMatch = this.allFireElements.find( every=> every.id===storeyData.data[key].FireElementId ) + if (!noMatch) { + this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key]) + } + } + this.handleTreeData(storeyData) //处理tree数据结构 + } + + + + //陈鹏飞↓↓↓ + //陈鹏飞↓↓↓ + //陈鹏飞↓↓↓ + params = {companyId: sessionStorage.getItem('companyId')} + // params = {companyId: this.route.snapshot.queryParams.id} + allFireElements:any = []; //当前 单位/建筑 下的消防要素 + + isShowAttribute:boolean = true; //属性栏 是否显示 默认数据 + isShowProperty:boolean = false //属性栏 是否有东西 + + toggleExpandPanel:boolean = false; //左侧可展开面板展开或关闭 + toggleExpandPanelRight:boolean = false; //右侧可展开面板展开或关闭 + togglePlane:boolean = true; //可展开面板平面图 显隐 + toggleMaterialBank:boolean = false; //可展开面板素材库 显隐 + toggleHandlePlans:boolean = true; //可展开面板处置预案 显隐 + //可展开面板展开或关闭 + toggle () { + this.toggleExpandPanel = !this.toggleExpandPanel + } + //可展开面板展开或关闭 + toggle2 () { + this.toggleExpandPanelRight = !this.toggleExpandPanelRight + } + //可展开面板 平面图 展开或关闭 + togglePlanarGraph () { + this.togglePlane = !this.togglePlane + } + //可展开面板 素材库 展开或关闭 + toggleMaterial () { + this.toggleMaterialBank = !this.toggleMaterialBank + } + //可展开面板 处置预案 展开或关闭 + toggleHandlePlan () { + this.toggleHandlePlans = !this.toggleHandlePlans + } + + sitePlanData:any = []; //总平面图 楼层/区域 数据 + selectingSitePlan:any; //选中的 平面图 楼层/区域 + selectSitePlanIndex:number; //选中的 平面图 楼层/区域 index + + //获取总平面图 + getSitePlan () { + let fireData = this.getFireElements(sessionStorage.getItem('buildingTypeId')) //获取单位下 消防要素 + let planData = this.getSitePlanCompanyData() //获取 单位 数据 + this.http.get('/api/SitePlans',{params:this.params}).subscribe(data=>{ + this.sitePlanData = data + this.selectingSitePlan = this.sitePlanData[0] || {} + this.canvasData.selectStorey = this.sitePlanData[0] || {} //服务中 存一份数据 + this.selectSitePlanIndex = 0 + + Promise.all([fireData,planData]).then((res)=>{ + this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据 + }) + + }) + } + + //获取建筑 楼层/区域 + getBuildingSitePlan (item) { + let params = { buildingId: item.id } + let fireData = this.getFireElements(item.buildingTypes[0].id || '') //获取建筑下 消防要素 + let planData = this.getBuildingData(params) //获取 建筑 数据 + this.http.get('/api/BuildingAreas',{params}).subscribe(data=>{ + this.sitePlanData = data + this.selectingSitePlan = this.sitePlanData[0] || {} + this.canvasData.selectStorey = this.sitePlanData[0] || {} //服务中 存一份数据 + this.selectSitePlanIndex = 0 + + Promise.all([fireData,planData]).then((res)=>{ + this.getBuildingStorey(this.selectingSitePlan) //获取 建筑 楼层数据 + }) + + }) + } + + //根据单位类型获得所有的消防要素 + getFireElements (e) { + let params = {ids:e} + return new Promise ((resolve,reject)=>{ + this.http.get('/api/Companies/FireElements',{params}).subscribe((data:any)=>{ + this.allFireElements = data //所有消防要素 + let other = { + children: [], + computed: true, + id: '', + name: '其他', + order: 999, + parentId: null, + tag: "INPUT", + isLookPattern : true + } + this.allFireElements.push(other) + resolve('success') + }) + }) + } + + //获取 单位 数据 + getSitePlanCompanyData () { + return new Promise ((resolve,reject)=>{ + this.http.get('/api/CompanyData',{params:this.params}).subscribe((data:any)=>{ + this.canvasData.originalcompanyBuildingData = data || {} // 单位原数据 + this.canvasData.originalcompanyBuildingData.data? this.canvasData.originalcompanyBuildingData.data = JSON.parse(this.canvasData.originalcompanyBuildingData.data) : this.canvasData.originalcompanyBuildingData.data = {} + this.canvasData.originalcompanyBuildingData.version? null : this.canvasData.originalcompanyBuildingData.version = "2.0" + this.canvasData.originalcompanyBuildingData.companyId? null : this.canvasData.originalcompanyBuildingData.companyId = sessionStorage.getItem('companyId') + resolve('success') + }) + }) + } + + //获取 平面图 楼层数据 + getSitePlanStorey (e) { + let params = {sitePlanId: e.id} + this.http.get(`/api/SitePlanData`,{params}).subscribe((data:any)=>{ + this.canvasData.originaleveryStoreyData = data || {} // 楼层原数据 + this.canvasData.originaleveryStoreyData.data? this.canvasData.originaleveryStoreyData.data = JSON.parse(this.canvasData.originaleveryStoreyData.data) : this.canvasData.originaleveryStoreyData.data = {} + this.canvasData.originaleveryStoreyData.version? null : this.canvasData.originaleveryStoreyData.version = "2.0" + this.canvasData.originaleveryStoreyData.sitePlanId? null : this.canvasData.originaleveryStoreyData.sitePlanId = e.id || null + this.renovateTreeData() + }) + } + + //获取 建筑 数据 + getBuildingData (e) { + return new Promise ((resolve,reject)=>{ + this.http.get(`/api/BuildingData`,{params:e}).subscribe((data:any)=>{ + this.canvasData.originalcompanyBuildingData = data || {} // 建筑原数据 + this.canvasData.originalcompanyBuildingData.data? this.canvasData.originalcompanyBuildingData.data = JSON.parse(this.canvasData.originalcompanyBuildingData.data) : this.canvasData.originalcompanyBuildingData.data = {} + this.canvasData.originalcompanyBuildingData.version? null : this.canvasData.originalcompanyBuildingData.version = "2.0" + this.canvasData.originalcompanyBuildingData.buildingId? null : this.canvasData.originalcompanyBuildingData.buildingId = e.buildingId + resolve('success') + }) + }) + } + + //获取 建筑 楼层数据 + getBuildingStorey (e) { + let params = {buildingAreaId: e.id} + this.http.get(`/api/BuildingAreaData`,{params}).subscribe((data:any)=>{ + this.canvasData.originaleveryStoreyData = data || {} // 楼层原数据 + this.canvasData.originaleveryStoreyData.data? this.canvasData.originaleveryStoreyData.data = JSON.parse(this.canvasData.originaleveryStoreyData.data) : this.canvasData.originaleveryStoreyData.data = {} + this.canvasData.originaleveryStoreyData.version? null : this.canvasData.originaleveryStoreyData.version = "2.0" + this.canvasData.originaleveryStoreyData.buildingAreaId? null : this.canvasData.originaleveryStoreyData.buildingAreaId = e.id || null + this.renovateTreeData() + }) + } + + //点击选中 平面图 楼层/区域 时 + selectSitePlan (item,index) { + + if (this.selectSitePlanIndex != index) { + this.canvasData.selectPanelPoint = new DisposalNodeData(); + if (this.canvasData.isChange) { //true 数据被改动 + let isTrue = confirm('是否保存当前编辑数据') + if (isTrue) { //先保存数据 在切换 + let isSuccess = this.saveSite()//true的时候 先保存数据 + if (isSuccess != false) { + this.selectingSitePlan = item + this.selectSitePlanIndex = index + this.canvasData.selectStorey = item //服务中 存一份数据 + if (this.checkedBuildingIndex==-1) { //总平面图时 + this.getSitePlanStorey(item) //获取 平面图 楼层数据 + } else { //楼层/区域时 + this.getBuildingStorey(item) //获取 建筑 楼层数据 + } + } + } else { //不保存数据 直接切换 + this.selectingSitePlan = item + this.selectSitePlanIndex = index + this.canvasData.selectStorey = item //服务中 存一份数据 + if (this.checkedBuildingIndex==-1) { //总平面图时 + this.getSitePlanStorey(item) //获取 平面图 楼层数据 + } else { //楼层/区域时 + this.getBuildingStorey(item) //获取 建筑 楼层数据 + } + } + + } else { //false 数据没被改动 + this.selectingSitePlan = item + this.selectSitePlanIndex = index + this.canvasData.selectStorey = item //服务中 存一份数据 + if (this.checkedBuildingIndex==-1) { //总平面图时 + this.getSitePlanStorey(item) //获取 平面图 楼层数据 + } else { //楼层/区域时 + this.getBuildingStorey(item) //获取 建筑 楼层数据 + } + } //if + + } + } + + //新增平面图 楼层/区域 + foundPanel (e) { + e.stopPropagation() + let data = { + isBuilding: this.checkedBuildingIndex==-1? false:true, + Panel: this.beforeOneCheckedBuilding, + order: this.sitePlanData.length? this.sitePlanData[this.sitePlanData.length-1].order+1:0, + } + let dialogRef = this.dialog.open(leftFunctionalDomainComponentPlan,{data}); + dialogRef.afterClosed().subscribe(data=>{ + if (data =='总平面图') { + this.renovateSitePlan() + } else if (data =='建筑') { + this.renovateBuilding() + } + }) + } + + //编辑平面图 楼层/区域 + editPlaneData (e) { + let data = { + isBuilding: this.checkedBuildingIndex==-1? false:true, + Panel: this.beforeOneCheckedBuilding, + buildingData: e, + } + let dialogRef = this.dialog.open(editPlaneFigureComponentPlan,{data}); + dialogRef.afterClosed().subscribe(data=>{ + if (data =='总平面图') { + this.renovateSitePlan() + } else if (data =='建筑') { + this.renovateBuilding() + } + }) + } + + //平面图 楼层/区域 上移 + moveUp (item,index) { + if (index != 0) { + let replaceIndex = this.sitePlanData[index].order + this.sitePlanData[index].order = this.sitePlanData[index-1].order + this.sitePlanData[index-1].order = replaceIndex + if (this.checkedBuildingIndex==-1) { //总平面图 + this.http.put(`/api/SitePlans/${this.sitePlanData[index-1].id}`,this.sitePlanData[index-1]).subscribe(data=>{ + this.http.put(`/api/SitePlans/${this.sitePlanData[index].id}`,this.sitePlanData[index]).subscribe(data=>{ + this.selectSitePlanIndex = this.selectSitePlanIndex-1 + this.renovateSitePlan() + }) + }) + } else { //楼层/区域 + this.http.put(`/api/BuildingAreas/${this.sitePlanData[index-1].id}`,this.sitePlanData[index-1],{params:this.params}).subscribe(data=>{ + this.http.put(`/api/BuildingAreas/${this.sitePlanData[index].id}`,this.sitePlanData[index],{params:this.params}).subscribe(data=>{ + this.selectSitePlanIndex = this.selectSitePlanIndex-1 + this.renovateBuilding() + }) + }) + } + + } //if index + } + + //平面图 楼层/区域 下移 + moveDown (item,index) { + if (index != this.sitePlanData.length-1) { + let replaceIndex = this.sitePlanData[index].order + this.sitePlanData[index].order = this.sitePlanData[index+1].order + this.sitePlanData[index+1].order = replaceIndex + if (this.checkedBuildingIndex==-1) { //总平面图 + this.http.put(`/api/SitePlans/${this.sitePlanData[index+1].id}`,this.sitePlanData[index+1]).subscribe(data=>{ + this.http.put(`/api/SitePlans/${this.sitePlanData[index].id}`,this.sitePlanData[index]).subscribe(data=>{ + this.selectSitePlanIndex = this.selectSitePlanIndex+1 + this.renovateSitePlan() + }) + }) + } else { //楼层/区域 + this.http.put(`/api/BuildingAreas/${this.sitePlanData[index+1].id}`,this.sitePlanData[index+1],{params:this.params}).subscribe(data=>{ + this.http.put(`/api/BuildingAreas/${this.sitePlanData[index].id}`,this.sitePlanData[index],{params:this.params}).subscribe(data=>{ + this.selectSitePlanIndex = this.selectSitePlanIndex+1 + this.renovateBuilding() + }) + }) + } + + } //if index + } + + //旋转底图 + revolveImg (item) { + item.imageAngle==270? item.imageAngle = 0 : item.imageAngle = item.imageAngle+90 + if (this.checkedBuildingIndex==-1) { //总平面图 + this.http.put(`/api/SitePlans/${item.id}`,item).subscribe(data=>{ + let isSuccess = this.renovateSitePlan() + isSuccess.then(res=>{ + this.canvas.refreshBackgroundImage() + }) + }) + } else { //楼层/区域 + this.http.put(`/api/BuildingAreas/${item.id}`,item,{params:this.params}).subscribe(data=>{ + let isSuccess = this.renovateBuilding() + isSuccess.then(res=>{ + this.canvas.refreshBackgroundImage() + }) + }) + } + + } + + //删除 平面图 楼层/区域 + deletePlaneData (item) { + const isDelete = confirm('您确定要删除吗'); + if (isDelete) { + if (this.checkedBuildingIndex==-1) { //总平面图 + let isHave = this.canvasData.allDisposalNode.find(items=>{ return items.sitePlanId === item.id }) + if (isHave == undefined) { + this.http.delete(`/api/SitePlans/${item.id}`).subscribe(data=>{ + this.deleteShareData(item,-1) + }) + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('含有数据节点的楼层不允许删除','确定',config); + } + } else { //楼层/区域 + let isHave = this.canvasData.allDisposalNode.find(items=>{ return items.buildingAreaId === item.id }) + if (isHave == undefined) { + this.http.delete(`/api/BuildingAreas/${item.id}`).subscribe(data=>{ + this.deleteShareData(item,1) + }) + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('含有数据节点的楼层不允许删除','确定',config); + } + } + } + } + + //删除当前 单位/建筑的 共享数据中 已删除data + deleteShareData (e,isCompany) { + this.sitePlanData.forEach((element,index) => { + if (element.id===e.id) { + this.sitePlanData.splice(index,1) + return + } + }); + let data = this.canvasData.originalcompanyBuildingData; + for(let key in data.data){ + if (data.data[key].FloorId === e.id) { //处理 单位/建筑 数据是否归于当前楼层下 + delete data.data[key] + } + } + let newData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData)); + newData.data = JSON.stringify(newData.data) // 转换JSON 数据格式 + this.selectingSitePlan = this.sitePlanData[0] || {} + this.canvasData.selectStorey = this.sitePlanData[0] || {} //服务中 存一份数据 + this.selectSitePlanIndex = 0 + if (isCompany===-1) { + this.http.post("/api/CompanyData",newData).subscribe(data => {}) + this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据 + } else { + this.http.post("/api/BuildingData",newData,{params:this.params}).subscribe(data => {}) + this.getBuildingStorey(this.selectingSitePlan) //获取 建筑 楼层数据 + } + } + + //复制图层 平面图 楼层/区域 + duplicateLayer (item) { + if (this.checkedBuildingIndex==-1) { //总平面图 + item.id = "" + item.modifiedTime = new Date() + item.name = item.name + '(副本)' + item.order = this.sitePlanData[this.sitePlanData.length-1].order+1 + this.http.post('/api/SitePlans',item).subscribe((data:any)=>{ + let newData = { + version: this.canvasData.originaleveryStoreyData.version || "2.0", + id: "", + data: JSON.stringify( JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData.data)) ) || null, + sitePlanId: data.id + } + this.http.post('/api/SitePlanData',newData,{params:this.params}).subscribe(data=>{ + this.renovateSitePlan() + }) + + }) + } else { //楼层/区域 + item.id = "" + item.modifiedTime = new Date() + item.name = item.name + '(副本)' + item.order = this.sitePlanData[this.sitePlanData.length-1].order+1 + this.http.post('/api/BuildingAreas',item,{params:this.params}).subscribe((data:any)=>{ + let newData = { + version: this.canvasData.originaleveryStoreyData.version || "2.0", + id: "", + data: JSON.stringify( JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData.data)) ) || null, + buildingAreaId: data.id + } + this.http.post('/api/BuildingAreaData',newData,{params:this.params}).subscribe(data=>{ + this.renovateBuilding() + }) + + }) + } + } + + //平面图 楼层/区域 替换底图 + replaceBaseMap (e,item) { + e.stopPropagation(); + let file = e.target.files[0] || null //获取上传的文件 + let fileSize = file.size || null //上传文件的总大小 + let maxSize = 5 * 1024 * 1024 //5MB一个分片 + + if (file && fileSize<=maxSize) { //上传文件<=5MB时 + let formData = new FormData() + formData.append("file",file) + this.http.post(`/api/Objects/WebPlan2D/${sessionStorage.getItem('companyId')}`,formData).subscribe((data:any)=>{ + this.renovateBaseMap(data.objectName,item) + }) + } else { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('上传底图需小于5MB','确定',config); + } + } + + //封装 替换底图 function + renovateBaseMap (e,item) { + item.imageUrl = '/api/Objects/WebPlan2D/' + e + if (this.checkedBuildingIndex ==-1) { //总平面图 + this.http.put(`/api/SitePlans/${item.id}`,item).subscribe(data=>{ + let isSuccess = this.renovateSitePlan() + isSuccess.then(res=>{ + this.canvas.refreshBackgroundImage() + }) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('上传底图成功','确定',config); + }) + } else { //楼层/区域 + this.http.put(`/api/BuildingAreas/${item.id}`,item,{params:this.params}).subscribe(data=>{ + let isSuccess = this.renovateBuilding() + isSuccess.then(res=>{ + this.canvas.refreshBackgroundImage() + }) + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('上传底图成功','确定',config); + }) + } + } + + //封装 刷新总平面图 数据 + renovateSitePlan () { + return new Promise ((resolve,reject)=>{ + this.http.get('/api/SitePlans',{params:this.params}).subscribe(data=>{ + this.sitePlanData = data + this.selectingSitePlan = this.sitePlanData[this.selectSitePlanIndex] + this.canvasData.selectStorey = this.sitePlanData[this.selectSitePlanIndex] //服务中 存一份数据 + this.canvasData.originaleveryStoreyData.sitePlanId? null : this.canvasData.originaleveryStoreyData.sitePlanId = this.selectingSitePlan.id || null + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('数据更新成功','确定',config); + resolve('success') + }) + }) + } + + //封装 刷新 楼层/区域 数据 + renovateBuilding () { + let params = { + buildingId: this.beforeOneCheckedBuilding.id + } + return new Promise ((resolve,reject)=>{ + this.http.get('/api/BuildingAreas',{params}).subscribe(data=>{ + this.sitePlanData = data + this.selectingSitePlan = this.sitePlanData[this.selectSitePlanIndex] + this.canvasData.selectStorey = this.sitePlanData[this.selectSitePlanIndex] //服务中 存一份数据 + this.canvasData.originaleveryStoreyData.buildingAreaId? null : this.canvasData.originaleveryStoreyData.buildingAreaId = this.selectingSitePlan.id || null + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('数据更新成功','确定',config); + resolve('success') + }) + }) + } + + allLibrary:any = []; //所有素材库 + 素材 + selectLibrary:any; //选中的素材库 + selectImage:any; //选中的素材库图片 + selectImageIndex:number; //选中的素材库图片index + + //获取素材库 + getAllLibrary (type:string='input') { + this.http.get(`/api/AssetLibraries?tag=${type}`).subscribe((data:any)=>{ + data.forEach(element => { + element.images = [] + }); + this.allLibrary = data + this.selectImageIndex = -1 + this.canvas.cancelPaint() + }) + } + + //素材库展开面板展开时 + opened (e) { + if (!e.images.length) { //当前素材库没加载素材时 + this.http.get(`/api/Assets?libraryId=${e.id}`).subscribe((data:any)=>{ + e.images = data + }) + } + } + + //点击选中素材库图片时 + selectImg (item,items,index) { + this.selectLibrary = item.name + this.selectImage = items + this.selectImageIndex = index + this.canvasData.selectTemplateData = items + this.canvas.beginPaint() + } + + + + //处置预案 + allFirePlan:any = []; //所有灾情 + selectDisposalNode:string = ''; //当前点击tree节点 css选中样式 + + //获取所有灾情 + getAllFirePlan () { + let params = {componentId: sessionStorage.getItem('planId')} + this.http.get('/api/Disasters',{params:params}).subscribe((data:any)=>{ + if (!data.length) { //该 单位没有灾情时 + let msg = { + name: '灾情', + modifiedTime: new Date(), + planComponentId: sessionStorage.getItem('planId') + } + this.http.post('/api/Disasters',msg).subscribe(data=>{ + this.allFirePlan.push(data) + let params = {disasterId: this.allFirePlan[0].id || ''} + this.http.get('/api/DisposalNodes',{params:params}).subscribe(data=>{ //所有处置节点 + this.canvasData.allDisposalNode = data + }) + }) + } else { //单位 有灾情时 + this.allFirePlan = data + let params = {disasterId: this.allFirePlan[0].id || ''} + this.http.get('/api/DisposalNodes',{params:params}).subscribe(data=>{ //所有处置节点 + this.canvasData.allDisposalNode = data + }) + } + }) + } + + //获取所有处置节点 + getDisposalNode () { + this.selectDisposalNode = '' + let params = {disasterId: this.allFirePlan[0].id || ''} + this.http.get('/api/DisasterData/Markers',{params:params}).subscribe(data=>{ //灾情标签信息 + this.canvasData.allNodeMarkers = data + this.mateFireForce() + }) + this.http.get('/api/DisposalNodes',{params:params}).subscribe(data=>{ //处置节点 + this.canvasData.allDisposalNode = data + this.handleHybridTree() + }) + } + + treeData:any = []; //渲染tree处理完成数据 + defaultExpandedKeys:any = []; //首次渲染 tree展开状态 + //处理 节点 Tree数据 + handleHybridTree () { + this.defaultExpandedKeys = [] + let treeData = [] + let data = JSON.parse(JSON.stringify( this.canvasData.allDisposalNode || [] )) + data.forEach(element => { + this.defaultExpandedKeys.push(element.id) + element.title = element.name //name + element.key = element.id //id + element.children = [] //children + if (element.sitePlanId || element.buildingAreaId) { //是数据节点 + element.isLeaf = true + element.isDataNode = true + } else { //不是数据节点 + element.isLeaf = false + element.isDataNode = false + } + data.forEach(item=>{ + item.parentId === element.id? element.children.push(item) : null + }) + }); + data.forEach(element=>{ + !element.parentId? treeData.push(element) : null + }) + this.treeData = [...treeData] + this.defaultExpandedKeys = [...this.defaultExpandedKeys] + } + + //刷新 treeData 保存已展开节点 + refurbishTreeData () { + this.defaultExpandedKeys = [] + let params = {disasterId: this.allFirePlan[0].id || ''} + this.http.get('/api/DisposalNodes',{params:params}).subscribe(nodeData=>{ //处置节点 + this.canvasData.allDisposalNode = nodeData + let oldTreeData = this.nzTreeComponent.getExpandedNodeList() + oldTreeData.forEach(item=>{ + this.defaultExpandedKeys.push(item.key) + }) + let treeData = [] + let data = JSON.parse(JSON.stringify( this.canvasData.allDisposalNode || [] )) + data.forEach(element => { + element.title = element.name //name + element.key = element.id //id + element.children = [] //children + if (element.sitePlanId || element.buildingAreaId) { //是数据节点 + element.isLeaf = true + element.isDataNode = true + } else { //不是数据节点 + element.isLeaf = false + element.isDataNode = false + } + data.forEach(item=>{ + item.parentId === element.id? element.children.push(item) : null + }) + }); + data.forEach(element=>{ + !element.parentId? treeData.push(element) : null + }) + this.treeData = [...treeData] + this.defaultExpandedKeys = [...this.defaultExpandedKeys] + }) + } + + sitePlanIcon = {fire:0,force:0} // 总平面图 火源/力量 图标 是否展示 + + //刷新 建筑楼层 匹配 火源/力量 图标 + mateFireForce () { + let data = this.canvasData.allNodeMarkers.markers || {} + for(let key in data){ //遍历 火/力量 图标 + this.sitePlanData.forEach(element => { //楼层 + if (element.id==key) { // 相匹配时 + data[key].fireCount != 0? element.fire=1 : element.fire=0 + data[key].forceCount != 0? element.force=1 : element.force=0 + } + }); + this.allBuildings.forEach(element => { //建筑 + if (element.id==key) { // 相匹配时 + data[key].fireCount != 0? element.fire=1 : element.fire=0 + data[key].forceCount != 0? element.force=1 : element.force=0 + } + }); + if (this.params.companyId==key) { //总平面图时 + data[key].fireCount != 0? this.sitePlanIcon.fire=1 : this.sitePlanIcon.fire=0 + data[key].forceCount != 0? this.sitePlanIcon.force=1 : this.sitePlanIcon.force=0 + } + } + + let buildingMSG = this.canvasData.allNodeMarkers.highlightMarkers || {} + for (let key in buildingMSG) { + if (key === this.canvasData.selectPanelPoint.DisposalNodeId) { + for (let keys in buildingMSG[key]) { + this.sitePlanData.forEach(element => { //楼层 + if (element.id === keys) { + buildingMSG[key][keys].fireCount != 0? element.fire=2 : null + buildingMSG[key][keys].forceCount != 0? element.force=2 : null + } + }); + this.allBuildings.forEach(element => { //建筑 + if (element.id === keys) { // 相匹配时 + buildingMSG[key][keys].fireCount != 0? element.fire=2 : null + buildingMSG[key][keys].forceCount != 0? element.force=2 : null + } + }); + if (this.params.companyId === keys) { //总平面图时 + buildingMSG[key][keys].fireCount != 0? this.sitePlanIcon.fire=2 : null + buildingMSG[key][keys].forceCount != 0? this.sitePlanIcon.force=2 : null + } + } + } + } + } + + // 切换 基本信息时 刷新 删除 建筑楼层 自定义属性 + mateDeleteCustomize () { + this.defaultExpandedKeys = [] + this.sitePlanIcon = {fire:0,force:0} + this.sitePlanData.forEach(element => { //楼层 + delete element.fire + delete element.force + }); + this.allBuildings.forEach(element => { //建筑 + delete element.fire + delete element.force + }); + } + + //计算差异 + countValue (e) { + e.stopPropagation() + let params = {disasterId: this.allFirePlan[0].id || ''} + this.http.get('/api/DisasterData/Diffs',{params:params}).subscribe(data=>{ + this.canvasData.allNodeMarkers = data + this.mateFireForce() + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('计算差异完成','确定',config); + }) + } + + //新建 处置预案 节点 + addPanelPoint (e,item,treeData) { + e.stopPropagation() + let order + if (item) { + item.children.length? order = item.children[item.children.length-1].order+1 : order = 0 + } else { + treeData.length? order = treeData[treeData.length-1].order+1 : order = 0 + } + let data = { + name: '', + level: item? 1 : 0, + order: order, + description: '', + disasterId: this.allFirePlan[0].id || '', + parentId: item? item.id : null, + planComponentId: sessionStorage.getItem('planId') || '', + } + let dialogRef = this.dialog.open(addDisposalNodeComponentPlan,{data}); + dialogRef.afterClosed().subscribe(data=>{ + if (data) { this.refurbishTreeData() } + }) + } + + //编辑 处置预案 节点 + editPanelPoint (e,item) { + e.stopPropagation() + let data = item.origin + let dialogRef = this.dialog.open(editDisposalNodeComponentPlan,{data}); + dialogRef.afterClosed().subscribe(data=>{ + if (data) { + item.title = data + this.canvasData.allDisposalNode.forEach(element => { element.id === item.key? element.name=data : null }); + } + }) + } + + //复制 处置预案 节点 + copyPanelPoint (e,item,treeData) { + e.stopPropagation() + if (confirm(`确定要复制 ${item.title} ?`)) { + let params = {id: item.origin.id} + let order + if (item.level==0) { + treeData.length? order = treeData[treeData.length-1].order+1 : order = 0 + } else { + let parent = item.getParentNode() //获取父节点 + parent.origin.children.length? order = parent.origin.children[parent.origin.children.length-1].order+1 : order = 0 + } + let data = { + name: item.title + '(副本)', + level: item.level, + order: order, + description: '', + disasterId: item.origin.disasterId || '', + parentId: item.origin.parentId || null, + planComponentId: item.origin.planComponentId || '', + } + this.http.post('/api/DisposalNodes/Clone',data,{params:params}).subscribe(data=>{ + this.refurbishTreeData() + }) + } //isTrue + } + + //删除 处置预案 节点 + deletePanelPoint (e,item) { + e.stopPropagation() + if (confirm(`确定要删除 ${item.name} ?`)) { + this.http.delete(`/api/DisposalNodes/${item.id}`).subscribe(data=>{ + this.refurbishTreeData() + }) + } + } + + //点击 处置Tree节点 + selectanelPoint (e) { + if (!e.buildingAreaId && !e.sitePlanId) { //当前节点 不是 数据节点 时 + let msg = this.canvasData.findDisposalNode(e.id) + this.canvasData.selectPanelPointBaseData = msg + this.selectDisposalNode == msg.id? this.selectDisposalNode = '' : this.selectDisposalNode = msg.id //选中 节点 + + } else if (e.buildingAreaId || e.sitePlanId) { //当前节点 是 数据节点 时 + let msg = this.canvasData.findDisposalNode(e.parentId) + this.canvasData.selectPanelPointBaseData = msg + this.selectDisposalNode = e.parentId //选中 节点 + + if (this.canvasData.selectPanelPoint.DisposalNodeId != e.id) { //选择节点 不是当前节点时 + let params = {nodeId: e.id} + let parameter = { //查询 节点 对应 建筑/楼层 index,id + buildingIndex: e.sitePlanId? -1 : this.allBuildings.findIndex(item=>{ return item.id===e.buildingId }), //总平面图/建筑 index + storeyId: e.sitePlanId? e.sitePlanId : e.buildingAreaId, //楼层id + } + this.http.get('/api/DisposalNodeData',{params:params}).subscribe(data=>{ + this.canvasData.selectPanelPoint = this.canvasData.deserialize(JSON.stringify(data || new DisposalNodeData())) //选择 当前 节点 + this.canvasData.selectPanelPoint.Data = this.canvasData.deserialize(this.canvasData.selectPanelPoint.Data) + this.seekPanelPoint(parameter) + }) + } //if + + } //else if + } + + //查找 数据节点 对应 建筑/楼层 + seekPanelPoint (paramsData) { + this.checkedBuildingIndex = paramsData.buildingIndex + if (paramsData.buildingIndex ==-1) { //总平面图时 + this.beforeOneCheckedBuilding={name:"总平面图"} + let fireData = this.getFireElements(sessionStorage.getItem('buildingTypeId')) //获取单位下 消防要素 + let planData = this.getSitePlanCompanyData() //获取 单位 数据 + this.http.get('/api/SitePlans',{params:this.params}).subscribe(data=>{ + this.sitePlanData = data + let index = this.sitePlanData.findIndex(item=>{ return item.id===paramsData.storeyId }) + this.selectingSitePlan = this.sitePlanData[index] || {} + this.canvasData.selectStorey = this.sitePlanData[index] || {} //服务中 存一份数据 + this.selectSitePlanIndex = index + + Promise.all([fireData,planData]).then((res)=>{ + this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据 + }) + }) //get + } else { //建筑时 + this.beforeOneCheckedBuilding=this.allBuildings[paramsData.buildingIndex] + let params = { buildingId: this.beforeOneCheckedBuilding.id } + let fireData = this.getFireElements(this.beforeOneCheckedBuilding.buildingTypes[0].id || '') //获取建筑下 消防要素 + let planData = this.getBuildingData(params) //获取 建筑 数据 + this.http.get('/api/BuildingAreas',{params}).subscribe(data=>{ + this.sitePlanData = data + let index = this.sitePlanData.findIndex(item=>{ return item.id===paramsData.storeyId }) + this.selectingSitePlan = this.sitePlanData[index] || {} + this.canvasData.selectStorey = this.sitePlanData[index] || {} //服务中 存一份数据 + this.selectSitePlanIndex = index + + Promise.all([fireData,planData]).then((res)=>{ + this.getBuildingStorey(this.selectingSitePlan) //获取 建筑 楼层数据 + }) + }) //get + } + } + + + +} + + + +//创建建筑 +@Component({ + selector: 'app-createBuilding-plan', + templateUrl: './createBuilding.html', + styleUrls: ['./collection-tools.component.scss'] +}) +export class CreateBuildingPlan { + + constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) { } + + allBuildingType:any//所有的建筑类型 + selected:any; //选中的建筑 + ngOnInit(): void { + this.getAllBuildingType() + } + + //获得所有单位类型 + getAllBuildingType(){ + this.http.get("/api/BuildingTypes/Simple").subscribe(data=>{ + this.allBuildingType = data + }) + } + + //创建建筑功能分区 + onSubmit (e) { + let companyId = sessionStorage.getItem("companyId") + let lastBuildingOrder = this.data.allBuildings.length != 0 ? this.data.allBuildings[this.data.allBuildings.length - 1].order + 1 : 0 + let data = + { + id: "", + name: e.propertyName, + order: lastBuildingOrder , + enabled: true, + companyId: companyId, + buildingTypes: [ + { + id: e.buildingId, + name: "" + } + ] + } + this.http.post("/api/Buildings",data,{ + params:{ + companyId : this.data.companyId + } + }).subscribe(data=>{ + this.dialogRef.close("创建成功"); + },err=>{ + this.dialogRef.close("创建失败"); + }) + } +} + +//编辑建筑 +@Component({ + selector: 'app-editBuilding-plan', + templateUrl: './editBuilding.html', + styleUrls: ['./collection-tools.component.scss'] +}) +export class EditBuildingPlan { + + constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) { } + + defaultName:String = this.data.item.name//默认建筑名称 + defaultBuildingType:String = this.data.item.buildingTypes[0].id//默认建筑类型 + allBuildingType:any//所有的建筑类型 + + ngOnInit(): void { + this.getAllBuildingType() + } + + getAllBuildingType(){ + this.http.get("/api/BuildingTypes/Simple").subscribe(data=>{ + this.allBuildingType = data + }) + } + + //编辑建筑信息 + onSubmit (e) { + let companyId = sessionStorage.getItem("companyId") + let data = + { + id: this.data.item.id, + name: e.propertyName, + order: this.data.item.order, + enabled: true, + companyId: companyId, + buildingTypes: [ + { + id: e.buildingId, + name: "" + } + ] + } + this.http.put(`/api/Buildings/${this.data.item.id}`,data,{ + params:{ + id:this.data.item.id, + companyId:companyId + } + }).subscribe(data=>{ + this.dialogRef.close("修改成功"); + },err=>{ + this.dialogRef.close("修改失败"); + }) + } +} + +//查看图片大图 +@Component({ + selector: 'viewdetails-plan', + templateUrl: './viewdetails.html', + styleUrls: ['./collection-tools.component.scss'] +}) +export class ViewDetailsPlan { + // myControl = new FormControl(); + //注入MatDialogRef,可以用来关闭对话框 + //要访问对话框组件中的数据,必须使用MAT_DIALOG_DATA注入令牌 + constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,private element: ElementRef) {} + imagesArr = this.data.imagesArr + onNoClick(): void { + this.dialogRef.close(); + } + ngOnInit(): void { + setTimeout(() => { + var mySwiper = new Swiper('.swiper-container',{ + loop: false, + initialSlide :this.data.index,//默认索引 + // 如果需要前进后退按钮 + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev', + } + //其他设置 + }); + }, 0); + } + closeDialog(){ + this.dialogRef.close(); + } + count = 10 + zoomimg(e) { + if(this.count != 1 || e.wheelDelta >= 120){ + if(e.wheelDelta >= 120){ + this.count++ + }else{ + this.count-- + } + } + e.srcElement.style.zoom = this.count + '0%' + e.srcElement.style.maxWidth = null + e.srcElement.style.maxHeight = null + } + +} diff --git a/src/app/ui/collection-tools-plan/createBuilding.html b/src/app/ui/collection-tools-plan/createBuilding.html new file mode 100644 index 0000000..16fdd7b --- /dev/null +++ b/src/app/ui/collection-tools-plan/createBuilding.html @@ -0,0 +1,28 @@ +
新增建筑
+
+
+ +
+ + + +
+
+ + + + {{item.name}} + + + +
+
+ + +
+
+
\ No newline at end of file diff --git a/src/app/ui/collection-tools-plan/editBuilding.html b/src/app/ui/collection-tools-plan/editBuilding.html new file mode 100644 index 0000000..433316d --- /dev/null +++ b/src/app/ui/collection-tools-plan/editBuilding.html @@ -0,0 +1,23 @@ +
编辑建筑
+
+
+
+ + + +
+
+ + + + {{item.name}} + + + +
+
+ + +
+
+
\ No newline at end of file diff --git a/src/app/ui/collection-tools-plan/editDisposalNode.html b/src/app/ui/collection-tools-plan/editDisposalNode.html new file mode 100644 index 0000000..40b2270 --- /dev/null +++ b/src/app/ui/collection-tools-plan/editDisposalNode.html @@ -0,0 +1,23 @@ +
+
+ +
+ +
+ +
+ + + +
+ +
+ + +
+ +
+ +
\ No newline at end of file diff --git a/src/app/ui/collection-tools-plan/editPlaneFigure.html b/src/app/ui/collection-tools-plan/editPlaneFigure.html new file mode 100644 index 0000000..a0f8016 --- /dev/null +++ b/src/app/ui/collection-tools-plan/editPlaneFigure.html @@ -0,0 +1,39 @@ +
+ +
+ + +
+ +
+ +
+ + + +
+ +
+ 是否为避难层 +
+ +
+ + + +
+ +
+ +
+ +
+ + +
+ +
+ +
\ No newline at end of file diff --git a/src/app/ui/collection-tools-plan/leftFunctionalDomain.ts b/src/app/ui/collection-tools-plan/leftFunctionalDomain.ts new file mode 100644 index 0000000..598e178 --- /dev/null +++ b/src/app/ui/collection-tools-plan/leftFunctionalDomain.ts @@ -0,0 +1,180 @@ +import { Component, OnInit, Inject } from '@angular/core'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; + +@Component({ + selector: 'app-leftFunctionalDomain-plan', + templateUrl: './addPlaneFigure.html', + styleUrls: ['./panel.scss'] +}) +export class leftFunctionalDomainComponentPlan implements OnInit { + + constructor( + private http:HttpClient, + public dialog: MatDialog, + public snackBar: MatSnackBar, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data) { } + + ngOnInit(): void { + + } + + params = {companyId: sessionStorage.getItem('companyId')} + checked:boolean = false;//是否为避难层 + + //提交表单创建平面图 + onSubmit (e) { + if (!this.data.isBuilding) { //总平面图 创建平面图 + let data = { + companyId: sessionStorage.getItem('companyId'), + name: e.name, + order: this.data.order, + area:e.area, + details:e.details, + enabled: true, + modifiedTime: new Date(), + } + this.http.post('/api/SitePlans',data).subscribe(data=>{ + this.dialogRef.close('总平面图'); + }) + } else { //建筑 创建楼层/区域 + let data = { + isRefugeStorey: e.isRefugeStorey, + buildingId: this.data.Panel.id, + name: e.name, + order: this.data.order, + area:e.area, + details:e.details, + enabled: true, + modifiedTime: new Date(), + } + this.http.post('/api/BuildingAreas',data,{params:this.params}).subscribe(data=>{ + this.dialogRef.close('建筑'); + }) + } + } + + + +} + +//编辑平面图 楼层/区域 +@Component({ + selector: 'app-editPlaneFigure-plan', + templateUrl: './editPlaneFigure.html', + styleUrls: ['./panel.scss'] +}) +export class editPlaneFigureComponentPlan implements OnInit { + + constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) { } + + ngOnInit(): void { + this.name = this.data.buildingData.name || '' + this.checked = this.data.buildingData.isRefugeStorey || false + this.area = this.data.buildingData.area || 0 + this.details = this.data.buildingData.details || '' + } + + params = {companyId: sessionStorage.getItem('companyId')} + name:any; //name + checked:boolean = false;//是否为避难层 + area:number; //面积 + details:string; //详情 + + //提交表单修改平面图 + onSubmit (e) { + if (!this.data.isBuilding) { //总平面图 修改平面图 + let data = { + companyId: sessionStorage.getItem('companyId'), + id: this.data.buildingData.id, + name: e.name, + cadUrl: this.data.buildingData.cadUrl, + imageUrl: this.data.buildingData.imageUrl, + imageAngle: this.data.buildingData.imageAngle, + order: this.data.buildingData.order, + area:e.area, + details:e.details, + enabled: this.data.buildingData.enabled, + modifiedTime: new Date(), + } + this.http.put(`/api/SitePlans/${this.data.buildingData.id}`,data).subscribe(data=>{ + this.dialogRef.close('总平面图'); + }) + } else { //建筑 修改楼层/区域 + let data = { + isRefugeStorey: e.isRefugeStorey, + buildingId: this.data.Panel.id, + id: this.data.buildingData.id, + name: e.name, + cadUrl: this.data.buildingData.cadUrl, + imageUrl: this.data.buildingData.imageUrl, + imageAngle: this.data.buildingData.imageAngle, + order: this.data.buildingData.order, + area:e.area, + details:e.details, + enabled: this.data.buildingData.enabled, + modifiedTime: new Date(), + } + this.http.put(`/api/BuildingAreas/${this.data.buildingData.id}`,data,{params:this.params}).subscribe(data=>{ + this.dialogRef.close('建筑'); + }) + } + } + + + +} + + + +//创建 处置预案 节点 +@Component({ + selector: 'app-addDisposalNode-plan', + templateUrl: './addDisposalNode.html', + styleUrls: ['./panel.scss'] +}) +export class addDisposalNodeComponentPlan implements OnInit { + + constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) { } + + ngOnInit(): void { + } + + //提交表单 + onSubmit (e) { + this.data.name = e.name + this.http.post('/api/DisposalNodes',this.data).subscribe(data=>{ + this.dialogRef.close('success'); + }) + } + +} + + + +//编辑 处置预案 节点 +@Component({ + selector: 'app-editDisposalNode-plan', + templateUrl: './editDisposalNode.html', + styleUrls: ['./panel.scss'] +}) +export class editDisposalNodeComponentPlan implements OnInit { + + constructor(private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data) { } + + ngOnInit(): void { + this.nodeName = JSON.parse(JSON.stringify( this.data.name || '' )) + } + nodeName:string; + + //提交表单 + onSubmit (e) { + this.data.name = e.name + this.http.put(`/api/DisposalNodes/${this.data.id}`,this.data).subscribe(data=>{ + this.dialogRef.close(e.name); + }) + } + +} \ No newline at end of file diff --git a/src/app/ui/collection-tools-plan/panel.scss b/src/app/ui/collection-tools-plan/panel.scss new file mode 100644 index 0000000..f0ae073 --- /dev/null +++ b/src/app/ui/collection-tools-plan/panel.scss @@ -0,0 +1,291 @@ +.matIcons { + color: #8E909F; +} + + + +//平面图 素材库 公共样式 头部 +.planarGraphHeader{ + height: 35px; + min-height: 35px; + cursor: pointer; + display: flex; + flex-direction: row; + align-items: center; + padding: 0 24px; + border-radius: 5px; + font-family: Roboto, "Helvetica Neue", sans-serif; + font-size: 15px; + font-weight: 400; + color: #000; + background: linear-gradient(to top,#cdced1,#FFF); +} +//平面图头部字体图标样式 +.hover { + width: 18px; + height: 18px; + margin-left: 90px; + border: 1px solid #999; + border-radius: 3px; + .mat-icon {font-size: 18px; color: #999;} +} +.hover:hover { + background-color: #4DA5FA; + .mat-icon {color: #fff;} +} + +//平面图 +.sitePlanContent { + position: relative; + width: 100%; + height: 35px; + line-height: 35px; + box-sizing: border-box; + padding: 0 10px 0 25px; + .mat-icon { + font-size: 20px; + } +} + +//火源/力量 图标 +.fireForce { + display: block; + float: right; + margin: 8px 5px 0 0; + width: 40px; + height: 20px; + line-height: 20px; + text-align: center; + position: relative; + overflow: hidden; + img{ + width: 20px; + height: 20px; + } +} +//替换底图 inputfile +.a-upload { + display: block; + float: right; + margin: 8px 18px 0 0; + width: 20px; + height: 20px; + line-height: 20px; + text-align: center; + position: relative; + overflow: hidden; + input { + position: absolute; + width: 20px; + height: 20px; + left: 0; + top: 0; + opacity: 0; + } +} +.a-upload:hover { + .mat-icon { + color: #fff; + } +} +//上传底图 inputfile +#a-uploadImg { + display: block; + width: 300px; + height: 170px; + position: fixed; + top: 40%; + left: 48%; + overflow: hidden; + border-radius: 5px; + border: 1px solid #999; + z-index: 999; + input { + position: absolute; + width: 300px; + height: 170px; + left: 0; + top: 0; + opacity: 0; + } + img { + width: 100%; + height: auto; + } +} +#a-uploadImg:hover { + border: 5px solid skyblue; +} + +//hover时显示右边操作栏 +.sitePlanContent:hover { + #rightOperate { + display: block; + } +} +//右边操作栏 +#rightOperate{ + width: 50px; + height: 100px; + position: absolute; + top: -32px; + right: -48px; + z-index: 99999; + border-radius: 0 100px 100px 0; + background-color: #F0F4F7; + // #F0F4F7 cdced1 + display: none; + .functionButton { + height: 25%; + line-height: 25px; + } + .bigFunctionIcon { + font-size: 24px; + } + .functionIcon { + color: #999; + } + .functionIcon:hover { + color: #4DA5FA; + } +} + +//处置预案 素材库 公用div +.publiclBankPlan { + flex: 1; + display: flex; + flex-direction: column; + overflow: hidden; + padding-bottom: 10px; + // border-top: 1px dashed #999; +} + + + +// 基本信息/想定作业 切换 +.scenarioAssignment { + overflow-y: auto; +} +.selectEditMode { + flex: 1; + display: flex; + flex-direction: column; + overflow: hidden; +} +.materialBankDIV{ + flex: 1; + overflow-x: hidden; + overflow-y: auto; +} +// 基本信息/想定作业 切换 +//处置预案 +#terrNodePublic { + height: 35px; + line-height: 35px; + display: flex; + .textNode {flex: 1;} +} +//字体图标 +.planIconDiv { + display: inline-block; + .mat-icon{ + font-size: 20px; + width: 20px; + height: 20px; + color: #666; + margin-right: 3px; + } +} + + + +.mat-expansion-panel-header { + height: 40px !important; +} +//素材库溢出隐藏 +#materialBank { + margin: 1px 0; +} +//素材库图片flex +#panelLibrary .text{ + box-sizing: border-box; + margin-left: 10px; +} +.panelLibraryFlex { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-between; /* 水平居中 */ + .imgBox { + width: 70px; + height: 100px; + display: inline-block; + text-align: center; + border-radius: 3px; + margin: 5px 0; + img { + width: 70px; + height: auto; + max-height: 70px; + cursor:pointer; + } + p { + font-size: 12px; + cursor:pointer; + } + } +} + +//文本溢出 +.overflowText { + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} +// 楼层/区域 是避难层时 +.isRefugeStorey { + color: #fff; + background-color: rgb(238, 186, 186); +} +//选中平面图时 +.selectSitePlan { + color: #fff; + background-color: #6BC2FF; +} +//选中素材库图片时 +.selectImg { + color: #fff; + background-color: #4DA5FA; +} +//选中 处置节点时 +.selectanelPoint { + background-color: #F4C235; +} + + + +//左侧功能区弹出框样式 +.keyMargin { + width: 100%; + margin: 5px 0; + .mat-form-field { + width: 100%; + } +} +.submitBottom { + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: space-between; /* 水平居中 */ +} +.functionalDomainContent { + width: 300px; + height: 100%; + textarea { + border-radius: 5px; + border: 1px solid #999; + width: 100%; + height: 120px; + resize:none; + } +} diff --git a/src/app/ui/collection-tools-plan/save.ts b/src/app/ui/collection-tools-plan/save.ts new file mode 100644 index 0000000..644deab --- /dev/null +++ b/src/app/ui/collection-tools-plan/save.ts @@ -0,0 +1,301 @@ +import { Component, OnInit, Inject } from '@angular/core'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; +import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; +import {CanvasShareDataService,DisposalNodeData} from '../../canvas-share-data.service' //引入服务 +// 保存想定作业第一个弹窗 +@Component({ + selector: 'dialog-overview-example-dialog', + templateUrl: 'saveOne.html', + styleUrls: ['./collection-tools.component.scss'] +}) +export class saveOneDialogPlan { + + constructor( + private http:HttpClient, + public dialog: MatDialog, + public snackBar: MatSnackBar, + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data) {} + + onNoClick(): void { + this.dialogRef.close() + } + allDisposalNode = this.data.allDisposalNode + + saveType(type){ + this.dialogRef.close() + const dialogRef = this.dialog.open(saveTwoDialogPlan, { + data: {type: type, + allDisposalNode: this.data.allDisposalNode, + selectedBuildingData:this.data.selectedBuildingData, + selectedSiteData:this.data.selectedSiteData, + siteOrbuilding:this.data.siteOrbuilding, + disasterId:this.data.disasterId} + }); + dialogRef.afterClosed().subscribe(result => { + }); + } + +} + + // 保存想定作业第二个弹窗 +@Component({ + selector: 'dialog-overview-example-dialog', + templateUrl: 'saveTwo.html', + styleUrls: ['./collection-tools.component.scss'] +}) +export class saveTwoDialogPlan { + + constructor( + private http:HttpClient, + public dialogRef: MatDialogRef, + public canvasData: CanvasShareDataService, + public snackBar: MatSnackBar, + @Inject(MAT_DIALOG_DATA) public data) {} + + type = this.data.type + allDisposalNode = this.data.allDisposalNode + allPlanDisposalNode = [] + allRootDisposalNode = [{name:"根节点",id:null}] + allDisposalNodeChild = [] + ngOnInit(): void { + //所有非数据节点 + this.allDisposalNode.forEach(item => { + if(!item.sitePlanId && !item.buildingAreaId){ + this.allPlanDisposalNode.push(item) + } + }) + + //所有一级节点 + this.allDisposalNode.forEach(item => { + if(!item.parentId){ + this.allRootDisposalNode.push(item) + } + }) + this.allDisposalNodeChild = JSON.parse(JSON.stringify(this.allDisposalNode)) + this.allDisposalNodeChild.forEach(item => { + item.children = [] + this.allDisposalNodeChild.forEach(i => { + if(i.parentId == item.id){ + item.children.push(i) + } + }) + }) + // console.log(this.nodeItem.id) + } + onNoClick(): void { + this.dialogRef.close(); + } + nodeItem + itemChildNum = 0 //点击处置节点子数据节点的数量 + clickNode(item){ + console.log(item) + this.nodeItem = item + this.allDisposalNodeChild.forEach(item => { + if(item.id == this.nodeItem.id){ + this.itemChildNum = item.children.length + } + }) + } + + selectedBuildingData = this.data.selectedBuildingData + selectedSiteData = this.data.selectedSiteData + onSubmit(value,type){ + // console.log(type) + let name = this.selectedBuildingData.name + '-' + this.selectedSiteData.name + //如果保存到已有节点 + var postdata = { + id: "", + name: name, + level: 0, + order: this.itemChildNum, + description: "", + notes: "", + weather: null, + airTemperature: null, + windDirection: null, + windScale: null, + imageNames: null, + imageUrls: null, + parentId: this.nodeItem ? this.nodeItem.id : null, + disasterId: this.data.disasterId, + planComponentId: sessionStorage.getItem('planId') || '', + companyId: this.data.siteOrbuilding == -1 ? sessionStorage.getItem('companyId') : null, + sitePlanId: this.data.siteOrbuilding==-1 ? this.selectedSiteData.id : null, + buildingId: this.selectedBuildingData.id || null, + buildingAreaId: this.data.siteOrbuilding!=-1 ? this.selectedSiteData.id : null + } + if(type == 'old'){ + let istrue = this.canvasData.findDisposalNode(this.nodeItem.id,name) + let putdata = this.nodeItem + putdata.weather = this.canvasData.selectPanelPointBaseData.weather + putdata.airTemperature = Number(this.canvasData.selectPanelPointBaseData.airTemperature) + putdata.windScale = Number(this.canvasData.selectPanelPointBaseData.windScale) + putdata.windDirection = Number(this.canvasData.selectPanelPointBaseData.windDirection) + putdata.description = this.canvasData.selectPanelPointBaseData.description + putdata.notes = this.canvasData.selectPanelPointBaseData.notes + + + if(istrue){//如果该处置节点下已有同名数据节点 则只修改 2个接口 + new Promise((resolve,reject)=>{ + this.http.put(`/api/DisposalNodes/${value.nodeId}`,putdata).subscribe(data => { + resolve("更新处置节点成功,将天气 节点详情等信息保存到点击的节点") + }) + }).then((values)=>{ + this.canvasData.sendMessage('send a message');//发布一条消息 + // 保存平面图数据到当前节点 + let postdata =JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint)) + postdata.Data = JSON.stringify(postdata.Data) + this.http.post(`/api/DisposalNodeData`,postdata).subscribe(data => { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config) + },err=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存失败','确定',config) + }) + this.dialogRef.close(); + this.canvasData.sendMessage('send a message');//发布一条消息 + }) + + }else{//需要3个接口 + new Promise((resolve,reject)=>{ + this.http.put(`/api/DisposalNodes/${value.nodeId}`,putdata).subscribe(data => { + resolve("更新处置节点成功,将天气 节点详情等信息保存到点击的节点") + }) + }).then((values)=>{ + console.log(values) + postdata.level = putdata.level + 1 + new Promise((resolve,reject) => { + this.http.post(`/api/DisposalNodes`,postdata).subscribe(data => { + resolve(data) + }) + }).then((data:any)=>{ + console.log(7788,data) + let objData = { + id: "", + data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null, + version: this.canvasData.selectPanelPoint.Version || "2.0", + disposalNodeId: data.id, + planComponentId: sessionStorage.getItem("planId"), + } + this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config) + },err=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存失败','确定',config) + }) + this.dialogRef.close(); + this.canvasData.sendMessage('send a message');//发布一条消息 + }) + }) + } + + }else{//如果保存到新建节点 + let dispositionNodeData //处置节点data + let order + let oneLevelNum = [] + //将order赋值为所有一级节点最后一个+1 + this.allDisposalNode.forEach(item => { + if(!item.parentId){ + oneLevelNum.push(item) + } + }) + if(oneLevelNum.length == 0){ + order = 0 + }else{ + order = oneLevelNum[oneLevelNum.length - 1].order + 1 + } + + if(this.nodeItem){//如果点击了下拉选择框 + if(this.nodeItem.id != null){ + this.allDisposalNodeChild.forEach(item => { + if(item.id == this.nodeItem.id){ + order = item.children.length + } + }) + } + } + dispositionNodeData = { + id: "", + name: value.name, + level: this.nodeItem && this.nodeItem.id != null ? this.nodeItem.level + 1 : 0, + order: order, + description: "", + notes: "", + weather: null, + airTemperature: 0, + windDirection: 0, + windScale: 0, + imageNames: null, + imageUrls: null, + parentId: this.nodeItem ? this.nodeItem.id : null, + disasterId: this.data.disasterId, + planComponentId: sessionStorage.getItem('planId') || '', + companyId: null, + sitePlanId: null, + buildingId: null, + buildingAreaId: null + } + + dispositionNodeData.weather = this.canvasData.selectPanelPointBaseData.weather + dispositionNodeData.airTemperature = Number(this.canvasData.selectPanelPointBaseData.airTemperature) + dispositionNodeData.windScale = Number(this.canvasData.selectPanelPointBaseData.windScale) + dispositionNodeData.windDirection = Number(this.canvasData.selectPanelPointBaseData.windDirection) + dispositionNodeData.description = this.canvasData.selectPanelPointBaseData.description + dispositionNodeData.notes = this.canvasData.selectPanelPointBaseData.notes + //1.先创建一个处置节点 然后 .then 2.创建数据节点到刚创建的处置节点 3.然后拿着创建好的数据节点的id 将平面图data保存 + new Promise((resolve,reject) => { + this.http.post("/api/DisposalNodes",dispositionNodeData).subscribe((data:any) => { + resolve(data.id) + }) + }).then((id) => { + let dataNodeData + console.log("qnm",id) + new Promise((resolve,reject) => { + postdata.parentId = id + postdata.level = dispositionNodeData.level + 1 + this.http.post("/api/DisposalNodes",postdata).subscribe((data:any) => { + resolve(data) + }) + }).then((data:any) => { + // 保存平面图数据到当前节点 + // console.log(6666,data) + // let postdata =JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint)) + // postdata.Data = JSON.stringify(postdata.Data) + let objData = { + id: "", + data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null, + version: this.canvasData.selectPanelPoint.Version || "2.0", + disposalNodeId: data.id, + planComponentId: sessionStorage.getItem("planId"), + } + + this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存成功','确定',config) + + },err=>{ + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('保存失败','确定',config) + }) + this.dialogRef.close(); + this.canvasData.sendMessage("send a message") + }) + }) + } + } +} \ No newline at end of file diff --git a/src/app/ui/collection-tools-plan/saveOne.html b/src/app/ui/collection-tools-plan/saveOne.html new file mode 100644 index 0000000..a6b0b32 --- /dev/null +++ b/src/app/ui/collection-tools-plan/saveOne.html @@ -0,0 +1,5 @@ +
处置节点保存
+
+ + +
\ No newline at end of file diff --git a/src/app/ui/collection-tools-plan/saveTwo.html b/src/app/ui/collection-tools-plan/saveTwo.html new file mode 100644 index 0000000..fec97ff --- /dev/null +++ b/src/app/ui/collection-tools-plan/saveTwo.html @@ -0,0 +1,53 @@ +
+
新增节点
+
+
+ +
+ + + +
+
+ + + + {{item.name}} + + + +
+
+ + +
+
+
+
+
+
保存到已有节点
+
+
+
+ + + + {{item.name}} + + + +
+
+ + +
+
+
+
\ No newline at end of file diff --git a/src/app/ui/collection-tools-plan/viewdetails.html b/src/app/ui/collection-tools-plan/viewdetails.html new file mode 100644 index 0000000..76638c2 --- /dev/null +++ b/src/app/ui/collection-tools-plan/viewdetails.html @@ -0,0 +1,24 @@ +
+
+ clear +
+ +
+
+ +
+
+ +
+
+
\ No newline at end of file diff --git a/src/app/ui/collection-tools/collection-tools.component.html b/src/app/ui/collection-tools/collection-tools.component.html index 50b2f12..c2f3b09 100644 --- a/src/app/ui/collection-tools/collection-tools.component.html +++ b/src/app/ui/collection-tools/collection-tools.component.html @@ -35,13 +35,13 @@ 基本信息编辑 - + 想定作业编辑
tv - create + create description
@@ -207,7 +207,7 @@ keyboard_arrow_up keyboard_arrow_down -