Browse Source

[完善]查看word预案完善

zhuzhou
邵佳豪 3 years ago
parent
commit
8f09a38a1b
  1. 4
      src/app/plan-management/entry-plan-look/entry-plan-look.component.html
  2. 25
      src/app/plan-management/entry-plan-look/entry-plan-look.component.spec.ts
  3. 111
      src/app/plan-management/entry-plan-look/entry-plan-look.component.ts
  4. 75
      src/app/plan-management/open-plan/open-plan.component.scss
  5. 25
      src/app/plan-management/open-plan/open-plan.component.spec.ts
  6. 106
      src/app/plan-management/open-plan/open-plan.component.ts
  7. 29
      src/app/plan-management/open-plan/previewImg.html
  8. 98
      src/app/plan-management/pass-plan/pass-plan.component.scss
  9. 25
      src/app/plan-management/pass-plan/pass-plan.component.spec.ts
  10. 108
      src/app/plan-management/pass-plan/pass-plan.component.ts
  11. 29
      src/app/plan-management/pass-plan/previewImg.html
  12. 6
      src/app/plan-management/plan-management.module.ts

4
src/app/plan-management/entry-plan-look/entry-plan-look.component.html

@ -77,7 +77,7 @@
<td mat-cell *matCellDef="let element">
<span (click)="changeName(element)" *ngIf="element.auditStatus==8">改名</span>
<span (click)="editPlan(element)" [ngClass]="{'grey': [!(element.auditStatus!='16' && element.auditStatus != '1')]&&element.planType!=1}">编辑</span>
<span (click)="lookPlan(element)" *ngIf="element.planType!=16">查看</span>
<span (click)="lookPlan(element)">查看</span>
<span (click)="readFile(element)" [ngClass]="{'grey': element.planMode == '1' || element.planMode == '2' || element.planMode == '3'}">下载</span>
<span (click)="deletePlan(element)" *ngIf="element.auditStatus==8">删除</span>
<span (click)="auditResult(element)">审批结果</span>
@ -88,7 +88,7 @@
<ng-container *ngIf="isoperation == 'false'" matColumnDef="operation">
<th mat-header-cell *matHeaderCellDef>操作</th>
<td mat-cell *matCellDef="let element">
<span (click)="lookPlan(element)" *ngIf="element.planType!=16">查看</span>
<span (click)="lookPlan(element)">查看</span>
<span (click)="readFile(element)" [ngClass]="{'grey': element.planMode == '1' || element.planMode == '2' || element.planMode == '3'}">下载</span>
</td>
</ng-container>

