Browse Source

[新增]实景图增加安全出口的显示

tangshan
邵佳豪 4 years ago
parent
commit
b8c11930eb
  1. 6
      src/app/key-unit/realistic-picture/realistic-picture.component.html
  2. 397
      src/app/key-unit/realistic-picture/realistic-picture.component.ts
  3. 7
      src/app/plan-audit/wait-examineer/wait-examineer.component.ts
  4. 27
      src/app/ui/collection-tools-building/collection-tools.component.ts
  5. 119
      src/app/ui/collection-tools-plan/collection-tools.component.ts

6
src/app/key-unit/realistic-picture/realistic-picture.component.html

@ -23,7 +23,7 @@
<div class="topBox"> <div class="topBox">
<div> <div>
<span class="title" *ngIf="selectReal">{{selectReal.name}}</span> <span class="title" *ngIf="selectReal">{{selectReal.name}}</span>
<button mat-raised-button color="primary" class="uploadFileFixed" *ngIf="!isLoading && selectReal && selectReal.id != '重点部位'"> <button mat-raised-button color="primary" class="uploadFileFixed" *ngIf="!isLoading && selectReal && selectReal.id != '重点部位'&& selectReal.id != '安全出口'">
上传图片 上传图片
<input type="file" id="uploadFile" class="uploadFile" (change)='uploadFile($event)' ng2FileSelect [uploader]="uploader" accept="image/*"> <input type="file" id="uploadFile" class="uploadFile" (change)='uploadFile($event)' ng2FileSelect [uploader]="uploader" accept="image/*">
</button> </button>
@ -42,8 +42,8 @@
<div class="fixedImg"><img [src]="item.newImageUrl" (click)='operation(item,key)' [ngClass]="{'selectImg': item.checked}"></div> <div class="fixedImg"><img [src]="item.newImageUrl" (click)='operation(item,key)' [ngClass]="{'selectImg': item.checked}"></div>
<label style="margin-left: 5px;">图片名称:</label> <label style="margin-left: 5px;">图片名称:</label>
<input type="text" style="margin-left: 10px;" [(ngModel)]="item.nameStart" maxlength="20"> <input type="text" style="margin-left: 10px;" [(ngModel)]="item.nameStart" maxlength="20">
<a *ngIf="selectReal.id != '重点部位'" href="javascript:" style="margin-left: 5px;" (click)='preservationImg(item)'>保存</a> <a *ngIf="selectReal.id != '重点部位'&& selectReal.id != '安全出口'" href="javascript:" style="margin-left: 5px;" (click)='preservationImg(item)'>保存</a>
<a *ngIf="selectReal.id != '重点部位'" href="javascript:" style="margin-left: 5px;" (click)="deleteImg(item)">删除</a> <a *ngIf="selectReal.id != '重点部位'&& selectReal.id != '安全出口'" href="javascript:" style="margin-left: 5px;" (click)="deleteImg(item)">删除</a>
</div> </div>
<p style="width: 100px;margin: 30px auto;" *ngIf="!allImages.length">暂无数据</p> <p style="width: 100px;margin: 30px auto;" *ngIf="!allImages.length">暂无数据</p>

397
src/app/key-unit/realistic-picture/realistic-picture.component.ts

