邵佳豪 4 years ago
parent
commit
6ccd32da9e
  1. 2
      src/app/navigation/navigation.component.html
  2. 6
      src/app/ui/collection-tools/collection-tools.component.html
  3. 109
      src/app/ui/collection-tools/collection-tools.component.ts

2
src/app/navigation/navigation.component.html

@ -8,7 +8,7 @@
<!-- basicinfo -->
<li [routerLink]="['/datacollection/basicinfo']" routerLinkActive="router-link-active">基本信息</li>
<!-- plan -->
<li [routerLink]="['/datacollection/collectionTools']" routerLinkActive="router-link-active">平面图</li>
<li [routerLink]="['/datacollection/collectionTools']" routerLinkActive="router-link-active">平面图</li>
<!-- allaround -->
<li [routerLink]="['/datacollection/allaround']" routerLinkActive="router-link-active">四周毗邻</li>
<!-- fire-fighting-device -->

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

@ -44,6 +44,10 @@
<!-- 头部操作栏 -->
<div class="headerOperate">
<button mat-button (click)="checkedBuilding({name:'总平面图'},-1)"
[ngClass]="{'buildingbtnchecked': checkedBuildingIndex==-1}">
<span>总平面图</span>
</button>
<button mat-button *ngFor="let item of allBuildings;let key = index" (click)="checkedBuilding(item,key)" class="bigeditdeletebtn"
[ngClass]="{'buildingbtnchecked': checkedBuildingIndex==key}">
<span>{{item.name}}</span>
@ -460,5 +464,7 @@
</div>
</div>
<!--功能区 -->
</div>
</div>

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

