|
|
|
@ -30,7 +30,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
isTemplate:node.isTemplate, |
|
|
|
|
isNewElement:node.isNewElement, |
|
|
|
|
isLook:node.isLook, |
|
|
|
|
node:node |
|
|
|
|
isLookPattern:node.isLookPattern || null |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
treeControl = new FlatTreeControl<any>(node => node.level, node => node.expandable); |
|
|
|
@ -162,17 +162,22 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
//素材宽度输入框改变
|
|
|
|
|
assetWidthIunput(){ |
|
|
|
|
this.canvasAssetObj.Width = this.assetWidth |
|
|
|
|
// 需要将this.canvasAssetObj替换到serves服务对应对象中 ↓↓↓↓↓↓↓
|
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.canvas.refresh() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//素材高度输入框改变
|
|
|
|
|
assetHeightIunput(){ |
|
|
|
|
this.canvasAssetObj.Height = this.assetHeight |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.canvas.refresh() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//素材角度输入框改变
|
|
|
|
|
assetAngleIunput(){ |
|
|
|
|
this.canvasAssetObj.Angle = this.sliderValue |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.canvas.refresh() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//素材是否高亮改变----->本地操作行为
|
|
|
|
@ -186,6 +191,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
return i.PropertyName == item.PropertyName |
|
|
|
|
}) |
|
|
|
|
this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//动态属性素材布尔值框改变radio
|
|
|
|
@ -194,7 +200,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
return i.PropertyName == item.PropertyName |
|
|
|
|
}) |
|
|
|
|
this.canvasAssetObj.PropertyInfos[index].PropertyValue = boolean |
|
|
|
|
|
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
colorIndex//默认素材颜色
|
|
|
|
@ -204,6 +210,8 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
//在当前透明度基础上改变颜色
|
|
|
|
|
this.selectedcolor = item + this.selectedcolor.substring(this.selectedcolor.length-2) |
|
|
|
|
this.canvasAssetObj.Color = this.selectedcolor |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.canvas.refresh() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//颜色选择滑竿的值
|
|
|
|
@ -217,6 +225,8 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
this.selectedcolor = replacepos(this.selectedcolor,7,8,colorOpacity.toString(16)) |
|
|
|
|
this.canvasAssetObj.Color = this.selectedcolor |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
this.canvas.refresh() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//查看图片详情
|
|
|
|
@ -233,7 +243,6 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
let imgFile = e.target.files[0] || null //上传的文件
|
|
|
|
|
this.startUploading(imgFile) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
objectName:any //上传对象名
|
|
|
|
|
startUploading (imgFile) { |
|
|
|
|
let _this = this |
|
|
|
@ -295,8 +304,8 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
}else{ |
|
|
|
|
this.isImgNumCss = false |
|
|
|
|
} |
|
|
|
|
//此处需要把 this.canvasAssetObj这个传入对象 返回给canvas 或者在源数据中替换掉↓↓↓↓↓↓↓↓↓↓
|
|
|
|
|
|
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
}) |
|
|
|
|
} else if (file && fileSize>shardSize) { //上传文件>5MB时,分块上传
|
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
@ -333,7 +342,8 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.mySwiper.update(); |
|
|
|
|
}, 0); |
|
|
|
|
//此处需要把 this.canvasAssetObj这个传入对象 返回给canvas ↓↓↓↓↓↓↓↓↓↓
|
|
|
|
|
|
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -343,6 +353,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
return i.PropertyName == item.PropertyName |
|
|
|
|
}) |
|
|
|
|
this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//动态属性供给区域select选择框
|
|
|
|
@ -351,6 +362,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
return i.PropertyName == item.PropertyName |
|
|
|
|
}) |
|
|
|
|
this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//动态属性供给类型select选择框
|
|
|
|
@ -359,6 +371,7 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
return i.PropertyName == item.PropertyName |
|
|
|
|
}) |
|
|
|
|
this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value |
|
|
|
|
this.canvasData.isChange = true |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
@ -366,11 +379,6 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
this.getAllLibrary() |
|
|
|
|
this.getSitePlan() |
|
|
|
|
this.getAllBuildings() |
|
|
|
|
setTimeout(() => { |
|
|
|
|
// console.log(1,this.canvasData.selectStorey)
|
|
|
|
|
// console.log(2,this.canvasData.originalcompanyBuildingData)
|
|
|
|
|
// console.log(3,this.canvasData.originaleveryStoreyData)
|
|
|
|
|
}, 3000); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -379,13 +387,26 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
this.canvas.on("select",obj=>{ |
|
|
|
|
//选中素材属性注入函数
|
|
|
|
|
this.setAssetsProperty(obj.assetData) |
|
|
|
|
console.log(obj.assetData) |
|
|
|
|
}) |
|
|
|
|
// 监听canvas组件取消选中素材事件
|
|
|
|
|
this.canvas.on("deselect",obj=>{ |
|
|
|
|
this.isShowProperty = false |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
copyAssetData:any //存储用于复制的素材
|
|
|
|
|
//复制素材
|
|
|
|
|
copyAsset(){ |
|
|
|
|
this.canvas.copy() |
|
|
|
|
} |
|
|
|
|
//粘贴素材
|
|
|
|
|
pasteAsset(){ |
|
|
|
|
let companyId = sessionStorage.getItem("companyId") |
|
|
|
|
let buildingId = this.beforeOneCheckedBuilding.id |
|
|
|
|
let floorId = this.selectingSitePlan.id |
|
|
|
|
this.canvas.paste(companyId,buildingId,floorId) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
basicInfo:boolean = true //基本信息名称显隐
|
|
|
|
|
wantToWork:boolean = true //想定作业名称显隐
|
|
|
|
|
//点击基本信息名称
|
|
|
|
@ -428,7 +449,6 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
CompanyData.data = JSON.stringify(CompanyData.data) |
|
|
|
|
|
|
|
|
|
if(this.checkedBuildingIndex==-1){ |
|
|
|
|
console.log(SitePlanData) |
|
|
|
|
this.http.post("/api/CompanyAccount/SitePlanData",SitePlanData).subscribe(data => { |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
@ -569,18 +589,33 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
handleTreeData (storeyData) { |
|
|
|
|
this.storeyData = storeyData |
|
|
|
|
|
|
|
|
|
let data = this.allFireElements //所有消防要素
|
|
|
|
|
let data = this.allFireElements //所有消防要素模板
|
|
|
|
|
let treeData = [] //tree型 处理完成后的数据
|
|
|
|
|
data.forEach(element => { |
|
|
|
|
element.isTemplate = true //添加模板标识
|
|
|
|
|
element.isLook = true //添加是否可见标识
|
|
|
|
|
element.children = [] |
|
|
|
|
element.name!='其他'? element.children = [] : element.children |
|
|
|
|
|
|
|
|
|
if(storeyData){ |
|
|
|
|
for(let key in storeyData.data){ |
|
|
|
|
storeyData.data[key].isLookPattern = true |
|
|
|
|
if(element.id == storeyData.data[key].FireElementId){ |
|
|
|
|
storeyData.data[key].isTemplate = false |
|
|
|
|
storeyData.data[key].isLook = true |
|
|
|
|
element.isNewElement = true |
|
|
|
|
|
|
|
|
|
element.isNewElement = true //该节点children是否存在新添加的真实素材 标识
|
|
|
|
|
|
|
|
|
|
//定义查看模式下能看到的元素
|
|
|
|
|
element.isLookPattern = true |
|
|
|
|
if(element.parentId){ |
|
|
|
|
data.forEach(i => { |
|
|
|
|
if(i.id == element.parentId){ |
|
|
|
|
i.isLookPattern = true |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
element.children.push(storeyData.data[key]) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -591,13 +626,16 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
if (!element.parentId) { treeData.push(element) } |
|
|
|
|
}); |
|
|
|
|
this.dataSource.data = treeData |
|
|
|
|
console.log(this.dataSource.data) |
|
|
|
|
this.treeControl.expandAll() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//点击树节点
|
|
|
|
|
clickTreeNode(node){ |
|
|
|
|
if(node.node.Point){
|
|
|
|
|
this.setAssetsProperty(node.node) |
|
|
|
|
if(this.canvasData.originalcompanyBuildingData.data[node.id]){ |
|
|
|
|
this.setAssetsProperty(this.canvasData.originalcompanyBuildingData.data[node.id]) |
|
|
|
|
}else if(this.canvasData.originaleveryStoreyData.data[node.id]){ |
|
|
|
|
this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[node.id]) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -642,7 +680,8 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
this.canvas.refresh() |
|
|
|
|
this.canvasData.isChange = false //服务中 数据是否改动 改为false
|
|
|
|
|
this.isShowProperty = true |
|
|
|
|
this.isShowAttribute = true //属性栏展示 默认数据
|
|
|
|
|
this.isShowAttribute = true |
|
|
|
|
this.allFireElements[this.allFireElements.length-1].children = [] |
|
|
|
|
|
|
|
|
|
let beforeOneId = this.selectingSitePlan.id || '' //当前 选中 平面图 楼层/区域 id
|
|
|
|
|
let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 当前 单位/建筑 数据
|
|
|
|
@ -653,6 +692,12 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
storeyData.data[key] = companyBuildingData.data[key] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for(let key in storeyData.data){ //筛选数据 没有匹配全部放入到 其他 数组
|
|
|
|
|
let noMatch = this.allFireElements.find( every=> every.id===storeyData.data[key].FireElementId ) |
|
|
|
|
if (!noMatch) { |
|
|
|
|
this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key]) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.handleTreeData(storeyData) //处理tree数据结构
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -726,6 +771,17 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
let params = {ids:e} |
|
|
|
|
let isTrue = this.http.get('/api/Companies/FireElements',{params}).subscribe((data:any)=>{ |
|
|
|
|
this.allFireElements = data //所有消防要素
|
|
|
|
|
let other = { |
|
|
|
|
children: [], |
|
|
|
|
computed: true, |
|
|
|
|
id: '', |
|
|
|
|
name: '其他', |
|
|
|
|
order: 999, |
|
|
|
|
parentId: null, |
|
|
|
|
tag: "INPUT", |
|
|
|
|
isLookPattern : true |
|
|
|
|
} |
|
|
|
|
this.allFireElements.push(other) |
|
|
|
|
return true |
|
|
|
|
}) |
|
|
|
|
if (isTrue) { return 'success' } |
|
|
|
@ -782,6 +838,22 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
//点击选中 平面图 楼层/区域 时
|
|
|
|
|
selectSitePlan (item,index) { |
|
|
|
|
if (this.selectSitePlanIndex != index) { |
|
|
|
|
|
|
|
|
|
if (this.canvasData.isChange) { //true 数据被改动
|
|
|
|
|
let isTrue = confirm('是否保存当前编辑数据') |
|
|
|
|
if (isTrue) { //保存一遍数据, 再刷新数据
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
this.selectingSitePlan = item |
|
|
|
|
this.selectSitePlanIndex = index |
|
|
|
|
this.canvasData.selectStorey = item //服务中 存一份数据
|
|
|
|
|
if (this.checkedBuildingIndex==-1) { //总平面图时
|
|
|
|
|
this.getSitePlanStorey(item) //获取 平面图 楼层数据
|
|
|
|
|
} else { //楼层/区域时
|
|
|
|
|
this.getBuildingStorey(item) //获取 建筑 楼层数据
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { //false 数据没被改动
|
|
|
|
|
this.selectingSitePlan = item |
|
|
|
|
this.selectSitePlanIndex = index |
|
|
|
|
this.canvasData.selectStorey = item //服务中 存一份数据
|
|
|
|
@ -790,6 +862,8 @@ export class CollectionToolsComponent implements OnInit {
|
|
|
|
|
} else { //楼层/区域时
|
|
|
|
|
this.getBuildingStorey(item) //获取 建筑 楼层数据
|
|
|
|
|
} |
|
|
|
|
} //if
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|