chenjingyu 4 years ago
parent
commit
11f453c9ad
  1. 3
      src/app/key-unit/key-unit-management/key-unit-management.component.ts
  2. 155
      src/app/ui/collection-tools-plan/collection-tools.component.ts

3
src/app/key-unit/key-unit-management/key-unit-management.component.ts

@ -825,10 +825,11 @@ export class CreateUnit {
}
onSubmit(value){
let myDate = new Date();
let usci = new Date().getTime() + '00000'
let body = {
id: "",
name: value.name,
usci: value.usci,
usci: value.usci || usci,
contacts: "",
phone: "",
address: "",

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

@ -86,7 +86,7 @@ export class CollectionToolsPlanComponent implements OnInit {
gallery//viewerJs实例
//设置属性框
setAssetsProperty(obj) {
console.log('传进来的属性信息',obj)
console.log('传进来的属性信息', obj)
//初始化viewerJs实例
setTimeout(() => {
obj.PropertyInfos.forEach(item => {
@ -231,28 +231,37 @@ export class CollectionToolsPlanComponent implements OnInit {
assetWidthIunput() {
this.canvasAssetObj.Width = this.assetWidth
this.canvasData.isChange = true
this.canvas.refreshIcon(this.canvasAssetObj.Id)
if(!this.isGis){
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
//素材高度输入框改变
assetHeightIunput() {
this.canvasAssetObj.Height = this.assetHeight
this.canvasData.isChange = true
this.canvas.refreshIcon(this.canvasAssetObj.Id)
if(!this.isGis){
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
//素材角度输入框改变
assetAngleIunput() {
this.canvasAssetObj.Angle = this.sliderValue
this.canvasData.isChange = true
this.canvas.refreshIcon(this.canvasAssetObj.Id)
if(!this.isGis){
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
//素材厚度输入框改变
assetThicknessIunput() {
this.canvasAssetObj.Thickness = this.sliderValueThickness
this.canvasData.isChange = true
this.canvas.refreshIcon(this.canvasAssetObj.Id)
if(!this.isGis){
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
//素材是否高亮改变----->本地操作行为
@ -277,7 +286,9 @@ export class CollectionToolsPlanComponent implements OnInit {
}
this.canvasAssetObj.PropertyInfos[index].PropertyValue = e.target.value
this.canvasData.isChange = true
this.canvas.refreshIcon(this.canvasAssetObj.Id)
if(!this.isGis){
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
//动态属性素材布尔值框改变radio
@ -297,7 +308,9 @@ export class CollectionToolsPlanComponent implements OnInit {
this.selectedcolor = item + this.selectedcolor.substring(this.selectedcolor.length - 2)
this.canvasAssetObj.Color = this.selectedcolor
this.canvasData.isChange = true
this.canvas.refreshIcon(this.canvasAssetObj.Id)
if(!this.isGis){
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
//颜色选择滑竿的值
colorDivSliderValue
@ -311,7 +324,9 @@ export class CollectionToolsPlanComponent implements OnInit {
this.selectedcolor = replacepos(this.selectedcolor, 7, 8, colorOpacity.toString(16))
this.canvasAssetObj.Color = this.selectedcolor
this.canvasData.isChange = true
this.canvas.refreshIcon(this.canvasAssetObj.Id)
if(!this.isGis){
this.canvas.refreshIcon(this.canvasAssetObj.Id)
}
}
//上传素材图片
@ -557,6 +572,26 @@ export class CollectionToolsPlanComponent implements OnInit {
// this.refurbishTreeData()
}
})
//点击marker关闭按钮
window.deleteMarker = () => {
this.canvasData.isChange = true
//清除地图标点
this.planDataMarkers.forEach((element, index) => {
if (element.id == this.clickId) {
this.planDataMarkers[index].setMap(null);
}
});
// 删除楼层数据
delete this.canvasData.originaleveryStoreyData.data[this.clickId];
// 删除建筑数据
delete this.canvasData.originalcompanyBuildingData.data[this.clickId];
console.log('originalcompanyBuildingData', this.canvasData.originalcompanyBuildingData)
console.log('originaleveryStoreyData', this.canvasData.originaleveryStoreyData)
}
}
//多选宽度共同改变
multipleAssetWidthInput() {
@ -1338,18 +1373,18 @@ export class CollectionToolsPlanComponent 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 || {} )) //当前 楼层 数据
let companyBuildingData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData || {})) // 当前 单位/建筑 数据
let storeyData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData || {})) //当前 楼层 数据
for(let key in companyBuildingData.data){
for (let key in companyBuildingData.data) {
if (companyBuildingData.data[key].FloorId === beforeOneId) { //处理 单位/建筑 数据是否归于当前楼层下
storeyData.data[key] = companyBuildingData.data[key]
}
}
for(let key in storeyData.data){ //筛选数据 没有匹配全部放入到 其他 数组
let noMatch = this.allFireElements.find( every=> every.id===storeyData.data[key].FireElementId )
for (let key in storeyData.data) { //筛选数据 没有匹配全部放入到 其他 数组
let noMatch = this.allFireElements.find(every => every.id === storeyData.data[key].FireElementId)
if (!noMatch && storeyData.data[key].Id != "图例") {
this.allFireElements[this.allFireElements.length-1].children.push(storeyData.data[key])
this.allFireElements[this.allFireElements.length - 1].children.push(storeyData.data[key])
}
}
this.handleTreeData(storeyData) //处理tree数据结构
@ -1364,6 +1399,44 @@ export class CollectionToolsPlanComponent implements OnInit {
this.map.on('click', (e) => {
this.showInfoClick(e)
});
this.map.on("complete", () => {
for (const key in this.canvasData.originaleveryStoreyData.data) {
if (Object.prototype.hasOwnProperty.call(this.canvasData.originaleveryStoreyData.data, key)) {
const element = this.canvasData.originaleveryStoreyData.data[key];
let markerContent = '' +
'<div class="custom-content-marker" id="xxxx">' +
`<img src="${element.ImageUrl}">` +
`<div class="close-btn" onclick='deleteMarker()'>X</div>` +
'</div>';
// 将 icon 传入 marker
let startMarker = new AMap.Marker({
position: new AMap.LngLat(element.Point.x, element.Point.y),
// 将 html 传给 content
content: markerContent,
// 以 icon 的 [center bottom] 为原点
offset: new AMap.Pixel(-13, -30),
draggable: true,
});
startMarker.id = element.Id
startMarker.on('click', (e) => {
this.clickId = e.target.id
this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[e.target.id])
});
startMarker.on('dragend', (e) => {
// console.log('拖拽完成', e)
this.canvasData.isChange = true
this.clickId = e.target.id
this.canvasData.originaleveryStoreyData.data[e.target.id].Point = { x: e.lnglat.lng, y: e.lnglat.lat }
});
this.planDataMarkers.push(startMarker)
this.map.add(startMarker);
}
}
});
}
@ -1991,9 +2064,8 @@ export class CollectionToolsPlanComponent implements OnInit {
if (!this.selectImage.imageUrl) {
return
}
this.canvasData.isChange = true
let id = ObjectID.default.generate()
// console.log('点击了地图', e)
// 新增点标记
// 点标记显示内容,HTML要素字符串
let markerContent = '' +
@ -2015,58 +2087,31 @@ export class CollectionToolsPlanComponent implements OnInit {
startMarker.id = id
startMarker.on('click', (e) => {
this.clickId = e.target.id
for (let index = 0; index < this.planData.length; index++) {
const item = this.planData[index];
if (item.Id == e.target.id) {
this.setAssetsProperty(item)
return
}
}
this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[e.target.id])
});
startMarker.on('dragend', (e) => {
console.log('拖拽完成', e)
// console.log('拖拽完成', e)
this.canvasData.isChange = true
this.clickId = e.target.id
for (let index = 0; index < this.planData.length; index++) {
const item = this.planData[index];
if (item.Id == e.target.id) {
//修改最终坐标数据
item.point = { x: e.lnglat.lng, y: e.lnglat.lat }
return
}
}
this.canvasData.originaleveryStoreyData.data[e.target.id].Point = { x: e.lnglat.lng, y: e.lnglat.lat }
});
//将图标数据添加
let itemData = JSON.parse(JSON.stringify(this.selectImage))
itemData.id = id
itemData.point = { x: e.lnglat.lng, y: e.lnglat.lat }
console.log(987,this.canvasData.deserialize(JSON.stringify(itemData)))
// console.log('originalcompanyBuildingData',this.canvasData.originalcompanyBuildingData)
// console.log('originaleveryStoreyData',this.canvasData.originaleveryStoreyData)
itemData = this.canvasData.deserialize(JSON.stringify(itemData))//反序列化为大写
this.planData.push(itemData)
// 添加楼层数据
this.canvasData.originaleveryStoreyData.data[id] = itemData;
// 添加建筑数据
this.canvasData.originalcompanyBuildingData.data[id] = itemData;
console.log('originalcompanyBuildingData', this.canvasData.originalcompanyBuildingData)
console.log('originaleveryStoreyData', this.canvasData.originaleveryStoreyData)
//将marker点添加
this.planDataMarkers.push(startMarker)
this.map.add(startMarker);
//点击关闭按钮
window.deleteMarker = () => {
//清除地图标点
this.planDataMarkers.forEach((element, index) => {
if (element.id == this.clickId) {
this.planDataMarkers[index].setMap(null);
}
});
//删除指定数据
for (let index = 0; index < this.planData.length; index++) {
const item = this.planData[index];
if (item.id == this.clickId) {
this.planData.splice(index, 1)
return
}
}
}
}

Loading…
Cancel
Save