diff --git a/src/app/key-unit/realistic-picture/realistic-picture.component.html b/src/app/key-unit/realistic-picture/realistic-picture.component.html
index 34cfb72..8d90b28 100644
--- a/src/app/key-unit/realistic-picture/realistic-picture.component.html
+++ b/src/app/key-unit/realistic-picture/realistic-picture.component.html
@@ -23,7 +23,7 @@
暂无数据
diff --git a/src/app/key-unit/realistic-picture/realistic-picture.component.ts b/src/app/key-unit/realistic-picture/realistic-picture.component.ts
index 01fef81..0af6721 100644
--- a/src/app/key-unit/realistic-picture/realistic-picture.component.ts
+++ b/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 { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
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';
@Component({
@@ -14,107 +14,137 @@ import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-scor
styleUrls: ['./realistic-picture.component.scss']
})
export class RealisticPictureComponent implements OnInit {
- uploader:FileUploader = new FileUploader({ //初始化上传文件
- url: `/api/Objects/PlanPlatform/${this.route.snapshot.queryParams.id}/RealImgs`,
- method: "POST",
+ uploader: FileUploader = new FileUploader({ //初始化上传文件
+ url: `/api/Objects/PlanPlatform/${this.route.snapshot.queryParams.id}/RealImgs`,
+ method: "POST",
itemAlias: "uploadedfile",
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 {
let companyId = this.route.snapshot.queryParams.id
- this.http.get('/api/RealityImageGroups',{params:{
- companyId : companyId
- }}).subscribe((data:any)=>{
+ this.http.get('/api/RealityImageGroups', {
+ params: {
+ companyId: companyId
+ }
+ }).subscribe((data: any) => {
this.allRealPicture = data
this.allRealPicture.unshift({
- companyId:sessionStorage.getItem('companyId'),
- id:'重点部位',
+ companyId: sessionStorage.getItem('companyId'),
+ id: '重点部位',
name: "重点部位",
- realityImages:null
+ realityImages: null
+ }, {
+ companyId: sessionStorage.getItem('companyId'),
+ id: '安全出口',
+ name: "安全出口",
+ realityImages: null
})
this.selectReal = data[0]
this.getAllRealPicture()
})
}
- companyId:any; //单位编号
- allRealPicture:any=[]; //所有实景图文件
- selectReal:any; //选中的实景图文件
- selectRealIndex:number=0; //选中的实景图文件下标
- allImages:any=[]; //实景图文件对应所有的实景图
- isDownload:boolean = false; //是否批量下载
- downloadList:any = []; //选中需要下载的图片
+ companyId: any; //单位编号
+ allRealPicture: any = []; //所有实景图文件
+ selectReal: any; //选中的实景图文件
+ selectRealIndex: number = 0; //选中的实景图文件下标
+ allImages: any = []; //实景图文件对应所有的实景图
+ isDownload: boolean = false; //是否批量下载
+ downloadList: any = []; //选中需要下载的图片
//分页
- @ViewChild(MatPaginator, {static: true})
+ @ViewChild(MatPaginator, { static: true })
paginator: MatPaginator;
- length:any; //共多少条数据
- pageSize:any = '12'; //每页条数
+ length: any; //共多少条数据
+ pageSize: any = '12'; //每页条数
pageSizeOptions: number[] = [12] //设置每页条数
- PageNumber:any; //第几页
+ PageNumber: any; //第几页
//分页切换
- chagePage (e) {
- this.PageNumber = e.pageIndex+1
+ chagePage(e) {
+ this.PageNumber = e.pageIndex + 1
this.getAllRealPicture()
}
//获取所有实景图分组
- getAllGrouping () {
+ getAllGrouping() {
let companyId = this.route.snapshot.queryParams.id
- this.http.get('/api/RealityImageGroups',{params:{
- companyId : companyId
- }}).subscribe((data:any)=>{
+ this.http.get('/api/RealityImageGroups', {
+ params: {
+ companyId: companyId
+ }
+ }).subscribe((data: any) => {
this.allRealPicture = data
this.selectReal = data[this.selectRealIndex]
})
}
//获取实景图分组对应实景图
- getAllRealPicture () {
+ getAllRealPicture() {
if (this.selectReal) {
- 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,
+ if (this.selectReal.id == '安全出口') {
+ let params = {
+ companyId: this.selectReal.companyId,
PageNumber: this.PageNumber || 1,
pageSize: this.pageSize,
}
- }
- 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`
+ 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
- }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 //图片是否选中布尔值
+ });
+ })
+ } else {
+ let data
+ if (this.selectReal.id == '重点部位') {
+ data = {
+ groupId: this.selectReal.id,
+ companyId: this.selectReal.companyId,
+ PageNumber: this.PageNumber || 1,
+ pageSize: this.pageSize,
}
- element.checked = false //图片是否选中布尔值
- element.nameEnd = element.name.substring(element.name.lastIndexOf("."),element.name.length); //图片名称后缀
- });
+ } else {
+ data = {
+ groupId: this.selectReal.id,
+ PageNumber: this.PageNumber || 1,
+ pageSize: this.pageSize,
+ }
+ }
+ 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) {
this.selectReal = e
this.selectRealIndex = index
@@ -125,65 +155,70 @@ export class RealisticPictureComponent implements OnInit {
}
//选择批量下载
- download () {
+ download() {
this.isDownload = !this.isDownload
if (!this.isDownload) { //取消批量下载时数组清空
- this.allImages.forEach(element => {element.checked = false});
+ this.allImages.forEach(element => { element.checked = false });
this.downloadList = []
}
}
-
+
// 预览图片---批量选择图片
- operation (e,index) {
+ operation(e, index) {
if (this.isDownload) { //批量选择图片
e.checked = !e.checked
- if (e.checked==true) {this.downloadList.push(e)}
- else {this.downloadList.splice(this.downloadList.findIndex(item => item.id === e.id), 1)}
+ if (e.checked == true) { this.downloadList.push(e) }
+ else { this.downloadList.splice(this.downloadList.findIndex(item => item.id === e.id), 1) }
} else { //预览图片
let data = {
- selectReal:this.selectReal,
- allImages:this.allImages,
- imgIndex: index}
+ selectReal: this.selectReal,
+ allImages: this.allImages,
+ imgIndex: index
+ }
let dialogRef = this.dialog.open(previewImg,
- {data});
- dialogRef.afterClosed().subscribe();
+ { data });
+ dialogRef.afterClosed().subscribe();
}
}
//新建实景图文件
- addReal () {
+ addReal() {
let dialogRef = this.dialog.open(addRealPicture);
- dialogRef.afterClosed().subscribe(data=>{
+ dialogRef.afterClosed().subscribe(data => {
if (data) {
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
- this.getAllGrouping()}
- });
+ this.getAllGrouping()
+ }
+ });
}
//编辑实景图文件
- editReal () {
+ editReal() {
let data = this.selectReal
if (this.selectReal) {
- let dialogRef = this.dialog.open(editRealPicture, {data});
- dialogRef.afterClosed().subscribe(data=>{
+ let dialogRef = this.dialog.open(editRealPicture, { data });
+ dialogRef.afterClosed().subscribe(data => {
if (data) {
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
- this.getAllGrouping()}
- });
+ this.getAllGrouping()
+ }
+ });
}
}
//删除实景图文件
- delete () {
+ delete() {
let companyId = this.route.snapshot.queryParams.id
if (this.selectReal) {
let isDelete = confirm('您确定要删除吗')
if (isDelete) {
- this.http.delete(`/api/RealityImageGroups/${this.selectReal.id}`).subscribe(data=>{
- this.http.get('/api/RealityImageGroups',{params:{
- companyId : companyId
- }}).subscribe((data:any)=>{
+ this.http.delete(`/api/RealityImageGroups/${this.selectReal.id}`).subscribe(data => {
+ this.http.get('/api/RealityImageGroups', {
+ params: {
+ companyId: companyId
+ }
+ }).subscribe((data: any) => {
this.allRealPicture = data
this.selectReal = data[this.selectRealIndex]
this.allImages = []
@@ -198,39 +233,41 @@ export class RealisticPictureComponent implements OnInit {
//实景图修改
- preservationImg (e) {
- let companyId = this.route.snapshot.queryParams.id
+ preservationImg(e) {
+ let companyId = this.route.snapshot.queryParams.id
let data = {
- id:e.id,
- name:e.nameStart+e.nameEnd,
- imageUrl:e.imageUrl,
- realityImageGroupId:e.realityImageGroupId
+ id: e.id,
+ name: e.nameStart + e.nameEnd,
+ imageUrl: e.imageUrl,
+ realityImageGroupId: e.realityImageGroupId
}
- this.http.put(`/api/RealityImages/${e.id}`,data,{params:{
- companyId : companyId
- }}).subscribe(data=>{
+ this.http.put(`/api/RealityImages/${e.id}`, data, {
+ params: {
+ companyId: companyId
+ }
+ }).subscribe(data => {
this.getAllRealPicture()
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
- this.snackBar.open('图片修改成功','确定',config);
+ this.snackBar.open('图片修改成功', '确定', config);
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
})
}
//实景图删除
- deleteImg (e) {
+ deleteImg(e) {
let isDelete = confirm('您确定要删除吗')
if (isDelete) {
- this.http.delete(`/api/RealityImages/${e.id}`).subscribe(data=>{
+ this.http.delete(`/api/RealityImages/${e.id}`).subscribe(data => {
this.getAllRealPicture()
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
- this.snackBar.open('图片删除成功','确定',config);
+ this.snackBar.open('图片删除成功', '确定', config);
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; //上传的文件
- objectName:any; //上传对象名
- uploadId:any; //上传分块上传事件编号
+ file: any; //上传的文件
+ objectName: any; //上传对象名
+ uploadId: any; //上传分块上传事件编号
//change选择文件
- uploadFile (e) {
+ uploadFile(e) {
if (this.selectReal) {
this.file = e.target.files[0] || null //上传的文件
let URL = window.URL.createObjectURL(this.file)
@@ -253,46 +290,47 @@ export class RealisticPictureComponent implements OnInit {
img.src = URL
let that = this
img.onload = function () {
- if(img.width>=4096 || img.height>=5000 ){
+ if (img.width >= 4096 || img.height >= 5000) {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
- that.snackBar.open('请选择分辨率小于4096*5000的图片','确定',config);
+ that.snackBar.open('请选择分辨率小于4096*5000的图片', '确定', config);
that.uploader.clearQueue(); //清空input控件文件
(
document.getElementById('uploadFile')).value = null //清空input框缓存
- }else{ that.startUploading() }
+ } else { that.startUploading() }
} //onload
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
- this.snackBar.open('请选择或创建实景图文件夹','确定',config);
+ this.snackBar.open('请选择或创建实景图文件夹', '确定', config);
this.uploader.clearQueue(); //清空input控件文件
(document.getElementById('uploadFile')).value = null //清空input框缓存
}
}
//上传文件
- startUploading () {
+ startUploading() {
let file = this.file || null //获取上传的文件
let fileSize = file.size || null //上传文件的总大小
let shardSize = 5 * 1024 * 1024 //5MB一个分片
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].onSuccess = (response, status, headers) => {
+ this.uploader.queue[0].onSuccess = (response, status, headers) => {
if (status == 201) { // 上传文件成功,上传文件后获取服务器返回的数据
let tempRes = JSON.parse(response);
this.objectName = tempRes.objectName
this.addRealImg()
- }else { // 上传文件后获取服务器返回的数据错误
- let tempRes = JSON.parse(response);
- }};
- } else if (file && fileSize>shardSize && fileSize5MB时,分块上传
- let data = {filename: file.name}
+ } else { // 上传文件后获取服务器返回的数据错误
+ let tempRes = JSON.parse(response);
+ }
+ };
+ } else if (file && fileSize > shardSize && fileSize < maxdSize) { //上传文件>5MB时,分块上传
+ let data = { filename: file.name }
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.uploadId = data.uploadId
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 fileSize = file.size || null //上传文件的总大小
let shardSize = 5 * 1024 * 1024 //5MB一个分片
let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段
- for (let i = 0;i < allSlice;i++) { //循环分段上传
- let start = i * shardSize //切割文件开始位置
- let end = Math.min(fileSize, start + shardSize); //切割文件结束位置
- let formData = new FormData()
- formData.append("file",file.slice(start, end))
-
- //同步写法实现异步调用
- let result = await new Promise((resolve, reject) => {
- // await 需要后面返回一个 promise 对象
- 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}
- resolve(msg) // 调用 promise 内置方法处理成功
- })
- });
- this.PartNumberETag.push(result)
- if (this.PartNumberETag.length === allSlice) {this.endUploading()}
+ for (let i = 0; i < allSlice; i++) { //循环分段上传
+ let start = i * shardSize //切割文件开始位置
+ let end = Math.min(fileSize, start + shardSize); //切割文件结束位置
+ let formData = new FormData()
+ formData.append("file", file.slice(start, end))
+
+ //同步写法实现异步调用
+ let result = await new Promise((resolve, reject) => {
+ // await 需要后面返回一个 promise 对象
+ 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
+ }
+ resolve(msg) // 调用 promise 内置方法处理成功
+ })
+ });
+ this.PartNumberETag.push(result)
+ if (this.PartNumberETag.length === allSlice) { this.endUploading() }
}//for循环
}
//完成分块上传
- endUploading () {
+ endUploading() {
let data = this.PartNumberETag
- let paramsData = {uploadId:this.uploadId}
- this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`,data,{params:paramsData}).subscribe(data=>{
+ let paramsData = { uploadId: this.uploadId }
+ this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`, data, { params: paramsData }).subscribe(data => {
this.addRealImg() //上传完成后,发送请求创建实景图
this.isLoading = false
this.uploader.clearQueue(); //清空input控件文件
- this.PartNumberETag =[] //清空保存返回的信息
+ this.PartNumberETag = [] //清空保存返回的信息
})
}
//上传图片成功后获取url地址发送请求创建实景图
- addRealImg () {
- let companyId = this.route.snapshot.queryParams.id
+ addRealImg() {
+ let companyId = this.route.snapshot.queryParams.id
let data = {
name: this.file.name,
- imageUrl:this.objectName,
+ imageUrl: this.objectName,
realityImageGroupId: this.selectReal.id,
}
- this.http.post('/api/RealityImages',data,{params:{
- companyId : companyId
- }}).subscribe(data=>{
+ this.http.post('/api/RealityImages', data, {
+ params: {
+ companyId: companyId
+ }
+ }).subscribe(data => {
(document.getElementById('uploadFile')).value = null //清空input框缓存
this.getAllRealPicture()
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
- this.snackBar.open('图片上传成功','确定',config);
+ this.snackBar.open('图片上传成功', '确定', config);
this.tabbarService.sendMessage('changeScore');//通知服务改变分数
})
}
@@ -368,26 +409,28 @@ export class RealisticPictureComponent implements OnInit {
//批量下载↓
//开始下载
- async batchDownload () {
+ async batchDownload() {
if (this.downloadList.length) { //开始批量循环下载
this.isLoading = true
- for (let i=0;i{
+ 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}`
+ } else {
+ 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 link = document.createElement("a");
link.style.display = "none";
link.href = url;
- let imgName
- if(this.selectReal.id == '重点部位'){
+ let imgName
+ if (this.selectReal.id == '重点部位') {
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
}
link.setAttribute("download", imgName);
@@ -396,18 +439,20 @@ export class RealisticPictureComponent implements OnInit {
result('success')
})
})
- if(i == this.downloadList.length-1) { //判断是否下载完毕
+ if (i == this.downloadList.length - 1) { //判断是否下载完毕
this.isLoading = false
this.isDownload = false
- this.allImages.forEach(element => {element.checked = false});
- this.downloadList = []}
+ this.allImages.forEach(element => { element.checked = false });
+ this.downloadList = []
+ }
} //for循环
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
- this.snackBar.open('请选择图片','确定',config);}
+ this.snackBar.open('请选择图片', '确定', config);
+ }
}
@@ -426,19 +471,19 @@ export class RealisticPictureComponent implements OnInit {
})
export class previewImg {
- constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef,
+ constructor(private http: HttpClient, public dialog: MatDialog, public dialogRef: MatDialogRef,
@Inject(MAT_DIALOG_DATA) public data) { }
- testSwiper: Swiper;
+ testSwiper: Swiper;
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{
+ } else {
element.previewImageUrl = `/api/Objects/PlanPlatform/${element.imageUrl}?x-oss-process=image/auto-orient,1` //处理图片URL地址
}
-
+
});
}
@@ -450,19 +495,19 @@ export class previewImg {
loop: false,
// 如果需要前进后退按钮
navigation: {
- nextEl: '.swiper-button-next',
- prevEl: '.swiper-button-prev',
+ nextEl: '.swiper-button-next',
+ prevEl: '.swiper-button-prev',
}
});
}
- allImages:any; //展示所有的图片
- rotationAngle:number=0; //旋转角度
+ allImages: any; //展示所有的图片
+ rotationAngle: number = 0; //旋转角度
//旋转图片
- rotate () {
- this.rotationAngle = this.rotationAngle+90
- if (this.rotationAngle === 360) {this.rotationAngle = 0}
+ rotate() {
+ this.rotationAngle = this.rotationAngle + 90
+ if (this.rotationAngle === 360) { this.rotationAngle = 0 }
}
}
@@ -477,22 +522,22 @@ export class previewImg {
})
export class addRealPicture {
- constructor(private router:Router,private route:ActivatedRoute,private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef) { }
+ constructor(private router: Router, private route: ActivatedRoute, private http: HttpClient, public dialog: MatDialog, public dialogRef: MatDialogRef) { }
ngOnInit(): void {
this.companyId = sessionStorage.getItem('companyId')
}
- companyId:any; //单位编号
+ companyId: any; //单位编号
//提交表单
- onSubmit (e) {
+ onSubmit(e) {
let companyId = this.route.snapshot.queryParams.id
- let data={
- name:e.name,
- companyId:companyId
+ let data = {
+ name: e.name,
+ companyId: companyId
}
- this.http.post('/api/RealityImageGroups',data).subscribe(data=>{
+ this.http.post('/api/RealityImageGroups', data).subscribe(data => {
this.dialogRef.close(data);
})
}
@@ -509,24 +554,24 @@ export class addRealPicture {
})
export class editRealPicture {
- constructor(private router:Router,private route:ActivatedRoute,private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef,
+ constructor(private router: Router, private route: ActivatedRoute, private http: HttpClient, public dialog: MatDialog, public dialogRef: MatDialogRef,
@Inject(MAT_DIALOG_DATA) public data) { }
ngOnInit(): void {
this.name = this.data.name
}
- name:any //实景图分组名称
+ name: any //实景图分组名称
//提交表单
- onSubmit (e) {
+ onSubmit(e) {
let companyId = this.route.snapshot.queryParams.id
let data = {
- id:this.data.id,
- name:e.name,
- companyId:companyId
+ id: this.data.id,
+ name: e.name,
+ 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');
})
}
diff --git a/src/app/plan-audit/wait-examineer/wait-examineer.component.ts b/src/app/plan-audit/wait-examineer/wait-examineer.component.ts
index 2ffe814..e71598c 100644
--- a/src/app/plan-audit/wait-examineer/wait-examineer.component.ts
+++ b/src/app/plan-audit/wait-examineer/wait-examineer.component.ts
@@ -291,7 +291,7 @@ export class WaitExamineerComponent implements OnInit {
})
} else {
this.http.get(`/api/PlanComponents/${item.itemId}`).subscribe((data: any) => {
- //console.log(data)
+ console.log('预案信息',data)
this.companyId = data.companyId
this.companyName = data.companyName
if (data.planType != 2 && data.planType != 1) {
@@ -328,10 +328,6 @@ export class WaitExamineerComponent implements OnInit {
this.planData = data
this.handleData()
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() {
+ console.log('lookWord')
this.showtype = 0
let src
let suffix = this.fetchUrl.split('.')[this.fetchUrl.split('.').length - 1].toLowerCase()
diff --git a/src/app/ui/collection-tools-building/collection-tools.component.ts b/src/app/ui/collection-tools-building/collection-tools.component.ts
index bdd7651..388f2d9 100644
--- a/src/app/ui/collection-tools-building/collection-tools.component.ts
+++ b/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 adjoinArr = [] //毗邻数组
- Object.keys(object).forEach(key=>{
- let isExist = this.sitePlanData.find(item=>{ return item.id === object[key].FloorId })
+ Object.keys(object).forEach(key => {
+ let isExist = this.sitePlanData.find(item => { return item.id === object[key].FloorId })
if (isExist === undefined) {
- console.log(object[key],'当前楼层已被删除')
+ console.log(object[key], '当前楼层已被删除')
delete object[key]
}
})
//遍历 建筑数据 删除多余数据
this.saveNum = []
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)
+
+
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData));
CompanyData.data = JSON.stringify(CompanyData.data)
if (this.pattern) {//如果是基本信息编辑模式
for (const key in object) {
if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻
-
object[key].PropertyInfos.forEach(element => {
if (element.PropertyName == "方向") {
adjoinArr.push(element.PropertyValue)
@@ -1068,7 +1080,6 @@ export class CollectionToolsBuildingComponent implements OnInit {
})
} else { //如果是建筑
-
//建筑平面图数据
this.http.post("/api/BuildingAreaData", SitePlanData, {
params: {
@@ -1659,6 +1670,7 @@ export class CollectionToolsBuildingComponent implements OnInit {
getSitePlanStorey(e) {
let params = { sitePlanId: e.id }
this.http.get(`/api/SitePlanData`, { params }).subscribe((data: any) => {
+
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"
@@ -1684,6 +1696,7 @@ export class CollectionToolsBuildingComponent implements OnInit {
getBuildingStorey(e) {
let params = { buildingAreaId: e.id }
this.http.get(`/api/BuildingAreaData`, { params }).subscribe((data: any) => {
+ console.log('建筑楼层数据', 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"
@@ -1744,12 +1757,12 @@ export class CollectionToolsBuildingComponent implements OnInit {
this.element.nativeElement.querySelector('#rightOperate').style.top = document.getElementsByClassName('sitePlanContentBox')[0].children[this.selectSitePlanIndex].getBoundingClientRect().top - 32 + 'px'
}, 0);
}
-
+
}
- hoverSitePlan(item,key){
- if(key == this.selectSitePlanIndex){
- if (this.element.nativeElement.querySelector('#rightOperate')) {
+ hoverSitePlan(item, key) {
+ if (key == this.selectSitePlanIndex) {
+ if (this.element.nativeElement.querySelector('#rightOperate')) {
setTimeout(() => {
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'
@@ -1757,7 +1770,7 @@ export class CollectionToolsBuildingComponent implements OnInit {
}, 0);
}
}
-
+
}
//新增平面图 楼层/区域
diff --git a/src/app/ui/collection-tools-plan/collection-tools.component.ts b/src/app/ui/collection-tools-plan/collection-tools.component.ts
index f314119..6c833bd 100644
--- a/src/app/ui/collection-tools-plan/collection-tools.component.ts
+++ b/src/app/ui/collection-tools-plan/collection-tools.component.ts
@@ -722,39 +722,39 @@ export class CollectionToolsPlanComponent implements OnInit {
}
//截图
takeScreenshot() {
- if (!this.isGis) {
- this.canvas.takeScreenshot();
- } else {
- this.takeScreenshotGis()
- }
+ if (!this.isGis) {
+ this.canvas.takeScreenshot();
+ } else {
+ this.takeScreenshotGis()
+ }
}
canvasImg
takeScreenshotGis() {
- // console.log(666666, this.selectingSitePlan)
- // 使用html2canvas插件,将数据源中的数据转换成画布。
- html2canvas(document.querySelector("#planContainer"), {
- useCORS: true, // 【重要】开启跨域配置,
- allowTaint: true,//允许跨域图片
- taintTest: false,//是否在渲染前测试图片
- onrendered: function (canvas) {
- var dataUrl = canvas.toDataURL("image/png");
- }
- }).then(canvas => {
- // 修改生成的宽度
- this.canvasImg = canvas.toDataURL("image/png");
- // console.log(this.canvasImg)
- }).then(() => {
- this.downloadFile(this.selectingSitePlan.name, this.canvasImg);
- })
+ // console.log(666666, this.selectingSitePlan)
+ // 使用html2canvas插件,将数据源中的数据转换成画布。
+ html2canvas(document.querySelector("#planContainer"), {
+ useCORS: true, // 【重要】开启跨域配置,
+ allowTaint: true,//允许跨域图片
+ taintTest: false,//是否在渲染前测试图片
+ onrendered: function (canvas) {
+ var dataUrl = canvas.toDataURL("image/png");
+ }
+ }).then(canvas => {
+ // 修改生成的宽度
+ this.canvasImg = canvas.toDataURL("image/png");
+ // console.log(this.canvasImg)
+ }).then(() => {
+ this.downloadFile(this.selectingSitePlan.name, this.canvasImg);
+ })
}
downloadFile(filename, content) {
- var base64Img = content;
- var oA = document.createElement('a');
- oA.href = base64Img;
- oA.download = filename;
- var event = document.createEvent('MouseEvents');
- event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
- oA.dispatchEvent(event);
+ var base64Img = content;
+ var oA = document.createElement('a');
+ oA.href = base64Img;
+ oA.download = filename;
+ var event = document.createEvent('MouseEvents');
+ event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+ oA.dispatchEvent(event);
}
isMultiSelect: boolean = false; // 多选/单选 切换
@@ -807,17 +807,28 @@ export class CollectionToolsPlanComponent implements OnInit {
//遍历 建筑数据 删除多余数据
let object = this.canvasData.originalcompanyBuildingData.data
let adjoinArr = [] //毗邻数组
- Object.keys(object).forEach(key=>{
- let isExist = this.sitePlanData.find(item=>{ return item.id === object[key].FloorId })
- if (isExist === undefined) {
- console.log(object[key],'当前楼层已被删除')
- delete object[key]
- }
+ Object.keys(object).forEach(key => {
+ let isExist = this.sitePlanData.find(item => { return item.id === object[key].FloorId })
+ if (isExist === undefined) {
+ console.log(object[key], '当前楼层已被删除')
+ delete object[key]
+ }
})
//遍历 建筑数据 删除多余数据
this.saveNum = []
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)
+
let CompanyData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData));
CompanyData.data = JSON.stringify(CompanyData.data)
@@ -1460,7 +1471,7 @@ export class CollectionToolsPlanComponent implements OnInit {
viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D',
zoom: 11, //初始化地图层级
WebGLParams: {
- preserveDrawingBuffer: true
+ preserveDrawingBuffer: true
}
});
if (this.selectingSitePlan.defaultCenter) {
@@ -1472,7 +1483,7 @@ export class CollectionToolsPlanComponent implements OnInit {
this.map.on('click', (e) => {
this.showInfoClick(e)
- },this);
+ }, this);
this.map.on("complete", () => {
for (const key in this.canvasData.originaleveryStoreyData.data) {
if (Object.prototype.hasOwnProperty.call(this.canvasData.originaleveryStoreyData.data, key)) {
@@ -1508,13 +1519,13 @@ export class CollectionToolsPlanComponent implements OnInit {
console.log(e)
this.clickId = e.target.id
this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[e.target.id])
- },this);
+ }, this);
startMarker.on('dragend', (e) => {
// console.log('拖拽完成', e)
this.canvasData.isChange = true
this.clickId = e.target.id
this.canvasData.originaleveryStoreyData.data[e.target.id].Point = { x: e.lnglat.lng, y: e.lnglat.lat }
- },this);
+ }, this);
this.planDataMarkers.push(startMarker)
this.map.add(startMarker);
}
@@ -1738,25 +1749,25 @@ export class CollectionToolsPlanComponent implements OnInit {
}
if (this.element.nativeElement.querySelector('#rightOperate')) {
- setTimeout(() => {
- 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.top = document.getElementsByClassName('sitePlanContentBox')[0].children[this.selectSitePlanIndex].getBoundingClientRect().top - 32 + 'px'
- }, 0);
+ setTimeout(() => {
+ 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.top = document.getElementsByClassName('sitePlanContentBox')[0].children[this.selectSitePlanIndex].getBoundingClientRect().top - 32 + 'px'
+ }, 0);
}
}
- hoverSitePlan(item,key){
- if(key == this.selectSitePlanIndex){
- if (this.element.nativeElement.querySelector('#rightOperate')) {
- setTimeout(() => {
- 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.top = document.getElementsByClassName('sitePlanContentBox')[0].children[this.selectSitePlanIndex].getBoundingClientRect().top - 32 + 'px'
- }, 0);
+ hoverSitePlan(item, key) {
+ if (key == this.selectSitePlanIndex) {
+ if (this.element.nativeElement.querySelector('#rightOperate')) {
+ setTimeout(() => {
+ 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.top = document.getElementsByClassName('sitePlanContentBox')[0].children[this.selectSitePlanIndex].getBoundingClientRect().top - 32 + 'px'
+ }, 0);
+ }
}
- }
-
+
}
//新增平面图 楼层/区域
@@ -2319,13 +2330,13 @@ export class CollectionToolsPlanComponent implements OnInit {
startMarker.on('click', (e) => {
this.clickId = e.target.id
this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[e.target.id])
- },this);
+ }, this);
startMarker.on('dragend', (e) => {
// console.log('拖拽完成', e)
this.canvasData.isChange = true
this.clickId = e.target.id
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))