@ -5,7 +5,7 @@ import { FileUploader } from 'ng2-file-upload';
import { MatPaginator } from '@angular/material/paginator'; import { MatPaginator } from '@angular/material/paginator';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import Swiper from 'swiper'; import Swiper from 'swiper';
import { Router,ActivatedRoute } from '@angular/router' import { Router, ActivatedRoute } from '@angular/router'
import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service'; import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service';
@Component({ @Component({
@ -14,107 +14,137 @@ import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-scor
styleUrls: ['./realistic-picture.component.scss'] styleUrls: ['./realistic-picture.component.scss']
}) })
export class RealisticPictureComponent implements OnInit { export class RealisticPictureComponent implements OnInit {
uploader:FileUploader = new FileUploader({ //初始化上传文件 uploader: FileUploader = new FileUploader({ //初始化上传文件
url: `/api/Objects/PlanPlatform/${this.route.snapshot.queryParams.id}/RealImgs`, url: `/api/Objects/PlanPlatform/${this.route.snapshot.queryParams.id}/RealImgs`,
method: "POST", method: "POST",
itemAlias: "uploadedfile", itemAlias: "uploadedfile",
autoUpload: false, autoUpload: false,
removeAfterUpload:true, removeAfterUpload: true,
}); });
constructor(private tabbarService: TabbarAndScoreService,private router:Router,private route:ActivatedRoute,private http:HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar) { } constructor(private tabbarService: TabbarAndScoreService, private router: Router, private route: ActivatedRoute, private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar) { }
ngOnInit(): void { ngOnInit(): void {
let companyId = this.route.snapshot.queryParams.id let companyId = this.route.snapshot.queryParams.id
this.http.get('/api/RealityImageGroups',{params:{ this.http.get('/api/RealityImageGroups', {
companyId : companyId params: {
}}).subscribe((data:any)=>{ companyId: companyId
}
}).subscribe((data: any) => {
this.allRealPicture = data this.allRealPicture = data
this.allRealPicture.unshift({ this.allRealPicture.unshift({
companyId:sessionStorage.getItem('companyId'), companyId: sessionStorage.getItem('companyId'),
id:'重点部位', id: '重点部位',
name: "重点部位", name: "重点部位",
realityImages:null realityImages: null
}, {
companyId: sessionStorage.getItem('companyId'),
id: '安全出口',
name: "安全出口",
realityImages: null
}) })
this.selectReal = data[0] this.selectReal = data[0]
this.getAllRealPicture() this.getAllRealPicture()
}) })
} }
companyId:any; //单位编号 companyId: any; //单位编号
allRealPicture:any=[]; //所有实景图文件 allRealPicture: any = []; //所有实景图文件
selectReal:any; //选中的实景图文件 selectReal: any; //选中的实景图文件
selectRealIndex:number=0; //选中的实景图文件下标 selectRealIndex: number = 0; //选中的实景图文件下标
allImages:any=[]; //实景图文件对应所有的实景图 allImages: any = []; //实景图文件对应所有的实景图
isDownload:boolean = false; //是否批量下载 isDownload: boolean = false; //是否批量下载
downloadList:any = []; //选中需要下载的图片 downloadList: any = []; //选中需要下载的图片
//分页 //分页
@ViewChild(MatPaginator, {static: true}) @ViewChild(MatPaginator, { static: true })
paginator: MatPaginator; paginator: MatPaginator;
length:any; //共多少条数据 length: any; //共多少条数据
pageSize:any = '12'; //每页条数 pageSize: any = '12'; //每页条数
pageSizeOptions: number[] = [12] //设置每页条数 pageSizeOptions: number[] = [12] //设置每页条数
PageNumber:any; //第几页 PageNumber: any; //第几页
//分页切换 //分页切换
chagePage (e) { chagePage(e) {
this.PageNumber = e.pageIndex+1 this.PageNumber = e.pageIndex + 1
this.getAllRealPicture() this.getAllRealPicture()
} }
//获取所有实景图分组 //获取所有实景图分组
getAllGrouping () { getAllGrouping() {
let companyId = this.route.snapshot.queryParams.id let companyId = this.route.snapshot.queryParams.id
this.http.get('/api/RealityImageGroups',{params:{ this.http.get('/api/RealityImageGroups', {
companyId : companyId params: {
}}).subscribe((data:any)=>{ companyId: companyId
}
}).subscribe((data: any) => {
this.allRealPicture = data this.allRealPicture = data
this.selectReal = data[this.selectRealIndex] this.selectReal = data[this.selectRealIndex]
}) })
} }
//获取实景图分组对应实景图 //获取实景图分组对应实景图
getAllRealPicture () { getAllRealPicture() {
if (this.selectReal) { if (this.selectReal) {
let data if (this.selectReal.id == '安全出口') {
if(this.selectReal.id == '重点部位'){ let params = {
data = { companyId: this.selectReal.companyId,
groupId: this.selectReal.id,
companyId : this.selectReal.companyId,
PageNumber: this.PageNumber || 1,
pageSize: this.pageSize,
}
}else{
data = {
groupId: this.selectReal.id,
PageNumber: this.PageNumber || 1, PageNumber: this.PageNumber || 1,
pageSize: this.pageSize, pageSize: this.pageSize,
} }
} this.http.get('/api/CompanySafetyExits/GetCompanySafetyExitImages', { params: params }).subscribe((data: any) => {
this.http.get('/api/RealityImages',{params:data}).subscribe((data:any)=>{ console.log('当前单位安全出口', data)
this.allImages = data.items this.allImages = data.items
this.length = data.totalCount this.length = data.totalCount
this.pageSize = data.pageSize this.pageSize = this.pageSize
this.downloadList = [] this.downloadList = []
this.allImages.forEach(element => { //每张图片设置选中状态为false this.allImages.forEach(element => { //每张图片设置选中状态为false
if(this.selectReal.id == '重点部位'){ element.newImageUrl = `${element.imageUrl}?x-oss-process=image/resize,m_fill,h_170,w_299` //处理图片URL地址
element.newImageUrl = `${element.imageUrl}?x-oss-process=image/resize,m_fill,h_170,w_299`
element.nameStart = element.name element.nameStart = element.name
}else{ element.checked = false //图片是否选中布尔值
element.newImageUrl = `/api/Objects/PlanPlatform/${element.imageUrl}?x-oss-process=image/resize,m_fill,h_170,w_299` //处理图片URL地址 });
element.nameStart = element.name.substring(0,element.name.lastIndexOf(".")); //图片名称前缀 })
} else {
let data
if (this.selectReal.id == '重点部位') {
data = {
groupId: this.selectReal.id,
companyId: this.selectReal.companyId,
PageNumber: this.PageNumber || 1,
pageSize: this.pageSize,
}
} else {
data = {
groupId: this.selectReal.id,
PageNumber: this.PageNumber || 1,
pageSize: this.pageSize,
} }
element.checked = false //图片是否选中布尔值 }
element.nameEnd = element.name.substring(element.name.lastIndexOf("."),element.name.length); //图片名称后缀 this.http.get('/api/RealityImages', { params: data }).subscribe((data: any) => {
}); this.allImages = data.items
this.length = data.totalCount
this.pageSize = data.pageSize
this.downloadList = []
this.allImages.forEach(element => { //每张图片设置选中状态为false
if (this.selectReal.id == '重点部位') {
element.newImageUrl = `${element.imageUrl}?x-oss-process=image/resize,m_fill,h_170,w_299`
element.nameStart = element.name
} else {
element.newImageUrl = `/api/Objects/PlanPlatform/${element.imageUrl}?x-oss-process=image/resize,m_fill,h_170,w_299` //处理图片URL地址
element.nameStart = element.name.substring(0, element.name.lastIndexOf(".")); //图片名称前缀
}
element.checked = false //图片是否选中布尔值
element.nameEnd = element.name.substring(element.name.lastIndexOf("."), element.name.length); //图片名称后缀
});
})
}
})
} }
} }
//切换左侧实景图文件 //切换左侧实景图文件
changeReal (e,index) { changeReal(e, index) {
if (this.selectRealIndex != index) { if (this.selectRealIndex != index) {
this.selectReal = e this.selectReal = e
this.selectRealIndex = index this.selectRealIndex = index
@ -125,65 +155,70 @@ export class RealisticPictureComponent implements OnInit {
} }
//选择批量下载 //选择批量下载
download () { download() {
this.isDownload = !this.isDownload this.isDownload = !this.isDownload
if (!this.isDownload) { //取消批量下载时数组清空 if (!this.isDownload) { //取消批量下载时数组清空
this.allImages.forEach(element => {element.checked = false}); this.allImages.forEach(element => { element.checked = false });
this.downloadList = [] this.downloadList = []
} }
} }
// 预览图片---批量选择图片 // 预览图片---批量选择图片
operation (e,index) { operation(e, index) {
if (this.isDownload) { //批量选择图片 if (this.isDownload) { //批量选择图片
e.checked = !e.checked e.checked = !e.checked
if (e.checked==true) {this.downloadList.push(e)} if (e.checked == true) { this.downloadList.push(e) }
else {this.downloadList.splice(this.downloadList.findIndex(item => item.id === e.id), 1)} else { this.downloadList.splice(this.downloadList.findIndex(item => item.id === e.id), 1) }
} else { //预览图片 } else { //预览图片
let data = { let data = {
selectReal:this.selectReal, selectReal: this.selectReal,
allImages:this.allImages, allImages: this.allImages,
imgIndex: index} imgIndex: index
}
let dialogRef = this.dialog.open(previewImg, let dialogRef = this.dialog.open(previewImg,
{data}); { data });
dialogRef.afterClosed().subscribe(); dialogRef.afterClosed().subscribe();
} }
} }
//新建实景图文件 //新建实景图文件
addReal () { addReal() {
let dialogRef = this.dialog.open(addRealPicture); let dialogRef = this.dialog.open(addRealPicture);
dialogRef.afterClosed().subscribe(data=>{ dialogRef.afterClosed().subscribe(data => {
if (data) { if (data) {
this.tabbarService.sendMessage('changeScore');//通知服务改变分数 this.tabbarService.sendMessage('changeScore');//通知服务改变分数
this.getAllGrouping()} this.getAllGrouping()
}
}); });
} }
//编辑实景图文件 //编辑实景图文件
editReal () { editReal() {
let data = this.selectReal let data = this.selectReal
if (this.selectReal) { if (this.selectReal) {
let dialogRef = this.dialog.open(editRealPicture, {data}); let dialogRef = this.dialog.open(editRealPicture, { data });
dialogRef.afterClosed().subscribe(data=>{ dialogRef.afterClosed().subscribe(data => {
if (data) { if (data) {
this.tabbarService.sendMessage('changeScore');//通知服务改变分数 this.tabbarService.sendMessage('changeScore');//通知服务改变分数
this.getAllGrouping()} this.getAllGrouping()
}
}); });
} }
} }
//删除实景图文件 //删除实景图文件
delete () { delete() {
let companyId = this.route.snapshot.queryParams.id let companyId = this.route.snapshot.queryParams.id
if (this.selectReal) { if (this.selectReal) {
let isDelete = confirm('您确定要删除吗') let isDelete = confirm('您确定要删除吗')
if (isDelete) { if (isDelete) {
this.http.delete(`/api/RealityImageGroups/${this.selectReal.id}`).subscribe(data=>{ this.http.delete(`/api/RealityImageGroups/${this.selectReal.id}`).subscribe(data => {
this.http.get('/api/RealityImageGroups',{params:{ this.http.get('/api/RealityImageGroups', {
companyId : companyId params: {
}}).subscribe((data:any)=>{ companyId: companyId
}
}).subscribe((data: any) => {
this.allRealPicture = data this.allRealPicture = data
this.selectReal = data[this.selectRealIndex] this.selectReal = data[this.selectRealIndex]
this.allImages = [] this.allImages = []
@ -198,39 +233,41 @@ export class RealisticPictureComponent implements OnInit {
//实景图修改 //实景图修改
preservationImg (e) { preservationImg(e) {
let companyId = this.route.snapshot.queryParams.id let companyId = this.route.snapshot.queryParams.id
let data = { let data = {
id:e.id, id: e.id,
name:e.nameStart+e.nameEnd, name: e.nameStart + e.nameEnd,
imageUrl:e.imageUrl, imageUrl: e.imageUrl,
realityImageGroupId:e.realityImageGroupId realityImageGroupId: e.realityImageGroupId
} }
this.http.put(`/api/RealityImages/${e.id}`,data,{params:{ this.http.put(`/api/RealityImages/${e.id}`, data, {
companyId : companyId params: {
}}).subscribe(data=>{ companyId: companyId
}
}).subscribe(data => {
this.getAllRealPicture() this.getAllRealPicture()
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('图片修改成功','确定',config); this.snackBar.open('图片修改成功', '确定', config);
this.tabbarService.sendMessage('changeScore');//通知服务改变分数 this.tabbarService.sendMessage('changeScore');//通知服务改变分数
}) })
} }
//实景图删除 //实景图删除
deleteImg (e) { deleteImg(e) {
let isDelete = confirm('您确定要删除吗') let isDelete = confirm('您确定要删除吗')
if (isDelete) { if (isDelete) {
this.http.delete(`/api/RealityImages/${e.id}`).subscribe(data=>{ this.http.delete(`/api/RealityImages/${e.id}`).subscribe(data => {
this.getAllRealPicture() this.getAllRealPicture()
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('图片删除成功','确定',config); this.snackBar.open('图片删除成功', '确定', config);
this.tabbarService.sendMessage('changeScore');//通知服务改变分数 this.tabbarService.sendMessage('changeScore');//通知服务改变分数
}) })
this.http.delete(`/api/Objects/PlanPlatform/${e.imageUrl}`).subscribe(data=>{}) this.http.delete(`/api/Objects/PlanPlatform/${e.imageUrl}`).subscribe(data => { })
} }
} }
@ -238,14 +275,14 @@ export class RealisticPictureComponent implements OnInit {
isLoading:boolean = false; //loading加载 isLoading: boolean = false; //loading加载
//上传文件↓ //上传文件↓
file:any; //上传的文件 file: any; //上传的文件
objectName:any; //上传对象名 objectName: any; //上传对象名
uploadId:any; //上传分块上传事件编号 uploadId: any; //上传分块上传事件编号
//change选择文件 //change选择文件
uploadFile (e) { uploadFile(e) {
if (this.selectReal) { if (this.selectReal) {
this.file = e.target.files[0] || null //上传的文件 this.file = e.target.files[0] || null //上传的文件
let URL = window.URL.createObjectURL(this.file) let URL = window.URL.createObjectURL(this.file)
@ -253,46 +290,47 @@ export class RealisticPictureComponent implements OnInit {
img.src = URL img.src = URL
let that = this let that = this
img.onload = function () { img.onload = function () {
if(img.width>=4096 || img.height>=5000 ){ if (img.width >= 4096 || img.height >= 5000) {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
that.snackBar.open('请选择分辨率小于4096*5000的图片','确定',config); that.snackBar.open('请选择分辨率小于4096*5000的图片', '确定', config);
that.uploader.clearQueue(); //清空input控件文件 that.uploader.clearQueue(); //清空input控件文件
(<HTMLInputElement>document.getElementById('uploadFile')).value = null //清空input框缓存 (<HTMLInputElement>document.getElementById('uploadFile')).value = null //清空input框缓存
}else{ that.startUploading() } } else { that.startUploading() }
} //onload } //onload
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('请选择或创建实景图文件夹','确定',config); this.snackBar.open('请选择或创建实景图文件夹', '确定', config);
this.uploader.clearQueue(); //清空input控件文件 this.uploader.clearQueue(); //清空input控件文件
(<HTMLInputElement>document.getElementById('uploadFile')).value = null //清空input框缓存 (<HTMLInputElement>document.getElementById('uploadFile')).value = null //清空input框缓存
} }
} }
//上传文件 //上传文件
startUploading () { startUploading() {
let file = this.file || null //获取上传的文件 let file = this.file || null //获取上传的文件
let fileSize = file.size || null //上传文件的总大小 let fileSize = file.size || null //上传文件的总大小
let shardSize = 5 * 1024 * 1024 //5MB一个分片 let shardSize = 5 * 1024 * 1024 //5MB一个分片
let maxdSize = 20 * 1024 * 1024 //限制20MB let maxdSize = 20 * 1024 * 1024 //限制20MB
if (file && fileSize<=shardSize) { //上传文件<=5MB时 if (file && fileSize <= shardSize) { //上传文件<=5MB时
this.uploader.queue[0].upload();//开始上传 this.uploader.queue[0].upload();//开始上传
this.uploader.queue[0].onSuccess = (response, status, headers) => { this.uploader.queue[0].onSuccess = (response, status, headers) => {
if (status == 201) { // 上传文件成功,上传文件后获取服务器返回的数据 if (status == 201) { // 上传文件成功,上传文件后获取服务器返回的数据
let tempRes = JSON.parse(response); let tempRes = JSON.parse(response);
this.objectName = tempRes.objectName this.objectName = tempRes.objectName
this.addRealImg() this.addRealImg()
}else { // 上传文件后获取服务器返回的数据错误 } else { // 上传文件后获取服务器返回的数据错误
let tempRes = JSON.parse(response); let tempRes = JSON.parse(response);
}}; }
} else if (file && fileSize>shardSize && fileSize<maxdSize) { //上传文件>5MB时, };
let data = {filename: file.name} } else if (file && fileSize > shardSize && fileSize < maxdSize) { //上传文件>5MB时,分块上传
let data = { filename: file.name }
this.isLoading = true this.isLoading = true
this.http.post(`/api/NewMultipartUpload/PlanPlatform/${this.companyId}/RealImgs`,{},{params:data}).subscribe((data:any)=>{ //初始化分段上传 this.http.post(`/api/NewMultipartUpload/PlanPlatform/${this.companyId}/RealImgs`, {}, { params: data }).subscribe((data: any) => { //初始化分段上传
this.objectName = data.objectName this.objectName = data.objectName
this.uploadId = data.uploadId this.uploadId = data.uploadId
this.subsectionUploading() this.subsectionUploading()
@ -301,65 +339,68 @@ export class RealisticPictureComponent implements OnInit {
} }
PartNumberETag:any=[]; //每次返回需要保存的信息 PartNumberETag: any = []; //每次返回需要保存的信息
//开始分段上传 //开始分段上传
async subsectionUploading () { async subsectionUploading() {
let file = this.file || null //获取上传的文件 let file = this.file || null //获取上传的文件
let fileSize = file.size || null //上传文件的总大小 let fileSize = file.size || null //上传文件的总大小
let shardSize = 5 * 1024 * 1024 //5MB一个分片 let shardSize = 5 * 1024 * 1024 //5MB一个分片
let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段 let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段
for (let i = 0;i < allSlice;i++) { //循环分段上传 for (let i = 0; i < allSlice; i++) { //循环分段上传
let start = i * shardSize //切割文件开始位置 let start = i * shardSize //切割文件开始位置
let end = Math.min(fileSize, start + shardSize); //切割文件结束位置 let end = Math.min(fileSize, start + shardSize); //切割文件结束位置
let formData = new FormData() let formData = new FormData()
formData.append("file",file.slice(start, end)) formData.append("file", file.slice(start, end))
//同步写法实现异步调用 //同步写法实现异步调用
let result = await new Promise((resolve, reject) => { let result = await new Promise((resolve, reject) => {
// await 需要后面返回一个 promise 对象 // await 需要后面返回一个 promise 对象
this.http.post(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}&partNumber=${i+1}`,formData).subscribe((data:any)=>{ this.http.post(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => {
let msg = { let msg = {
"partNumber":data.partNumber || null, "partNumber": data.partNumber || null,
"eTag": data.eTag || null} "eTag": data.eTag || null
resolve(msg) // 调用 promise 内置方法处理成功 }
}) resolve(msg) // 调用 promise 内置方法处理成功
}); })
this.PartNumberETag.push(result) });
if (this.PartNumberETag.length === allSlice) {this.endUploading()} this.PartNumberETag.push(result)
if (this.PartNumberETag.length === allSlice) { this.endUploading() }
}//for循环 }//for循环
} }
//完成分块上传 //完成分块上传
endUploading () { endUploading() {
let data = this.PartNumberETag let data = this.PartNumberETag
let paramsData = {uploadId:this.uploadId} let paramsData = { uploadId: this.uploadId }
this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`,data,{params:paramsData}).subscribe(data=>{ this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`, data, { params: paramsData }).subscribe(data => {
this.addRealImg() //上传完成后,发送请求创建实景图 this.addRealImg() //上传完成后,发送请求创建实景图
this.isLoading = false this.isLoading = false
this.uploader.clearQueue(); //清空input控件文件 this.uploader.clearQueue(); //清空input控件文件
this.PartNumberETag =[] //清空保存返回的信息 this.PartNumberETag = [] //清空保存返回的信息
}) })
} }
//上传图片成功后获取url地址发送请求创建实景图 //上传图片成功后获取url地址发送请求创建实景图
addRealImg () { addRealImg() {
let companyId = this.route.snapshot.queryParams.id let companyId = this.route.snapshot.queryParams.id
let data = { let data = {
name: this.file.name, name: this.file.name,
imageUrl:this.objectName, imageUrl: this.objectName,
realityImageGroupId: this.selectReal.id, realityImageGroupId: this.selectReal.id,
} }
this.http.post('/api/RealityImages',data,{params:{ this.http.post('/api/RealityImages', data, {
companyId : companyId params: {
}}).subscribe(data=>{ companyId: companyId
}
}).subscribe(data => {
(<HTMLInputElement>document.getElementById('uploadFile')).value = null //清空input框缓存 (<HTMLInputElement>document.getElementById('uploadFile')).value = null //清空input框缓存
this.getAllRealPicture() this.getAllRealPicture()
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('图片上传成功','确定',config); this.snackBar.open('图片上传成功', '确定', config);
this.tabbarService.sendMessage('changeScore');//通知服务改变分数 this.tabbarService.sendMessage('changeScore');//通知服务改变分数
}) })
} }
@ -368,26 +409,28 @@ export class RealisticPictureComponent implements OnInit {
//批量下载↓ //批量下载↓
//开始下载 //开始下载
async batchDownload () { async batchDownload() {
if (this.downloadList.length) { //开始批量循环下载 if (this.downloadList.length) { //开始批量循环下载
this.isLoading = true this.isLoading = true
for (let i=0;i<this.downloadList.length;i++) { for (let i = 0; i < this.downloadList.length; i++) {
let result = await new Promise ((result,reject)=>{ let result = await new Promise((result, reject) => {
let url let url
if(this.selectReal.id == '重点部位'){ if (this.selectReal.id == '重点部位' || this.selectReal.id == '安全出口') {
url = this.downloadList[i].imageUrl url = this.downloadList[i].imageUrl
}else{ } else {
url =`/api/Objects/PlanPlatform/${this.downloadList[i].imageUrl}` url = `/api/Objects/PlanPlatform/${this.downloadList[i].imageUrl}`
} }
this.http.get(url,{responseType: 'blob'},).subscribe((data:any)=>{ this.http.get(url, { responseType: 'blob' },).subscribe((data: any) => {
let url = window.URL.createObjectURL(new Blob([data])); //createObjectURL创建一个下载Blob的url地址 let url = window.URL.createObjectURL(new Blob([data])); //createObjectURL创建一个下载Blob的url地址
let link = document.createElement("a"); let link = document.createElement("a");
link.style.display = "none"; link.style.display = "none";
link.href = url; link.href = url;
let imgName let imgName
if(this.selectReal.id == '重点部位'){ if (this.selectReal.id == '重点部位') {
imgName = this.downloadList[i].name + '.' + data.type.split('/')[data.type.split('/').length - 1] imgName = this.downloadList[i].name + '.' + data.type.split('/')[data.type.split('/').length - 1]
}else{ } else if (this.selectReal.id == '安全出口') {
imgName = '安全出口' + this.downloadList[i].name
} else {
imgName = this.downloadList[i].name imgName = this.downloadList[i].name
} }
link.setAttribute("download", imgName); link.setAttribute("download", imgName);
@ -396,18 +439,20 @@ export class RealisticPictureComponent implements OnInit {
result('success') result('success')
}) })
}) })
if(i == this.downloadList.length-1) { //判断是否下载完毕 if (i == this.downloadList.length - 1) { //判断是否下载完毕
this.isLoading = false this.isLoading = false
this.isDownload = false this.isDownload = false
this.allImages.forEach(element => {element.checked = false}); this.allImages.forEach(element => { element.checked = false });
this.downloadList = []} this.downloadList = []
}
} //for循环 } //for循环
} else { } else {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('请选择图片','确定',config);} this.snackBar.open('请选择图片', '确定', config);
}
} }
@ -426,16 +471,16 @@ export class RealisticPictureComponent implements OnInit {
}) })
export class previewImg { export class previewImg {
constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef<previewImg>, constructor(private http: HttpClient, public dialog: MatDialog, public dialogRef: MatDialogRef<previewImg>,
@Inject(MAT_DIALOG_DATA) public data) { } @Inject(MAT_DIALOG_DATA) public data) { }
testSwiper: Swiper; testSwiper: Swiper;
ngOnInit(): void { ngOnInit(): void {
this.allImages = this.data.allImages this.allImages = this.data.allImages
this.allImages.forEach(element => { this.allImages.forEach(element => {
if( this.data.selectReal.id == '重点部位'){ if (this.data.selectReal.id == '重点部位' || this.data.selectReal.id == '安全出口') {
element.previewImageUrl = `${element.imageUrl}` //处理图片URL地址 element.previewImageUrl = `${element.imageUrl}` //处理图片URL地址
}else{ } else {
element.previewImageUrl = `/api/Objects/PlanPlatform/${element.imageUrl}?x-oss-process=image/auto-orient,1` //处理图片URL地址 element.previewImageUrl = `/api/Objects/PlanPlatform/${element.imageUrl}?x-oss-process=image/auto-orient,1` //处理图片URL地址
} }
@ -450,19 +495,19 @@ export class previewImg {
loop: false, loop: false,
// 如果需要前进后退按钮 // 如果需要前进后退按钮
navigation: { navigation: {
nextEl: '.swiper-button-next', nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev', prevEl: '.swiper-button-prev',
} }
}); });
} }
allImages:any; //展示所有的图片 allImages: any; //展示所有的图片
rotationAngle:number=0; //旋转角度 rotationAngle: number = 0; //旋转角度
//旋转图片 //旋转图片
rotate () { rotate() {
this.rotationAngle = this.rotationAngle+90 this.rotationAngle = this.rotationAngle + 90
if (this.rotationAngle === 360) {this.rotationAngle = 0} if (this.rotationAngle === 360) { this.rotationAngle = 0 }
} }
} }
@ -477,22 +522,22 @@ export class previewImg {
}) })
export class addRealPicture { export class addRealPicture {
constructor(private router:Router,private route:ActivatedRoute,private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef<addRealPicture>) { } constructor(private router: Router, private route: ActivatedRoute, private http: HttpClient, public dialog: MatDialog, public dialogRef: MatDialogRef<addRealPicture>) { }
ngOnInit(): void { ngOnInit(): void {
this.companyId = sessionStorage.getItem('companyId') this.companyId = sessionStorage.getItem('companyId')
} }
companyId:any; //单位编号 companyId: any; //单位编号
//提交表单 //提交表单
onSubmit (e) { onSubmit(e) {
let companyId = this.route.snapshot.queryParams.id let companyId = this.route.snapshot.queryParams.id
let data={ let data = {
name:e.name, name: e.name,
companyId:companyId companyId: companyId
} }
this.http.post('/api/RealityImageGroups',data).subscribe(data=>{ this.http.post('/api/RealityImageGroups', data).subscribe(data => {
this.dialogRef.close(data); this.dialogRef.close(data);
}) })
} }
@ -509,24 +554,24 @@ export class addRealPicture {
}) })
export class editRealPicture { export class editRealPicture {
constructor(private router:Router,private route:ActivatedRoute,private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef<editRealPicture>, constructor(private router: Router, private route: ActivatedRoute, private http: HttpClient, public dialog: MatDialog, public dialogRef: MatDialogRef<editRealPicture>,
@Inject(MAT_DIALOG_DATA) public data) { } @Inject(MAT_DIALOG_DATA) public data) { }
ngOnInit(): void { ngOnInit(): void {
this.name = this.data.name this.name = this.data.name
} }
name:any //实景图分组名称 name: any //实景图分组名称
//提交表单 //提交表单
onSubmit (e) { onSubmit(e) {
let companyId = this.route.snapshot.queryParams.id let companyId = this.route.snapshot.queryParams.id
let data = { let data = {
id:this.data.id, id: this.data.id,
name:e.name, name: e.name,
companyId:companyId companyId: companyId
} }
this.http.put(`/api/RealityImageGroups/${this.data.id}`,data).subscribe(data=>{ this.http.put(`/api/RealityImageGroups/${this.data.id}`, data).subscribe(data => {
this.dialogRef.close('success'); this.dialogRef.close('success');
}) })
} }

7
src/app/plan-audit/wait-examineer/wait-examineer.component.ts

@ -291,7 +291,7 @@ export class WaitExamineerComponent implements OnInit {
}) })
} else { } else {
this.http.get(`/api/PlanComponents/${item.itemId}`).subscribe((data: any) => { this.http.get(`/api/PlanComponents/${item.itemId}`).subscribe((data: any) => {
//console.log(data) console.log('预案信息',data)
this.companyId = data.companyId this.companyId = data.companyId
this.companyName = data.companyName this.companyName = data.companyName
if (data.planType != 2 && data.planType != 1) { if (data.planType != 2 && data.planType != 1) {
@ -328,10 +328,6 @@ export class WaitExamineerComponent implements OnInit {
this.planData = data this.planData = data
this.handleData() this.handleData()
return return
//this.src=`/planAudit/planpass?id=${data.companyId}&companyName=${data.companyName}&auditPlanId=${data.id}&auditStatus=${data.auditStatus}&planType=1`
//this.iframeSrc=this.sanitizer.bypassSecurityTrustResourceUrl(this.src);
//window.open(`/planAudit/planpass?id=${data.companyId}&companyName=${data.companyName}&auditPlanId=${data.id}&auditStatus=${data.auditStatus}&planType=1`)
} }
@ -352,6 +348,7 @@ export class WaitExamineerComponent implements OnInit {
//毕升 //毕升
lookWord() { lookWord() {
console.log('lookWord')
this.showtype = 0 this.showtype = 0
let src let src
let suffix = this.fetchUrl.split('.')[this.fetchUrl.split('.').length - 1].toLowerCase() let suffix = this.fetchUrl.split('.')[this.fetchUrl.split('.').length - 1].toLowerCase()

27
src/app/ui/collection-tools-building/collection-tools.component.ts

@ -897,24 +897,36 @@ export class CollectionToolsBuildingComponent implements OnInit {
//遍历 建筑数据 删除多余数据 //遍历 建筑数据 删除多余数据
let object = this.canvasData.originalcompanyBuildingData.data let object = this.canvasData.originalcompanyBuildingData.data
let adjoinArr = [] //毗邻数组 let adjoinArr = [] //毗邻数组
Object.keys(object).forEach(key=>{ Object.keys(object).forEach(key => {
let isExist = this.sitePlanData.find(item=>{ return item.id === object[key].FloorId }) let isExist = this.sitePlanData.find(item => { return item.id === object[key].FloorId })
if (isExist === undefined) { if (isExist === undefined) {
console.log(object[key],'当前楼层已被删除') console.log(object[key], '当前楼层已被删除')
delete object[key] delete object[key]
} }
}) })
//遍历 建筑数据 删除多余数据 //遍历 建筑数据 删除多余数据
this.saveNum = [] this.saveNum = []
let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData)); let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData));
console.log(SitePlanData.data)
for (const key in SitePlanData.data) {
if (Object.prototype.hasOwnProperty.call(SitePlanData.data, key)) {
const element = SitePlanData.data[key];
element.Width = Number(element.Width)
element.Height = Number(element.Height)
element.PropertyInfos.forEach(item => {
item.PropertyType = Number(item.PropertyType)
});
}
}
SitePlanData.data = JSON.stringify(SitePlanData.data) SitePlanData.data = JSON.stringify(SitePlanData.data)
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData)); let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData));
CompanyData.data = JSON.stringify(CompanyData.data) CompanyData.data = JSON.stringify(CompanyData.data)
if (this.pattern) {//如果是基本信息编辑模式 if (this.pattern) {//如果是基本信息编辑模式
for (const key in object) { for (const key in object) {
if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻 if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻
object[key].PropertyInfos.forEach(element => { object[key].PropertyInfos.forEach(element => {
if (element.PropertyName == "方向") { if (element.PropertyName == "方向") {
adjoinArr.push(element.PropertyValue) adjoinArr.push(element.PropertyValue)
@ -1068,7 +1080,6 @@ export class CollectionToolsBuildingComponent implements OnInit {
}) })
} else { //如果是建筑 } else { //如果是建筑
//建筑平面图数据 //建筑平面图数据
this.http.post("/api/BuildingAreaData", SitePlanData, { this.http.post("/api/BuildingAreaData", SitePlanData, {
params: { params: {
@ -1659,6 +1670,7 @@ export class CollectionToolsBuildingComponent implements OnInit {
getSitePlanStorey(e) { getSitePlanStorey(e) {
let params = { sitePlanId: e.id } let params = { sitePlanId: e.id }
this.http.get(`/api/SitePlanData`, { params }).subscribe((data: any) => { this.http.get(`/api/SitePlanData`, { params }).subscribe((data: any) => {
this.canvasData.originaleveryStoreyData = data || {} // 楼层原数据 this.canvasData.originaleveryStoreyData = data || {} // 楼层原数据
this.canvasData.originaleveryStoreyData.data ? this.canvasData.originaleveryStoreyData.data = JSON.parse(this.canvasData.originaleveryStoreyData.data) : this.canvasData.originaleveryStoreyData.data = {} this.canvasData.originaleveryStoreyData.data ? this.canvasData.originaleveryStoreyData.data = JSON.parse(this.canvasData.originaleveryStoreyData.data) : this.canvasData.originaleveryStoreyData.data = {}
this.canvasData.originaleveryStoreyData.version = "2.0" this.canvasData.originaleveryStoreyData.version = "2.0"
@ -1684,6 +1696,7 @@ export class CollectionToolsBuildingComponent implements OnInit {
getBuildingStorey(e) { getBuildingStorey(e) {
let params = { buildingAreaId: e.id } let params = { buildingAreaId: e.id }
this.http.get(`/api/BuildingAreaData`, { params }).subscribe((data: any) => { this.http.get(`/api/BuildingAreaData`, { params }).subscribe((data: any) => {
console.log('建筑楼层数据', data)
this.canvasData.originaleveryStoreyData = data || {} // 楼层原数据 this.canvasData.originaleveryStoreyData = data || {} // 楼层原数据
this.canvasData.originaleveryStoreyData.data ? this.canvasData.originaleveryStoreyData.data = JSON.parse(this.canvasData.originaleveryStoreyData.data) : this.canvasData.originaleveryStoreyData.data = {} this.canvasData.originaleveryStoreyData.data ? this.canvasData.originaleveryStoreyData.data = JSON.parse(this.canvasData.originaleveryStoreyData.data) : this.canvasData.originaleveryStoreyData.data = {}
this.canvasData.originaleveryStoreyData.version = "2.0" this.canvasData.originaleveryStoreyData.version = "2.0"
@ -1747,8 +1760,8 @@ export class CollectionToolsBuildingComponent implements OnInit {
} }
hoverSitePlan(item,key){ hoverSitePlan(item, key) {
if(key == this.selectSitePlanIndex){ if (key == this.selectSitePlanIndex) {
if (this.element.nativeElement.querySelector('#rightOperate')) { if (this.element.nativeElement.querySelector('#rightOperate')) {
setTimeout(() => { setTimeout(() => {
this.element.nativeElement.querySelector('#rightOperate').style.position = 'fixed' this.element.nativeElement.querySelector('#rightOperate').style.position = 'fixed'

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

@ -722,39 +722,39 @@ export class CollectionToolsPlanComponent implements OnInit {
} }
//截图 //截图
takeScreenshot() { takeScreenshot() {
if (!this.isGis) { if (!this.isGis) {
this.canvas.takeScreenshot(); this.canvas.takeScreenshot();
} else { } else {
this.takeScreenshotGis() this.takeScreenshotGis()
} }
} }
canvasImg canvasImg
takeScreenshotGis() { takeScreenshotGis() {
// console.log(666666, this.selectingSitePlan) // console.log(666666, this.selectingSitePlan)
// 使用html2canvas插件,将数据源中的数据转换成画布。 // 使用html2canvas插件,将数据源中的数据转换成画布。
html2canvas(document.querySelector("#planContainer"), { html2canvas(document.querySelector("#planContainer"), {
useCORS: true, // 【重要】开启跨域配置, useCORS: true, // 【重要】开启跨域配置,
allowTaint: true,//允许跨域图片 allowTaint: true,//允许跨域图片
taintTest: false,//是否在渲染前测试图片 taintTest: false,//是否在渲染前测试图片
onrendered: function (canvas) { onrendered: function (canvas) {
var dataUrl = canvas.toDataURL("image/png"); var dataUrl = canvas.toDataURL("image/png");
} }
}).then(canvas => { }).then(canvas => {
// 修改生成的宽度 // 修改生成的宽度
this.canvasImg = canvas.toDataURL("image/png"); this.canvasImg = canvas.toDataURL("image/png");
// console.log(this.canvasImg) // console.log(this.canvasImg)
}).then(() => { }).then(() => {
this.downloadFile(this.selectingSitePlan.name, this.canvasImg); this.downloadFile(this.selectingSitePlan.name, this.canvasImg);
}) })
} }
downloadFile(filename, content) { downloadFile(filename, content) {
var base64Img = content; var base64Img = content;
var oA = document.createElement('a'); var oA = document.createElement('a');
oA.href = base64Img; oA.href = base64Img;
oA.download = filename; oA.download = filename;
var event = document.createEvent('MouseEvents'); var event = document.createEvent('MouseEvents');
event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
oA.dispatchEvent(event); oA.dispatchEvent(event);
} }
isMultiSelect: boolean = false; // 多选/单选 切换 isMultiSelect: boolean = false; // 多选/单选 切换
@ -807,17 +807,28 @@ export class CollectionToolsPlanComponent implements OnInit {
//遍历 建筑数据 删除多余数据 //遍历 建筑数据 删除多余数据
let object = this.canvasData.originalcompanyBuildingData.data let object = this.canvasData.originalcompanyBuildingData.data
let adjoinArr = [] //毗邻数组 let adjoinArr = [] //毗邻数组
Object.keys(object).forEach(key=>{ Object.keys(object).forEach(key => {
let isExist = this.sitePlanData.find(item=>{ return item.id === object[key].FloorId }) let isExist = this.sitePlanData.find(item => { return item.id === object[key].FloorId })
if (isExist === undefined) { if (isExist === undefined) {
console.log(object[key],'当前楼层已被删除') console.log(object[key], '当前楼层已被删除')
delete object[key] delete object[key]
} }
}) })
//遍历 建筑数据 删除多余数据 //遍历 建筑数据 删除多余数据
this.saveNum = [] this.saveNum = []
let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData)); let SitePlanData = JSON.parse(JSON.stringify(this.canvasData.originaleveryStoreyData));
for (const key in SitePlanData.data) {
if (Object.prototype.hasOwnProperty.call(SitePlanData.data, key)) {
const element = SitePlanData.data[key];
element.Width = Number(element.Width)
element.Height = Number(element.Height)
element.PropertyInfos.forEach(item => {
item.PropertyType = Number(item.PropertyType)
});
}
}
SitePlanData.data = JSON.stringify(SitePlanData.data) SitePlanData.data = JSON.stringify(SitePlanData.data)
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData)); let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData));
CompanyData.data = JSON.stringify(CompanyData.data) CompanyData.data = JSON.stringify(CompanyData.data)
@ -1460,7 +1471,7 @@ export class CollectionToolsPlanComponent implements OnInit {
viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D', viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D',
zoom: 11, //初始化地图层级 zoom: 11, //初始化地图层级
WebGLParams: { WebGLParams: {
preserveDrawingBuffer: true preserveDrawingBuffer: true
} }
}); });
if (this.selectingSitePlan.defaultCenter) { if (this.selectingSitePlan.defaultCenter) {
@ -1472,7 +1483,7 @@ export class CollectionToolsPlanComponent implements OnInit {
this.map.on('click', (e) => { this.map.on('click', (e) => {
this.showInfoClick(e) this.showInfoClick(e)
},this); }, this);
this.map.on("complete", () => { this.map.on("complete", () => {
for (const key in this.canvasData.originaleveryStoreyData.data) { for (const key in this.canvasData.originaleveryStoreyData.data) {
if (Object.prototype.hasOwnProperty.call(this.canvasData.originaleveryStoreyData.data, key)) { if (Object.prototype.hasOwnProperty.call(this.canvasData.originaleveryStoreyData.data, key)) {
@ -1508,13 +1519,13 @@ export class CollectionToolsPlanComponent implements OnInit {
console.log(e) console.log(e)
this.clickId = e.target.id this.clickId = e.target.id
this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[e.target.id]) this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[e.target.id])
},this); }, this);
startMarker.on('dragend', (e) => { startMarker.on('dragend', (e) => {
// console.log('拖拽完成', e) // console.log('拖拽完成', e)
this.canvasData.isChange = true this.canvasData.isChange = true
this.clickId = e.target.id this.clickId = e.target.id
this.canvasData.originaleveryStoreyData.data[e.target.id].Point = { x: e.lnglat.lng, y: e.lnglat.lat } this.canvasData.originaleveryStoreyData.data[e.target.id].Point = { x: e.lnglat.lng, y: e.lnglat.lat }
},this); }, this);
this.planDataMarkers.push(startMarker) this.planDataMarkers.push(startMarker)
this.map.add(startMarker); this.map.add(startMarker);
} }
@ -1738,24 +1749,24 @@ export class CollectionToolsPlanComponent implements OnInit {
} }
if (this.element.nativeElement.querySelector('#rightOperate')) { if (this.element.nativeElement.querySelector('#rightOperate')) {
setTimeout(() => { setTimeout(() => {
this.element.nativeElement.querySelector('#rightOperate').style.position = 'fixed' this.element.nativeElement.querySelector('#rightOperate').style.position = 'fixed'
this.element.nativeElement.querySelector('#rightOperate').style.left = document.getElementsByClassName('sitePlanContentBox')[0].children[this.selectSitePlanIndex].getBoundingClientRect().left + document.getElementById("leftDiv").offsetWidth + 'px' this.element.nativeElement.querySelector('#rightOperate').style.left = document.getElementsByClassName('sitePlanContentBox')[0].children[this.selectSitePlanIndex].getBoundingClientRect().left + document.getElementById("leftDiv").offsetWidth + 'px'
this.element.nativeElement.querySelector('#rightOperate').style.top = document.getElementsByClassName('sitePlanContentBox')[0].children[this.selectSitePlanIndex].getBoundingClientRect().top - 32 + 'px' this.element.nativeElement.querySelector('#rightOperate').style.top = document.getElementsByClassName('sitePlanContentBox')[0].children[this.selectSitePlanIndex].getBoundingClientRect().top - 32 + 'px'
}, 0); }, 0);
} }
} }
hoverSitePlan(item,key){ hoverSitePlan(item, key) {
if(key == this.selectSitePlanIndex){ if (key == this.selectSitePlanIndex) {
if (this.element.nativeElement.querySelector('#rightOperate')) { if (this.element.nativeElement.querySelector('#rightOperate')) {
setTimeout(() => { setTimeout(() => {
this.element.nativeElement.querySelector('#rightOperate').style.position = 'fixed' this.element.nativeElement.querySelector('#rightOperate').style.position = 'fixed'
this.element.nativeElement.querySelector('#rightOperate').style.left = document.getElementsByClassName('sitePlanContentBox')[0].children[this.selectSitePlanIndex].getBoundingClientRect().left + document.getElementById("leftDiv").offsetWidth + 'px' this.element.nativeElement.querySelector('#rightOperate').style.left = document.getElementsByClassName('sitePlanContentBox')[0].children[this.selectSitePlanIndex].getBoundingClientRect().left + document.getElementById("leftDiv").offsetWidth + 'px'
this.element.nativeElement.querySelector('#rightOperate').style.top = document.getElementsByClassName('sitePlanContentBox')[0].children[this.selectSitePlanIndex].getBoundingClientRect().top - 32 + 'px' this.element.nativeElement.querySelector('#rightOperate').style.top = document.getElementsByClassName('sitePlanContentBox')[0].children[this.selectSitePlanIndex].getBoundingClientRect().top - 32 + 'px'
}, 0); }, 0);
}
} }
}
} }
@ -2319,13 +2330,13 @@ export class CollectionToolsPlanComponent implements OnInit {
startMarker.on('click', (e) => { startMarker.on('click', (e) => {
this.clickId = e.target.id this.clickId = e.target.id
this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[e.target.id]) this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[e.target.id])
},this); }, this);
startMarker.on('dragend', (e) => { startMarker.on('dragend', (e) => {
// console.log('拖拽完成', e) // console.log('拖拽完成', e)
this.canvasData.isChange = true this.canvasData.isChange = true
this.clickId = e.target.id this.clickId = e.target.id
this.canvasData.originaleveryStoreyData.data[e.target.id].Point = { x: e.lnglat.lng, y: e.lnglat.lat } this.canvasData.originaleveryStoreyData.data[e.target.id].Point = { x: e.lnglat.lng, y: e.lnglat.lat }
},this); }, this);
//将图标数据添加 //将图标数据添加
let itemData = JSON.parse(JSON.stringify(this.selectImage)) let itemData = JSON.parse(JSON.stringify(this.selectImage))

Loading…
Cancel
Save