|
|
|
@ -29,6 +29,17 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
this.companyId = sessionStorage.getItem('companyId') |
|
|
|
|
this.http.get('/api/CompanyAccount/RealityImageGroups').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() |
|
|
|
|
}) |
|
|
|
@ -67,25 +78,65 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
//获取实景图分组对应实景图
|
|
|
|
|
getAllRealPicture() { |
|
|
|
|
if (this.selectReal) { |
|
|
|
|
let data ={ |
|
|
|
|
|
|
|
|
|
if (this.selectReal.id == '安全出口') { |
|
|
|
|
let params = { |
|
|
|
|
companyId: this.selectReal.companyId, |
|
|
|
|
PageNumber: this.PageNumber || 1, |
|
|
|
|
pageSize: this.pageSize, |
|
|
|
|
} |
|
|
|
|
this.http.get('/api/CompanyAccount/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 = { |
|
|
|
|
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, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.http.get('/api/CompanyAccount/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
|
|
|
|
|
// element.newImageUrl = `/api/Objects/PlanPlatform/${element.imageUrl}?x-oss-process=image/resize,m_fill,h_170,w_299` //处理图片URL地址
|
|
|
|
|
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.checked = false //图片是否选中布尔值
|
|
|
|
|
element.nameStart = element.name.substring(0, element.name.lastIndexOf(".")); //图片名称前缀
|
|
|
|
|
} |
|
|
|
|
element.checked = false //图片是否选中布尔值
|
|
|
|
|
// element.nameStart = element.name.substring(0,element.name.lastIndexOf(".")); //图片名称前缀
|
|
|
|
|
element.nameEnd = element.name.substring(element.name.lastIndexOf("."), element.name.length); //图片名称后缀
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//切换左侧实景图文件
|
|
|
|
@ -116,11 +167,15 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
else { this.downloadList.splice(this.downloadList.findIndex(item => item.id === e.id), 1) } |
|
|
|
|
} else { //预览图片
|
|
|
|
|
let data = { |
|
|
|
|
selectReal: this.selectReal, |
|
|
|
|
allImages: this.allImages, |
|
|
|
|
imgIndex: index} |
|
|
|
|
imgIndex: index |
|
|
|
|
} |
|
|
|
|
let dialogRef = this.dialog.open(previewImg, |
|
|
|
|
{width: '1600px', |
|
|
|
|
height:'900px',data}); |
|
|
|
|
{ |
|
|
|
|
width: '1600px', |
|
|
|
|
height: '900px', data |
|
|
|
|
}); |
|
|
|
|
dialogRef.afterClosed().subscribe(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -147,12 +202,30 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
|
|
|
|
|
//删除实景图文件
|
|
|
|
|
delete() { |
|
|
|
|
if(this.selectReal.name == '重点部位' || this.selectReal.name == '安全出口' || this.selectReal.name == '外观'){ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('内置项不允许删除', '确定', config); |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
if (this.selectReal) { |
|
|
|
|
let isDelete = confirm('您确定要删除吗') |
|
|
|
|
if (isDelete) { |
|
|
|
|
this.http.delete(`/api/CompanyAccount/RealityImageGroups/${this.selectReal.id}`).subscribe(data => { |
|
|
|
|
this.http.get('/api/CompanyAccount/RealityImageGroups').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[this.selectRealIndex] |
|
|
|
|
this.allImages = [] |
|
|
|
|
this.getAllRealPicture() |
|
|
|
@ -250,7 +323,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 |
|
|
|
@ -283,7 +357,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 内置方法处理成功
|
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
@ -331,28 +406,45 @@ export class RealisticPictureComponent implements OnInit {
|
|
|
|
|
this.isLoading = true |
|
|
|
|
for (let i = 0; i < this.downloadList.length; i++) { |
|
|
|
|
let result = await new Promise((result, reject) => { |
|
|
|
|
this.http.get(`/api/Objects/PlanPlatform/${this.downloadList[i].imageUrl}`,{responseType: 'blob'},).subscribe(data=>{
|
|
|
|
|
// this.http.get(`/api/Objects/PlanPlatform/${this.downloadList[i].imageUrl}`,{responseType: 'blob'},).subscribe(data=>{
|
|
|
|
|
let url |
|
|
|
|
if (this.selectReal.id == '重点部位') { |
|
|
|
|
url = this.downloadList[i].imageUrl |
|
|
|
|
} else { |
|
|
|
|
url = `/api/Objects/PlanPlatform/${this.downloadList[i].imageUrl}` |
|
|
|
|
} |
|
|
|
|
this.http.get(url, { responseType: 'blob' },).subscribe((data: any) => { |
|
|
|
|
let url = window.URL.createObjectURL(new Blob([data])); //createObjectURL创建一个下载Blob的url地址
|
|
|
|
|
let link = document.createElement("a"); |
|
|
|
|
link.style.display = "none"; |
|
|
|
|
link.href = url; |
|
|
|
|
link.setAttribute("download", this.downloadList[i].name); |
|
|
|
|
// link.setAttribute("download", this.downloadList[i].name);
|
|
|
|
|
let imgName |
|
|
|
|
if (this.selectReal.id == '重点部位') { |
|
|
|
|
imgName = this.downloadList[i].name + '.' + data.type.split('/')[data.type.split('/').length - 1] |
|
|
|
|
} else { |
|
|
|
|
imgName = this.downloadList[i].name |
|
|
|
|
} |
|
|
|
|
link.setAttribute("download", imgName); |
|
|
|
|
document.body.appendChild(link); |
|
|
|
|
link.click(); |
|
|
|
|
result('success')}) |
|
|
|
|
result('success') |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
if (i == this.downloadList.length - 1) { //判断是否下载完毕
|
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -378,7 +470,12 @@ export class previewImg {
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.allImages = this.data.allImages |
|
|
|
|
this.allImages.forEach(element => { |
|
|
|
|
// element.previewImageUrl = `/api/Objects/PlanPlatform/${element.imageUrl}?x-oss-process=image/auto-orient,1` //处理图片URL地址
|
|
|
|
|
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地址
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -420,7 +517,7 @@ export class previewImg {
|
|
|
|
|
}) |
|
|
|
|
export class addRealPicture { |
|
|
|
|
|
|
|
|
|
constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef<addRealPicture>) { } |
|
|
|
|
constructor(private http: HttpClient, public dialog: MatDialog, public dialogRef: MatDialogRef<addRealPicture>, public snackBar: MatSnackBar) { } |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.companyId = sessionStorage.getItem('companyId') |
|
|
|
@ -434,6 +531,12 @@ export class addRealPicture {
|
|
|
|
|
name: e.name, |
|
|
|
|
companyId: this.companyId |
|
|
|
|
} |
|
|
|
|
if(e.name == '安全出口' || e.name == '重点部位' || e.name == '外观'){ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('不允许创建名为安全出口、重点部位、外观的文件夹', '确定', config); |
|
|
|
|
}else{ |
|
|
|
|
this.http.post('/api/CompanyAccount/RealityImageGroups', data).subscribe(data => { |
|
|
|
|
this.dialogRef.close(data); |
|
|
|
|
}) |
|
|
|
@ -441,6 +544,8 @@ export class addRealPicture {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//编辑实景图文件组件
|
|
|
|
@ -452,7 +557,7 @@ export class addRealPicture {
|
|
|
|
|
export class editRealPicture { |
|
|
|
|
|
|
|
|
|
constructor(private http: HttpClient, public dialog: MatDialog, public dialogRef: MatDialogRef<editRealPicture>, |
|
|
|
|
@Inject(MAT_DIALOG_DATA) public data) { } |
|
|
|
|
@Inject(MAT_DIALOG_DATA) public data, public snackBar: MatSnackBar) { } |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.name = this.data.name |
|
|
|
@ -467,9 +572,17 @@ export class editRealPicture {
|
|
|
|
|
name: e.name, |
|
|
|
|
companyId: this.data.companyId |
|
|
|
|
} |
|
|
|
|
if(e.name == '安全出口' || e.name == '重点部位'){ |
|
|
|
|
let config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('文件名不允许为安全出口、重点部位、外观', '确定', config); |
|
|
|
|
}else{ |
|
|
|
|
this.http.put(`/api/CompanyAccount/RealityImageGroups/${this.data.id}`, data).subscribe(data => { |
|
|
|
|
this.dialogRef.close('success'); |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |