From e5c5c2934386a8bfd970d92c5d72a4bf6fb6debc Mon Sep 17 00:00:00 2001 From: chenjingyu <1148019379@qq.com> Date: Mon, 13 Dec 2021 11:25:55 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E9=A2=84=E6=A1=88=E7=BC=96?= =?UTF-8?q?=E5=88=B6=E6=8C=89=E9=92=AE=E5=8A=A0=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entry-plan-look.component.ts | 182 +++++++++--------- 1 file changed, 94 insertions(+), 88 deletions(-) diff --git a/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts b/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts index fcf5fcc..23d25ee 100644 --- a/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts +++ b/src/app/plan-management/entry-plan-look/entry-plan-look.component.ts @@ -174,76 +174,9 @@ export class EntryPlanLookComponent implements OnInit { const config = new MatSnackBarConfig(); config.verticalPosition = 'top'; config.duration = 3000 - if (e.auditStatus == 8) { - if (e.planType == 1) { //如果是在线编辑 - let id = e.id - sessionStorage.setItem("planId", id) - sessionStorage.setItem("companyId", this.companyId) - sessionStorage.setItem("buildingTypeId", this.unittypeId) - sessionStorage.setItem("editable", "1") - sessionStorage.setItem("planName", e.name) - let companyId = sessionStorage.getItem("companyId") - window.open(`/keyUnit/editunitinfo?id=${companyId}&orName=${this.route.snapshot.queryParams.orName}&orId=${this.route.snapshot.queryParams.orId}`); - } - else if (e.planType == 16) { - if (e.attachmentUrls == null) { - if(e.planMode==4){ - window.open(`/planManagement/createplanonlinefive?navIsOpen=false&companyId=${this.companyId}&planName=${e.name}&unitName=${this.unitdata.unitname}&planCategory=${e.planCategory}&planId=${e.id}&unitTypeId=${this.compantData.buildingTypes[0].id}&orName=${this.compantData.organizationName}&orId=${this.compantData.organizationId}&pattern=true&haveNew=true`) - }else{ - window.open(`/planManagement/createplanonlinefive?navIsOpen=false&companyId=${this.companyId}&planName=${e.name}&unitName=${this.unitdata.unitname}&planCategory=${e.planCategory}&planId=${e.id}&unitTypeId=${this.compantData.buildingTypes[0].id}&orName=${this.compantData.organizationName}&orId=${this.compantData.organizationId}&pattern=true`) - } - - } - else { - let body = {}; - let resetAudit = true - let headers = new HttpHeaders({ - 'Content-Type': 'text/json' - }); - let options = { - headers - }; - this.http.put(`/api/PlanComponents/${e.id}?resetAudit=${resetAudit}`, body, options).subscribe(data => { - this.getAllPlanComponents() - this.lookPlan(e) - }/* ,err => { - this.snackBar.open(err,'确定',config); - } */) - } - - } - else if (e.planType == 2) { //三维预案 - const dialogRef = this.dialog.open(ChangeUrl, { - //改网址 - data: { element: e } - }); - dialogRef.afterClosed().subscribe( - data => { - if (data) { - const config = new MatSnackBarConfig(); - config.verticalPosition = 'top'; - config.duration = 3000 - this.snackBar.open('修改成功!', '确定', config); - this.getAllPlanComponents() - } - } - ); - /* if (e.url.indexOf('app') == 0) { - window.location.href = e.url - } else { - sessionStorage.setItem("url", e.url) - if ((e.url as string).includes('gis/threeDimensionalHome')) { //三维预案 - window.open(`${e.url}?unitId=${this.companyId}&unitName=${this.unitdata.unitname}&editMode=true`) - } else { - window.open(`/planManagement/webLook`) - } - } */ - } else { - this.snackBar.open('只有二维预案和文本预案可以编辑!', '确定', config); - } - } else { - let isTrue = confirm('编辑后审核状态会成为未审核状态,您确定要编辑吗') - if (isTrue) { + let isTrue = confirm('您确定编辑吗,若是公开预案会变成未公开状态') + if(isTrue){ + if (e.auditStatus == 8) { if (e.planType == 1) { //如果是在线编辑 let id = e.id sessionStorage.setItem("planId", id) @@ -256,8 +189,12 @@ export class EntryPlanLookComponent implements OnInit { } else if (e.planType == 16) { if (e.attachmentUrls == null) { - console.log(this.compantData) - window.open(`/planManagement/createplanonlinefive?navIsOpen=false&companyId=${this.companyId}&planName=${e.name}&unitName=${this.unitdata.unitname}&planCategory=${e.planCategory}&planId=${e.id}&unitTypeId=${this.compantData.buildingTypes[0].id}&orName=${this.compantData.organizationName}&orId=${this.compantData.organizationId}`) + if(e.planMode==4){ + window.open(`/planManagement/createplanonlinefive?navIsOpen=false&companyId=${this.companyId}&planName=${e.name}&unitName=${this.unitdata.unitname}&planCategory=${e.planCategory}&planId=${e.id}&unitTypeId=${this.compantData.buildingTypes[0].id}&orName=${this.compantData.organizationName}&orId=${this.compantData.organizationId}&pattern=true&haveNew=true`) + }else{ + window.open(`/planManagement/createplanonlinefive?navIsOpen=false&companyId=${this.companyId}&planName=${e.name}&unitName=${this.unitdata.unitname}&planCategory=${e.planCategory}&planId=${e.id}&unitTypeId=${this.compantData.buildingTypes[0].id}&orName=${this.compantData.organizationName}&orId=${this.compantData.organizationId}&pattern=true`) + } + } else { let body = {}; @@ -272,23 +209,14 @@ export class EntryPlanLookComponent implements OnInit { this.getAllPlanComponents() this.lookPlan(e) }/* ,err => { - this.snackBar.open(err,'确定',config); - } */) + this.snackBar.open(err,'确定',config); + } */) } - + } else if (e.planType == 2) { //三维预案 - /* if (e.url.indexOf('app') == 0) { - window.location.href = e.url - } else { - sessionStorage.setItem("url", e.url) - if ((e.url as string).includes('gis/threeDimensionalHome')) { //三维预案 - window.open(`${e.url}?unitId=${this.companyId}&unitName=${this.unitdata.unitname}&editMode=true`) - } else { - window.open(`/planManagement/webLook`) - } - } */ const dialogRef = this.dialog.open(ChangeUrl, { + //改网址 data: { element: e } }); dialogRef.afterClosed().subscribe( @@ -299,18 +227,92 @@ export class EntryPlanLookComponent implements OnInit { config.duration = 3000 this.snackBar.open('修改成功!', '确定', config); this.getAllPlanComponents() - } } ); + /* if (e.url.indexOf('app') == 0) { + window.location.href = e.url + } else { + sessionStorage.setItem("url", e.url) + if ((e.url as string).includes('gis/threeDimensionalHome')) { //三维预案 + window.open(`${e.url}?unitId=${this.companyId}&unitName=${this.unitdata.unitname}&editMode=true`) + } else { + window.open(`/planManagement/webLook`) + } + } */ } else { - this.snackBar.open('只有二维预案和文本预案可以编辑!', '确定', config); } + } else { + let isTrue = confirm('编辑后审核状态会成为未审核状态,您确定要编辑吗') + if (isTrue) { + if (e.planType == 1) { //如果是在线编辑 + let id = e.id + sessionStorage.setItem("planId", id) + sessionStorage.setItem("companyId", this.companyId) + sessionStorage.setItem("buildingTypeId", this.unittypeId) + sessionStorage.setItem("editable", "1") + sessionStorage.setItem("planName", e.name) + let companyId = sessionStorage.getItem("companyId") + window.open(`/keyUnit/editunitinfo?id=${companyId}&orName=${this.route.snapshot.queryParams.orName}&orId=${this.route.snapshot.queryParams.orId}`); + } + else if (e.planType == 16) { + if (e.attachmentUrls == null) { + console.log(this.compantData) + window.open(`/planManagement/createplanonlinefive?navIsOpen=false&companyId=${this.companyId}&planName=${e.name}&unitName=${this.unitdata.unitname}&planCategory=${e.planCategory}&planId=${e.id}&unitTypeId=${this.compantData.buildingTypes[0].id}&orName=${this.compantData.organizationName}&orId=${this.compantData.organizationId}`) + } + else { + let body = {}; + let resetAudit = true + let headers = new HttpHeaders({ + 'Content-Type': 'text/json' + }); + let options = { + headers + }; + this.http.put(`/api/PlanComponents/${e.id}?resetAudit=${resetAudit}`, body, options).subscribe(data => { + this.getAllPlanComponents() + this.lookPlan(e) + }/* ,err => { + this.snackBar.open(err,'确定',config); + } */) + } + + } + else if (e.planType == 2) { //三维预案 + /* if (e.url.indexOf('app') == 0) { + window.location.href = e.url + } else { + sessionStorage.setItem("url", e.url) + if ((e.url as string).includes('gis/threeDimensionalHome')) { //三维预案 + window.open(`${e.url}?unitId=${this.companyId}&unitName=${this.unitdata.unitname}&editMode=true`) + } else { + window.open(`/planManagement/webLook`) + } + } */ + const dialogRef = this.dialog.open(ChangeUrl, { + data: { element: e } + }); + dialogRef.afterClosed().subscribe( + data => { + if (data) { + const config = new MatSnackBarConfig(); + config.verticalPosition = 'top'; + config.duration = 3000 + this.snackBar.open('修改成功!', '确定', config); + this.getAllPlanComponents() + + } + } + ); + } else { + + this.snackBar.open('只有二维预案和文本预案可以编辑!', '确定', config); + } + } } } - } allPlanComponents: any //所有预案组件 companyId: any //新建预案需要使用的id @@ -384,6 +386,8 @@ export class EntryPlanLookComponent implements OnInit { this.http.delete(`/api/PlanComponents2D/${plandata.id}`).subscribe(data => { this.snackBar.open('删除成功!', '确定', config); this.getAllPlanComponents() + },err=>{ + this.snackBar.open(err, '确定', config); }) } else { this.http.delete(`/api/PlanComponents/${plandata.id}`).subscribe(data => { @@ -392,6 +396,8 @@ export class EntryPlanLookComponent implements OnInit { config.duration = 3000 this.snackBar.open('删除成功!', '确定', config); this.getAllPlanComponents() + },err=>{ + this.snackBar.open(err, '确定', config); }) } }