|
|
|
@ -83,11 +83,12 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
buildingTypesname:any//存储当前建筑的默认类型name
|
|
|
|
|
buildingCustomData:any //存储当前建筑的自定义信息
|
|
|
|
|
allunittype: any //所有单位类型
|
|
|
|
|
allorganizing:any //所有组织机构
|
|
|
|
|
constructor(private http: HttpClient, private tree: TreeService, private sanitizer: DomSanitizer, public dialog: MatDialog,public snackBar: MatSnackBar) { } |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.getallunittype() |
|
|
|
|
this.getorganization() |
|
|
|
|
// this.getorganization()
|
|
|
|
|
this.getunitinfo() |
|
|
|
|
this.getunitallbuilding() |
|
|
|
|
} |
|
|
|
@ -101,15 +102,49 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
getorganization() { |
|
|
|
|
this.http.get('/api/Organizations').subscribe( |
|
|
|
|
(data: any) => { |
|
|
|
|
console.log(data) |
|
|
|
|
this.allorganizing = data |
|
|
|
|
this.dataSource.data = this.tree.toTree(data); |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
//获得当前单位的基本信息
|
|
|
|
|
getunitinfo(){ |
|
|
|
|
this.getorganization() |
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.http.get("/api/CompanyAccount/Company").subscribe((data:any)=>{ |
|
|
|
|
let node |
|
|
|
|
this.allorganizing.forEach(item => { |
|
|
|
|
if(item.id == data.organizationId){ |
|
|
|
|
node = item |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if(!node.parentId){ |
|
|
|
|
this.selectedorganization = node.name |
|
|
|
|
}else{ |
|
|
|
|
let namearr = [node.name] |
|
|
|
|
let targetId = node.parentId; // 临时变量
|
|
|
|
|
for(let i = 0; i < node.level ; i++){ |
|
|
|
|
this.allorganizing.forEach(item => { |
|
|
|
|
if(item.id == targetId ){ |
|
|
|
|
namearr.push(item.name)
|
|
|
|
|
targetId = item.parentId; // 临时变量更新没有副作用
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
namearr.reverse() |
|
|
|
|
let str = '' |
|
|
|
|
namearr.forEach(item=>{ |
|
|
|
|
str += '/' + item |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
this.selectedorganization = str.substr(1) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.unitinfo = data |
|
|
|
|
this.selectedorganization = data.organizationName |
|
|
|
|
// this.selectedorganization = data.organizationName
|
|
|
|
|
this.selectedorganizationid = data.organizationId |
|
|
|
|
if(data.imageUrl){ |
|
|
|
|
this.imgsrc = data.imageUrl |
|
|
|
@ -119,6 +154,8 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
this.buildingTypesname = data.buildingTypes[0].name |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, 500); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
//获得建筑自定义信息
|
|
|
|
|
getbuildingCustomData(){ |
|
|
|
@ -741,10 +778,32 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
//点击辖区中队树,将选择的辖区中队添加到变量
|
|
|
|
|
add(node) { |
|
|
|
|
this.selectedorganization = node.name |
|
|
|
|
console.log(node) |
|
|
|
|
this.selectedorganizationid = node.id |
|
|
|
|
this.isorganizationbox = false |
|
|
|
|
|
|
|
|
|
if(!node.parentId){ |
|
|
|
|
this.selectedorganization = node.name |
|
|
|
|
}else{ |
|
|
|
|
let namearr = [node.name] |
|
|
|
|
let targetId = node.parentId; // 临时变量
|
|
|
|
|
for(let i = 0; i < node.level ; i++){ |
|
|
|
|
this.allorganizing.forEach(item => { |
|
|
|
|
if(item.id == targetId ){ |
|
|
|
|
namearr.push(item.name)
|
|
|
|
|
targetId = item.parentId; // 临时变量更新没有副作用
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
namearr.reverse() |
|
|
|
|
let str = '' |
|
|
|
|
namearr.forEach(item=>{ |
|
|
|
|
str += '/' + item |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
this.selectedorganization = str.substr(1) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//关闭辖区中队隐藏框
|
|
|
|
|
closeorganizationbox() { |
|
|
|
@ -768,10 +827,30 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
//change选择文件
|
|
|
|
|
filechange(e) { |
|
|
|
|
this.file = e.target.files[0] || null //上传的文件
|
|
|
|
|
var reader = new FileReader(); |
|
|
|
|
reader.readAsDataURL(this.file); |
|
|
|
|
var image:any = new Image(); |
|
|
|
|
reader.onload = function(){ |
|
|
|
|
image.src = reader.result |
|
|
|
|
} |
|
|
|
|
setTimeout(() => { |
|
|
|
|
if(image.width>=4096 || image.height>=5000 ){
|
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('请选择分辨率小于4096*5000的图片','确定',config); |
|
|
|
|
}else{ |
|
|
|
|
if(this.file){ |
|
|
|
|
this.startUploading() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}, 100); |
|
|
|
|
|
|
|
|
|
// if(this.file){
|
|
|
|
|
// this.startUploading()
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
//查看单位大图
|
|
|
|
|
lookmaster(){ |
|
|
|
|
const dialogRef = this.dialog.open(LookMaster, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
@ -813,6 +892,10 @@ export class BasicinfoComponent implements OnInit {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//小于5MB不需要分块上传
|
|
|
|
|
upload(){ |
|
|
|
|
this.uploader.queue[0].upload();//开始上传
|
|
|
|
|