|
|
|
@ -11,6 +11,8 @@ import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
|
|
|
|
|
import { TreeService } from '../../http-interceptors/tree.service' |
|
|
|
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
|
|
|
|
import { async } from '@angular/core/testing'; |
|
|
|
|
import { Viewer } from 'photo-sphere-viewer'; |
|
|
|
|
import {STEPPER_GLOBAL_OPTIONS} from '@angular/cdk/stepper'; |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-entry-plan-look', |
|
|
|
|
templateUrl: './entry-plan-look.component.html', |
|
|
|
@ -99,10 +101,14 @@ export class EntryPlanLookComponent implements OnInit {
|
|
|
|
|
//查看预案
|
|
|
|
|
lookPlan(e){ |
|
|
|
|
if(e.planMode == 0){
|
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
|
config.duration = 3000 |
|
|
|
|
this.snackBar.open('本地文件,请下载查看','确定',config); |
|
|
|
|
console.log() |
|
|
|
|
if(e.attachmentUrls[0].substr(0,3)=='psw'){ |
|
|
|
|
const dialogRef = this.dialog.open(PsViewer, { |
|
|
|
|
width: '1500px', |
|
|
|
|
height:'800px', |
|
|
|
|
data: e.attachmentUrls[0] |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(e.planMode == 1){ |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
@ -141,6 +147,7 @@ export class EntryPlanLookComponent implements OnInit {
|
|
|
|
|
allPlanComponents:any //所有预案组件
|
|
|
|
|
companyId : any //新建预案需要使用的id
|
|
|
|
|
planId : any //统一预案id
|
|
|
|
|
lookUrl //查看文件路径
|
|
|
|
|
//改名
|
|
|
|
|
changeName(element){ |
|
|
|
|
// console.log(element)
|
|
|
|
@ -385,7 +392,7 @@ export class EntryPlanLookComponent implements OnInit {
|
|
|
|
|
addplan () { |
|
|
|
|
const dialogRef = this.dialog.open(AddPlanone, { |
|
|
|
|
width:"585px", |
|
|
|
|
height:"410px", |
|
|
|
|
height:"430px", |
|
|
|
|
data: {companyId:this.companyId}, |
|
|
|
|
disableClose:true |
|
|
|
|
}); |
|
|
|
@ -414,7 +421,8 @@ export class EntryPlanLookComponent implements OnInit {
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'AddPlanone', |
|
|
|
|
templateUrl: './AddPlanone.html', |
|
|
|
|
styleUrls: ['./entry-plan-look.component.scss'] |
|
|
|
|
styleUrls: ['./entry-plan-look.component.scss'], |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
export class AddPlanone { |
|
|
|
|
isLinear = true; //是否为线性步进器
|
|
|
|
@ -428,7 +436,8 @@ export class AddPlanone {
|
|
|
|
|
|
|
|
|
|
this.firstFormGroup = this._formBuilder.group({ |
|
|
|
|
firstCtrlone: ['', Validators.required], |
|
|
|
|
firstCtrltwo: ['', Validators.required] |
|
|
|
|
firstCtrltwo: ['', Validators.required], |
|
|
|
|
firstCtrlthree: ['', Validators.required], |
|
|
|
|
}); |
|
|
|
|
this.secondFormGroup = this._formBuilder.group({ |
|
|
|
|
secondCtrl: ['', Validators.required] |
|
|
|
@ -442,6 +451,8 @@ export class AddPlanone {
|
|
|
|
|
isweb:boolean = false //web输入框是否显示
|
|
|
|
|
isinput:boolean = false //导入是否显示
|
|
|
|
|
defaultisshow = '0' //默认显示上传input框
|
|
|
|
|
pswShow=false //是否为全景图选项默认不显示
|
|
|
|
|
psw//是否为全景图
|
|
|
|
|
//选择radio
|
|
|
|
|
selectradio(e){ |
|
|
|
|
if(e.value == "0"){ //如果点击本地上传
|
|
|
|
@ -481,7 +492,14 @@ export class AddPlanone {
|
|
|
|
|
uploadId:any; //上传分块上传事件编号
|
|
|
|
|
//上传文件input
|
|
|
|
|
filechange(e){ |
|
|
|
|
this.psw=false |
|
|
|
|
this.file = e.target.files[0] || null //上传的文件
|
|
|
|
|
if(this.selectedPLanType=='4'&&this.file.type!=null&&this.file.type!=undefined){ |
|
|
|
|
if(this.file.type=='image/png'||this.file.type=='image/jpeg'){ |
|
|
|
|
this.pswShow=true |
|
|
|
|
}else{this.pswShow=false} |
|
|
|
|
}else{this.pswShow=false} |
|
|
|
|
|
|
|
|
|
// this.startUploading()
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -491,11 +509,12 @@ export class AddPlanone {
|
|
|
|
|
let file = this.file || null //获取上传的文件
|
|
|
|
|
let fileSize = file.size || null //上传文件的总大小
|
|
|
|
|
let shardSize = 5 * 1024 * 1024 //5MB一个分片
|
|
|
|
|
console.log(this.psw) |
|
|
|
|
|
|
|
|
|
if (file && fileSize<=shardSize) { //上传文件<=5MB时
|
|
|
|
|
let formData = new FormData() |
|
|
|
|
formData.append("file",file) |
|
|
|
|
this.http.post(`/api/Objects/PlanPlatform/${this.data.companyId}/2D`,formData).subscribe((data:any)=>{ |
|
|
|
|
this.http.post(this.psw?'/api/Objects/PlanPlatform/psw': `/api/Objects/PlanPlatform/${this.data.companyId}/2D`,formData).subscribe((data:any)=>{ |
|
|
|
|
this.objectName = data.objectName |
|
|
|
|
const config = new MatSnackBarConfig(); |
|
|
|
|
config.verticalPosition = 'top'; |
|
|
|
@ -531,6 +550,7 @@ export class AddPlanone {
|
|
|
|
|
planType:Number(this.selectedPLanType), |
|
|
|
|
planMode: Number(this.defaultisshow), |
|
|
|
|
planLevel: PlanLevel, |
|
|
|
|
planCategory: Number(this.selectedPLanLevel), |
|
|
|
|
url: "", |
|
|
|
|
attachmentUrls: [`${this.objectName}`] |
|
|
|
|
},{params:{ |
|
|
|
@ -546,7 +566,7 @@ export class AddPlanone {
|
|
|
|
|
} else if (file && fileSize>shardSize) { //上传文件>5MB时,分块上传
|
|
|
|
|
let data = {filename: file.name} |
|
|
|
|
this.uploadisLoading = true |
|
|
|
|
this.http.post(`/api/NewMultipartUpload/PlanPlatform/${this.data.companyId}/2D`,{},{params:data}).subscribe((data:any)=>{ //初始化分段上传
|
|
|
|
|
this.http.post(this.psw?'/api/NewMultipartUpload/PlanPlatform/psw':`/api/NewMultipartUpload/PlanPlatform/${this.data.companyId}/2D`,{},{params:data}).subscribe((data:any)=>{ //初始化分段上传
|
|
|
|
|
this.objectName = data.objectName |
|
|
|
|
this.uploadId = data.uploadId |
|
|
|
|
this.subsectionUploading(planType) |
|
|
|
@ -630,6 +650,7 @@ export class AddPlanone {
|
|
|
|
|
planType:Number(this.selectedPLanType), |
|
|
|
|
planMode: Number(this.defaultisshow), |
|
|
|
|
planLevel: PlanLevel, |
|
|
|
|
planCategory: Number(this.selectedPLanLevel), |
|
|
|
|
url: "", |
|
|
|
|
attachmentUrls: [`${this.objectName}`] |
|
|
|
|
},{params:{ |
|
|
|
@ -671,14 +692,18 @@ export class AddPlanone {
|
|
|
|
|
//点击下一步
|
|
|
|
|
selectedPLanType:any//所选预案类型
|
|
|
|
|
selectedPLanName:any//所选预案名称
|
|
|
|
|
selectedPLanLevel:any//所选预案级别
|
|
|
|
|
localup:boolean = false //本地上传
|
|
|
|
|
inputword:boolean = false //导入文档
|
|
|
|
|
onlineedit:boolean = false //在线编辑
|
|
|
|
|
website:boolean = false //网页地址
|
|
|
|
|
next(formdata){ |
|
|
|
|
// console.log(formdata.value.firstCtrltwo)
|
|
|
|
|
//console.log(this.file)
|
|
|
|
|
this.psw=false |
|
|
|
|
this.selectedPLanName = formdata.value.firstCtrlone |
|
|
|
|
this.selectedPLanType = formdata.value.firstCtrltwo |
|
|
|
|
this.selectedPLanLevel= formdata.value.firstCtrlthree |
|
|
|
|
if(formdata.value.firstCtrltwo=='8'){ //如果是卡片预案
|
|
|
|
|
this.localup = true |
|
|
|
|
this.inputword = true |
|
|
|
@ -696,10 +721,25 @@ export class AddPlanone {
|
|
|
|
|
this.inputword = false |
|
|
|
|
this.onlineedit = false |
|
|
|
|
this.website = true |
|
|
|
|
this.pswShow=true |
|
|
|
|
} |
|
|
|
|
if(this.selectedPLanType=='4'&&this.file!=undefined&&this.file.type!=null){ |
|
|
|
|
if(this.file.type=='image/png'||this.file.type=='image/jpeg'){ |
|
|
|
|
this.pswShow=true |
|
|
|
|
}else{this.pswShow=false} |
|
|
|
|
}else{this.pswShow=false} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
setttt(){ |
|
|
|
|
this.pswShow=false |
|
|
|
|
this.psw=false |
|
|
|
|
} |
|
|
|
|
closediv(){ |
|
|
|
|
this.cancel(); |
|
|
|
|
console.log(this.file) |
|
|
|
|
if(this.file!=undefined){ |
|
|
|
|
this.cancel(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.dialogRef.close(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -985,4 +1025,22 @@ export class ChangeName {
|
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//全景图弹出框
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'PsViewer', |
|
|
|
|
templateUrl: './Photo-Sphere-Viewer.html', |
|
|
|
|
styleUrls: ['./entry-plan-look.component.scss'] |
|
|
|
|
}) |
|
|
|
|
export class PsViewer{ |
|
|
|
|
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<PsViewer>,@Inject(MAT_DIALOG_DATA) public data: any) {} |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
console.log(this.data) |
|
|
|
|
const viewer = new Viewer({ |
|
|
|
|
container: document.querySelector('#viewer'), |
|
|
|
|
panorama:'/api/Objects/PlanPlatform/'+ this.data, |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |