徐振升 4 years ago
parent
commit
9b6b85c05f
  1. 11
      src/app/ui/collection-tools/collection-tools.component.html
  2. 3
      src/app/ui/collection-tools/collection-tools.component.scss
  3. 112
      src/app/ui/collection-tools/collection-tools.component.ts
  4. 4
      src/app/working-area/working-area.component.ts

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

@ -14,11 +14,11 @@
<mat-option value="option3">放大4倍</mat-option>
</mat-select>
</mat-form-field>
<button class="copytobutn" mat-button title="复制" style="margin:0 5px;" *ngIf="isEditPattern">
<button (click)="copyAsset()" class="copytobutn" mat-button title="复制" style="margin:0 5px;" *ngIf="isEditPattern">
<mat-icon>library_books</mat-icon>
</button>
<button class="copytobutn" mat-button title="粘贴" *ngIf="isEditPattern">
<button (click)="pasteAsset()" class="copytobutn" mat-button title="粘贴" *ngIf="isEditPattern">
<mat-icon>screen_share</mat-icon>
</button>
@ -147,7 +147,7 @@
<!-- 右侧div鼠标拖动div -->
<div style="width: 3px;height: 100%;position: absolute;left: 0;cursor: e-resize;z-index: 1000;" (mousedown)="rightDivMouseDown($event)"></div>
<!-- 属性 -->
<div id="property" class="property" style="height: 50%;">
<div [ngClass]="{'forbidden': !isEditPattern}" id="property" class="property" style="height: 50%;">
<div class="title">
<div>
<span style="user-select: none">属性</span>
@ -302,7 +302,8 @@
<div class="firecategoriesTree">
<!-- 消防列表树写在这里 -->
<mat-tree [dataSource]="dataSource" [treeControl]="treeControl" >
<mat-tree-node *matTreeNodeDef="let node;" matTreeNodePadding cdkTreeNodePaddingIndent='26' (click)="clickTreeNode(node)">
<mat-tree-node [ngClass]="{'isLookPattern': !node.isLookPattern && !isEditPattern}" *matTreeNodeDef="let node;" matTreeNodePadding cdkTreeNodePaddingIndent='26' (click)="clickTreeNode(node)" >
<button mat-icon-button disabled></button>
{{node.name}}
<span *ngIf="node.isTemplate">({{node.children.length}})</span>
@ -310,7 +311,7 @@
</mat-tree-node>
<mat-tree-node *matTreeNodeDef="let node;when: hasChild" matTreeNodePadding (click)="clickTreeNode(node)">
<mat-tree-node [ngClass]="{'isLookPattern': !node.isLookPattern && !isEditPattern}" *matTreeNodeDef="let node;when: hasChild" matTreeNodePadding (click)="clickTreeNode(node)">
<button mat-icon-button
matTreeNodeToggle
[attr.aria-label]="'toggle ' + node.name">

3
src/app/ui/collection-tools/collection-tools.component.scss

@ -299,3 +299,6 @@ div:focus {
.mat-tree-node:hover{
background-color: #ccebf8;
}
.isLookPattern{
display: none;
}

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

@ -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
}
}

4
src/app/working-area/working-area.component.ts

@ -270,7 +270,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
public versionChecking(): void {
const floorData = this.canvasData.originaleveryStoreyData;
const buildingData = this.canvasData.originalcompanyBuildingData;
if (floorData.version === '1.0') {
if (floorData.version && floorData.version === '1.0') {
floorData.version = '2.0';
Object.keys(floorData.data).forEach(item => {
floorData.data[item].Point.y *= -1;
@ -279,7 +279,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
});
});
}
if (buildingData.version === '1.0') {
if (buildingData.version && buildingData.version === '1.0') {
buildingData.version = '2.0';
Object.keys(buildingData.data).forEach(item => {
buildingData.data[item].Point.y *= -1;

Loading…
Cancel
Save