chenjingyu 4 years ago
parent
commit
dbfae5749a
  1. 5
      src/app/app.component.html
  2. 12
      src/app/app.component.scss
  3. 10
      src/app/app.component.ts
  4. 4
      src/app/app.module.ts
  5. 16
      src/app/data-collection/fire-force/fire-force.component.html
  6. 17
      src/app/data-collection/fire-force/fire-force.component.scss
  7. 174
      src/app/data-collection/fire-force/fire-force.component.ts
  8. 2
      src/app/gis-management/gis-labeling/gis-labeling.component.ts
  9. 16
      src/app/key-unit/edit-plan-info/edit-plan-info.component.html
  10. 18
      src/app/key-unit/edit-unit-info/edit-unit-info.component.html
  11. 3
      src/app/key-unit/key-unit.module.ts
  12. 64
      src/app/key-unit/router-gis/router-gis.component.html
  13. 123
      src/app/key-unit/router-gis/router-gis.component.scss
  14. 176
      src/app/key-unit/router-gis/router-gis.component.ts
  15. 18
      src/app/key-unit/view-unit-details-plan/view-unit-details-plan.component.html
  16. 16
      src/app/key-unit/view-unit-details/view-unit-details.component.html
  17. 56
      src/app/key-unit/water-road/water-road.component.html
  18. 59
      src/app/key-unit/water-road/water-road.component.scss
  19. 237
      src/app/key-unit/water-road/water-road.component.ts
  20. 18
      src/app/mask-layer.service.ts
  21. 17
      src/app/ui/collection-tools-plan/collection-tools.component.html
  22. 115
      src/app/ui/collection-tools-plan/collection-tools.component.ts
  23. 7
      src/app/ui/collection-tools-plan/save.ts
  24. 17
      src/app/ui/collection-tools/collection-tools.component.html
  25. 159
      src/app/ui/collection-tools/collection-tools.component.ts
  26. 19
      src/app/ui/collection-tools/save.ts

5
src/app/app.component.html

@ -1 +1,4 @@
<router-outlet></router-outlet>
<router-outlet></router-outlet>
<div class="maskLayer" *ngIf="isMaskLayerShow">
<mat-spinner [diameter]='50'></mat-spinner>
</div>

12
src/app/app.component.scss

@ -0,0 +1,12 @@
.maskLayer{
position: absolute;
left: 0;
top: 0;
z-index: 2000;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.2);
display: flex;
justify-content: center;
align-items: center;
}

10
src/app/app.component.ts

