|
|
|
@ -26,15 +26,22 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
let companyId = this.route.snapshot.queryParams.id |
|
|
|
|
this.http.get('/api/RealityImageGroups',{params:{ |
|
|
|
|
this.http.get('/api/RealityImageGroups', { |
|
|
|
|
params: { |
|
|
|
|
companyId: companyId |
|
|
|
|
}}).subscribe((data:any)=>{ |
|
|
|
|
} |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
this.allRealPicture = data |
|
|
|
|
this.allRealPicture.unshift({ |
|
|
|
|
companyId: sessionStorage.getItem('companyId'), |
|
|
|
|
id: '重点部位', |
|
|
|
|
name: "重点部位", |
|
|
|
|
realityImages: null |
|
|
|
|
}, { |
|
|
|
|
companyId: sessionStorage.getItem('companyId'), |
|
|
|
|
id: '安全出口', |
|
|
|
|
name: "安全出口", |
|
|
|
|
realityImages: null |
|
|
|
|
}) |
|
|
|
|
this.selectReal = data[0] |
|
|
|
|
this.getAllRealPicture() |
|
|
|
@ -66,9 +73,11 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
//获取所有实景图分组
|
|
|
|
|
getAllGrouping() { |
|
|
|
|
let companyId = this.route.snapshot.queryParams.id |
|
|
|
|
this.http.get('/api/RealityImageGroups',{params:{ |
|
|
|
|
this.http.get('/api/RealityImageGroups', { |
|
|
|
|
params: { |
|
|
|
|
companyId: companyId |
|
|
|
|
}}).subscribe((data:any)=>{ |
|
|
|
|
} |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
this.allRealPicture = data |
|
|
|
|
this.selectReal = data[this.selectRealIndex] |
|
|
|
|
}) |
|
|
|
@ -77,6 +86,25 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
//获取实景图分组对应实景图
|
|
|
|
|
getAllRealPicture() { |
|
|
|
|
if (this.selectReal) { |
|
|
|
|
if (this.selectReal.id == '安全出口') { |
|
|
|
|
let params = { |
|
|
|
|
companyId: this.selectReal.companyId, |
|
|
|
|
PageNumber: this.PageNumber || 1, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
} |
|
|
|
|
this.http.get('/api/CompanySafetyExits/GetCompanySafetyExitImages', { params: params }).subscribe((data: any) => { |
|
|
|
|
console.log('当前单位安全出口', data) |
|
|
|
|
this.allImages = data.items |
|
|
|
|
this.length = data.totalCount |
|
|
|
|
this.pageSize = this.pageSize |
|
|
|
|
this.downloadList = [] |
|
|
|
|
this.allImages.forEach(element => { //每张图片设置选中状态为false
|
|
|
|
|
element.newImageUrl = `${element.imageUrl}?x-oss-process=image/resize,m_fill,h_170,w_299` //处理图片URL地址
|
|
|
|
|
element.nameStart = element.name |
|
|
|
|
element.checked = false //图片是否选中布尔值
|
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
let data |
|
|
|
|
if (this.selectReal.id == '重点部位') { |
|
|
|
|
data = { |
|
|
|
@ -111,6 +139,8 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//切换左侧实景图文件
|
|
|
|
@ -143,7 +173,8 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
let data = { |
|
|
|
|
selectReal: this.selectReal, |
|
|
|
|
allImages: this.allImages, |
|
|
|
|
imgIndex: index} |
|
|
|
|
imgIndex: index |
|
|
|
|
} |
|
|
|
|
let dialogRef = this.dialog.open(previewImg, |
|
|
|
|
{ data }); |
|
|
|
|
dialogRef.afterClosed().subscribe(); |
|
|
|
@ -157,7 +188,8 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
dialogRef.afterClosed().subscribe(data => { |
|
|
|
|
if (data) { |
|
|
|
|
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
|
|
|
|
|
this.getAllGrouping()} |
|
|
|
|
this.getAllGrouping() |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -169,7 +201,8 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
dialogRef.afterClosed().subscribe(data => { |
|
|
|
|
if (data) { |
|
|
|
|
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
|
|
|
|
|
this.getAllGrouping()} |
|
|
|
|
this.getAllGrouping() |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -181,9 +214,11 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
let isDelete = confirm('您确定要删除吗') |
|
|
|
|
if (isDelete) { |
|
|
|
|
this.http.delete(`/api/RealityImageGroups/${this.selectReal.id}`).subscribe(data => { |
|
|
|
|
this.http.get('/api/RealityImageGroups',{params:{ |
|
|
|
|
this.http.get('/api/RealityImageGroups', { |
|
|
|
|
params: { |
|
|
|
|
companyId: companyId |
|
|
|
|
}}).subscribe((data:any)=>{ |
|
|
|
|
} |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
this.allRealPicture = data |
|
|
|
|
this.selectReal = data[this.selectRealIndex] |
|
|
|
|
this.allImages = [] |
|
|
|
@ -206,9 +241,11 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
imageUrl: e.imageUrl, |
|
|
|
|
realityImageGroupId: e.realityImageGroupId |
|
|
|
|
} |
|
|
|
|
this.http.put(`/api/RealityImages/${e.id}`,data,{params:{ |
|
|
|
|
this.http.put(`/api/RealityImages/${e.id}`, data, { |
|
|
|
|
params: { |
|
|
|
|
companyId: companyId |
|
|
|
|
}}).subscribe(data=>{ |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
this.getAllRealPicture() |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
@ -288,7 +325,8 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
this.addRealImg() |
|
|
|
|
} else { // 上传文件后获取服务器返回的数据错误
|
|
|
|
|
let tempRes = JSON.parse(response); |
|
|
|
|
}}; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
} else if (file && fileSize > shardSize && fileSize < maxdSize) { //上传文件>5MB时,分块上传
|
|
|
|
|
let data = { filename: file.name } |
|
|
|
|
this.isLoading = true |
|
|
|
@ -321,7 +359,8 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
this.http.post(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => { |
|
|
|
|
let msg = { |
|
|
|
|
"partNumber": data.partNumber || null, |
|
|
|
|
"eTag": data.eTag || null} |
|
|
|
|
"eTag": data.eTag || null |
|
|
|
|
} |
|
|
|
|
resolve(msg) // 调用 promise 内置方法处理成功
|
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
@ -351,9 +390,11 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
imageUrl: this.objectName, |
|
|
|
|
realityImageGroupId: this.selectReal.id, |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/RealityImages',data,{params:{ |
|
|
|
|
this.http.post('/api/RealityImages', data, { |
|
|
|
|
params: { |
|
|
|
|
companyId: companyId |
|
|
|
|
}}).subscribe(data=>{ |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
(<HTMLInputElement>document.getElementById('uploadFile')).value = null //清空input框缓存
|
|
|
|
|
this.getAllRealPicture() |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
@ -374,7 +415,7 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
for (let i = 0; i < this.downloadList.length; i++) { |
|
|
|
|
let result = await new Promise((result, reject) => { |
|
|
|
|
let url |
|
|
|
|
if(this.selectReal.id == '重点部位'){ |
|
|
|
|
if (this.selectReal.id == '重点部位' || this.selectReal.id == '安全出口') { |
|
|
|
|
url = this.downloadList[i].imageUrl |
|
|
|
|
} else { |
|
|
|
|
url = `/api/Objects/PlanPlatform/${this.downloadList[i].imageUrl}` |
|
|
|
@ -387,6 +428,8 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
let imgName |
|
|
|
|
if (this.selectReal.id == '重点部位') { |
|
|
|
|
imgName = this.downloadList[i].name + '.' + data.type.split('/')[data.type.split('/').length - 1] |
|
|
|
|
} else if (this.selectReal.id == '安全出口') { |
|
|
|
|
imgName = '安全出口' + this.downloadList[i].name |
|
|
|
|
} else { |
|
|
|
|
imgName = this.downloadList[i].name |
|
|
|
|
} |
|
|
|
@ -400,14 +443,16 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
this.isLoading = false |
|
|
|
|
this.isDownload = false |
|
|
|
|
this.allImages.forEach(element => { element.checked = false }); |
|
|
|
|
this.downloadList = []} |
|
|
|
|
this.downloadList = [] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} //for循环
|
|
|
|
|
} else { |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('请选择图片','确定',config);} |
|
|
|
|
this.snackBar.open('请选择图片', '确定', config); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -433,7 +478,7 @@ export class previewImg {
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.allImages = this.data.allImages |
|
|
|
|
this.allImages.forEach(element => { |
|
|
|
|
if( this.data.selectReal.id == '重点部位'){ |
|
|
|
|
if (this.data.selectReal.id == '重点部位' || this.data.selectReal.id == '安全出口') { |
|
|
|
|
element.previewImageUrl = `${element.imageUrl}` //处理图片URL地址
|
|
|
|
|
} else { |
|
|
|
|
element.previewImageUrl = `/api/Objects/PlanPlatform/${element.imageUrl}?x-oss-process=image/auto-orient,1` //处理图片URL地址
|
|
|
|
|