You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.8 KiB
91 lines
2.8 KiB
/* |
|
* @Descripttion: |
|
* @version: |
|
* @Author: sueRimn |
|
* @Date: 2020-11-26 17:10:54 |
|
* @LastEditors: sueRimn |
|
* @LastEditTime: 2021-03-02 09:32:08 |
|
*/ |
|
import { Component, OnInit, Inject } from '@angular/core'; |
|
import { HttpClient } from '@angular/common/http'; |
|
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; |
|
import { ImgDetails } from './imgdetails.component' |
|
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
|
import { Router, ActivatedRoute } from '@angular/router'; |
|
|
|
|
|
|
|
@Component({ |
|
selector: 'app-allaround', |
|
templateUrl: './allaround.component.html', |
|
styleUrls: ['./allaround.component.scss'] |
|
}) |
|
export class AllaroundComponent implements OnInit { |
|
|
|
constructor(private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,private route:ActivatedRoute,) { } |
|
|
|
ngOnInit(): void { |
|
this.getAllCompany() |
|
this.getAllBuilding() |
|
} |
|
|
|
AllAdjoining:any = []; //所有单位毗邻 |
|
AllBuilding:any = []; //所有建筑 + 建筑毗邻图片 |
|
//单位相关数据 |
|
unitId:string = sessionStorage.getItem('companyId') |
|
//5ee19fe06f91049f5e23e937 |
|
//5fb78554919f2b44e464017e |
|
//获取所有单位毗邻图片 |
|
getAllCompany () { |
|
let id = {companyId:this.unitId} |
|
this.http.get('/api/CompanyAdjoins',{params:id}).subscribe(data=>{ |
|
this.AllAdjoining = data |
|
this.AllAdjoining.forEach(element => {element.imgURL = element.imageUrls[0] +'?x-oss-process=image/resize,m_fill,h_170,w_299'}) |
|
}) |
|
} |
|
|
|
//获取所有建筑 |
|
getAllBuilding () { |
|
let id = {companyId:this.unitId} |
|
this.http.get('/api/Buildings',{params:id}).subscribe((data:any)=>{ |
|
if (data.length) { |
|
this.AllBuilding = data |
|
this.AllBuilding.forEach(element => { |
|
element.allImgs = [] |
|
}); |
|
this.getAllArchitecture()} |
|
}) |
|
} |
|
|
|
//获取所有建筑毗邻图片 |
|
getAllArchitecture () { |
|
this.AllBuilding.forEach(element => { |
|
let id = {buildingId:element.id} |
|
this.http.get('/api/BuildingAdjoins',{params:id}).subscribe(data=>{ |
|
element.allImgs = data |
|
/* console.log(element) |
|
console.log(element.allImgs) */ |
|
element.allImgs.forEach(element => {element.imgURL = element.imageUrls[0] +'?x-oss-process=image/resize,m_fill,h_170,w_299'}); |
|
}) |
|
}); |
|
} |
|
|
|
//预览图片 |
|
imgdetails(e){ |
|
if (e.length && e!=null) { |
|
let data = e |
|
const dialogRef = this.dialog.open(ImgDetails, {//调用open方法打开对话框并且携带参数过去 |
|
width: '1600px', |
|
height:'900px',data}); |
|
dialogRef.afterClosed().subscribe(); |
|
} else{ |
|
const config = new MatSnackBarConfig(); |
|
config.verticalPosition = 'top'; |
|
config.duration = 3000 |
|
this.snackBar.open('暂无图片数据','确定',config); |
|
} |
|
} |
|
|
|
|
|
|
|
}
|
|
|