25
src/app/plan-management/entry-plan-look/entry-plan-look.component.spec.ts

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EntryPlanLookComponent } from './entry-plan-look.component';
describe('EntryPlanLookComponent', () => {
let component: EntryPlanLookComponent;
let fixture: ComponentFixture<EntryPlanLookComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EntryPlanLookComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EntryPlanLookComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

111
src/app/plan-management/entry-plan-look/entry-plan-look.component.ts

@ -66,7 +66,9 @@ export class EntryPlanLookComponent implements OnInit {
data.items.forEach(element => {
if (element.companyId === this.route.snapshot.queryParams.unitId) {
this.compantData = element.company
return } });
return
}
});
// console.log(123,this.compantData)
this.unitdata.unitname = this.compantData.name
this.unitdata.organizationName = this.compantData.organizationName
@ -104,8 +106,8 @@ export class EntryPlanLookComponent implements OnInit {
}
//查看预案
lookPlan(e) {
console.log(e)
if (e.planType == 16 || e.planType == 4 || e.planType == 8) {
// console.log(e.attachmentUrls)
var index = e.attachmentUrls[0].indexOf("\/")
if (e.attachmentUrls[0].substr(0, index) == 'psw') {
const dialogRef = this.dialog.open(PsViewer, {
@ -113,60 +115,31 @@ export class EntryPlanLookComponent implements OnInit {
height: '800px',
data: e.attachmentUrls[0]
});
}else if(e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='JPG'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='png'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='jpeg'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='jpg'){
} else if (e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'JPG' || e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'png' || e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'peg' || e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'jpg') {
let data = e
const dialogRef = this.dialog.open(ImgDetails, {//调用open方法打开对话框并且携带参数过去
data: data.attachmentUrls,
});
dialogRef.afterClosed().subscribe();
}
else /* if(e.attachmentUrls[0].substr(e.attachmentUrls[0].length-4,e.attachmentUrls[0].length-1)=='docx'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='pdf'
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='doc'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='DOC'
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='txt'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='JPG') */{
let filename:string
} else {
let fetchUrl = e.attachmentUrls[0]
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl);
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray);
let jwt = sessionStorage.getItem("token");
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]);
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt);
let identityJsonparse=JSON.parse(identityJson)
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{
filename=data.fileName
let json={
doc: {
docId: docId,
title: filename,
fetchUrl: `http://39.106.78.171:8000/api/Objects/PlanPlatform/`+fetchUrl,
},
user: {
uid: identityJsonparse.sub,
nickName: identityJsonparse.name,
avatar: "",
privilege: e.auditStatus!='1'&&e.auditStatus!='16'?[
'FILE_READ','FILE_WRITE','FILE_DOWNLOAD', 'FILE_PRINT'
]:[
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
],
},
}
var stringjson=JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://121.5.10.84:80/apps/editor/openPreview?data=${base64}`)
})
if (fetchUrl) {
let suffix = fetchUrl.split('.')[fetchUrl.split('.').length - 1].toLowerCase()
if (suffix == 'docx' || suffix == 'doc') {
let arr = fetchUrl.split('.')
arr[arr.length - 1] = 'pdf'
window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
} else if (suffix == 'pdf') {
window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
} else {
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('该文件类型暂不支持在线查看', '确定', config);
}
}
}
/* if(e.planType == 4){
var index=e.attachmentUrls[0].indexOf("\/")
if(e.attachmentUrls[0].substr(0,index)=='psw'){
const dialogRef = this.dialog.open(PsViewer, {
width: '1500px',
height:'800px',
data: e.attachmentUrls[0]
});
}
} */
if (e.planType == 1) { //如果是在线编辑
let id = e.id
sessionStorage.setItem("planId", id)
@ -201,11 +174,6 @@ export class EntryPlanLookComponent implements OnInit {
}
else if (e.planType == 16) {
this.lookPlan(e)
// let body={
// // id:e.planId,
// // resetAudit:true
// ""
// }
let body = JSON.stringify("");
let resetAudit = true
let headers = new HttpHeaders({
@ -449,7 +417,8 @@ export class EntryPlanLookComponent implements OnInit {
let result = await new Promise((result, reject) => {
this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`, { headers: { 'range': `bytes= ${start}-${end}` }, responseType: 'blob' }).subscribe(data => {
result(data) })
result(data)
})
})
allFile.push(result)
this.downloadProgress = Number((i / allSlice).toFixed(2)) * 100
@ -651,9 +620,11 @@ export class AddPlanone {
planCategory: Number(this.selectedPLanLevel),
url: "",
attachmentUrls: [`${this.objectName}`]
},{params:{
}, {
params: {
companyId: this.data.companyId
}}).subscribe(data=>{
}
}).subscribe(data => {
this.dialogRef.close(data);
})
} else {
@ -693,7 +664,8 @@ export class AddPlanone {
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 内置方法处理成功
})
});
@ -702,7 +674,8 @@ export class AddPlanone {
if (this.PartNumberETag.length === allSlice) {
this.uploadProgress = 100
this.endUploading(planType)}
this.endUploading(planType)
}
}//for循环
}
@ -751,9 +724,11 @@ export class AddPlanone {
planCategory: Number(this.selectedPLanLevel),
url: "",
attachmentUrls: [`${this.objectName}`]
},{params:{
}, {
params: {
companyId: this.data.companyId
}}).subscribe(data=>{
}
}).subscribe(data => {
this.dialogRef.close(data);
})
} else {
@ -915,9 +890,11 @@ export class AddPlanone {
attachmentUrls: null
}
//console.log(body)
this.http.post("/api/PlanComponents",body,{params:{
this.http.post("/api/PlanComponents", body, {
params: {
companyId: this.data.companyId
}}).subscribe(data=>{
}
}).subscribe(data => {
// console.log("创建成功")
this.dialogRef.close(data);
})
@ -965,9 +942,11 @@ export class AddPlanone {
url: "",
attachmentUrls: null
}
this.http.post("/api/PlanComponents2D",body,{params:{
this.http.post("/api/PlanComponents2D", body, {
params: {
companyId: this.data.companyId
}}).subscribe(data=>{
}
}).subscribe(data => {
// console.log("创建成功")
this.dialogRef.close(data);
})
@ -993,9 +972,11 @@ export class AddPlanone {
attachmentUrls: null
}
//console.log(body)
this.http.post("/api/PlanComponents2D",body,{params:{
this.http.post("/api/PlanComponents2D", body, {
params: {
companyId: this.data.companyId
}}).subscribe(data=>{
}
}).subscribe(data => {
// console.log("创建成功")
this.dialogRef.close(data);
})

75
src/app/plan-management/open-plan/open-plan.component.scss

@ -3,6 +3,7 @@
padding: 12px 5px;
// margin-bottom: 10px;
box-sizing: border-box;
// border-bottom: 1px solid black;
.queryBox {
box-sizing: border-box;
@ -11,8 +12,10 @@
flex-direction: row;
flex-wrap: wrap;
align-items: center;
// justify-content:center;
.queryField {
//margin: 3px 10px;
input {
width: 180px;
@ -20,24 +23,31 @@
line-height: 22px;
border-radius: 3px;
}
@media screen and (min-device-width:1400px) {
margin: 3px 20px;
}
@media screen and (max-device-width:1400px)and (min-device-width:1200px) {
margin: 3px 10px;
mat-form-field {
width: 180px;
}
}
@media screen and (max-device-width:1200px) {
margin: 3px 0 3px 10px;
mat-form-field {
width: 130px;
}
}
}
} //queryBox
}
//queryBox
.ordiv {
position: relative;
@ -51,18 +61,22 @@
z-index: 999;
border: 1px solid grey;
overflow-y: auto;
li {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
mat-tree-node {
cursor: pointer;
white-space: pre;
}
mat-tree-node:hover {
background: rgba(225, 225, 225, 0.8);
}
.closediv {
z-index: 100;
position: absolute;
@ -74,6 +88,7 @@
line-height: 30px;
text-align: center;
}
.closediv:hover {
background: rgba(225, 225, 225, 0.8);
}
@ -81,23 +96,79 @@
}
}
.body {
.buttonbox {
padding-left: 50px;
button {
margin: 0 10px
}
}
.tablebox {
table {
width: 100%;
margin-top: 15px;
}
th,td{
th,
td {
text-align: center;
}
mat-paginator {
width: 100%;
}
}
}
@media screen and (max-width:1200px) {
.bigimgbox {
width: 880px;
height: 580px;
//预览图片
.previewImgBox {
width: 800px;
height: 475px;
text-align: center;
}
}
}
@media screen and (min-width:1200px) and (max-width:1400px) {
.bigimgbox {
width: 880px;
height: 610px;
//预览图片
.previewImgBox {
width: 800px;
height: 500px;
text-align: center;
}
}
}
@media screen and (min-width:1400px) {
.bigimgbox {
width: 1110px;
height: 860px;
//预览图片
.previewImgBox {
width: 900px;
height: 100%;
text-align: center;
}
.previewImgBottom {
text-align: center;
height: 30px;
margin: 20px auto;
}
}
}

25
src/app/plan-management/open-plan/open-plan.component.spec.ts

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { OpenPlanComponent } from './open-plan.component';
describe('OpenPlanComponent', () => {
let component: OpenPlanComponent;
let fixture: ComponentFixture<OpenPlanComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ OpenPlanComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(OpenPlanComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

106
src/app/plan-management/open-plan/open-plan.component.ts

@ -11,6 +11,7 @@ import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { TreeService } from '../../http-interceptors/tree.service'
import { Viewer } from 'photo-sphere-viewer';
declare var CryptoJS
import Swiper from 'swiper';
@Component({
selector: 'app-open-plan',
templateUrl: './open-plan.component.html',
@ -191,12 +192,8 @@ export class OpenPlanComponent implements OnInit {
}
//跳转查看预案页面 公开预案
routerTo(e) {
/* sessionStorage.setItem("companyName",element.companyName)
window.open(`/planAudit/planpass?id=${element.companyId}&companyName=${element.companyName}&auditPlanId=${element.id}&auditStatus=${element.auditStatus}&type=6&planType=2`); */
// console.log(e)
console.log(e)
if (e.planMode == 0 || e.planMode == 1) {
//console.log(e.attachmentUrls)
var index = e.attachmentUrls[0].indexOf("\/")
if (e.attachmentUrls[0].substr(0, index) == 'psw') {
const dialogRef = this.dialog.open(GkhtmlPsViewer, {
@ -204,40 +201,29 @@ export class OpenPlanComponent implements OnInit {
height: '800px',
data: e.attachmentUrls[0]
});
}
else /* if(e.attachmentUrls[0].substr(e.attachmentUrls[0].length-4,e.attachmentUrls[0].length-1)=='docx'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='pdf'
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='doc'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='DOC'
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='txt'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='JPG') */{
let filename:string
} else if (e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'JPG' || e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'png' || e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'peg' || e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'jpg') {
let data = e
const dialogRef = this.dialog.open(OpenImgDetails, {//调用open方法打开对话框并且携带参数过去
data: data.attachmentUrls,
});
dialogRef.afterClosed().subscribe();
} else {
let fetchUrl = e.attachmentUrls[0]
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl);
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray);
let jwt = sessionStorage.getItem("token");
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]);
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt);
let identityJsonparse=JSON.parse(identityJson)
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{
filename=data.fileName
let json={
doc: {
docId: docId,
title: filename,
fetchUrl: `http://39.106.78.171:8000/api/Objects/PlanPlatform/`+fetchUrl,
},
user: {
uid: identityJsonparse.sub,
nickName: identityJsonparse.name,
avatar: "",
privilege: [
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
],
},
}
var stringjson=JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://121.5.10.84:80/apps/editor/openPreview?data=${base64}`)
})
if (fetchUrl) {
let suffix = fetchUrl.split('.')[fetchUrl.split('.').length - 1].toLowerCase()
if (suffix == 'docx' || suffix == 'doc') {
let arr = fetchUrl.split('.')
arr[arr.length - 1] = 'pdf'
window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
} else if (suffix == 'pdf') {
window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
} else {
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('该文件类型暂不支持在线查看', '确定', config);
}
}
}
}
@ -327,3 +313,47 @@ export class GkhtmlPsViewer{
});
}
}
//普通图片弹窗
@Component({
selector: 'imgdetails',
templateUrl: './previewImg.html',
styleUrls: ['./open-plan.component.scss']
})
export class OpenImgDetails {
constructor(private http: HttpClient, public dialog: MatDialog, public dialogRef: MatDialogRef<OpenImgDetails>,
@Inject(MAT_DIALOG_DATA) public data) { }
testSwiper: Swiper;
ngOnInit(): void {
this.allImages = []
this.data.forEach(element => {
element = `/api/Objects/PlanPlatform/${element}?x-oss-process=image/auto-orient,1`
this.allImages.push(element)
});
}
ngAfterViewInit() {
this.testSwiper = new Swiper('.swiper-container', {
lazy: true,
direction: 'horizontal',
loop: false,
// 如果需要前进后退按钮
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
}
});
}
allImages: any; //展示所有的图片
rotationAngle: number = 0; //旋转角度
//旋转图片
rotate() {
this.rotationAngle = this.rotationAngle + 90
if (this.rotationAngle === 360) { this.rotationAngle = 0 }
}
}

29
src/app/plan-management/open-plan/previewImg.html

@ -0,0 +1,29 @@
<!--
* @Descripttion:
* @version:
* @Author: sueRimn
* @Date: 2021-05-18 15:09:43
* @LastEditors: sueRimn
* @LastEditTime: 2021-05-18 15:25:35
-->
<div class="bigimgbox">
<!-- <div mat-dialog-title>图片详情</div> -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div *ngFor="let item of allImages" class="swiper-slide previewImgBox">
<img [ngClass]="{'rotateA':rotationAngle==90,'rotateB':rotationAngle==180,'rotateC':rotationAngle==270}" class="swiper-lazy"
[attr.data-src]="item">
<div class="swiper-lazy-preloader"></div>
</div>
</div>
<!-- 如果需要导航按钮 -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
<div class="previewImgBottom">
<button type="button" mat-icon-button (click)='rotate()'><mat-icon>refresh</mat-icon></button>
</div>
</div>

98
src/app/plan-management/pass-plan/pass-plan.component.scss

@ -2,6 +2,7 @@
width: 100%;
padding: 12px 10px;
box-sizing: border-box;
.queryBox {
box-sizing: border-box;
padding: 5px 0 0 5px;
@ -10,8 +11,10 @@
flex-direction: row;
flex-wrap: wrap;
align-items: center;
// justify-content:center;
.queryField {
//margin: 0 10px;
input {
width: 180px;
@ -19,17 +22,22 @@
line-height: 22px;
border-radius: 3px;
}
@media screen and (min-device-width:1400px) {
margin: 3px 20px;
}
@media screen and (max-device-width:1400px)and (min-device-width:1200px) {
margin: 3px 10px;
mat-form-field {
width: 180px;
}
}
@media screen and (max-device-width:1200px) {
margin: 3px 0 3px 10px;
mat-form-field {
width: 120px;
}
@ -38,15 +46,20 @@
}
} //queryBox
}
//queryBox
.butclass {
button {
width: 80px;height: 36px;
width: 80px;
height: 36px;
font-size: 16px;
}
}
.ordiv {
position: relative;
.organizationbox {
width: 450px;
height: 200px;
@ -57,18 +70,22 @@
z-index: 999;
border: 1px solid grey;
overflow-y: auto;
li {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
mat-tree-node {
cursor: pointer;
white-space: pre;
}
mat-tree-node:hover {
background: rgba(225, 225, 225, 0.8);
}
.closediv {
z-index: 100;
position: absolute;
@ -80,6 +97,7 @@
line-height: 30px;
text-align: center;
}
.closediv:hover {
background: rgba(225, 225, 225, 0.8);
}
@ -87,19 +105,23 @@
}
}
.body {
.buttonbox {
padding-left: 50px;
button {
margin: 0 10px
}
}
.tablebox {
table {
width: 100%;
// margin-left: 2%;
margin-top: 15px;
}
mat-paginator {
width: 100%;
// margin-left: 2%;
@ -107,9 +129,11 @@
}
}
}
.mat-header-cell {
text-align: center;
}
.mat-cell {
text-align: center;
@ -123,6 +147,7 @@
// background-image: linear-gradient(to right, #e2e7ee ,#FF4500, #FF8C00,#32cd32);
margin: 0 auto;
position: relative;
.integrityNum {
position: absolute;
left: 50%;
@ -133,9 +158,11 @@
font-size: 15px;
cursor: default;
}
.integrityColorDiv {
height: 100%;
}
.integrityDetails {
position: absolute;
display: none;
@ -143,6 +170,7 @@
height: 280px;
border: 1px solid rgba(0, 0, 0, 0.22);
background-color: white;
.integrityDetailsTop {
width: 100%;
height: 23px;
@ -150,21 +178,26 @@
border-bottom: 1px solid rgba(0, 0, 0, 0.22);
margin-bottom: 1px;
font-size: 14px;
span {
display: inline-block;
text-align: center;
font-weight: 800;
}
.span1 {
width: 25%;
}
.span2 {
width: 60%;
}
.span3 {
width: 15%;
}
}
.integrityDetailsBody {
ul {
li {
@ -172,18 +205,22 @@
height: 23px;
line-height: 23px;
margin: 3px 0;
div {
float: left;
font-size: 13px;
}
.name {
width: 25%;
height: 100%;
}
.colorDiv {
width: 60%;
height: 100%;
position: relative;
.colorDivBac {
width: 90%;
height: 100%;
@ -193,12 +230,14 @@
transform: translate(-50%, -50%);
background-color: #dfe5ec;
border-radius: 5px;
.colorDivCon {
border-radius: 5px;
height: 100%;
background-color: #2398f1;
}
}
span {
position: absolute;
left: 50%;
@ -208,6 +247,7 @@
font-weight: 600;
}
}
.number {
width: 15%;
height: 100%;
@ -217,17 +257,71 @@
}
}
.bottomposition {
top: 2px;
left: 188px;
}
.topposition {
top: -252px;
left: 188px;
}
}
.integrityDiv:hover {
.integrityDetails {
display: block;
}
}
@media screen and (max-width:1200px) {
.bigimgbox {
width: 880px;
height: 580px;
//预览图片
.previewImgBox {
width: 800px;
height: 475px;
text-align: center;
}
}
}
@media screen and (min-width:1200px) and (max-width:1400px) {
.bigimgbox {
width: 880px;
height: 610px;
//预览图片
.previewImgBox {
width: 800px;
height: 500px;
text-align: center;
}
}
}
@media screen and (min-width:1400px) {
.bigimgbox {
width: 1110px;
height: 860px;
//预览图片
.previewImgBox {
width: 900px;
height: 100%;
text-align: center;
}
.previewImgBottom {
text-align: center;
height: 30px;
margin: 20px auto;
}
}
}

25
src/app/plan-management/pass-plan/pass-plan.component.spec.ts

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PassPlanComponent } from './pass-plan.component';
describe('PassPlanComponent', () => {
let component: PassPlanComponent;
let fixture: ComponentFixture<PassPlanComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PassPlanComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PassPlanComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

108
src/app/plan-management/pass-plan/pass-plan.component.ts

@ -11,6 +11,7 @@ import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { TreeService } from '../../http-interceptors/tree.service'
import { Viewer } from 'photo-sphere-viewer';
declare var CryptoJS
import Swiper from 'swiper';
@Component({
selector: 'app-pass-plan',
templateUrl: './pass-plan.component.html',
@ -327,11 +328,6 @@ export class PassPlanComponent implements OnInit {
}
//查看单位信息
lookUnitInfo(element) {
// console.log(element)
// const dialogRef = this.dialog.open(UnitInfo, {
// width: '1500px',
// height:'800px'
// });
sessionStorage.setItem("editable", "0")
sessionStorage.setItem("companyName", element.company.name)
sessionStorage.setItem("companyId", element.company.id)
@ -341,9 +337,8 @@ export class PassPlanComponent implements OnInit {
//跳转查看预案页面 审核通过预案
routerTo(e) {
// console.log(e)
console.log(e)
if (e.planMode == 0 || e.planMode == 1) {
//console.log(e.attachmentUrls)
var index = e.attachmentUrls[0].indexOf("\/")
if (e.attachmentUrls[0].substr(0, index) == 'psw') {
const dialogRef = this.dialog.open(GkPsViewer, {
@ -351,40 +346,29 @@ export class PassPlanComponent implements OnInit {
height: '800px',
data: e.attachmentUrls[0]
});
}
else /* if(e.attachmentUrls[0].substr(e.attachmentUrls[0].length-4,e.attachmentUrls[0].length-1)=='docx'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='pdf'
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='doc'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='DOC'
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='txt'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='JPG') */{
let filename:string
} else if (e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'JPG' || e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'png' || e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'peg' || e.attachmentUrls[0].substr(e.attachmentUrls[0].length - 3, e.attachmentUrls[0].length) == 'jpg') {
let data = e
const dialogRef = this.dialog.open(PassImgDetails, {//调用open方法打开对话框并且携带参数过去
data: data.attachmentUrls,
});
dialogRef.afterClosed().subscribe();
} else {
let fetchUrl = e.attachmentUrls[0]
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl);
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray);
let jwt = sessionStorage.getItem("token");
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]);
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt);
let identityJsonparse=JSON.parse(identityJson)
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{
filename=data.fileName
let json={
doc: {
docId: docId,
title: filename,
fetchUrl: `http://39.106.78.171:8000/api/Objects/PlanPlatform/`+fetchUrl,
},
user: {
uid: identityJsonparse.sub,
nickName: identityJsonparse.name,
avatar: "",
privilege: [
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
],
},
}
var stringjson=JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://121.5.10.84:80/apps/editor/openPreview?data=${base64}`)
})
if (fetchUrl) {
let suffix = fetchUrl.split('.')[fetchUrl.split('.').length - 1].toLowerCase()
if (suffix == 'docx' || suffix == 'doc') {
let arr = fetchUrl.split('.')
arr[arr.length - 1] = 'pdf'
window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
} else if (suffix == 'pdf') {
window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
} else {
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('该文件类型暂不支持在线查看', '确定', config);
}
}
}
}
@ -514,3 +498,47 @@ export class UnitInfo{
// console.log(this.data)
}
}
//普通图片弹窗
@Component({
selector: 'imgdetails',
templateUrl: './previewImg.html',
styleUrls: ['./pass-plan.component.scss']
})
export class PassImgDetails {
constructor(private http: HttpClient, public dialog: MatDialog, public dialogRef: MatDialogRef<PassImgDetails>,
@Inject(MAT_DIALOG_DATA) public data) { }
testSwiper: Swiper;
ngOnInit(): void {
this.allImages = []
this.data.forEach(element => {
element = `/api/Objects/PlanPlatform/${element}?x-oss-process=image/auto-orient,1`
this.allImages.push(element)
});
}
ngAfterViewInit() {
this.testSwiper = new Swiper('.swiper-container', {
lazy: true,
direction: 'horizontal',
loop: false,
// 如果需要前进后退按钮
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
}
});
}
allImages: any; //展示所有的图片
rotationAngle: number = 0; //旋转角度
//旋转图片
rotate() {
this.rotationAngle = this.rotationAngle + 90
if (this.rotationAngle === 360) { this.rotationAngle = 0 }
}
}

29
src/app/plan-management/pass-plan/previewImg.html

@ -0,0 +1,29 @@
<!--
* @Descripttion:
* @version:
* @Author: sueRimn
* @Date: 2021-05-18 15:09:43
* @LastEditors: sueRimn
* @LastEditTime: 2021-05-18 15:25:35
-->
<div class="bigimgbox">
<!-- <div mat-dialog-title>图片详情</div> -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div *ngFor="let item of allImages" class="swiper-slide previewImgBox">
<img [ngClass]="{'rotateA':rotationAngle==90,'rotateB':rotationAngle==180,'rotateC':rotationAngle==270}" class="swiper-lazy"
[attr.data-src]="item">
<div class="swiper-lazy-preloader"></div>
</div>
</div>
<!-- 如果需要导航按钮 -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
<div class="previewImgBottom">
<button type="button" mat-icon-button (click)='rotate()'><mat-icon>refresh</mat-icon></button>
</div>
</div>

6
src/app/plan-management/plan-management.module.ts

@ -45,8 +45,8 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { MatTreeModule } from '@angular/material/tree';
import { EntryPlanComponent } from './entry-plan/entry-plan.component';
import { PassPlanComponent, UnitInfo } from './pass-plan/pass-plan.component';
import { OpenPlanComponent } from './open-plan/open-plan.component';
import { PassPlanComponent, UnitInfo, PassImgDetails } from './pass-plan/pass-plan.component';
import { OpenPlanComponent,OpenImgDetails } from './open-plan/open-plan.component';
import { EntryPlanLookComponent, AddPlanone, DownloadFile, AuditResult, ChangeName, ImgDetails } from './entry-plan-look/entry-plan-look.component';
import { PlanType, AuditSatus, PlanLevel, state } from '../pipes/boolean.pipe';
import { WebLookComponent } from './web-look/web-look.component';
@ -70,7 +70,7 @@ import { ReinforcePlanComponent } from './reinforce-plan/reinforce-plan.componen
@NgModule({
declarations: [EntryPlanComponent, PassPlanComponent, OpenPlanComponent, EntryPlanLookComponent, AddPlanone, PlanType, AuditSatus, PlanLevel, DownloadFile, AuditResult, ChangeName,
WebLookComponent, OnetwoEntryPlanComponent, newunitComponent, MeetPlanComponent, newunitMeet, TypePlanComponent, newunitType, PsViewer, onetwoAuditResult, meetAuditResult,
typeAuditResult, MaintainUpComponent, GkPsViewer, GkhtmlPsViewer, UnitInfo, ReinforcePlanComponent, state, ImgDetails],
typeAuditResult, MaintainUpComponent, GkPsViewer, GkhtmlPsViewer, UnitInfo, ReinforcePlanComponent, state, ImgDetails,PassImgDetails,OpenImgDetails],
imports: [
CommonModule,
PlanManagementRoutingModule,

Loading…
Cancel
Save