Browse Source

[完善]修改调用canvas方法时机

master
邵佳豪 4 years ago
parent
commit
fb30efc2fb
  1. 74
      src/app/ui/collection-tools-examinee/collection-tools.component.ts
  2. 24
      src/app/ui/collection-tools-examinee/save.ts
  3. 137
      src/app/ui/collection-tools-read/collection-tools.component.ts
  4. 152
      src/app/ui/collection-tools/collection-tools.component.ts

74
src/app/ui/collection-tools-examinee/collection-tools.component.ts

@ -882,45 +882,7 @@ export class CollectionToolsExamineeComponent implements OnInit {
let beforeOneId = this.selectingSitePlan.id || '' //当前 选中 平面图 楼层/区域 id
let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 当前 单位/建筑 数据
let storeyData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData || {} )) //当前 楼层 数据
// console.log('看看这是啥',this.Facilities)
// this.Facilities ? this.Facilities.forEach(item => {
// item.key == this.selectingSitePlan.id ?
// this.getAllAssetLibraries(item) :
// this.canvas.loadExamineeData()
// }) : this.canvas.loadExamineeData();this.allLibrary = this.originalallLibrary
//如果有需要标注的平面图
if(this.Facilities){
this.Facilities.some((item,key)=>{
if(item.key == this.selectingSitePlan.id){
let arr = []
item.children.forEach(i => {
arr.push(i.Id)
})
this.canvasData.hiddenBasicInfoFacilities = JSON.parse(JSON.stringify(arr))
console.log('这层有需要标注的基本信息素材',item)
let allFireElements = JSON.parse(JSON.stringify(this.allFireElements))
if(this.clickedNodeType == 0){
this.canvas.onExaminerClickFloor()
this.clickedNodeType = null
}else{
this.canvas.onExamineeClickFloor()
this.clickedNodeType = null
}
return true
} else{
if(key == this.Facilities.length - 1){
this.canvas.onExaminerClickFloor()
return false
}
}
})
}else{
this.canvas.onExamineeClickFloor()
}
for(let key in storeyData.data){ //筛选数据
storeyData.data[key].key = storeyData.data[key].Id
let noMatch = this.allFireElements.find( every=> every.id===storeyData.data[key].FireElementId )
@ -1081,6 +1043,23 @@ export class CollectionToolsExamineeComponent implements OnInit {
this.canvasData.examOriginaleveryStoreyData.version? null : this.canvasData.examOriginaleveryStoreyData.version = "2.0"
this.canvasData.examOriginaleveryStoreyData.buildingAreaId? null : this.canvasData.examOriginaleveryStoreyData.buildingAreaId = e.id || null
this.renovateTreeData()
if(this.Facilities){
console.log(1111)
this.Facilities.forEach(item => {
if(item.key == this.selectingSitePlan.id){
console.log(333)
//如果当层有需要标记的基本信息素材
this.getAllAssetLibraries(item)
}else{
console.log(444)
this.canvas.onExamineeClickFloor()
}
})
}else{
console.log(2222)
this.canvas.onExamineeClickFloor();
this.allLibrary = this.originalallLibrary
}
})
})
}
@ -1104,6 +1083,17 @@ export class CollectionToolsExamineeComponent implements OnInit {
this.canvasData.examOriginaleveryStoreyData.version? null : this.canvasData.examOriginaleveryStoreyData.version = "2.0"
this.canvasData.examOriginaleveryStoreyData.buildingAreaId? null : this.canvasData.examOriginaleveryStoreyData.buildingAreaId = e.id || null
this.renovateTreeData()
if(this.Facilities){
this.Facilities.forEach(item => {
if(item.key == this.selectingSitePlan.id){
this.getAllAssetLibraries(item)
}else{
this.canvas.onExamineeClickFloor()
}
})
}else{
this.canvas.onExamineeClickFloor();this.allLibrary = this.originalallLibrary
}
})
})
}
@ -1694,7 +1684,13 @@ export class CollectionToolsExamineeComponent implements OnInit {
if (this.canvasData.selectPanelPoint.DisposalNodeId != e.id) { //选择节点 不是当前节点时
let api
type == 0 ? api='/api/DisposalNodeData' : api='/api/ExamDisposalNodeData'
//如果是已存在预案
if( this.examType == 1){
type == 0 ? api='/api/DisposalNodeData' : api='/api/ExamDisposalNodeData'
}else{ //如果是自定义预案
api='/api/ExamDisposalNodeData'
}
let params = {nodeId: e.id}
let parameter = { //查询 节点 对应 建筑/楼层 index,id
buildingIndex: e.sitePlanId? -1 : this.allBuildings.findIndex(item=>{ return item.id===e.buildingId }), //总平面图/建筑 index

24
src/app/ui/collection-tools-examinee/save.ts

@ -133,12 +133,12 @@ export class saveOneDialogExaminee {
if(type == 'old'){
let istrue = this.canvasData.findDisposalNode(this.nodeItem.id,name)
let putdata = this.nodeItem
putdata.weather = this.canvasData.selectPanelPointBaseData.weather
putdata.airTemperature = Number(this.canvasData.selectPanelPointBaseData.airTemperature)
putdata.windScale = Number(this.canvasData.selectPanelPointBaseData.windScale)
putdata.windDirection = Number(this.canvasData.selectPanelPointBaseData.windDirection)
putdata.description = this.canvasData.selectPanelPointBaseData.description
putdata.notes = this.canvasData.selectPanelPointBaseData.notes
putdata.weather = null
putdata.airTemperature = null
putdata.windScale = null
putdata.windDirection = null
putdata.description = null
putdata.notes = null
if(istrue){//如果该处置节点下已有同名数据节点 则只修改 2个接口
@ -253,12 +253,12 @@ export class saveOneDialogExaminee {
disposalNodeType:1
}
dispositionNodeData.weather = this.canvasData.selectPanelPointBaseData.weather
dispositionNodeData.airTemperature = Number(this.canvasData.selectPanelPointBaseData.airTemperature)
dispositionNodeData.windScale = Number(this.canvasData.selectPanelPointBaseData.windScale)
dispositionNodeData.windDirection = Number(this.canvasData.selectPanelPointBaseData.windDirection)
dispositionNodeData.description = this.canvasData.selectPanelPointBaseData.description
dispositionNodeData.notes = this.canvasData.selectPanelPointBaseData.notes
dispositionNodeData.weather = null
dispositionNodeData.airTemperature = null
dispositionNodeData.windScale = null
dispositionNodeData.windDirection = null
dispositionNodeData.description = null
dispositionNodeData.notes = null
//1.先创建一个处置节点 然后 .then 2.创建数据节点到刚创建的处置节点 3.然后拿着创建好的数据节点的id 将平面图data保存
new Promise((resolve,reject) => {
console.log(1,dispositionNodeData)

137
src/app/ui/collection-tools-read/collection-tools.component.ts

@ -397,8 +397,6 @@ export class CollectionToolsReadComponent implements OnInit {
//点击树节点的显示隐藏icon
clickLookItem(node){
// console.log(this.allFireElements)
//子节点跟随父节点的islook变化
  if(node.origin.children && node.origin.children.length != 0){
node.origin.isLook = !node.origin.isLook
@ -416,26 +414,6 @@ export class CollectionToolsReadComponent implements OnInit {
//canvas上的素材显隐
let iconVisibleArr:any = []
// if(node.origin.children && node.origin.children.length != 0){//如果是模板,则开始向下找
// node.origin.children.forEach(item => {
// if(item.children && item.children.length != 0){//如果子节点依旧是模板,则继续开始向下找
// item.children.forEach(i => {
// if(i.isLook == false){
// iconVisibleArr.push(i.Id)
// }
// })
// }else{
// if(item.isLook == false){
// iconVisibleArr.push(item.Id)
// }
// }
// })
// }else{
// if(node.origin.isLook == false){
// iconVisibleArr.push(node.origin.Id)
// }
// }
console.log(this.renderData)
this.renderData.forEach(item =>{
if(item.Id && item.isLook == false){
@ -585,45 +563,7 @@ export class CollectionToolsReadComponent implements OnInit {
let companyBuildingData = JSON.parse(JSON.stringify( this.canvasData.originalcompanyBuildingData || {} )) // 当前 单位/建筑 数据
let storeyData = JSON.parse(JSON.stringify( this.canvasData.originaleveryStoreyData || {} )) //当前 楼层 数据
console.log('this.Facilities',this.Facilities)
//如果有需要标注的平面图
if(this.Facilities){
this.Facilities.some((item,key)=>{
if(item.key == this.selectingSitePlan.id){
let arr = []
item.children.forEach(i => {
arr.push(i.Id)
})
this.hiddenBasicInfoFacilities = arr
this.canvasData.hiddenBasicInfoFacilities = JSON.parse(JSON.stringify(arr))
console.log('这层有需要标注的基本信息素材',item)
let allFireElements = JSON.parse(JSON.stringify(this.allFireElements))
this.renderData = []
setTimeout(() => {
this.renderData = [...this.processingData(allFireElements,item.children)]
}, 0);
if(this.clickedNodeType == 0){
this.canvas.onExaminerClickFloor()
this.clickedNodeType = null
}else{
this.canvas.onExamineeClickFloor()
this.clickedNodeType = null
}
return true
} else{
if(key == this.Facilities.length - 1){
this.renderData = []
this.canvas.onExaminerClickFloor()
return false
}
}
})
}else{
this.canvas.onExamineeClickFloor()
}
for(let key in storeyData.data){ //筛选数据
storeyData.data[key].key = storeyData.data[key].Id
let noMatch = this.allFireElements.find( every=> every.id===storeyData.data[key].FireElementId )
@ -844,8 +784,39 @@ export class CollectionToolsReadComponent implements OnInit {
this.canvasData.examOriginaleveryStoreyData.version? null : this.canvasData.examOriginaleveryStoreyData.version = "2.0"
this.canvasData.examOriginaleveryStoreyData.buildingAreaId? null : this.canvasData.examOriginaleveryStoreyData.buildingAreaId = e.id || null
this.renovateTreeData()
//如果有需要标注的平面图
if(this.Facilities){
this.Facilities.some((item,key)=>{
if(item.key == this.selectingSitePlan.id){
let arr = []
item.children.forEach(i => {
arr.push(i.Id)
})
this.hiddenBasicInfoFacilities = arr
this.canvasData.hiddenBasicInfoFacilities = JSON.parse(JSON.stringify(arr))
console.log('这层有需要标注的基本信息素材',item)
let allFireElements = JSON.parse(JSON.stringify(this.allFireElements))
this.renderData = []
setTimeout(() => {
this.renderData = [...this.processingData(allFireElements,item.children)]
}, 0);
this.canvas.onExamineeClickFloor()
this.clickedNodeType = null
return true
} else{
if(key == this.Facilities.length - 1){
this.renderData = []
this.canvas.onExamineeClickFloor()
return false
}
}
})
}else{
this.canvas.onExamineeClickFloor()
}
})
//如果有需要标注的平面图
})
@ -870,6 +841,40 @@ export class CollectionToolsReadComponent implements OnInit {
this.canvasData.examOriginaleveryStoreyData.version? null : this.canvasData.examOriginaleveryStoreyData.version = "2.0"
this.canvasData.examOriginaleveryStoreyData.buildingAreaId? null : this.canvasData.examOriginaleveryStoreyData.buildingAreaId = e.id || null
this.renovateTreeData()
//如果有需要标注的平面图
if(this.Facilities){
this.Facilities.some((item,key)=>{
if(item.key == this.selectingSitePlan.id){
let arr = []
item.children.forEach(i => {
arr.push(i.Id)
})
this.hiddenBasicInfoFacilities = arr
this.canvasData.hiddenBasicInfoFacilities = JSON.parse(JSON.stringify(arr))
console.log('这层有需要标注的基本信息素材',item)
let allFireElements = JSON.parse(JSON.stringify(this.allFireElements))
this.renderData = []
setTimeout(() => {
this.renderData = [...this.processingData(allFireElements,item.children)]
}, 0);
this.canvas.onExamineeClickFloor()
this.clickedNodeType = null
return true
} else{
if(key == this.Facilities.length - 1){
this.renderData = []
this.canvas.onExamineeClickFloor()
return false
}
}
})
}else{
this.canvas.onExamineeClickFloor()
}
})
})
}
@ -1115,14 +1120,20 @@ export class CollectionToolsReadComponent implements OnInit {
if (this.canvasData.selectPanelPoint.DisposalNodeId != e.id) { //选择节点 不是当前节点时
let api
type == 0 ? api='/api/DisposalNodeData' : api='/api/ExamDisposalNodeData'
//如果是已存在预案
if( this.examType == 1){
type == 0 ? api='/api/DisposalNodeData' : api='/api/ExamDisposalNodeData'
}else{ //如果是自定义预案
api='/api/ExamDisposalNodeData'
}
let params = {nodeId: e.id}
let parameter = { //查询 节点 对应 建筑/楼层 index,id
buildingIndex: e.sitePlanId? -1 : this.allBuildings.findIndex(item=>{ return item.id===e.buildingId }), //总平面图/建筑 index
storeyId: e.sitePlanId? e.sitePlanId : e.buildingAreaId, //楼层id
}
this.http.get(api,{params:params}).subscribe(data=>{
// console.log('xixixi',data)
this.canvasData.selectPanelPoint = this.canvasData.deserialize(JSON.stringify(data || new DisposalNodeData())) //选择 当前 节点
this.canvasData.selectPanelPoint.Data = this.canvasData.deserialize(this.canvasData.selectPanelPoint.Data)

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

@ -802,38 +802,38 @@ export class CollectionToolsComponent implements OnInit {
checkedBuilding(item,index){
if (this.checkedBuildingIndex!=index) {
if (this.canvasData.isChange) { //true 数据被改动
let isTrue = confirm('是否保存当前编辑数据')
if (isTrue) { //先保存数据 在切换
let isSuccess = this.saveSite()//true的时候 先保存数据
if (isSuccess != false) {
this.beforeOneCheckedBuilding = item
this.checkedBuildingIndex = index
if (index==-1) { //总平面图数据
this.getSitePlan()
} else { //建筑楼层/区域数据
this.getBuildingSitePlan(item)
}
}
} else {
this.beforeOneCheckedBuilding = item
this.checkedBuildingIndex = index
if (index==-1) { //总平面图数据
this.getSitePlan()
} else { //建筑楼层/区域数据
this.getBuildingSitePlan(item)
}
}
} else { //flase 数据未被改动
this.beforeOneCheckedBuilding = item
this.checkedBuildingIndex = index
if (index==-1) { //总平面图数据
this.getSitePlan()
} else { //建筑楼层/区域数据
this.getBuildingSitePlan(item)
}
} //if
// if (this.canvasData.isChange) { //true 数据被改动
// let isTrue = confirm('是否保存当前编辑数据')
// if (isTrue) { //先保存数据 在切换
// let isSuccess = this.saveSite()//true的时候 先保存数据
// if (isSuccess != false) {
// this.beforeOneCheckedBuilding = item
// this.checkedBuildingIndex = index
// if (index==-1) { //总平面图数据
// this.getSitePlan()
// } else { //建筑楼层/区域数据
// this.getBuildingSitePlan(item)
// }
// }
// } else {
// this.beforeOneCheckedBuilding = item
// this.checkedBuildingIndex = index
// if (index==-1) { //总平面图数据
// this.getSitePlan()
// } else { //建筑楼层/区域数据
// this.getBuildingSitePlan(item)
// }
// }
// } else { //flase 数据未被改动
// } //if
this.beforeOneCheckedBuilding = item
this.checkedBuildingIndex = index
if (index==-1) { //总平面图数据
this.getSitePlan()
} else { //建筑楼层/区域数据
this.getBuildingSitePlan(item)
}
} //if
}
@ -1106,9 +1106,10 @@ export class CollectionToolsComponent implements OnInit {
//封装 刷新 tree 数据
async renovateTreeData (isRefresh:boolean = true) {
this.allFireElements[this.allFireElements.length-1].children = []
this.beforeOneCheckedBuildingIsShow = false
isRefresh? await this.canvas.refresh() : null
// isRefresh? await this.canvas.refresh() : null
this.canvas.setNameVisible(this.basicInfo,0)
this.canvas.setNameVisible(this.wantToWork,1)
isRefresh? this.canvasData.isChange = false : null //服务中 数据是否改动 改为false
@ -1128,9 +1129,6 @@ export class CollectionToolsComponent implements OnInit {
}
}
this.handleTreeData(storeyData) //处理tree数据结构
this.canvas.onExaminerClickFloor()
// 隐藏基本信息图形
this.canvas.setNameVisible(false, 0);
}
@ -1255,6 +1253,9 @@ export class CollectionToolsComponent implements OnInit {
this.canvasData.originaleveryStoreyData.version? null : this.canvasData.originaleveryStoreyData.version = "2.0"
this.canvasData.originaleveryStoreyData.sitePlanId? null : this.canvasData.originaleveryStoreyData.sitePlanId = e.id || null
this.renovateTreeData()
this.canvas.onExaminerClickFloor()
// 隐藏基本信息图形
this.canvas.setNameVisible(false, 0);
})
}
@ -1280,6 +1281,9 @@ export class CollectionToolsComponent implements OnInit {
this.canvasData.originaleveryStoreyData.version? null : this.canvasData.originaleveryStoreyData.version = "2.0"
this.canvasData.originaleveryStoreyData.buildingAreaId? null : this.canvasData.originaleveryStoreyData.buildingAreaId = e.id || null
this.renovateTreeData()
this.canvas.onExaminerClickFloor()
// 隐藏基本信息图形
this.canvas.setNameVisible(false, 0);
})
}
@ -1288,45 +1292,45 @@ export class CollectionToolsComponent implements OnInit {
if (this.selectSitePlanIndex != index) {
this.canvasData.selectPanelPoint = new DisposalNodeData();
if (this.canvasData.isChange) { //true 数据被改动
let isTrue = confirm('是否保存当前编辑数据')
if (isTrue) { //先保存数据 在切换
let isSuccess = this.saveSite()//true的时候 先保存数据
if (isSuccess != false) {
this.selectingSitePlan = item
this.selectSitePlanIndex = index
this.canvasData.selectStorey = item //服务中 存一份数据
if (this.checkedBuildingIndex==-1) { //总平面图时
this.getSitePlanStorey(item) //获取 平面图 楼层数据
} else { //楼层/区域时
this.getBuildingStorey(item) //获取 建筑 楼层数据
}
}
} else { //不保存数据 直接切换
this.selectingSitePlan = item
this.selectSitePlanIndex = index
this.canvasData.selectStorey = item //服务中 存一份数据
if (this.checkedBuildingIndex==-1) { //总平面图时
this.getSitePlanStorey(item) //获取 平面图 楼层数据
this.getSitePlanCompanyData()
} else { //楼层/区域时
this.getBuildingStorey(item) //获取 建筑 楼层数据
let params = { buildingId: this.beforeOneCheckedBuilding.id }
this.getBuildingData(params)
}
}
// if (this.canvasData.isChange) { //true 数据被改动
// let isTrue = confirm('是否保存当前编辑数据')
// if (isTrue) { //先保存数据 在切换
// let isSuccess = this.saveSite()//true的时候 先保存数据
// if (isSuccess != false) {
// this.selectingSitePlan = item
// this.selectSitePlanIndex = index
// this.canvasData.selectStorey = item //服务中 存一份数据
// if (this.checkedBuildingIndex==-1) { //总平面图时
// this.getSitePlanStorey(item) //获取 平面图 楼层数据
// } else { //楼层/区域时
// this.getBuildingStorey(item) //获取 建筑 楼层数据
// }
// }
// } else { //不保存数据 直接切换
// this.selectingSitePlan = item
// this.selectSitePlanIndex = index
// this.canvasData.selectStorey = item //服务中 存一份数据
// if (this.checkedBuildingIndex==-1) { //总平面图时
// this.getSitePlanStorey(item) //获取 平面图 楼层数据
// this.getSitePlanCompanyData()
// } else { //楼层/区域时
// this.getBuildingStorey(item) //获取 建筑 楼层数据
// let params = { buildingId: this.beforeOneCheckedBuilding.id }
// this.getBuildingData(params)
// }
// }
} else { //false 数据没被改动
this.selectingSitePlan = item
this.selectSitePlanIndex = index
this.canvasData.selectStorey = item //服务中 存一份数据
if (this.checkedBuildingIndex==-1) { //总平面图时
this.getSitePlanStorey(item) //获取 平面图 楼层数据
} else { //楼层/区域
this.getBuildingStorey(item) //获取 建筑 楼层数据
}
} //if
// } else { //false 数据没被改动
// } //if
this.selectingSitePlan = item
this.selectSitePlanIndex = index
this.canvasData.selectStorey = item //服务中 存一份数据
if (this.checkedBuildingIndex==-1) { //总平面图
this.getSitePlanStorey(item) //获取 平面图 楼层数据
} else { //楼层/区域时
this.getBuildingStorey(item) //获取 建筑 楼层数据
}
}
}

Loading…
Cancel
Save