@ -3,6 +3,7 @@ import { HttpClient } from '@angular/common/http'
import { Data } from './interface'
import { Router,ActivatedRoute } from '@angular/router'
import {CacheTokenService} from './http-interceptors/cache-token.service'//引入服务
import { MaskLayerService } from './mask-layer.service';
@ -13,9 +14,16 @@ import {CacheTokenService} from './http-interceptors/cache-token.service'//引
})
export class AppComponent {
constructor(private http:HttpClient,private router:Router,public token:CacheTokenService) { }
constructor(private maskLayerService:MaskLayerService,private http:HttpClient,private router:Router,public token:CacheTokenService) { }
isMaskLayerShow:boolean = false
ngOnInit(): void {
//监听遮罩层
this.maskLayerService.getMessage().subscribe((message: any)=>{
this.isMaskLayerShow = message
});
var token = sessionStorage.getItem("token");
var refreshToken = sessionStorage.getItem("refreshToken");
if(token && refreshToken) {

4
src/app/app.module.ts

@ -21,6 +21,7 @@ import { MTokenK1Component } from './m-token-k1/m-token-k1.component' //K1秘钥
import { CountdownModule } from 'ngx-countdown'; //倒计时插件
import { GISManagementModule } from './gis-management/gis-management.module';
import { DataCollectionModule } from './data-collection/data-collection.module';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
@NgModule({
declarations: [
@ -42,7 +43,8 @@ import { DataCollectionModule } from './data-collection/data-collection.module';
HttpClientModule,
CountdownModule,
GISManagementModule,
DataCollectionModule
DataCollectionModule,
MatProgressSpinnerModule
],
providers: [httpInterceptorProviders, CacheTokenService,TreeService],
bootstrap: [AppComponent]

16
src/app/data-collection/fire-force/fire-force.component.html

@ -46,7 +46,7 @@
<div class="integrity">
</div>
<div class="deletebtn" (click)="deleteWater(node,$event)"><mat-icon>highlight_off</mat-icon></div>
<div class="deletebtn" (click)="deleteFireForce(node,$event)"><mat-icon>highlight_off</mat-icon></div>
</mat-tree-node>
<mat-tree-node (click)="selectTreeNode(node)" [ngClass]="{'selectedTreeNode': node.id == selectedFireForceId}" *matTreeNodeDef="let node;when: hasChild" matTreeNodePadding matTreeNodePaddingIndent='10px'>
@ -62,7 +62,7 @@
<div class="integrity">
</div>
<div class="deletebtn" (click)="deleteWater(node,$event)"><mat-icon>highlight_off</mat-icon></div>
<div class="deletebtn" (click)="deleteFireForce(node,$event)"><mat-icon>highlight_off</mat-icon></div>
</mat-tree-node>
</mat-tree>
</div>
@ -87,14 +87,18 @@
<div (click)="selectedTab(1)" [ngClass]="{'selectedBtn': tabIndex == 1}">
<span>详情</span>
</div>
<div (click)="selectedTab(2)" [ngClass]="{'selectedBtn': tabIndex == 2}">
<!-- <div (click)="selectedTab(2)" [ngClass]="{'selectedBtn': tabIndex == 2}">
<span>车辆装备</span>
</div>
</div> -->
<div (click)="selectedTab(3)" [ngClass]="{'selectedBtn': tabIndex == 3}">
<span>相关资料</span>
</div>
</div>
<div class="btnbox">
<button class="uploadAttachment" *ngIf="tabIndex == 3" mat-flat-button color="primary">
<mat-icon>attach_file</mat-icon>
上传附件
</button>
<span class="save" (click)="save()"><mat-icon>save</mat-icon>保存</span>
<span class="submitAudit"><mat-icon>open_in_browser</mat-icon>提交审核</span>
</div>
@ -504,9 +508,9 @@
</div>
</div>
<!-- 车辆 -->
<div class="contant" *ngIf="tabIndex == 2">
<!-- <div class="contant" *ngIf="tabIndex == 2">
车辆
</div>
</div> -->
<!-- 相关资料 -->
<div class="contant" *ngIf="tabIndex == 3">
相关资料

17
src/app/data-collection/fire-force/fire-force.component.scss

@ -233,6 +233,22 @@
.submitAudit{
margin: 0 30px;
}
.uploadAttachment{
margin-right: 20px;
width: 120px;
text-align: center;
height: 28px;
line-height: 28px;
mat-icon{
transform: rotate(25deg);
font-size: 20px;
width: 20px;
height: 20px;
}
mat-icon{
padding: 0 8px;
}
}
}
}
.contant{
@ -294,6 +310,7 @@
}
}
.addWaterBox{
width: 260px;
height: 284px;

174
src/app/data-collection/fire-force/fire-force.component.ts

@ -50,28 +50,34 @@ export class FireForceComponent implements OnInit {
}, 0);
}
//获得所有消防力量
newdata:any
getAllFireForce(){
this.http.get('/api/CustomFireForce').subscribe((data:any) => {
  this.dataSource.data = this.tree.toTree(data)
const nodes = this.treeControl.dataNodes;
const expandNodes = [];
nodes.forEach((item) => {
if(item.expandable && this.treeControl.isExpanded(item)){
expandNodes.push(item.id);
}
});
// this.dataSource.data = this.newdata;
let newNodes = this.treeControl.dataNodes;
newNodes = newNodes.filter(n => {
return expandNodes.indexOf(n.id) >= 0;
});
console.log(newNodes)
newNodes.forEach(item => {
this.treeControl.expand(item);
});
console.log('所有消防力量',data)
   this.dataSource.data = this.tree.toTree(data)
})
}
upDateAllFireForce = ():void=>{
this.http.get('/api/CustomFireForce').subscribe((data:any) => {
   this.newdata = this.tree.toTree(data)
const nodes = this.treeControl.dataNodes;
const expandNodes = [];
nodes.forEach((item) => {
if(item.expandable && this.treeControl.isExpanded(item)){
expandNodes.push(item.id);
}
});
this.dataSource.data = this.newdata;
let newNodes = this.treeControl.dataNodes;
newNodes = newNodes.filter(n => {
return expandNodes.indexOf(n.id) >= 0;
});
console.log(newNodes)
newNodes.forEach(item => {
this.treeControl.expand(item);
});
console.log('所有消防力量',data)
})
}
private _transformer = (node, level: number) => {//要给渲染节点传那些属性参数
return {
expandable: !!node.children && node.children.length > 0,
@ -96,19 +102,28 @@ export class FireForceComponent implements OnInit {
selectedFireForceLevel:any
selectedFireForce:any
//选择要显示的消防力量
superior:any = { //上级单位
name:'',
code:''
}
selectTreeNode(node){
console.log(node)
this.isGisTopBox = false
if(this.selectedFireForceId != node.id){
this.clearData()
this.selectedFireForce = node
this.selectedFireForceId = node.id
this.selectedFireForceLevel = node.level
if(node.forceType != 0){//如果是其他消防力量
this.selectedFireForceLevel = 4
}else{
this.selectedFireForceLevel = node.level
}
this.FireForceDetailInfo.stationName = node.name
if(this.newPositionMarker){
this.map.remove(this.newPositionMarker);
}
if(node.fireForceDetailId ){
if(node.fireForceDetailId){
this.isPost = false//是否走post创建接口
let type
if(node.forceType == 0){
@ -117,9 +132,7 @@ export class FireForceComponent implements OnInit {
type = 1
}
this.http.get(`/api/FireForceDetail/${type}/${node.id}`).subscribe((data:any) => {
console.log('当前详情',data)
this.FireForceDetailInfo = data
if(data.location && data.location.x){//如果已经标注单位坐标
console.log('开始标注')
this.positionLngLat = data.location
@ -131,13 +144,29 @@ export class FireForceComponent implements OnInit {
})
// 将 markers 添加到地图
this.map.add(this.newPositionMarker);
}else{
this.map.setCity('上海市');
}
if(this.selectedFireForceLevel == 0){
if(node.forceType == 0 && node.level == 0){
this.ZongpersonCountData = JSON.parse(data.personCountData)
this.ZongcontactData = JSON.parse(data.contactData)
}
if(node.forceType == 0 && node.level == 1){
this.ZongpersonCountData = JSON.parse(data.personCountData)
this.ZhicontactData = JSON.parse(data.contactData)
}
if(node.forceType == 0 && (node.level == 2 || node.level == 3)){
this.DaZhongpersonCountData = JSON.parse(data.personCountData)
this.DaZhongcontactData = JSON.parse(data.contactData)
}
if(node.forceType != 0){
this.otherpersonCountData = JSON.parse(data.personCountData)
this.othercontactData = JSON.parse(data.contactData)
}
})
}else{
this.map.setCity('上海市');
}
}
}
@ -164,36 +193,6 @@ export class FireForceComponent implements OnInit {
return (arg1*arg2).toFixed(fix).toString();
}
}
//点击水源列表
selectedLiIndex:any
clickWaterLi(item,index){
// console.log(item)
// if(this.selectedLiIndex != index){
// this.selectedLiIndex = index
// this.clearData()
// // this.selectedWaterTypeIndex = item.waterSourceType//点击的水源类型
// this.waterData = item
// item.waterSourceType == 0 && item.detailData ? this.fireCockData = JSON.parse(item.detailData) : null
// item.waterSourceType == 1 && item.detailData ? this.poolData = JSON.parse(item.detailData) : null
// item.waterSourceType == 2 && item.detailData ? this.naturalWaterData = JSON.parse(item.detailData) : null
// this.positionLngLat = item.location
// if(this.newPositionMarker){
// this.map.remove(this.newPositionMarker);
// }
// if(item.location.x){//如果已经标注单位坐标
// console.log('开始标注')
// this.map.setCenter([item.location.x,item.location.y]);
// this.newPositionMarker = new AMap.Marker({
// position: [item.location.x,item.location.y],
// content: this.newPositionMarkerContent,
// offset: new AMap.Pixel(-15, -18)
// })
// // 将 markers 添加到地图
// this.map.add(this.newPositionMarker);
// }
// }
}
//完整度颜色
integrity(width){
let _this = this
@ -211,16 +210,20 @@ export class FireForceComponent implements OnInit {
return style
}
//删除某条消防队
deleteWater(item,e){
deleteFireForce(item,e){
e.stopPropagation()
let isDelete = window.confirm(`确定要删除${item.name}`)
if(isDelete){
// this.http.delete(`/api/WaterSources/${item.id}`).subscribe(data => {
// const config = new MatSnackBarConfig();
// config.verticalPosition = 'top';
// config.duration = 3000
// this.snackBar.open('删除成功','确定',config);
// })
this.http.delete(`/api/CustomFireForce/${item.id}`).subscribe(data => {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('删除成功','确定',config);
this.upDateAllFireForce()
if(item.id == this.selectedFireForce.id){
this.selectedFireForceLevel = null
}
})
}
}
//当前点击tab页面第几个
@ -239,7 +242,10 @@ export class FireForceComponent implements OnInit {
jurisdictionArea:null,//辖区面积
remark:'',//备注
address:'',//地址
location:null,
location:{
x:'',
y:''
},
personCountData:[],//人员数量自定义
contactData:[],//联系方式自定义
dutyForceData:[]//执勤力量自定义
@ -299,6 +305,10 @@ export class FireForceComponent implements OnInit {
]
//清空表单数据
clearData(){
this.superior = {
name:'',
code:''
}
this.positionLngLat = {x:'',y:''}
this.FireForceDetailInfo = {
// id:'',//编号
@ -309,7 +319,10 @@ export class FireForceComponent implements OnInit {
jurisdictionArea:null,//辖区面积
remark:'',//备注
address:'',//地址
location:null,
location:{
x:'',
y:''
},
personCountData:[],//人员数量自定义
contactData:[],//联系方式自定义
dutyForceData:[]//执勤力量自定义
@ -393,19 +406,26 @@ export class FireForceComponent implements OnInit {
}
//保存
isPost:boolean = false//是否走post创建接口
newselectedFireForceId:any //创建成功其他消防力量后保存一下创建出来的id
save(){
if(!this.FireForceDetailInfo.stationName){
alert('名称必填')
return
}
console.log(777,this.atLastPositionLngLat)
this.FireForceDetailInfo.jurisdictionArea = Number(this.FireForceDetailInfo.jurisdictionArea)
//如果是总支大中
// console.log(8888, this.FireForceDetailInfo)
this.FireForceDetailInfo.location = {x:'',y:''}
if(this.atLastPositionLngLat.x){
this.FireForceDetailInfo.location.x = this.atLastPositionLngLat.x
this.FireForceDetailInfo.location.y = this.atLastPositionLngLat.y
}else{
this.FireForceDetailInfo.location = null
}
if(this.selectedFireForce.forceType == 0&&(this.selectedFireForceLevel == 0 || this.selectedFireForceLevel == 1 || this.selectedFireForceLevel == 2 || this.selectedFireForceLevel == 3)){//如果是总队
let body = this.FireForceDetailInfo
if(this.atLastPositionLngLat.x){
this.FireForceDetailInfo.location.x = this.atLastPositionLngLat.x
this.FireForceDetailInfo.location.y = this.atLastPositionLngLat.y
}
if(this.selectedFireForceLevel == 0){//总队
this.FireForceDetailInfo.personCountData = JSON.stringify(this.ZongpersonCountData)
this.FireForceDetailInfo.contactData = JSON.stringify(this.ZongcontactData)
@ -426,6 +446,7 @@ export class FireForceComponent implements OnInit {
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
this.upDateAllFireForce()
console.log(123,data)
})
}
@ -436,12 +457,18 @@ export class FireForceComponent implements OnInit {
body.personCountData = JSON.stringify(this.otherpersonCountData)
body.contactData = JSON.stringify(this.othercontactData)
body.dutyForceData = null
this.http.put(`/api/FireForceDetail/1/${this.selectedFireForce.id}`,body).subscribe(data => {
let id
if(this.selectedFireForce.forceType == 0){
id = this.newselectedFireForceId
}else{
id = this.selectedFireForce.id
}
this.http.put(`/api/FireForceDetail/1/${id}`,body).subscribe(data => {
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
console.log(123,data)
// console.log(123,data)
})
}else{
let forceType
@ -459,18 +486,21 @@ export class FireForceComponent implements OnInit {
}
this.http.post('/api/CustomFireForce',body,{params:params}).subscribe((data:any) => {
console.log('创建其他消防力量成功',data)
this.getAllFireForce()
this.newselectedFireForceId = data.id
this.selectedFireForce = data
let body = this.FireForceDetailInfo
body.personCountData = JSON.stringify(this.otherpersonCountData)
body.contactData = JSON.stringify(this.othercontactData)
body.dutyForceData = null
this.http.put(`/api/FireForceDetail/1/${data.id}`,body).subscribe(data => {
this.http.put(`/api/FireForceDetail/1/${data.id}`,body).subscribe(data2 => {
this.upDateAllFireForce()
this.selectedFireForceId = data.id
this.isPost = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
console.log(123,data)
console.log(123,data2)
})
})
}
@ -535,7 +565,7 @@ export class FireForceComponent implements OnInit {
searchTitle:any = ''//
positionLngLat:any = {}//临时坐标点
atLastPositionLngLat:any = {}//最终坐标点
atLastPositionLngLat:any = {x:null,y:null}//最终坐标点
setPosition(){
if(!this.isGisTopBox){
this.isGisTopBox = true

2
src/app/gis-management/gis-labeling/gis-labeling.component.ts

@ -387,7 +387,7 @@ export class GisLabelingComponent implements OnInit {
// 创建一个 Icon
let startIcon = new AMap.Icon({
image: '../../../assets/images/fireHydrant.png',
imageSize: new AMap.Size(32, 32),
imageSize: new AMap.Size(20, 20),
});
positonList.forEach((item,index)=>{
let marker = new AMap.Marker({

16
src/app/key-unit/edit-plan-info/edit-plan-info.component.html

@ -32,17 +32,27 @@
<app-function-division></app-function-division>
</ng-template>
</mat-tab>
<mat-tab label="7.实景图">
<mat-tab label="7.行车路线">
<ng-template matTabContent>
<app-router-gis></app-router-gis>
</ng-template>
</mat-tab>
<mat-tab label="8.周边水源">
<ng-template matTabContent>
<app-water-road></app-water-road>
</ng-template>
</mat-tab>
<mat-tab label="9.实景图">
<ng-template matTabContent>
<app-realistic-picture></app-realistic-picture>
</ng-template>
</mat-tab>
<mat-tab label="8.上传CAD">
<mat-tab label="10.上传CAD">
<ng-template matTabContent>
<app-uploading-cad></app-uploading-cad>
</ng-template>
</mat-tab>
<!-- <mat-tab label="9.unity平面图">
<!-- <mat-tab label="11.unity平面图">
<ng-template matTabContent>
<iframe id="main" src="/unityApp2Basic/index.html" name="unityApp" frameborder="0" width="96%" height="100%" style="margin-left: 2%;"></iframe>
</ng-template>

18
src/app/key-unit/edit-unit-info/edit-unit-info.component.html

@ -31,22 +31,32 @@
<app-function-division></app-function-division>
</ng-template>
</mat-tab>
<mat-tab label="6.实景图">
<mat-tab label="6.行车路线">
<ng-template matTabContent>
<app-router-gis></app-router-gis>
</ng-template>
</mat-tab>
<mat-tab label="7.周边水源">
<ng-template matTabContent>
<app-water-road></app-water-road>
</ng-template>
</mat-tab>
<mat-tab label="8.实景图">
<ng-template matTabContent>
<app-realistic-picture></app-realistic-picture>
</ng-template>
</mat-tab>
<mat-tab label="7.上传CAD">
<mat-tab label="9.上传CAD">
<ng-template matTabContent>
<app-uploading-cad></app-uploading-cad>
</ng-template>
</mat-tab>
<mat-tab label="8.作战部署">
<mat-tab label="10.作战部署">
<ng-template matTabContent>
<app-collection-tools></app-collection-tools>
</ng-template>
</mat-tab>
<!-- <mat-tab label="9.unity作战部署">
<!-- <mat-tab label="11.unity作战部署">
<ng-template matTabContent>
<iframe id="main" src="/unityApp2/index.html" name="unityApp" frameborder="0" width="100%" height="98%"></iframe>
</ng-template>

3
src/app/key-unit/key-unit.module.ts

@ -137,7 +137,8 @@ import { upname } from './key-unit-management/key-unit-management.component'
FormsModule,
CountdownModule,
FileUploadModule,
UiModule
UiModule,
ReactiveFormsModule,
]
})
export class KeyUnitModule { }

64
src/app/key-unit/router-gis/router-gis.component.html

@ -1,7 +1,63 @@
<div class="content">
<div class="center" id="center"></div>
<div class="btnbox">
<div class="btn" (click)="next()">已到达熟悉单位</div>
<div (click)="back()">取消本次任务</div>
<div class="map" id="map"></div>
<!-- 导航路线 -->
<div class="routeGIS">
<div class="routeHeader">
<label style="bottom: 8px; left: 38px;" class="routeGISPublicIcon" (click)='clearGISRoute()'>清除路线</label>
<label style="bottom: 8px; left: 275px;" class="routeGISPublicIcon" (click)='queryGISRoute()'>查询</label>
<div class="routeLeft" (click)='exchangeGISRoute()'><mat-icon>import_export</mat-icon></div>
<div class="routeContent">
<div class="routeEveryRow">
<label class="routeText"></label>
<input type="text" list="start" [(ngModel)]="routeStart" (ngModelChange)="routeChange(0)">
<datalist id="start">
<option *ngFor="let item of routeStartList" value="{{item.district}} {{item.name}}">
</datalist>
<label class="routeClear" *ngIf="routeStart" (click)='deleteSearchGIS(0)'>×</label>
</div>
<div class="routeEveryRow">
<label class="routeText"></label>
<input type="text" list="end" [(ngModel)]="routeEnd" (ngModelChange)="routeChange(1)">
<datalist id="end">
<option *ngFor="let item of routeEndList" value="{{item.district}} {{item.name}}">
</datalist>
<label class="routeClear" *ngIf="routeEnd" (click)='deleteSearchGIS(1)'>×</label>
</div>
</div>
</div>
<div class="routeCenter" *ngIf="routes.steps.length">
<div style="text-align: center;">
<button class="routeType" [ngClass]="{'selectRouteType': selectType}" (click)='toggleRoute(true)'>推荐方案</button>
<button class="routeType" [ngClass]="{'selectRouteType': !selectType}" (click)='toggleRoute(false)'>躲避拥堵</button>
</div>
<div class="routeTypeExplain" style="text-align: center; font-weight: 550;">
<label>约{{ routes.time / 60 | number:'0.0-0' }}分钟</label>
<label>{{ routes.distance / 1000 | number:'0.1-1' }}公里</label>
</div>
<div class="routeTypeExplain" style="color: rgb(176, 180, 184); margin-top: -10px;">
<label>途径</label>
<span *ngFor="let item of routes.steps">{{item.road? item.road + '>' : null}}</span>
</div>
<div class="routeCenterTB" title="{{routeStart}}">
<p style="background-color: #0080FF;"></p><label style="font-weight: 550;">{{routeStart}}</label>
</div>
<div class="routeCenterTB" *ngFor="let item of routes.steps" style="border-bottom: 1px solid rgb(223, 212, 212);" title="{{item.instruction}}">
<p class="orientation" *ngIf="item.orientation == '西'"></p>
<p class="orientation" *ngIf="item.orientation == '北'"></p>
<p class="orientation" *ngIf="item.orientation == '东'"></p>
<p class="orientation" *ngIf="item.orientation == '南'"></p>
<p class="orientation" *ngIf="item.orientation == '西北'"></p>
<p class="orientation" *ngIf="item.orientation == '西南'"></p>
<p class="orientation" *ngIf="item.orientation == '东北'"></p>
<p class="orientation" *ngIf="item.orientation == '东南'"></p>
<label>{{item.instruction}}</label>
</div>
<div class="routeCenterTB" title="{{routeEnd}}">
<p style="background-color: rgb(250, 21, 21);"></p><label style="font-weight: 550;">{{routeEnd}}</label>
</div>
</div>
</div>
<!-- 导航路线 -->
</div>

123
src/app/key-unit/router-gis/router-gis.component.scss

@ -2,34 +2,111 @@
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 3px;
padding: 1px;
overflow: hidden;
position: relative;
.center {
.map { width: 100%; height: 100%; }
}
//文本溢出
.overflowText {
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
.mat-icon, label, button, p, span {cursor:pointer;}
//左侧导航路线
.routeGIS {
width: 340px;
max-height: 700px;
overflow: hidden;
position: absolute;
border-radius: 10px;
background-color: #0080FF;
left: 30px;
top: 15px;
z-index: 6;
display: flex;
flex-direction: column;
.routeHeader {
width: 100%;
height: 740px;
}
.btnbox{
position: absolute;
left: 50%;
bottom: 7%;;
transform: translateX(-50%);
height: 130px;
min-height: 130px;
position: relative;
display: flex;
div{
align-items: center;
justify-content: center;
.routeLeft {
width: 26px;
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;
margin: 0 5px;
box-sizing: border-box;
.mat-icon { font-size: 24px; color: #fff; }
}
.routeContent {
flex: 1;
//起点终点 input
.routeEveryRow {
position: relative;
height: 30px;
margin: 3px 0;
label { position: absolute; color: #fff; }
.routeText {
font-size: 14px;
top: 5.5px;
left: 5px;
}
.routeClear {
top: 0px;
right: 18px;
font-size: 20px;
}
input {
width: 80%;
padding-left: 25px;
height: 30px;
border-radius: 5px;
border: none;
outline: none;
color: #fff;
background-color: #0874DE;
}
}
}
.btn{
background: linear-gradient(337deg, #FC7045 0%, #FF4923 100%);
color: #fff;
}
//导航内容区
.routeCenter::-webkit-scrollbar {
display: none; /* Chrome Safari */
}
.routeCenter {
width: 100%;
overflow-y: auto;
scrollbar-width: none; /* Firefox */
box-sizing: border-box;
background-color: #fff;
border-radius: 0 0 10px 10px;
border: 1px solid rgb(201, 197, 197);
>div {
width: 100%;
height: 30px;
line-height: 30px;
box-sizing: border-box;
margin: 5px 0;
font-size: 12px;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
} //div
>div:not(:first-child){ padding: 0 10px; box-sizing: border-box; }
.routeTypeExplain label { margin: 0 10px; }
.routeCenterTB {
p { display: inline-block; margin-right: 10px; width: 30px; height: 30px; border-radius: 50%; color: #fff; text-align: center; font-size: 14px; }
.orientation { color: #0080FF; }
}
}
}
}
.routeGISPublicIcon { position: absolute; color: #fff; font-size: 14px; } //导航 定位部分公共样式
//选择路线 方案 button
.routeType { margin: 0 10px; outline: none; border: none; background-color: transparent; font-size: 14px; font-weight: 550; color: rgb(122, 116, 116); }
.selectRouteType { color: #0080FF; }

176
src/app/key-unit/router-gis/router-gis.component.ts

@ -1,4 +1,5 @@
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
import { Component, EventEmitter, NgZone, OnInit, Output } from '@angular/core';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
declare var AMap: any;
@Component({
@ -8,53 +9,158 @@ declare var AMap: any;
})
export class RouterGISComponent implements OnInit {
@Output() onCustomEvent: EventEmitter<any> = new EventEmitter();//创建实力
constructor() { }
constructor(public _ngZone:NgZone,public snackBar: MatSnackBar,) { }
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,
let that = this
var layer = new AMap.createDefaultLayer({
zooms:[3,20], //可见级别
visible:true, //是否可见
opacity:1, //透明度
zIndex:0, //叠加层级
resizeEnable: true //是否监控地图容器尺寸变化,
})
that.map = new AMap.Map('map',{
layers:[layer], //当只想显示标准图层时layers属性可缺省,
});
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:'山东'}], //路线可搜索, 可用坐标
that.map.setCity('上海市');
}
//下一步
next(){
this.emitEvent()
map:any; //地图实例
routeStart:any; //起点
routeStartList:any = [] //起点 搜索结果
routeEnd:any; //终点
routeEndList:any = [] //终点 搜索结果
timeout:any; //延时器
routeGIS:any; //查询结果 规划路线
selectType:boolean = true; //路线选择 推荐方案/躲避用拥堵
//输入框 输入事件
routeChange (e) {
let that = this
window.clearTimeout(this.timeout)
this.timeout = window.setTimeout(()=>{
that.map.getCity( function(info){ //获取当前 city
AMap.plugin(['AMap.AutoComplete'], () =>{
var autoOptions = {city: info.city}
let keywords
e == 0 ? keywords = that.routeStart : keywords = that.routeEnd
var autoComplete = new AMap.Autocomplete(autoOptions);
autoComplete.search(keywords, function(status, result) {
if (result && result.tips && result.tips.length) { //搜索到数据时
that._ngZone.run(()=>{
if(e == 0){
that.routeStartList = result.tips
that.startCoordinate = new AMap.LngLat(result.tips[0].location.lng, result.tips[0].location.lat)
}else{
that.routeEndList = result.tips
that.endCoordinate = new AMap.LngLat(result.tips[0].location.lng, result.tips[0].location.lat)
}
});
} //if
})
})
}); //获取当前 city
},500)
}
private emitEvent(){
this.onCustomEvent.emit('data from child');//通过emit可将需要传递的数据发送给父组件
//清空导航输入框
deleteSearchGIS (e) {
if (e==0) {
this.routeStart = null
this.routeStartList = []
this.startCoordinate = null
} else {
this.routeEnd = null
this.routeEndList = []
this.endCoordinate = null
}
}
//取消
back(){
window.history.back();
//清除路线
clearGISRoute () {
this.routeStart = null
this.routeStartList = []
this.routeEnd = null
this.routeEndList = []
this.startCoordinate = null
this.endCoordinate = null
this.routeGIS? this.routeGIS.clear() : null
this.routes = { distance: 0, time: 0, steps: [], }
this.map.setCity('上海市'); //设置地图中心点
}
//交换起始点
exchangeGISRoute () {
let data = this.routeStart
this.routeStart = this.routeEnd
this.routeEnd = data
this.routeStartList = []
this.routeEndList = []
let data2 = this.startCoordinate
this.startCoordinate = this.endCoordinate
this.endCoordinate = data2
}
routes:any = { distance: 0, time: 0, steps: [], };//导航查询结果 路线规划
startCoordinate:any//开始坐标
endCoordinate:any//结束坐标
//导航查询
queryGISRoute () {
if (this.startCoordinate && this.endCoordinate) {
//构造路线导航类
let that = this
this.selectType = true
this.routeGIS? this.routeGIS.clear() : null
this.routeGIS = new AMap.Driving({
map: this.map,
});
this.routeGIS.search(this.startCoordinate,this.endCoordinate,
function(status, result) {
if (status === 'complete') {
that.routes = result.routes[0]
} else { alert('获取驾驶规划路线失败') }
}
);
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请选择起始点','确定',config);
}
}
//切换 导航模式 推荐方案/躲避拥堵
toggleRoute (e) {
let that = this
if (this.selectType != e) {
this.selectType = e
this.routeGIS? this.routeGIS.clear() : null
this.routeGIS = new AMap.Driving({
map: this.map,
policy: e==true? AMap.DrivingPolicy.LEAST_TIME : AMap.DrivingPolicy.REAL_TRAFFIC
});
// 根据起终点名称规划驾车导航路线
this.routeGIS.search(this.startCoordinate,this.endCoordinate,
function(status, result) {
if (status === 'complete') {
that.routes = result.routes[0]
} else { alert('获取驾驶规划路线失败') }
}
);
}
}
}

18
src/app/key-unit/view-unit-details-plan/view-unit-details-plan.component.html

@ -24,22 +24,32 @@
<app-function-division-look></app-function-division-look>
</ng-template>
</mat-tab>
<mat-tab label="6.实景图">
<mat-tab label="6.行车路线">
<ng-template matTabContent>
<app-router-gis></app-router-gis>
</ng-template>
</mat-tab>
<mat-tab label="7.周边水源">
<ng-template matTabContent>
<app-water-road></app-water-road>
</ng-template>
</mat-tab>
<mat-tab label="8.实景图">
<ng-template matTabContent>
<app-realistic-picture-look></app-realistic-picture-look>
</ng-template>
</mat-tab>
<mat-tab label="7.上传CAD">
<mat-tab label="9.上传CAD">
<ng-template matTabContent>
<app-uploading-cad-look></app-uploading-cad-look>
</ng-template>
</mat-tab>
<mat-tab label="8.作战部署">
<mat-tab label="10.作战部署">
<ng-template matTabContent>
<app-collection-tools></app-collection-tools>
</ng-template>
</mat-tab>
<!-- <mat-tab label="9.unity作战部署">
<!-- <mat-tab label="11.unity作战部署">
<ng-template matTabContent>
<app-collection-tools></app-collection-tools>
<iframe id="main" src="/unityApp2/index.html" name="unityApp" frameborder="0" width="100%" height="98%"></iframe>

16
src/app/key-unit/view-unit-details/view-unit-details.component.html

@ -29,17 +29,27 @@
<app-function-division-look></app-function-division-look>
</ng-template>
</mat-tab>
<mat-tab label="7.实景图">
<mat-tab label="7.行车路线">
<ng-template matTabContent>
<app-router-gis></app-router-gis>
</ng-template>
</mat-tab>
<mat-tab label="8.周边水源">
<ng-template matTabContent>
<app-water-road></app-water-road>
</ng-template>
</mat-tab>
<mat-tab label="9.实景图">
<ng-template matTabContent>
<app-realistic-picture-look></app-realistic-picture-look>
</ng-template>
</mat-tab>
<mat-tab label="8.上传CAD">
<mat-tab label="10.上传CAD">
<ng-template matTabContent>
<app-uploading-cad-look></app-uploading-cad-look>
</ng-template>
</mat-tab>
<!-- <mat-tab label="9.unity平面图">
<!-- <mat-tab label="11.unity平面图">
<ng-template matTabContent>
<iframe id="main" src="/unityApp2Basic/index.html" name="unityApp" frameborder="0" width="96%" height="100%" style="margin-left:2%;"></iframe>
</ng-template>

56
src/app/key-unit/water-road/water-road.component.html

@ -1,19 +1,45 @@
<div class="content">
<div class="center" id="map"></div>
<!-- <div class="textbox">
<div class="btn">
<span>
<mat-icon (click)="save()">description</mat-icon>
<mat-icon (click)="clickicon()">create</mat-icon>
</span>
</div>
<div class="text" [hidden]="!isshow">
<textarea [(ngModel)]="textcontant" name="" id="" cols="28" rows="18" placeholder="水源情况主要包括消火栓位置、管径、外观完好情况、停车取水位置试水情况,消防水池位置、容量、停车取水位置、取水测试情况,取消码头位置、水位、停车取水位置等;道路情况主要包括道路长度、宽度、起始点、沿线重点单位、立交、桥梁、涵洞及其通车能力。【该项主要在道路水源熟悉时填写】"></textarea>
</div>
</div> -->
<div class="editbtn" (click)="opendialog()">
<p style="margin-top: 20px;"><mat-icon>create</mat-icon></p>
<p style="font-size: 16px;color: #fff;">编辑</p>
<div class="center" id="center"></div>
<!-- 右上角 -->
<div class="rightTopBox">
<div class="contantbox">
<div class="waterBox">
<form [formGroup]="watertForm" class="inputList" (submit)='waterSubmit(watertForm.value)'>
<div style="display: flex;justify-content: space-between;align-items: center;">
<mat-checkbox color="primary" formControlName="allSelectedWater" (change)="selectedAllWater($event)">全选</mat-checkbox>
</div>
<div class="inputItem">
<mat-checkbox *ngFor="let water of waters.controls;let i = index" color="primary" [formControl]="water">{{waterList[i].name}}</mat-checkbox>
</div>
<div class="btnbox">
<div>
<span>显示范围 : </span>
<mat-form-field>
<select matNativeControl formControlName="areaWater" [(ngModel)]="waterAreaDefault">
<option value="0">当前视野范围</option>
<option value="200">200米</option>
<option value="500">500米</option>
<option value="1000">1000米</option>
<option value="1500">1500米</option>
<option value="2000">2000米</option>
<option value="2500">2500米</option>
<option value="3000">3000米</option>
<option value="4000">4000米</option>
<option value="5000">5000米</option>
</select>
</mat-form-field>
</div>
<button class="submit" id="submit">确定</button>
<button class="cancel" type="button" (click)="resetWater()">取消显示</button>
</div>
</form>
</div>
</div>
</div>
<!-- 右上角 -->
</div>

59
src/app/key-unit/water-road/water-road.component.scss

@ -78,4 +78,61 @@
background: linear-gradient(337deg, #FC7045 0%, #FF4923 100%);
}
}
}
}
//右上角div
.rightTopBox{
width: 480px;
position: absolute;
left: 30px;
top: 15px;
.contantbox{
width: 100%;
background: #fff;
margin-top: 3px;
border-radius: 6px;
.keyUnitBox,.waterBox,.coverageBox{
box-sizing: border-box;
padding:8px 15px;
font-size: 14px;
color: #333333;
}
.inputList{
.inputItem{
margin-top: 8px;
display: flex;
flex-wrap: wrap;
mat-checkbox{
margin-right: 15px;
}
}
.btnbox{
display: flex;
align-items: center;
justify-content: space-between;
button{
cursor: pointer;
}
.submit{
width: 68px;
height: 30px;
text-align: center;
border: 0;
background: #0080FF;
opacity: 1;
border-radius: 4px;
color: #fff;
}
.cancel{
width: 96px;
height: 30px;
background: #EEF1F5;
opacity: 1;
border-radius: 4px;
border: 0;
color: #333333;
}
}
}
}
}

237
src/app/key-unit/water-road/water-road.component.ts

@ -1,7 +1,8 @@
import { Component, Inject, OnInit } from '@angular/core';
import { Component, ElementRef, Inject, OnInit, Renderer2 } from '@angular/core';
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
declare var AMap: any;
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
declare var AMap: any;
@Component({
selector: 'app-water-road',
@ -10,108 +11,172 @@ import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
})
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);
}
constructor(public renderer2: Renderer2,public snackBar: MatSnackBar,public dialog: MatDialog,private fb: FormBuilder) { }
map:any //地图
markers:any = [{_position: [121.472644,31.231706]}] //当前单位坐标
watertForm:FormGroup //gis右上角水源表单
waterList = [
{id:'0',name:'消火栓',selected:false},
{id:'1',name:'消防水池',selected:false},
{id:'2',name:'天然水源',selected:false},
]
waterAreaDefault:any = '0' //默认水源范围
selectedWaterList:any = [] //选择提交的水源
//地图范围圆圈---水源
circleofwater = new AMap.Circle({
center: null,
radius: 0, //半径
strokeOpacity: 1,
fillOpacity: 0.4,
strokeStyle: 'dashed',
strokeDasharray: [10, 10],
// 线样式还支持 'dashed'
fillColor: '#ee2200',
zIndex: 50,
})
ngOnInit(): void {
this.watertForm = this.fb.group({
waters:this.waterUnits(),
allSelectedWater:new FormControl(),
areaWater:new FormControl()
})
this.waters.valueChanges.subscribe(values => {
let selects:string[] = []
values.forEach((selected:boolean,i:number) => {
selected === true && selects.push(this.waterList[i].id)
});
this.selectedWaterList = selects
})
this.waterList.forEach(item => {
if(item.selected){
this.selectedWaterList.push(item.name)
}
})
setTimeout(() => {
this.creatMap()
}, 0);
}
get waters():any{
return this.watertForm.get('waters')
}
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)
//全选水源
selectedAllWater(event){
if(event.checked){
this.waters.controls.forEach(item => {item.setValue(true)})
}else{
this.watertForm.reset()
this.watertForm.controls.areaWater.setValue('0')
}
}
//水源提交
waterSubmit(value){
if(this.markers.length == 0){
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请先选择一个单位','确定',config);
}else{
this.createwaterMarker()
this.circleofwater.setRadius(Number(this.waterAreaDefault))
this.circleofwater.setCenter(this.markers[0]._position)
this.circleofwater.setMap(this.map)
if(this.waterAreaDefault == '0'){
this.circleofwater.setRadius(this.Calculationofdistance(this.map.getBounds())/2)
}
}
}
waterIconList = []; //展示的水源图标
//循环渲染出所有水源markers
createwaterMarker(){
this.waterIconList.forEach((element,index) => { this.map.remove(element) }); //先删除所有标点
this.waterIconList = []
let waterType = this.selectedWaterList //筛选出展示的 水源类型
if (waterType.length) {
let x = JSON.parse( JSON.stringify(this.markers[0]._position[0]) ) //中心标注的 坐标
let y = JSON.parse( JSON.stringify(this.markers[0]._position[1]) ) //中心标注的 坐标
let positonList = [0.015, -0.035, 0.045, 0.061, -0.013, 0.029]
// 创建一个 Icon
let startIcon = new AMap.Icon({
image: '../../../assets/images/fireHydrant.png',
imageSize: new AMap.Size(20, 20),
});
positonList.forEach((item,index)=>{
let marker = new AMap.Marker({
map: this.map,
position: index%2==0? JSON.parse( JSON.stringify([x+item,y-item]) ) : JSON.parse( JSON.stringify([x-item,y+item]) ),
icon: startIcon,
});
this.waterIconList.push(marker)
})
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())
});
positonList.forEach((item,index)=>{
let marker = new AMap.Marker({
map: this.map,
position: index%2==0? JSON.parse( JSON.stringify([x+item,y+item]) ) : JSON.parse( JSON.stringify([x-item,y-item]) ),
icon: startIcon,
});
this.waterIconList.push(marker)
})
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请选择水源类型','确定',config);
}
}
// this.map.setCity('南宁市')
this.map.add(Arr);//火源标点
//取消显示水源
resetWater(){
this.waterIconList.forEach((element,index) => { this.map.remove(element) }); //先删除所有标点
this.waterIconList = []
this.watertForm.reset()
this.watertForm.controls.areaWater.setValue('0')
this.map.remove(this.circleofwater)
}
//计算两地距离
Calculationofdistance(bounds){
let p1 = [bounds.northEast.lng, bounds.northEast.lat];
let p2 = [bounds.northEast.lng, bounds.southWest.lat];
// 返回 p1 到 p2 间的地面距离,单位:米
let dis = AMap.GeometryUtil.distance(p1, p2);
return dis
}
//构造水源checkbox控制器
waterUnits() {
const arr = this.waterList.map(item => {
return this.fb.control(item.selected);
});
return this.fb.array(arr);
}
opendialog(){
let dialogRef = this.dialog.open(EditText);
dialogRef.afterClosed().subscribe(data=>{
if(data){
}
});
//地图初始化
creatMap(){
let that = this
var layer = new AMap.createDefaultLayer({
zooms:[3,20], //可见级别
visible:true, //是否可见
opacity:1, //透明度
zIndex:0, //叠加层级
resizeEnable: true //是否监控地图容器尺寸变化,
})
that.map = new AMap.Map('center',{
layers:[layer], //当只想显示标准图层时layers属性可缺省,
});
that.map.setCity('上海市');
}
}
}
//编辑水源道路情况
@Component({
selector: 'app-editBuilding',

18
src/app/mask-layer.service.ts

@ -0,0 +1,18 @@
import { Injectable } from '@angular/core';
import {ReplaySubject} from "rxjs";
import { Observable } from "rxjs";
@Injectable({
providedIn: 'root'
})
export class MaskLayerService {
private _sendMessage: ReplaySubject<any> = new ReplaySubject<any>(1);
/** * *
* @param message * @returns {Observavle<any>} */
public sendMessage(message: any) {
this._sendMessage.next(message);
}
public getMessage(): Observable <any> {
return this._sendMessage.asObservable();
}
constructor() { }
}

17
src/app/ui/collection-tools-plan/collection-tools.component.html

@ -7,14 +7,6 @@
<button mat-button (click)="toggle2()">
<mat-icon style="vertical-align: middle;">list</mat-icon>
</button>
<span style="color: gray;margin-right: 10px;margin-left: 10px;">图标大小</span>
<mat-form-field style="margin-top: 3px;">
<mat-select (selectionChange)='iconScale()' [(ngModel)]="selected">
<mat-option value="1">正常</mat-option>
<mat-option value="2">放大2倍</mat-option>
<mat-option value="4">放大4倍</mat-option>
</mat-select>
</mat-form-field>
<button (click)="copyAsset()" class="copytobutn" mat-button title="复制" style="margin:0 5px;" *ngIf="isEditPattern">
<mat-icon style="padding-bottom: 7px;">library_books</mat-icon>
</button>
@ -35,9 +27,6 @@
<span (click)="baseInfo()" [ngClass]="{'selectedPattern': pattern}">
基本信息编辑
</span>
<!-- <span *ngIf="isSixbtn" (click)="wantWork()" [ngClass]="{'selectedPattern': !pattern}">
想定作业编辑
</span> -->
</div>
<span style="position: absolute;right: 60px;cursor: pointer;">
<mat-icon title="查看/编辑模式" (click)="lookpat()" *ngIf="isEditPattern">tv</mat-icon>
@ -269,7 +258,7 @@
</div>
</div>
<!-- 如果是多点连线 -->
<div *ngIf="canvasAssetObj.InteractiveMode == 1">
<div *ngIf="canvasAssetObj.InteractiveMode == 1 || canvasAssetObj.InteractiveMode == 3">
<p>厚度</p>
<div style="width: 100%;display: flex;vertical-align: top;height: 22px;">
<input type="number" class="smallinput" [(ngModel)]="sliderValueThickness"
@ -291,7 +280,7 @@
</div>
</div>
<div class="colorDiv" *ngIf="isEditPattern">
<div class="colorDiv" *ngIf="isEditPattern && pattern && canvasAssetObj.GameMode == 0">
<ul>
<li (click)="selectcolor(item,key)" class="colorLi" *ngFor="let item of colors,let key=index" [style]="{'background-color':item}"></li>
</ul>
@ -444,7 +433,7 @@
</div>
<div class="body">
<textarea [disabled]="!isEditPattern" *ngIf="detailsAndattentBtn" name="" id="" rows="10" [(ngModel)]="canvasData.selectPanelPointBaseData.description"></textarea>
<textarea [disabled]="!isEditPattern" *ngIf="!detailsAndattentBtn" name="" id="" rows="10" [(ngModel)]="canvasData.selectPanelPointBaseData.nodes"></textarea>
<textarea [disabled]="!isEditPattern" *ngIf="!detailsAndattentBtn" name="" id="" rows="10" [(ngModel)]="canvasData.selectPanelPointBaseData.notes"></textarea>
</div>
</div>
</div>

115
src/app/ui/collection-tools-plan/collection-tools.component.ts

@ -12,12 +12,11 @@ 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';
import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service';
import { MaskLayerService } from 'src/app/mask-layer.service';
import * as ObjectID from 'bson-objectid';
@Component({
selector: 'app-collection-tools-plan',
@ -28,7 +27,7 @@ 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) { }
constructor(private maskLayerService:MaskLayerService,private tabbarService: TabbarAndScoreService,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) => {//要给渲染节点传那些属性参数
@ -667,14 +666,11 @@ export class CollectionToolsPlanComponent implements OnInit {
this.canvas.on("deselect",obj=>{
this.isShowProperty = false
})
// 监听canvas组件新增素材事件
this.canvas.on("createIcon",obj=>{
this.renovateTreeData(false)
})
// 监听canvas组件删除素材事件
this.canvas.on("deleteIcon",obj=>{
//监听数据变化后
this.canvas.on('canvasDataChanged',()=>{
// 收到数据表示共享数据发生变化
this.renovateTreeData(false)
})
});
}
copyAssetData:any //存储用于复制的素材
@ -688,6 +684,7 @@ export class CollectionToolsPlanComponent implements OnInit {
let buildingId = this.beforeOneCheckedBuilding.id
let floorId = this.selectingSitePlan.id
this.canvas.paste(companyId,buildingId,floorId)
this.renovateTreeData(false)
}
basicInfo:boolean = true //基本信息名称显隐
@ -726,12 +723,13 @@ export class CollectionToolsPlanComponent implements OnInit {
//保存平面图
saveNum :any = []
saveSite(){
//更新用于统计的数据
this.canvasData.updateBuildingData()
if (this.selectingSitePlan && this.selectingSitePlan.id) {
//打开遮罩层
this.maskLayerService.sendMessage(true)
this.saveNum = []
let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData));
SitePlanData.data = JSON.stringify(SitePlanData.data)
@ -754,6 +752,7 @@ export class CollectionToolsPlanComponent implements OnInit {
}
if((new Set(adjoinArr)).size != adjoinArr.length){
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
@ -762,6 +761,7 @@ export class CollectionToolsPlanComponent implements OnInit {
}else{
//如果是单位 总平面图
if(this.checkedBuildingIndex==-1){
// console.log(111,SitePlanData)
//保存平面图数据
this.http.post("/api/SitePlanData",SitePlanData,{
params:{
@ -770,13 +770,16 @@ export class CollectionToolsPlanComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
this.tabbarService.sendMessage('changeScore');
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
@ -792,13 +795,16 @@ export class CollectionToolsPlanComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
this.tabbarService.sendMessage('changeScore');
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
@ -815,18 +821,25 @@ export class CollectionToolsPlanComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
this.tabbarService.sendMessage('changeScore');
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位毗邻保存失败','确定',config);
if(err == 'infos 有重复方向!'){
this.snackBar.open('单位毗邻同步失败,存在相同方向','确定',config);
}else{
this.snackBar.open('单位毗邻同步失败','确定',config);
}
})
//批量保存单位重点部位
@ -838,18 +851,21 @@ export class CollectionToolsPlanComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
this.tabbarService.sendMessage('changeScore');
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位重点部位保存失败','确定',config);
this.snackBar.open('单位重点部位同步失败','确定',config);
})
//批量保存单位消防设施素材
@ -861,18 +877,22 @@ export class CollectionToolsPlanComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
this.tabbarService.sendMessage('changeScore');
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位消防设施素材保存失败','确定',config);
this.snackBar.open('单位消防设施素材同步失败','确定',config);
})
}else{ //如果是建筑
@ -885,13 +905,17 @@ export class CollectionToolsPlanComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
this.tabbarService.sendMessage('changeScore');
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
@ -907,13 +931,17 @@ export class CollectionToolsPlanComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
this.tabbarService.sendMessage('changeScore');
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
@ -926,18 +954,25 @@ export class CollectionToolsPlanComponent implements OnInit {
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.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
this.tabbarService.sendMessage('changeScore');
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑毗邻保存失败','确定',config);
if(err == 'infos 有重复方向!'){
this.snackBar.open('建筑毗邻同步失败,存在相同方向','确定',config);
}else{
this.snackBar.open('建筑毗邻同步失败','确定',config);
}
})
//批量保存建筑重点部位
@ -945,18 +980,21 @@ export class CollectionToolsPlanComponent implements OnInit {
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.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
this.tabbarService.sendMessage('changeScore');
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑重点部位保存失败','确定',config);
this.snackBar.open('建筑重点部位同步失败','确定',config);
})
//批量保存建筑消防设施素材
@ -964,18 +1002,21 @@ export class CollectionToolsPlanComponent implements OnInit {
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.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config);
this.tabbarService.sendMessage('changeScore');
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑消防设施素材保存失败','确定',config);
this.snackBar.open('建筑消防设施素材同步失败','确定',config);
})
}
@ -991,7 +1032,7 @@ export class CollectionToolsPlanComponent implements OnInit {
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
// console.log('The dialog was closed');
});
}
@ -1016,10 +1057,10 @@ export class CollectionToolsPlanComponent implements OnInit {
//拖拽tree
drop(e){
console.log(1111,e)
// console.log(1111,e)
}
drop2(e){
console.log(222,e)
// console.log(222,e)
}
//创建建筑
@ -1443,7 +1484,7 @@ export class CollectionToolsPlanComponent implements OnInit {
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.version = "2.0"
this.canvasData.originalcompanyBuildingData.companyId? null : this.canvasData.originalcompanyBuildingData.companyId = sessionStorage.getItem('companyId')
resolve('success')
})
@ -1456,7 +1497,7 @@ export class CollectionToolsPlanComponent implements OnInit {
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.version = "2.0"
this.canvasData.originaleveryStoreyData.sitePlanId? null : this.canvasData.originaleveryStoreyData.sitePlanId = e.id || null
this.renovateTreeData()
})
@ -1468,7 +1509,7 @@ export class CollectionToolsPlanComponent implements OnInit {
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.version = "2.0"
this.canvasData.originalcompanyBuildingData.buildingId? null : this.canvasData.originalcompanyBuildingData.buildingId = e.buildingId
resolve('success')
})
@ -1481,7 +1522,7 @@ export class CollectionToolsPlanComponent implements OnInit {
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.version = "2.0"
this.canvasData.originaleveryStoreyData.buildingAreaId? null : this.canvasData.originaleveryStoreyData.buildingAreaId = e.id || null
this.renovateTreeData()
})
@ -1489,7 +1530,6 @@ export class CollectionToolsPlanComponent implements OnInit {
//点击选中 平面图 楼层/区域 时
selectSitePlan (item,index) {
if (this.selectSitePlanIndex != index) {
this.canvasData.selectPanelPoint = new DisposalNodeData();
if (this.canvasData.isChange) { //true 数据被改动
@ -1703,6 +1743,15 @@ export class CollectionToolsPlanComponent implements OnInit {
//复制图层 平面图 楼层/区域
duplicateLayer (item) {
let paramsData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData.data || {} ))
Object.keys(paramsData).forEach((key)=>{
if (key != '图例') {
let ID = ObjectID.default.generate()
paramsData[key].Id = ID
paramsData[ID] = paramsData[key]
delete paramsData[key]
}
}) //图标Id重新赋值
if (this.checkedBuildingIndex==-1) { //总平面图
item.id = ""
item.modifiedTime = new Date()
@ -1710,9 +1759,9 @@ export class CollectionToolsPlanComponent implements OnInit {
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",
version: "2.0",
id: "",
data: JSON.stringify( JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData.data)) ) || null,
data: JSON.stringify( paramsData ) || null,
sitePlanId: data.id
}
this.http.post('/api/SitePlanData',newData,{params:this.params}).subscribe(data=>{
@ -1727,9 +1776,9 @@ export class CollectionToolsPlanComponent implements OnInit {
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",
version: "2.0",
id: "",
data: JSON.stringify( JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData.data)) ) || null,
data: JSON.stringify( paramsData ) || null,
buildingAreaId: data.id
}
this.http.post('/api/BuildingAreaData',newData,{params:this.params}).subscribe(data=>{
@ -1839,7 +1888,6 @@ export class CollectionToolsPlanComponent implements OnInit {
});
this.allLibrary = data
this.selectImageIndex = -1
// this.canvas.cancelPaint()
})
}
@ -2024,6 +2072,7 @@ export class CollectionToolsPlanComponent implements OnInit {
// 切换 基本信息时 刷新 删除 建筑楼层 自定义属性
mateDeleteCustomize () {
this.canvasData.selectPanelPointBaseData = {description: '', notes: '', weather: '', airTemperature: '', windDirection: '', windScale: ''}
this.defaultExpandedKeys = []
this.sitePlanIcon = {fire:0,force:0}
this.sitePlanData.forEach(element => { //楼层

7
src/app/ui/collection-tools-plan/save.ts

@ -90,7 +90,7 @@ export class saveTwoDialogPlan {
nodeItem
itemChildNum = 0 //点击处置节点子数据节点的数量
clickNode(item){
console.log(item)
// console.log(item)
this.nodeItem = item
this.allDisposalNodeChild.forEach(item => {
if(item.id == this.nodeItem.id){
@ -168,14 +168,14 @@ export class saveTwoDialogPlan {
resolve("更新处置节点成功,将天气 节点详情等信息保存到点击的节点")
})
}).then((values)=>{
console.log(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)
// console.log(7788,data)
let objData = {
id: "",
data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null,
@ -260,7 +260,6 @@ export class saveTwoDialogPlan {
})
}).then((id) => {
let dataNodeData
console.log("qnm",id)
new Promise((resolve,reject) => {
postdata.parentId = id
postdata.level = dispositionNodeData.level + 1

17
src/app/ui/collection-tools/collection-tools.component.html

@ -7,14 +7,6 @@
<button mat-button (click)="toggle2()">
<mat-icon style="vertical-align: middle;">list</mat-icon>
</button>
<span style="color: gray;margin-right: 10px;margin-left: 10px;">图标大小</span>
<mat-form-field style="margin-top: 3px;">
<mat-select (selectionChange)='iconScale()' [(ngModel)]="selected">
<mat-option value="1">正常</mat-option>
<mat-option value="2">放大2倍</mat-option>
<mat-option value="4">放大4倍</mat-option>
</mat-select>
</mat-form-field>
<button (click)="copyAsset()" class="copytobutn" mat-button title="复制" style="margin:0 5px;" *ngIf="isEditPattern">
<mat-icon style="padding-bottom: 7px;">library_books</mat-icon>
</button>
@ -74,7 +66,6 @@
style="font-size: 23px;vertical-align:sub;color: rgb(224, 51, 51);">delete</mat-icon>
</span>
</button>
<!-- <button (click)="yyy()">yyyyy</button> -->
<button mat-button (click)="createBuilding()" *ngIf="isEditPattern && pattern">
<span style="font-size: 24px;">+</span>
</button>
@ -135,7 +126,7 @@
</div>
<div [hidden]="!togglePlane" >
<div class="sitePlanContent" *ngFor="let item of sitePlanData;let key = index" [ngClass]="{'isRefugeStorey':item.isRefugeStorey==true,'selectSitePlan': selectSitePlanIndex==key}" (click)='selectSitePlan(item,key)'>
<label class="overflowText" style="display:inline-block; max-width: 160px;"><mat-icon *ngIf="!item.imageUrl" class="matIcons">broken_image</mat-icon>{{item.name}}</label>
<label class="overflowText" [title]="item.name" style="display:inline-block; max-width: 145px;"><mat-icon *ngIf="!item.imageUrl" class="matIcons">broken_image</mat-icon>{{item.name}}</label>
<a href="javascript:;" class="fireForce" *ngIf="isEditPattern && !pattern">
<img src="../../../assets/images/fire.png" *ngIf="item.fire && item.fire==2">
<img src="../../../assets/images/noFire.png" *ngIf="item.fire && item.fire==1">
@ -269,7 +260,7 @@
</div>
</div>
<!-- 如果是多点连线 -->
<div *ngIf="canvasAssetObj.InteractiveMode == 1">
<div *ngIf="canvasAssetObj.InteractiveMode == 1 || canvasAssetObj.InteractiveMode == 3">
<p>厚度</p>
<div style="width: 100%;display: flex;vertical-align: top;height: 22px;">
<input type="number" class="smallinput" [(ngModel)]="sliderValueThickness"
@ -291,7 +282,7 @@
</div>
</div>
<div class="colorDiv" *ngIf="isEditPattern">
<div class="colorDiv" *ngIf="isEditPattern && pattern && canvasAssetObj.GameMode == 0">
<ul>
<li (click)="selectcolor(item,key)" class="colorLi" *ngFor="let item of colors,let key=index" [style]="{'background-color':item}"></li>
</ul>
@ -444,7 +435,7 @@
</div>
<div class="body">
<textarea [disabled]="!isEditPattern" *ngIf="detailsAndattentBtn" name="" id="" rows="10" [(ngModel)]="canvasData.selectPanelPointBaseData.description"></textarea>
<textarea [disabled]="!isEditPattern" *ngIf="!detailsAndattentBtn" name="" id="" rows="10" [(ngModel)]="canvasData.selectPanelPointBaseData.nodes"></textarea>
<textarea [disabled]="!isEditPattern" *ngIf="!detailsAndattentBtn" name="" id="" rows="10" [(ngModel)]="canvasData.selectPanelPointBaseData.notes"></textarea>
</div>
</div>
</div>

159
src/app/ui/collection-tools/collection-tools.component.ts

@ -12,12 +12,10 @@ import Swiper from 'swiper';
import { saveOneDialog } 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';
import { MaskLayerService } from 'src/app/mask-layer.service';
import * as ObjectID from 'bson-objectid';
@Component({
selector: 'app-collection-tools',
@ -28,7 +26,7 @@ export class CollectionToolsComponent 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) { }
constructor(private maskLayerService:MaskLayerService,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) => {//要给渲染节点传那些属性参数
@ -150,9 +148,6 @@ export class CollectionToolsComponent implements OnInit {
pattern:boolean = true//默认为基本信息编辑
yyy(){
console.log(this.canvasData.selectPanelPoint)
}
//基本信息编辑模式
baseInfo(){
if (!this.pattern) {
@ -230,14 +225,13 @@ export class CollectionToolsComponent implements OnInit {
targetNodeData.forEach(i => {
idArr.push(i.id)
})
console.log(6666666666666,event);
if(this.pos == 0 && event.node.origin.children.length == 1){
console.log("移入,没有兄弟")
// console.log("移入,没有兄弟")
let key = event.dragNode.key
orders[key] = 0
parentId = event.node.key
}else{
console.log("移入,多个兄弟")
// console.log("移入,多个兄弟")
let array = []
targetNodeData.forEach(item => {
if(item.id != event.dragNode.key){ //将拖动项先移除掉
@ -245,13 +239,13 @@ export class CollectionToolsComponent implements OnInit {
}
})
if(event.dragNode.isEnd[event.dragNode.isEnd.length - 1]){ //如果移入到最后一个
console.log("最后")
// console.log("最后")
array.push(event.dragNode.origin)
}else if(event.dragNode.isStart[event.dragNode.isStart.length - 1]){//如果移入到第一个
console.log("第一")
// console.log("第一")
array.unshift(event.dragNode.origin)
}else{//如果移入中间位置
console.log("中间")
// console.log("中间")
array.splice(event.node.origin.order, 0, event.dragNode.origin)
}
array.forEach((item,key) => {
@ -274,7 +268,7 @@ export class CollectionToolsComponent implements OnInit {
})
}
}
isDrag //是否可以拖动
pos//放置位置
beforeDrop = (arg: NzFormatBeforeDropEvent) => {
@ -683,15 +677,11 @@ export class CollectionToolsComponent implements OnInit {
this.canvas.on("deselect",obj=>{
this.isShowProperty = false
})
// 监听canvas组件新增素材事件
this.canvas.on("createIcon",obj=>{
//监听数据变化后
this.canvas.on('canvasDataChanged',()=>{
// 收到数据表示共享数据发生变化
this.renovateTreeData(false)
})
// 监听canvas组件删除素材事件
this.canvas.on("deleteIcon",obj=>{
this.renovateTreeData(false)
})
});
}
copyAssetData:any //存储用于复制的素材
@ -705,6 +695,7 @@ export class CollectionToolsComponent implements OnInit {
let buildingId = this.beforeOneCheckedBuilding.id
let floorId = this.selectingSitePlan.id
this.canvas.paste(companyId,buildingId,floorId)
this.renovateTreeData(false)
}
basicInfo:boolean = true //基本信息名称显隐
@ -743,6 +734,9 @@ export class CollectionToolsComponent implements OnInit {
//保存平面图
saveNum :any = []
saveSite(){
//更新用于统计的数据
this.canvasData.updateBuildingData()
if (this.selectingSitePlan && this.selectingSitePlan.id) {
this.saveNum = []
let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData));
@ -754,8 +748,7 @@ export class CollectionToolsComponent implements OnInit {
let adjoinArr = [] //毗邻数组
if(this.pattern){//如果是基本信息编辑模式
//更新用于统计的数据
this.canvasData.updateBuildingData()
this.maskLayerService.sendMessage(true)
for (const key in object) {
if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻
@ -772,6 +765,7 @@ export class CollectionToolsComponent implements OnInit {
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存失败,毗邻存在相同方向','确定',config);
this.maskLayerService.sendMessage(false)
return false
}else{
//如果是单位 总平面图
@ -784,6 +778,7 @@ export class CollectionToolsComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
@ -791,6 +786,7 @@ export class CollectionToolsComponent implements OnInit {
this.snackBar.open('保存成功','确定',config);
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
@ -806,6 +802,7 @@ export class CollectionToolsComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
@ -813,6 +810,7 @@ export class CollectionToolsComponent implements OnInit {
this.snackBar.open('保存成功','确定',config);
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
@ -829,6 +827,7 @@ export class CollectionToolsComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
@ -836,11 +835,16 @@ export class CollectionToolsComponent implements OnInit {
this.snackBar.open('保存成功','确定',config);
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位毗邻保存失败','确定',config);
if(err == 'infos 有重复方向!'){
this.snackBar.open('单位毗邻同步失败,存在相同方向','确定',config);
}else{
this.snackBar.open('单位毗邻同步失败','确定',config);
}
})
//批量保存单位重点部位
@ -852,6 +856,7 @@ export class CollectionToolsComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
@ -859,11 +864,12 @@ export class CollectionToolsComponent implements OnInit {
this.snackBar.open('保存成功','确定',config);
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位重点部位保存失败','确定',config);
this.snackBar.open('单位重点部位同步失败','确定',config);
})
//批量保存单位消防设施素材
@ -875,6 +881,7 @@ export class CollectionToolsComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
@ -882,11 +889,12 @@ export class CollectionToolsComponent implements OnInit {
this.snackBar.open('保存成功','确定',config);
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位消防设施素材保存失败','确定',config);
this.snackBar.open('单位消防设施素材同步失败','确定',config);
})
}else{ //如果是建筑
@ -899,6 +907,7 @@ export class CollectionToolsComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
@ -906,6 +915,7 @@ export class CollectionToolsComponent implements OnInit {
this.snackBar.open('保存成功','确定',config);
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
@ -921,6 +931,7 @@ export class CollectionToolsComponent implements OnInit {
}).subscribe(data => {
this.saveNum.push("1")
if(this.saveNum.length == 5){
this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
@ -928,6 +939,7 @@ export class CollectionToolsComponent implements OnInit {
this.snackBar.open('保存成功','确定',config);
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
@ -940,6 +952,7 @@ export class CollectionToolsComponent implements OnInit {
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.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
@ -947,11 +960,16 @@ export class CollectionToolsComponent implements OnInit {
this.snackBar.open('保存成功','确定',config);
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑毗邻保存失败','确定',config);
if(err == 'infos 有重复方向!'){
this.snackBar.open('建筑毗邻同步失败,存在相同方向','确定',config);
}else{
this.snackBar.open('建筑毗邻同步失败','确定',config);
}
})
//批量保存建筑重点部位
@ -959,6 +977,7 @@ export class CollectionToolsComponent implements OnInit {
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.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
@ -966,11 +985,12 @@ export class CollectionToolsComponent implements OnInit {
this.snackBar.open('保存成功','确定',config);
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑重点部位保存失败','确定',config);
this.snackBar.open('建筑重点部位同步失败','确定',config);
})
//批量保存建筑消防设施素材
@ -978,6 +998,7 @@ export class CollectionToolsComponent implements OnInit {
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.maskLayerService.sendMessage(false)
this.canvasData.isChange = false
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
@ -985,11 +1006,12 @@ export class CollectionToolsComponent implements OnInit {
this.snackBar.open('保存成功','确定',config);
}
},err=>{
this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑消防设施素材保存失败','确定',config);
this.snackBar.open('建筑消防设施素材同步失败','确定',config);
})
}
@ -1005,7 +1027,7 @@ export class CollectionToolsComponent implements OnInit {
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
// console.log('The dialog was closed');
});
}
@ -1030,10 +1052,10 @@ export class CollectionToolsComponent implements OnInit {
//拖拽tree
drop(e){
console.log(1111,e)
// console.log(1111,e)
}
drop2(e){
console.log(222,e)
// console.log(222,e)
}
//创建建筑
@ -1156,11 +1178,11 @@ export class CollectionToolsComponent implements OnInit {
}
storeyData //将建筑素材和当前楼层素材合二为一
selectPanelPoint //传过来的处置素材
//处理 tree 数据结构
handleTreeData (storeyData) {
handleTreeData (storeyData,selectPanelPoint) {
this.storeyData = storeyData
this.selectPanelPoint = selectPanelPoint
let data = this.allFireElements //所有消防要素模板
let treeData = [] //tree型 处理完成后的数据
data.forEach(element => {
@ -1192,6 +1214,30 @@ export class CollectionToolsComponent implements OnInit {
}
}
}
if(selectPanelPoint.Data){
for(let key in selectPanelPoint.Data.Stock){
selectPanelPoint.Data.Stock[key].isLookPattern = true
if(element.id == selectPanelPoint.Data.Stock[key].FireElementId){
selectPanelPoint.Data.Stock[key].isTemplate = false
selectPanelPoint.Data.Stock[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(selectPanelPoint.Data.Stock[key])
}
}
}
data.forEach(item => { if (item.parentId == element.id) {element.children.push(item)} });
});
data.forEach(element => {
@ -1349,7 +1395,16 @@ export class CollectionToolsComponent implements OnInit {
this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key])
}
}
this.handleTreeData(storeyData) //处理tree数据结构
let selectPanelPoint = JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint || {} )) //当前 节点 数据
if(selectPanelPoint.Data){
for(let key in selectPanelPoint.Data.Stock){ //筛选数据 没有匹配全部放入到 其他 数组
let noMatch = this.allFireElements.find( every=> every.id===selectPanelPoint.Data.Stock[key].FireElementId )
if (!noMatch) {
this.allFireElements[this.allFireElements.length-1].children.push(selectPanelPoint.Data.Stock[key])
}
}
}
this.handleTreeData(storeyData,selectPanelPoint) //处理tree数据结构
}
@ -1456,7 +1511,7 @@ export class CollectionToolsComponent implements OnInit {
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.version = "2.0"
this.canvasData.originalcompanyBuildingData.companyId? null : this.canvasData.originalcompanyBuildingData.companyId = sessionStorage.getItem('companyId')
resolve('success')
})
@ -1469,7 +1524,7 @@ export class CollectionToolsComponent implements OnInit {
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.version = "2.0"
this.canvasData.originaleveryStoreyData.sitePlanId? null : this.canvasData.originaleveryStoreyData.sitePlanId = e.id || null
this.renovateTreeData()
})
@ -1481,7 +1536,7 @@ export class CollectionToolsComponent implements OnInit {
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.version = "2.0"
this.canvasData.originalcompanyBuildingData.buildingId? null : this.canvasData.originalcompanyBuildingData.buildingId = e.buildingId
resolve('success')
})
@ -1494,7 +1549,7 @@ export class CollectionToolsComponent implements OnInit {
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.version = "2.0"
this.canvasData.originaleveryStoreyData.buildingAreaId? null : this.canvasData.originaleveryStoreyData.buildingAreaId = e.id || null
this.renovateTreeData()
})
@ -1502,7 +1557,6 @@ export class CollectionToolsComponent implements OnInit {
//点击选中 平面图 楼层/区域 时
selectSitePlan (item,index) {
if (this.selectSitePlanIndex != index) {
this.canvasData.selectPanelPoint = new DisposalNodeData();
if (this.canvasData.isChange) { //true 数据被改动
@ -1716,6 +1770,15 @@ export class CollectionToolsComponent implements OnInit {
//复制图层 平面图 楼层/区域
duplicateLayer (item) {
let paramsData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData.data || {} ))
Object.keys(paramsData).forEach((key)=>{
if (key != '图例') {
let ID = ObjectID.default.generate()
paramsData[key].Id = ID
paramsData[ID] = paramsData[key]
delete paramsData[key]
}
}) //图标Id重新赋值
if (this.checkedBuildingIndex==-1) { //总平面图
item.id = ""
item.modifiedTime = new Date()
@ -1723,9 +1786,9 @@ export class CollectionToolsComponent implements OnInit {
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",
version: "2.0",
id: "",
data: JSON.stringify( JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData.data)) ) || null,
data: JSON.stringify( paramsData ) || null,
sitePlanId: data.id
}
this.http.post('/api/SitePlanData',newData,{params:this.params}).subscribe(data=>{
@ -1740,9 +1803,9 @@ export class CollectionToolsComponent implements OnInit {
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",
version: "2.0",
id: "",
data: JSON.stringify( JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData.data)) ) || null,
data: JSON.stringify( paramsData ) || null,
buildingAreaId: data.id
}
this.http.post('/api/BuildingAreaData',newData,{params:this.params}).subscribe(data=>{
@ -1852,7 +1915,6 @@ export class CollectionToolsComponent implements OnInit {
});
this.allLibrary = data
this.selectImageIndex = -1
// this.canvas.cancelPaint()
})
}
@ -2037,6 +2099,7 @@ export class CollectionToolsComponent implements OnInit {
// 切换 基本信息时 刷新 删除 建筑楼层 自定义属性
mateDeleteCustomize () {
this.canvasData.selectPanelPointBaseData = {description: '', notes: '', weather: '', airTemperature: '', windDirection: '', windScale: ''}
this.defaultExpandedKeys = []
this.sitePlanIcon = {fire:0,force:0}
this.sitePlanData.forEach(element => { //楼层

19
src/app/ui/collection-tools/save.ts

@ -3,6 +3,7 @@ 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' //引入服务
import { MaskLayerService } from 'src/app/mask-layer.service';
// 保存想定作业第一个弹窗
@Component({
selector: 'dialog-overview-example-dialog',
@ -48,6 +49,7 @@ export class saveOneDialog {
export class saveTwoDialog {
constructor(
private maskLayerService:MaskLayerService,
private http:HttpClient,
public dialogRef: MatDialogRef<saveTwoDialog>,
public canvasData: CanvasShareDataService,
@ -90,7 +92,7 @@ export class saveOneDialog {
nodeItem
itemChildNum = 0 //点击处置节点子数据节点的数量
clickNode(item){
console.log(item)
// console.log(item)
this.nodeItem = item
this.allDisposalNodeChild.forEach(item => {
if(item.id == this.nodeItem.id){
@ -102,6 +104,8 @@ export class saveOneDialog {
selectedBuildingData = this.data.selectedBuildingData
selectedSiteData = this.data.selectedSiteData
onSubmit(value,type){
this.maskLayerService.sendMessage(true)
let name = this.selectedBuildingData.name + '-' + this.selectedSiteData.name
//如果保存到已有节点
var postdata = {
@ -146,14 +150,14 @@ export class saveOneDialog {
// 保存平面图数据到当前节点
let postdata =JSON.parse(JSON.stringify(this.canvasData.selectPanelPoint))
postdata.Data = JSON.stringify(postdata.Data)
postdata.DisposalNodeId = istrue.id
// console.log(111,istrue)
this.http.post(`/api/DisposalNodeData`,postdata).subscribe(data => {
this.maskLayerService.sendMessage(false)
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config)
},err=>{
this.maskLayerService.sendMessage(false)
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
@ -176,7 +180,6 @@ export class saveOneDialog {
resolve(data)
})
}).then((data:any)=>{
// console.log(7788,data)
let objData = {
id: "",
data: JSON.stringify(this.canvasData.selectPanelPoint.Data) || null,
@ -185,11 +188,13 @@ export class saveOneDialog {
planComponentId: sessionStorage.getItem("planId"),
}
this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => {
this.maskLayerService.sendMessage(false)
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config)
},err=>{
this.maskLayerService.sendMessage(false)
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
@ -261,7 +266,6 @@ export class saveOneDialog {
})
}).then((id) => {
let dataNodeData
// console.log("qnm",id)
new Promise((resolve,reject) => {
postdata.parentId = id
postdata.level = dispositionNodeData.level + 1
@ -270,9 +274,6 @@ export class saveOneDialog {
})
}).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,
@ -282,12 +283,14 @@ export class saveOneDialog {
}
this.http.post(`/api/DisposalNodeData`,objData).subscribe(data => {
this.maskLayerService.sendMessage(false)
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('保存成功','确定',config)
},err=>{
this.maskLayerService.sendMessage(false)
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000

Loading…
Cancel
Save