|
|
|
@ -19,6 +19,7 @@ import * as _ from 'lodash';
|
|
|
|
|
import Swiper from 'swiper'; |
|
|
|
|
import { LookMaster } from './lookmaster.component' |
|
|
|
|
import { ActivatedRoute } from '@angular/router'; |
|
|
|
|
import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service'; |
|
|
|
|
declare var AMap: any; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@ -81,7 +82,7 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
buildingCustomData:any //存储当前建筑的自定义信息
|
|
|
|
|
allunittype: any //所有单位类型
|
|
|
|
|
allorganizing:any = [] //所有组织机构
|
|
|
|
|
constructor(private route:ActivatedRoute,private elementRef: ElementRef,public renderer2: Renderer2,private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar) { } |
|
|
|
|
constructor(private tabbarService: TabbarAndScoreService,private route:ActivatedRoute,private elementRef: ElementRef,public renderer2: Renderer2,private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar) { } |
|
|
|
|
|
|
|
|
|
houses: any = [] //存储当前单位的建筑信息
|
|
|
|
|
unitId : any //当前单位id
|
|
|
|
@ -103,7 +104,9 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
element.data = [] |
|
|
|
|
}); |
|
|
|
|
this.houses = data |
|
|
|
|
this.getBuildingInfo() |
|
|
|
|
if(this.houses.length != 0){ |
|
|
|
|
this.getBuildingInfo() |
|
|
|
|
}
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -408,7 +411,7 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
async data => { |
|
|
|
|
if(data){ |
|
|
|
|
this.houses.push(data) |
|
|
|
|
// console.log('新增了',this.houses)
|
|
|
|
|
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
@ -513,9 +516,12 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
selectedTabChange(e){ |
|
|
|
|
// console.log(e)
|
|
|
|
|
this.selectedBuildingIndex = e.index |
|
|
|
|
if((this.houses[this.selectedBuildingIndex].data && !this.houses[this.selectedBuildingIndex].data.length) || !this.houses[this.selectedBuildingIndex].data){ |
|
|
|
|
this.getBuildingInfo() |
|
|
|
|
if(this.houses.length != 0){ |
|
|
|
|
if((this.houses[this.selectedBuildingIndex].data && !this.houses[this.selectedBuildingIndex].data.length) || !this.houses[this.selectedBuildingIndex].data){ |
|
|
|
|
this.getBuildingInfo() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//表格加一行
|
|
|
|
|
addline(ele){ |
|
|
|
@ -660,11 +666,30 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
image.src = reader.result |
|
|
|
|
} |
|
|
|
|
setTimeout(() => { |
|
|
|
|
if(image.width>=4096 || image.height>=5000 ){
|
|
|
|
|
if(this.file.type.indexOf('image') == -1){ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('请上传图片','确定',config); |
|
|
|
|
if((<HTMLInputElement>document.getElementById('selectedfile'))){ |
|
|
|
|
(<HTMLInputElement>document.getElementById('selectedfile')).value = null //清空input框缓存
|
|
|
|
|
} |
|
|
|
|
}else if(this.file.name.toLowerCase().indexOf('png') == -1 && this.file.name.toLowerCase().indexOf('jpg') == -1 && this.file.name.toLowerCase().indexOf('jpeg') == -1){ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('请上传图片后缀为png,jpg,jpeg的文件','确定',config); |
|
|
|
|
if((<HTMLInputElement>document.getElementById('selectedfile'))){ |
|
|
|
|
(<HTMLInputElement>document.getElementById('selectedfile')).value = null //清空input框缓存
|
|
|
|
|
}
|
|
|
|
|
}else if(image.width>=4096 || image.height>=5000 ){
|
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('请选择分辨率小于4096*5000的图片','确定',config); |
|
|
|
|
if((<HTMLInputElement>document.getElementById('selectedfile'))){ |
|
|
|
|
(<HTMLInputElement>document.getElementById('selectedfile')).value = null //清空input框缓存
|
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
if(this.file){ |
|
|
|
|
this.startUploading() |
|
|
|
@ -799,9 +824,9 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('删除成功','确定',config); |
|
|
|
|
this.houses.splice(this.houses.findIndex(items=>items==item),1)
|
|
|
|
|
|
|
|
|
|
let obj ={index:key} |
|
|
|
|
this.selectedTabChange(obj) |
|
|
|
|
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -856,15 +881,20 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
this.http.post("/api/Buildings",addbody).subscribe(data=>{//首先创建建筑成功了,需要刷出当前建筑类型的模板
|
|
|
|
|
this.http.post("/api/Buildings",addbody,{params:{ |
|
|
|
|
companyId : this.unitId |
|
|
|
|
}}).subscribe(data=>{//首先创建建筑成功了,需要刷出当前建筑类型的模板
|
|
|
|
|
// alert('创建主体建筑成功')
|
|
|
|
|
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
|
|
|
|
|
this.getUnitAllBuildings() |
|
|
|
|
}) |
|
|
|
|
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
|
|
|
|
|
}else{ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('保存成功','确定',config); |
|
|
|
|
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
|
|
|
|
|
} |
|
|
|
|
}), |
|
|
|
|
err=>{ |
|
|
|
@ -1030,12 +1060,14 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('建筑信息保存成功','确定',config); |
|
|
|
|
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
|
|
|
|
|
}, |
|
|
|
|
err=>{ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('请检查输入数据是否有误','确定',config); |
|
|
|
|
this.snackBar.open('建筑信息保存失败','确定',config); |
|
|
|
|
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//保存建筑自定义信息
|
|
|
|
@ -1044,7 +1076,7 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
companyId :this.unitId, |
|
|
|
|
buildingId:item.id |
|
|
|
|
}}).subscribe(data=>{ |
|
|
|
|
|
|
|
|
|
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
|
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
item.customData.customProperties = [] |
|
|
|
@ -1052,7 +1084,7 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
companyId :this.unitId, |
|
|
|
|
buildingId:item.id |
|
|
|
|
}}).subscribe(data=>{ |
|
|
|
|
|
|
|
|
|
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|