@ -3,12 +3,12 @@ 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 {leftFunctionalDomainComponent,editPlaneFigureComponent} from './leftFunctionalDomain'
import Swiper from 'swiper';
import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree';
import {FlatTreeControl} from '@angular/cdk/tree';
import {WorkingAreaComponent} from '../../working-area/working-area.component'
import {CanvasShareDataService} from '../../canvas-share-data.service' //引入服务
import Viewer from 'viewerjs';
import Swiper from 'swiper';
import * as ObjectID from 'bson-objectid';
import { AxMessageSystem } from 'src/app/working-area/model/axMessageSystem';
@Component({
@ -48,9 +48,9 @@ export class CollectionToolsComponent implements OnInit {
selected = "1" //图标大小选择框
allBuildings //该单位所有建筑
beforeOneCheckedBuilding:any; //当前点击选择的建筑
checkedBuildingIndex:number = 0; //当前点击选择的建筑index
isEditPat:boolean = true; //当前是否是编辑模式
beforeOneCheckedBuilding:any = {name:"总平面图"}; //当前点击选择的建筑
checkedBuildingIndex:number = -1 //当前点击选择的建筑index
isEditPat:boolean = true //当前是否是编辑模式
assetName:String//素材名称
assetWidth:number//素材宽度
@ -306,7 +306,7 @@ export class CollectionToolsComponent implements OnInit {
formData.append("file",file)
await new Promise((resolve,reject)=>{
this.http.delete(`/api/Objects/WebPlan2D/${companyId}/${file.name}?x-oss-process=image/resize,m_fixed,h_100,w_100`).subscribe(data=>{
console.log('删除缩略图成功')
// console.log('删除缩略图成功')
resolve('删除缩略图成功')
})
})
@ -440,13 +440,10 @@ export class CollectionToolsComponent implements OnInit {
this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value
this.canvasData.isChange = true
}
isMultiSelect:boolean = false; // 多选/单选 切换
changeMultiSelect (e) { this.canvas.setMulitSelect(this.isMultiSelect) }
isShowLegend:boolean = true; //图例是否显示
changeLegend (e) { this.canvasData.selectPanelPoint.BackgroundImageUrl? null : this.canvas.setLegendVisible(this.isShowLegend) }
isMultipleAsset:boolean = false//框选多个素材属性显隐
multipleAsset:any = {
Width:null,
@ -459,7 +456,6 @@ export class CollectionToolsComponent implements OnInit {
multipleAssetData:any//当前多选的素材
firstMultipleAssetData:any//当前多选的第一个素材
ngOnInit(): void {
let _this = this
AxMessageSystem.addListener('selectionChanged', ()=>{
if(this.canvas.selection.size() == 1){//如果是单选
@ -513,6 +509,8 @@ export class CollectionToolsComponent implements OnInit {
}, this)
this.getAllLibrary()
this.getAllBuildings()
let that = this
window.setTimeout(()=>{
document.getElementById("functionalDomainContent").oncontextmenu = function (event) {
@ -623,11 +621,13 @@ export class CollectionToolsComponent implements OnInit {
})
}
ngAfterViewInit(): void {
this.getAllBuildings(true)
// 监听canvas组件新增素材事件
this.canvas.on("canvasDataChanged",obj=>{
this.getSitePlan()
//监听数据变化后
this.canvas.on('canvasDataChanged',()=>{
// 收到数据表示共享数据发生变化
this.renovateTreeData(false)
})
});
}
copyAssetData:any //存储用于复制的素材
@ -647,12 +647,19 @@ export class CollectionToolsComponent implements OnInit {
}
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.basicInfo,1)
// }
isEditPattern:boolean = true //是否为编辑模式
//进入编辑模式
editpat(){
@ -761,7 +768,11 @@ export class CollectionToolsComponent implements OnInit {
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);
}
})
//批量保存单位重点部位
@ -780,7 +791,7 @@ export class CollectionToolsComponent implements OnInit {
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位重点部位保存失败','确定',config);
this.snackBar.open('单位重点部位同步失败','确定',config);
})
//批量保存单位消防设施素材
@ -799,7 +810,7 @@ export class CollectionToolsComponent implements OnInit {
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('单位消防设施素材保存失败','确定',config);
this.snackBar.open('单位消防设施素材同步失败','确定',config);
})
}else{ //如果是建筑
@ -856,7 +867,11 @@ export class CollectionToolsComponent implements OnInit {
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);
}
})
//批量保存建筑重点部位
@ -875,7 +890,7 @@ export class CollectionToolsComponent implements OnInit {
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑重点部位保存失败','确定',config);
this.snackBar.open('建筑重点部位同步失败','确定',config);
})
//批量保存建筑消防设施素材
@ -894,7 +909,7 @@ export class CollectionToolsComponent implements OnInit {
config.verticalPosition = 'top';
config.duration = 3000
this.canvasData.isChange = true
this.snackBar.open('建筑消防设施素材保存失败','确定',config);
this.snackBar.open('建筑消防设施素材同步失败','确定',config);
})
}
@ -909,14 +924,9 @@ export class CollectionToolsComponent implements OnInit {
}
//获得所有的建筑物
getAllBuildings(init:boolean = false){
this.http.get("/api/CompanyAccount/Buildings").subscribe((data:any)=>{
getAllBuildings(){
this.http.get("/api/CompanyAccount/Buildings").subscribe(data=>{
this.allBuildings = data
if (init) {
this.checkedBuildingIndex = 0
data && data.length? this.beforeOneCheckedBuilding = data[0] : this.beforeOneCheckedBuilding = {id:null, buildingTypes:[{id:null}]}
this.getBuildingSitePlan(this.beforeOneCheckedBuilding)
}
})
}
@ -930,7 +940,7 @@ export class CollectionToolsComponent implements OnInit {
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('创建成功','确定',config);
this.allBuildings.length? this.getAllBuildings() : this.getAllBuildings(true)
this.getAllBuildings()
}else if (data == "创建失败") {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
@ -1008,13 +1018,18 @@ export class CollectionToolsComponent implements OnInit {
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('删除成功','确定',config);
this.getAllBuildings(true)
this.http.get("/api/CompanyAccount/Buildings").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(true)
this.getAllBuildings()
})
}
}
@ -1023,7 +1038,7 @@ export class CollectionToolsComponent implements OnInit {
//处理 tree 数据结构
handleTreeData (storeyData) {
this.hideAllTreenode = true
this.storeyData = storeyData
let data = this.allFireElements //所有消防要素模板
let treeData = [] //tree型 处理完成后的数据
@ -1062,6 +1077,7 @@ export class CollectionToolsComponent implements OnInit {
if (!element.parentId) { treeData.push(element) }
});
this.dataSource.data = treeData
this.treeControl.expandAll()
}
@ -1173,31 +1189,6 @@ export class CollectionToolsComponent implements OnInit {
this.canvas.setIconVisible(iconVisibleArr,!node.isLook)
}
//计算 可视区域内宽度, 是否缩放背景图
backGroundScale () {
// let that = this
// let dad = document.querySelector('.functionalDomainContent').clientWidth
// let dadHeight = document.querySelector('.functionalDomainContent').clientHeight
// let left = document.querySelector('.functionalDomainLeft').clientWidth
// let right = document.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) {
@ -1224,6 +1215,7 @@ export class CollectionToolsComponent implements OnInit {
}
}
this.handleTreeData(storeyData) //处理tree数据结构
}
@ -1419,7 +1411,6 @@ export class CollectionToolsComponent implements OnInit {
//新增平面图 楼层/区域
foundPanel (e) {
e.stopPropagation()
if (this.beforeOneCheckedBuilding.id) {
let data = {
isBuilding: this.checkedBuildingIndex==-1? false:true,
Panel: this.beforeOneCheckedBuilding,
@ -1433,12 +1424,6 @@ export class CollectionToolsComponent implements OnInit {
this.renovateBuilding()
}
})
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请选择建筑','确定',config);
}
}
//编辑平面图 楼层/区域

Loading…
Cancel
Save