Compare commits
30 Commits
Author | SHA1 | Date |
---|---|---|
|
294eccdda7 | 11 months ago |
|
411722d6a8 | 3 years ago |
|
4dbeaf2b36 | 3 years ago |
|
bc75ce7993 | 3 years ago |
|
bc1e6d3997 | 3 years ago |
|
720098a068 | 3 years ago |
|
1c35191071 | 3 years ago |
|
2f8548211a | 3 years ago |
|
3ac88e8a1a | 3 years ago |
|
f676d9e2d8 | 3 years ago |
|
8f09a38a1b | 3 years ago |
|
2ebf5df542 | 3 years ago |
|
8d8098bb60 | 3 years ago |
|
689e5c1573 | 3 years ago |
|
aa43b3c2d7 | 3 years ago |
|
495f73bf6f | 3 years ago |
|
6ba3be89d9 | 3 years ago |
|
8dc468c261 | 3 years ago |
|
4b6ec4c9a2 | 3 years ago |
|
58db1fc807 | 3 years ago |
|
209ab9a802 | 3 years ago |
|
fe46ca80b7 | 3 years ago |
|
036c9834a6 | 3 years ago |
|
f58e91a420 | 3 years ago |
|
44a72a93ec | 4 years ago |
|
e6b3652c36 | 4 years ago |
|
a35b485add | 4 years ago |
|
d76ab10342 | 4 years ago |
|
1bc637f97c | 4 years ago |
|
b8d8b7ab9a | 4 years ago |
365 changed files with 36857 additions and 91707 deletions
@ -1,10 +1,7 @@
|
||||
{ |
||||
"/api": { |
||||
"target": "http://121.36.37.70:8201/", |
||||
"生产": "http://10.81.73.39:8000/", |
||||
"测试": "http://121.36.37.70:8201/", |
||||
"生产2": "http://183.194.244.232:8088/", |
||||
"secure": false, |
||||
"changeOrigin": true |
||||
} |
||||
} |
||||
"/api": { |
||||
"target": "http://218.75.214.31:28085/", |
||||
"secure": false, |
||||
"changeOrigin": true |
||||
} |
||||
} |
@ -1,66 +1,27 @@
|
||||
@charset "utf-8"; |
||||
html, |
||||
body, |
||||
ul, |
||||
ol, |
||||
dl, |
||||
li, |
||||
dt, |
||||
dd, |
||||
p, |
||||
form, |
||||
input, |
||||
h1, |
||||
h2, |
||||
h3, |
||||
h4, |
||||
h5, |
||||
h6, |
||||
section, |
||||
article, |
||||
aside, |
||||
header, |
||||
footer, |
||||
nav, |
||||
figure, |
||||
time, |
||||
mark, |
||||
main, |
||||
canvas { |
||||
margin: 0; |
||||
padding: 0; |
||||
font-size: 16px; |
||||
html,body,ul,ol,dl,li,dt,dd,p,form,input,h1,h2,h3,h4,h5,h6,section,article,aside,header,footer,nav,figure,time,mark,main,canvas{ |
||||
margin:0; |
||||
padding:0; |
||||
font-size:16px; |
||||
} |
||||
b, |
||||
strong, |
||||
i, |
||||
em, |
||||
h1, |
||||
h2, |
||||
h3, |
||||
h4, |
||||
h5, |
||||
h6 { |
||||
font-weight: 500; |
||||
font-style: normal; |
||||
b,strong,i,em,h1,h2,h3,h4,h5,h6{ |
||||
font-weight:500; |
||||
font-style:normal; |
||||
} |
||||
img { |
||||
border: none; |
||||
img{ |
||||
border:none; |
||||
} |
||||
a { |
||||
a{ |
||||
text-decoration: none; |
||||
color: #000; |
||||
ul, |
||||
ol, |
||||
li { |
||||
list-style: none; |
||||
} |
||||
color:#000; |
||||
ul,ol,li{ |
||||
list-style:none; |
||||
} |
||||
.clearfn:after { |
||||
content: ""; |
||||
clear: both; |
||||
.clearfn:after{ |
||||
content:""; |
||||
clear:both; |
||||
display: block; |
||||
overflow: hidden; |
||||
height: 0; |
||||
overflow:hidden; |
||||
height:0; |
||||
visibility: hidden; |
||||
} |
||||
} |
@ -1,70 +1,31 @@
|
||||
import { HttpClient } from "@angular/common/http"; |
||||
import { Injectable } from "@angular/core"; |
||||
import { |
||||
CanActivate, |
||||
ActivatedRouteSnapshot, |
||||
RouterStateSnapshot, |
||||
Router, |
||||
} from "@angular/router"; |
||||
import { Injectable } from '@angular/core'; |
||||
import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, Router } from '@angular/router'; |
||||
|
||||
@Injectable({ |
||||
providedIn: "root", |
||||
providedIn: 'root' |
||||
}) |
||||
export class AuthGuard implements CanActivate { |
||||
constructor(private http: HttpClient, private router: Router) {} |
||||
|
||||
// 路由守卫
|
||||
async canActivate( |
||||
next: ActivatedRouteSnapshot, |
||||
state: RouterStateSnapshot |
||||
): Promise<boolean> { |
||||
console.log("next", next); |
||||
console.log("state", state); |
||||
constructor(private router: Router) { |
||||
|
||||
if ( |
||||
next.queryParams.singleSignOn && |
||||
next.queryParams.singleSignOn === "true" |
||||
) { |
||||
//执行自动登录逻辑
|
||||
await this.onSubmit(); |
||||
} |
||||
return this.checkLogin(); |
||||
} |
||||
|
||||
checkLogin(): boolean { |
||||
// 判断本地有没有token
|
||||
const token = sessionStorage.getItem("token"); |
||||
// 路由守卫
|
||||
canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { |
||||
|
||||
// 如果有token,允许访问
|
||||
if (token) { |
||||
return true; |
||||
return this.checkLogin(); |
||||
} |
||||
|
||||
//如果没有token,跳转登录页
|
||||
this.router.navigate(["/login"]); |
||||
return false; |
||||
} |
||||
checkLogin(): boolean { |
||||
|
||||
onSubmit() { |
||||
return new Promise<void>((resolve, reject) => { |
||||
this.http |
||||
.post("/api/Account/SignIn", { |
||||
name: "superadmin", |
||||
password: "SHya119!@", |
||||
}) |
||||
.subscribe( |
||||
(data: any) => { |
||||
sessionStorage.setItem("level", data.level); |
||||
sessionStorage.setItem("token", data.token); |
||||
sessionStorage.setItem("refreshToken", data.refreshToken); |
||||
sessionStorage.setItem("isDefaultPassword", data.isDefaultPassword); //是否需要修改默认密码
|
||||
sessionStorage.setItem("singleSignOn", "true"); //是否需要修改默认密码
|
||||
resolve(); |
||||
}, |
||||
(err) => { |
||||
reject(); |
||||
} |
||||
); |
||||
}); |
||||
} |
||||
// 判断本地有没有token
|
||||
const token = sessionStorage.getItem('token'); |
||||
|
||||
// 如果有token,允许访问
|
||||
if (token) { return true; } |
||||
|
||||
//如果没有token,跳转登录页
|
||||
this.router.navigate(['/login']); |
||||
return false; |
||||
} |
||||
} |
||||
|
@ -1,104 +1,103 @@
|
||||
import { NgModule } from '@angular/core'; |
||||
import { CommonModule } from '@angular/common'; |
||||
import { A11yModule } from '@angular/cdk/a11y'; |
||||
import { DragDropModule } from '@angular/cdk/drag-drop'; |
||||
import { PortalModule } from '@angular/cdk/portal'; |
||||
import { ScrollingModule } from '@angular/cdk/scrolling'; |
||||
import { CdkStepperModule } from '@angular/cdk/stepper'; |
||||
import { CdkTableModule } from '@angular/cdk/table'; |
||||
import { CdkTreeModule } from '@angular/cdk/tree'; |
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete'; |
||||
import { MatBadgeModule } from '@angular/material/badge'; |
||||
import { MatBottomSheetModule } from '@angular/material/bottom-sheet'; |
||||
import { MatButtonModule } from '@angular/material/button'; |
||||
import { MatButtonToggleModule } from '@angular/material/button-toggle'; |
||||
import { MatCardModule } from '@angular/material/card'; |
||||
import { MatCheckboxModule } from '@angular/material/checkbox'; |
||||
import { MatChipsModule } from '@angular/material/chips'; |
||||
import { MatStepperModule } from '@angular/material/stepper'; |
||||
import { MatDatepickerModule } from '@angular/material/datepicker'; |
||||
import { MatDialogModule } from '@angular/material/dialog'; |
||||
import { MatDividerModule } from '@angular/material/divider'; |
||||
import { MatExpansionModule } from '@angular/material/expansion'; |
||||
import { MatGridListModule } from '@angular/material/grid-list'; |
||||
import { MatIconModule } from '@angular/material/icon'; |
||||
import { MatInputModule } from '@angular/material/input'; |
||||
import { MatListModule } from '@angular/material/list'; |
||||
import { MatMenuModule } from '@angular/material/menu'; |
||||
import { MatNativeDateModule, MatRippleModule, MatOption } from '@angular/material/core'; |
||||
import { MatPaginatorModule } from '@angular/material/paginator'; |
||||
import { MatProgressBarModule } from '@angular/material/progress-bar'; |
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; |
||||
import { MatRadioModule } from '@angular/material/radio'; |
||||
import { MatSelectModule } from '@angular/material/select'; |
||||
import { MatSidenavModule } from '@angular/material/sidenav'; |
||||
import { MatSliderModule } from '@angular/material/slider'; |
||||
import { MatSlideToggleModule } from '@angular/material/slide-toggle'; |
||||
import { MatSnackBarModule } from '@angular/material/snack-bar'; |
||||
import { MatSortModule } from '@angular/material/sort'; |
||||
import { MatTableModule } from '@angular/material/table'; |
||||
import { MatTabsModule } from '@angular/material/tabs'; |
||||
import { MatToolbarModule } from '@angular/material/toolbar'; |
||||
import { MatTooltipModule } from '@angular/material/tooltip'; |
||||
import { MatTreeModule } from '@angular/material/tree'; |
||||
import {A11yModule} from '@angular/cdk/a11y'; |
||||
import {DragDropModule} from '@angular/cdk/drag-drop'; |
||||
import {PortalModule} from '@angular/cdk/portal'; |
||||
import {ScrollingModule} from '@angular/cdk/scrolling'; |
||||
import {CdkStepperModule} from '@angular/cdk/stepper'; |
||||
import {CdkTableModule} from '@angular/cdk/table'; |
||||
import {CdkTreeModule} from '@angular/cdk/tree'; |
||||
import {MatAutocompleteModule} from '@angular/material/autocomplete'; |
||||
import {MatBadgeModule} from '@angular/material/badge'; |
||||
import {MatBottomSheetModule} from '@angular/material/bottom-sheet'; |
||||
import {MatButtonModule} from '@angular/material/button'; |
||||
import {MatButtonToggleModule} from '@angular/material/button-toggle'; |
||||
import {MatCardModule} from '@angular/material/card'; |
||||
import {MatCheckboxModule} from '@angular/material/checkbox'; |
||||
import {MatChipsModule} from '@angular/material/chips'; |
||||
import {MatStepperModule} from '@angular/material/stepper'; |
||||
import {MatDatepickerModule} from '@angular/material/datepicker'; |
||||
import {MatDialogModule} from '@angular/material/dialog'; |
||||
import {MatDividerModule} from '@angular/material/divider'; |
||||
import {MatExpansionModule} from '@angular/material/expansion'; |
||||
import {MatGridListModule} from '@angular/material/grid-list'; |
||||
import {MatIconModule} from '@angular/material/icon'; |
||||
import {MatInputModule} from '@angular/material/input'; |
||||
import {MatListModule} from '@angular/material/list'; |
||||
import {MatMenuModule} from '@angular/material/menu'; |
||||
import {MatNativeDateModule, MatRippleModule, MatOption} from '@angular/material/core'; |
||||
import {MatPaginatorModule} from '@angular/material/paginator'; |
||||
import {MatProgressBarModule} from '@angular/material/progress-bar'; |
||||
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; |
||||
import {MatRadioModule} from '@angular/material/radio'; |
||||
import {MatSelectModule} from '@angular/material/select'; |
||||
import {MatSidenavModule} from '@angular/material/sidenav'; |
||||
import {MatSliderModule} from '@angular/material/slider'; |
||||
import {MatSlideToggleModule} from '@angular/material/slide-toggle'; |
||||
import {MatSnackBarModule} from '@angular/material/snack-bar'; |
||||
import {MatSortModule} from '@angular/material/sort'; |
||||
import {MatTableModule} from '@angular/material/table'; |
||||
import {MatTabsModule} from '@angular/material/tabs'; |
||||
import {MatToolbarModule} from '@angular/material/toolbar'; |
||||
import {MatTooltipModule} from '@angular/material/tooltip'; |
||||
import {MatTreeModule} from '@angular/material/tree'; |
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
||||
import { DataCollectionRoutingModule } from './data-collection.routing'; |
||||
import { AddWater, WaterCollectionComponent } from './water-collection/water-collection.component'; |
||||
import { AddFireForce, AddFireForceCar, FireForceComponent, ViewDetails } from './fire-force/fire-force.component'; |
||||
import { AddFireForce, FireForceComponent, ViewDetails } from './fire-force/fire-force.component'; |
||||
import { AddLinkageForce, LinkageForcesComponent, ViewDetails2 } from './linkage-forces/linkage-forces.component'; |
||||
import { NzTreeModule } from 'ng-zorro-antd/tree'; |
||||
import { NzTreeSelectModule } from 'ng-zorro-antd/tree-select'; |
||||
|
||||
@NgModule({ |
||||
declarations: [WaterCollectionComponent, FireForceComponent, LinkageForcesComponent, AddWater, AddFireForce, ViewDetails, AddLinkageForce, ViewDetails2,AddFireForceCar], |
||||
imports: [ |
||||
CommonModule, |
||||
A11yModule, |
||||
CdkStepperModule, |
||||
CdkTableModule, |
||||
CdkTreeModule, |
||||
DragDropModule, |
||||
MatAutocompleteModule, |
||||
MatBadgeModule, |
||||
MatBottomSheetModule, |
||||
MatButtonModule, |
||||
MatButtonToggleModule, |
||||
MatCardModule, |
||||
MatCheckboxModule, |
||||
MatChipsModule, |
||||
MatStepperModule, |
||||
MatDatepickerModule, |
||||
MatDialogModule, |
||||
MatDividerModule, |
||||
MatExpansionModule, |
||||
MatGridListModule, |
||||
MatIconModule, |
||||
MatInputModule, |
||||
MatListModule, |
||||
MatMenuModule, |
||||
MatNativeDateModule, |
||||
MatPaginatorModule, |
||||
MatProgressBarModule, |
||||
MatProgressSpinnerModule, |
||||
MatRadioModule, |
||||
MatRippleModule, |
||||
MatSelectModule, |
||||
MatSidenavModule, |
||||
MatSliderModule, |
||||
MatSlideToggleModule, |
||||
MatSnackBarModule, |
||||
MatSortModule, |
||||
MatTableModule, |
||||
MatTabsModule, |
||||
MatToolbarModule, |
||||
MatTooltipModule, |
||||
MatTreeModule, |
||||
PortalModule, |
||||
ScrollingModule, |
||||
FormsModule, |
||||
ReactiveFormsModule, |
||||
DataCollectionRoutingModule, |
||||
NzTreeModule, |
||||
NzTreeSelectModule |
||||
] |
||||
declarations: [WaterCollectionComponent, FireForceComponent, LinkageForcesComponent,AddWater,AddFireForce,ViewDetails,AddLinkageForce,ViewDetails2], |
||||
imports: [ |
||||
CommonModule, |
||||
A11yModule, |
||||
CdkStepperModule, |
||||
CdkTableModule, |
||||
CdkTreeModule, |
||||
DragDropModule, |
||||
MatAutocompleteModule, |
||||
MatBadgeModule, |
||||
MatBottomSheetModule, |
||||
MatButtonModule, |
||||
MatButtonToggleModule, |
||||
MatCardModule, |
||||
MatCheckboxModule, |
||||
MatChipsModule, |
||||
MatStepperModule, |
||||
MatDatepickerModule, |
||||
MatDialogModule, |
||||
MatDividerModule, |
||||
MatExpansionModule, |
||||
MatGridListModule, |
||||
MatIconModule, |
||||
MatInputModule, |
||||
MatListModule, |
||||
MatMenuModule, |
||||
MatNativeDateModule, |
||||
MatPaginatorModule, |
||||
MatProgressBarModule, |
||||
MatProgressSpinnerModule, |
||||
MatRadioModule, |
||||
MatRippleModule, |
||||
MatSelectModule, |
||||
MatSidenavModule, |
||||
MatSliderModule, |
||||
MatSlideToggleModule, |
||||
MatSnackBarModule, |
||||
MatSortModule, |
||||
MatTableModule, |
||||
MatTabsModule, |
||||
MatToolbarModule, |
||||
MatTooltipModule, |
||||
MatTreeModule, |
||||
PortalModule, |
||||
ScrollingModule, |
||||
FormsModule, |
||||
ReactiveFormsModule, |
||||
DataCollectionRoutingModule, |
||||
NzTreeModule |
||||
] |
||||
}) |
||||
export class DataCollectionModule { } |
||||
|
@ -1,20 +0,0 @@
|
||||
<div class="addCarBox"> |
||||
<div class="topbox"> |
||||
<span>新增消防车辆</span> |
||||
</div> |
||||
<div class="content"> |
||||
<!-- <div (click)="selecteAddType(item,key)" *ngFor="let item of addList;let key = index" [ngClass]="{selectedDiv: item.id == selectedFireForceTypeIndex}"> |
||||
{{item.name}} |
||||
</div> --> |
||||
<form class="example-form" (ngSubmit)="onSubmit(form.value)" #form="ngForm"> |
||||
<mat-form-field class="example-full-width"> |
||||
<mat-label>车辆名称</mat-label> |
||||
<input name="carName" matInput [(ngModel)]="carName" required> |
||||
</mat-form-field> |
||||
</form> |
||||
</div> |
||||
<div class="btnbox"> |
||||
<button type="submit" mat-flat-button color="primary" [disabled]='form.invalid' (click)="onSubmit(form.value)">确定</button> |
||||
<button type="button" mat-flat-button style="background-color: #F2F4F6;" mat-dialog-close>取消</button> |
||||
</div> |
||||
</div> |
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,3 +0,0 @@
|
||||
<div class="box"> |
||||
<button mat-raised-button color="primary" (click)="export()">导出excel表格</button> |
||||
</div> |
@ -1,7 +0,0 @@
|
||||
.box{ |
||||
width: 100%; |
||||
height: 100%; |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
} |
@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||
|
||||
import { ExportExcelComponent } from './export-excel.component'; |
||||
|
||||
describe('ExportExcelComponent', () => { |
||||
let component: ExportExcelComponent; |
||||
let fixture: ComponentFixture<ExportExcelComponent>; |
||||
|
||||
beforeEach(async(() => { |
||||
TestBed.configureTestingModule({ |
||||
declarations: [ ExportExcelComponent ] |
||||
}) |
||||
.compileComponents(); |
||||
})); |
||||
|
||||
beforeEach(() => { |
||||
fixture = TestBed.createComponent(ExportExcelComponent); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -1,31 +0,0 @@
|
||||
import { HttpClient } from '@angular/common/http'; |
||||
import { Component, OnInit } from '@angular/core'; |
||||
|
||||
@Component({ |
||||
selector: 'app-export-excel', |
||||
templateUrl: './export-excel.component.html', |
||||
styleUrls: ['./export-excel.component.scss'] |
||||
}) |
||||
export class ExportExcelComponent implements OnInit { |
||||
|
||||
constructor(public http:HttpClient) { } |
||||
|
||||
ngOnInit(): void { |
||||
} |
||||
export(){ |
||||
const httpOptions = { |
||||
responseType: 'blob' as 'json' |
||||
}; |
||||
this.http.get('/api/StatisticsAnalysis/ExportToExcel',httpOptions).subscribe((data:any) => { |
||||
// 文件名中有中文 则对文件名进行转码
|
||||
const link = document.createElement('a'); |
||||
const blob = new Blob([data], {type: 'application/vnd.ms-excel'}); |
||||
link.setAttribute('href', window.URL.createObjectURL(blob)); |
||||
link.setAttribute('download', '统计信息'+'.xls'); |
||||
link.style.visibility = 'hidden'; |
||||
document.body.appendChild(link); |
||||
link.click(); |
||||
document.body.removeChild(link); |
||||
}) |
||||
} |
||||
} |
@ -1,73 +1,11 @@
|
||||
<mat-tab-group *ngIf="planId" selectedIndex="10" style="height: 99%;"> |
||||
<mat-tab label="1.基本信息"> |
||||
<ng-template matTabContent> |
||||
<app-basicinfo-look></app-basicinfo-look> |
||||
</ng-template> |
||||
</mat-tab> |
||||
<mat-tab label="2.四周毗邻"> |
||||
<ng-template matTabContent> |
||||
<app-allaround></app-allaround> |
||||
</ng-template> |
||||
</mat-tab> |
||||
<mat-tab label="3.消防设施"> |
||||
<ng-template matTabContent> |
||||
<app-fire-fighting-device-look></app-fire-fighting-device-look> |
||||
</ng-template> |
||||
</mat-tab> |
||||
<mat-tab label="4.重点部位"> |
||||
<ng-template matTabContent> |
||||
<app-key-site-look></app-key-site-look> |
||||
</ng-template> |
||||
</mat-tab> |
||||
<mat-tab label="5.功能分区"> |
||||
<ng-template matTabContent> |
||||
<app-function-division-look></app-function-division-look> |
||||
</ng-template> |
||||
</mat-tab> |
||||
<mat-tab label="6.行车路线"> |
||||
<ng-template matTabContent> |
||||
<app-router-gis></app-router-gis> |
||||
</ng-template> |
||||
</mat-tab> |
||||
<mat-tab label="7.周边水源及力量"> |
||||
<ng-template matTabContent> |
||||
<app-water-road></app-water-road> |
||||
</ng-template> |
||||
</mat-tab> |
||||
<mat-tab label="8.实景图"> |
||||
<ng-template matTabContent> |
||||
<app-realistic-picture-look></app-realistic-picture-look> |
||||
</ng-template> |
||||
</mat-tab> |
||||
<mat-tab label="9.上传CAD"> |
||||
<ng-template matTabContent> |
||||
<app-uploading-cad-look></app-uploading-cad-look> |
||||
</ng-template> |
||||
</mat-tab> |
||||
<mat-tab label="10.特别警示"> |
||||
<ng-template matTabContent> |
||||
<app-special-warning></app-special-warning> |
||||
</ng-template> |
||||
</mat-tab> |
||||
<mat-tab label="11.作战部署"> |
||||
<ng-template matTabContent> |
||||
<div *ngIf="showType == 0"> |
||||
<iframe id="inneriframe" [src]='iframeSrc' frameborder="0" style="width: 100%;height: 100%;"></iframe> |
||||
</div> |
||||
<div *ngIf="showType == 1" id="viewer"></div> |
||||
<div *ngIf="showType == 3"> |
||||
<app-collection-tools></app-collection-tools> |
||||
</div> |
||||
|
||||
<!-- 在线编制预案 --> |
||||
<div *ngIf="showType == 2"> |
||||
<app-create-plan-online-five></app-create-plan-online-five> |
||||
</div> |
||||
</ng-template> |
||||
</mat-tab> |
||||
|
||||
</mat-tab-group> |
||||
|
||||
<div *ngIf="unitId"> |
||||
<app-basicinfo-look></app-basicinfo-look> |
||||
</div> |
||||
<!-- 株洲项目:传入预案id显示相应预案 --> |
||||
<div *ngIf="showType == 0"> |
||||
<iframe id="inneriframe" [src]='iframeSrc' frameborder="0" style="width: 100%;height: 100%;"></iframe> |
||||
</div> |
||||
<div *ngIf="showType == 1" id="viewer"></div> |
||||
<div *ngIf="showType == 2"> |
||||
<iframe id="inneriframe2" [src]='threedUrl' frameborder="0" style="width: 100%;height: 100%;"></iframe> |
||||
</div> |
||||
<div *ngIf="showType == 3"> |
||||
<app-collection-tools></app-collection-tools> |
||||
</div> |
||||
|
@ -1,198 +1,139 @@
|
||||
import { HttpClient } from "@angular/common/http"; |
||||
import { Component, OnInit } from "@angular/core"; |
||||
import { ActivatedRoute, Router } from "@angular/router"; |
||||
import { CacheTokenService } from "../http-interceptors/cache-token.service"; |
||||
import { Viewer } from "photo-sphere-viewer"; |
||||
import { DomSanitizer } from "@angular/platform-browser"; |
||||
import { HttpClient } from '@angular/common/http'; |
||||
import { Component, OnInit } from '@angular/core'; |
||||
import { ActivatedRoute } from '@angular/router'; |
||||
import { CacheTokenService } from '../http-interceptors/cache-token.service'; |
||||
import { Viewer } from 'photo-sphere-viewer'; |
||||
import { DomSanitizer } from '@angular/platform-browser'; |
||||
|
||||
declare var CryptoJS |
||||
@Component({ |
||||
selector: "app-external-links-plan", |
||||
templateUrl: "./external-links-plan.component.html", |
||||
styleUrls: ["./external-links-plan.component.scss"], |
||||
selector: 'app-external-links-plan', |
||||
templateUrl: './external-links-plan.component.html', |
||||
styleUrls: ['./external-links-plan.component.scss'] |
||||
}) |
||||
export class ExternalLinksPlanComponent implements OnInit { |
||||
constructor( |
||||
private http: HttpClient, |
||||
private token: CacheTokenService, |
||||
public route: ActivatedRoute, |
||||
private sanitizer: DomSanitizer, |
||||
private router: Router |
||||
) {} |
||||
|
||||
planId: any; //预案id
|
||||
viewer; //全景图对象
|
||||
fetchUrl; //预案文件地址
|
||||
showType; //预案类型 1:全景图
|
||||
planData; //预案信息
|
||||
|
||||
unitId; |
||||
constructor(private http: HttpClient, private token: CacheTokenService, public route: ActivatedRoute, private sanitizer: DomSanitizer) { } |
||||
planId: any//预案id
|
||||
viewer//全景图对象
|
||||
fetchUrl//预案文件地址
|
||||
showType//预案类型 1:全景图
|
||||
planData//预案信息
|
||||
async ngOnInit(): Promise<void> { |
||||
await this.login(); //登录存储token
|
||||
this.route.queryParams.subscribe((paramsData) => { |
||||
console.log(paramsData.planId) |
||||
if (paramsData.planId) { |
||||
this.planId = paramsData.planId; |
||||
this.http |
||||
.get(`/api/PlanComponents/${this.planId}`) |
||||
.subscribe((data: any) => { |
||||
console.log("单个预案详细信息", data); |
||||
sessionStorage.setItem("planId", data.id); |
||||
sessionStorage.setItem("companyId", data.companyId); |
||||
sessionStorage.setItem( |
||||
"buildingTypeId", |
||||
data.company.buildingTypes[0].id |
||||
); |
||||
sessionStorage.setItem("editable", "0"); |
||||
sessionStorage.setItem("planName", data.name); |
||||
let queryParams = {}; |
||||
if (data.webTextData && data.planType === 16) { |
||||
queryParams = { |
||||
id: data.companyId, |
||||
planId: data.id, |
||||
orName: data.company.organizationName, |
||||
orId: data.company.organizationId, |
||||
companyId: data.companyId, |
||||
planName: data.name, |
||||
unitName: data.companyName, |
||||
planCategory: data.planCategory, |
||||
unitTypeId: data.company.buildingTypes[0].id, |
||||
pattern: "false", |
||||
}; |
||||
} else { |
||||
queryParams = { |
||||
id: data.companyId, |
||||
planId: data.id, |
||||
orName: data.company.organizationName, |
||||
orId: data.company.organizationId, |
||||
}; |
||||
await this.login()//登录存储token
|
||||
this.route.queryParams.subscribe(paramsData => { |
||||
this.planId = paramsData.planId |
||||
let planId = paramsData.planId |
||||
this.http.get(`/api/PlanComponents/${planId}`).subscribe((data: any) => { |
||||
console.log('单个预案详细信息', data) |
||||
this.planData = data |
||||
if (data.planType != 1 && data.planType != 2) { |
||||
this.fetchUrl = data.attachmentUrls[0] |
||||
var index = this.fetchUrl.indexOf("\/") |
||||
if (this.fetchUrl.substr(0, index) == 'psw') { |
||||
this.showType = 1 |
||||
var obj = document.getElementById('viewer') |
||||
if (obj != null) { |
||||
obj.innerHTML = '' |
||||
} |
||||
this.router.navigate([`/linksPlan`], { |
||||
queryParams: queryParams, |
||||
}); |
||||
this.planData = data; |
||||
|
||||
//如果是查看文件类型
|
||||
|
||||
console.log("data.planType", data.planType); |
||||
if (data.planType != 1 && data.planType != 2) { |
||||
this.fetchUrl = data.attachmentUrls ? data.attachmentUrls[0] : ""; |
||||
var index = this.fetchUrl.indexOf("/"); |
||||
|
||||
// 在线编制预案
|
||||
if (data.webTextData && data.planType === 16) { |
||||
this.showType = 2; |
||||
return; |
||||
} |
||||
|
||||
//全景图图片
|
||||
if (this.fetchUrl.substr(0, index) == "psw") { |
||||
this.showType = 1; |
||||
var obj = document.getElementById("viewer"); |
||||
if (obj != null) { |
||||
obj.innerHTML = ""; |
||||
} |
||||
window.setTimeout(() => { |
||||
this.viewer = new Viewer({ |
||||
container: document.querySelector("#viewer"), |
||||
panorama: "/api/Objects/PlanPlatform/" + this.fetchUrl, |
||||
}); |
||||
}); |
||||
} else { |
||||
//word文档
|
||||
this.lookWord(); |
||||
} |
||||
} else { |
||||
// 如果是二三维预案
|
||||
this.handleData(); |
||||
} |
||||
}); |
||||
} else if (paramsData.unitId) { |
||||
this.http |
||||
.get(`/api/Companies/${paramsData.unitId}`) |
||||
.subscribe((data: any) => { |
||||
console.log("单位信息", data); |
||||
sessionStorage.setItem("editable", "0"); |
||||
sessionStorage.setItem("companyName", data.name); |
||||
sessionStorage.setItem("companyId", data.id); |
||||
sessionStorage.setItem( |
||||
data.id, |
||||
JSON.stringify(data.companyIntegrityScore) |
||||
); |
||||
let queryParams = { |
||||
id: data.id, |
||||
usci: data.usci, |
||||
}; |
||||
this.unitId = paramsData.unitId; |
||||
this.router.navigate([`/linksPlan`], { |
||||
queryParams: queryParams, |
||||
}); |
||||
}); |
||||
} |
||||
}); |
||||
window.setTimeout(() => { |
||||
this.viewer = new Viewer({ |
||||
container: document.querySelector('#viewer'), |
||||
panorama: '/api/Objects/PlanPlatform/' + this.fetchUrl, |
||||
}); |
||||
}) |
||||
} else { |
||||
//毕生
|
||||
this.lookWord() |
||||
} |
||||
} else { |
||||
// 二维三维预案
|
||||
this.handleData(data.url) |
||||
} |
||||
}) |
||||
}) |
||||
} |
||||
|
||||
async login() { |
||||
await new Promise((resolve, reject) => { |
||||
let { appKey, signature, timestamp } = this.route.snapshot.queryParams; |
||||
if (!appKey || !signature || !timestamp) { |
||||
alert("url参数不完整"); |
||||
return; |
||||
} |
||||
this.http |
||||
.get("/api/Account/VerifyAppInfo", { |
||||
params: { |
||||
appKey: appKey, |
||||
signature: signature, |
||||
timestamp: timestamp, |
||||
}, |
||||
}) |
||||
.subscribe((data: any) => { |
||||
sessionStorage.setItem("level", data.level); |
||||
sessionStorage.setItem("token", data.token); |
||||
sessionStorage.setItem("refreshToken", data.refreshToken); |
||||
console.log("登录成功", data); |
||||
resolve(data); |
||||
this.token.startUp(); |
||||
}); |
||||
}); |
||||
this.http.post('/api/Account/SignIn', { |
||||
name: 'zhuzhouyuanchakan', |
||||
password: '12345678' |
||||
}).subscribe((data: any) => { |
||||
sessionStorage.setItem("level", data.level); |
||||
sessionStorage.setItem("token", data.token); |
||||
sessionStorage.setItem("refreshToken", data.refreshToken); |
||||
console.log('登录成功', data) |
||||
resolve(data) |
||||
this.token.startUp() |
||||
}) |
||||
}) |
||||
|
||||
} |
||||
iframeSrc; //word服务器链接
|
||||
iframeSrc//毕生服务器链接
|
||||
src//文件存储地址
|
||||
lookWord() { |
||||
this.showType = 0; |
||||
let src; |
||||
let suffix = this.fetchUrl |
||||
.split(".") |
||||
[this.fetchUrl.split(".").length - 1].toLowerCase(); |
||||
if (suffix == "docx" || suffix == "doc") { |
||||
let arr = this.fetchUrl.split("."); |
||||
arr[arr.length - 1] = "pdf"; |
||||
src = `/api/Objects/PlanPlatform/` + arr.join("."); |
||||
} else if (suffix == "pdf") { |
||||
src = `/api/Objects/PlanPlatform/` + this.fetchUrl; |
||||
} |
||||
this.iframeSrc = this.sanitizer.bypassSecurityTrustResourceUrl(src); |
||||
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + this.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) |
||||
let filename: string |
||||
this.http.get(`/api/ObjectMetadata/PlanPlatform/${this.fetchUrl}`).subscribe((data: any) => { |
||||
filename = data.fileName |
||||
let json = { |
||||
doc: { |
||||
docId: docId, |
||||
title: filename, |
||||
//title: filename,
|
||||
fetchUrl: `http://39.106.78.171:8000/api/Objects/PlanPlatform/` + this.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); |
||||
this.src = `http://121.5.10.84:80/apps/editor/openPreview?data=${base64}` |
||||
this.iframeSrc = this.sanitizer.bypassSecurityTrustResourceUrl(this.src); |
||||
this.showType = 0 |
||||
}) |
||||
} |
||||
|
||||
companyData; //当前公司信息
|
||||
thirdPartyURL; |
||||
threedUrl: any; |
||||
handleData() { |
||||
let data = this.planData; |
||||
if (this.planData.planMode == 1 || this.planData.planMode == 2) { |
||||
//预案planMode=2时, 跳查看页面组件
|
||||
this.showType = 3; |
||||
} else if (this.planData.planMode == 3) { |
||||
//网页地址
|
||||
let localhostPath = window.document.location.href.substring( |
||||
0, |
||||
window.document.location.href.indexOf(window.document.location.pathname) |
||||
); |
||||
let url = data.url; |
||||
if (url.indexOf(localhostPath) != -1) { |
||||
window.location.href = `${url}?unitId=${data.company.id}&unitName=${data.company.name}&editMode=false`; |
||||
} else { |
||||
window.location.href = `${url}?unitId=${data.company.id}&unitName=${data.company.name}&editMode=false`; |
||||
} |
||||
companyData//当前公司信息
|
||||
thirdPartyURL |
||||
threedUrl: any |
||||
handleData(url?:string) { |
||||
let data = this.planData |
||||
// console.log('ddddd',data)
|
||||
if (this.planData.planMode == 2) { //预案planMode=2时, 跳查看页面组件
|
||||
|
||||
this.http.get(`/api/Plans/${data.companyId}`).subscribe((data: any) => { |
||||
console.log(data) |
||||
data && data.company ? this.companyData = data.company : null |
||||
sessionStorage.setItem("buildingTypeId", this.companyData.buildingTypes.length ? this.companyData.buildingTypes[0].id : undefined); |
||||
sessionStorage.setItem("companyId", data.companyId); |
||||
sessionStorage.setItem("planId", this.planId); |
||||
sessionStorage.setItem("editable", '0'); |
||||
sessionStorage.setItem("planName", this.planData.name) |
||||
this.showType = 3 |
||||
// this.threedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(`/keyUnit/viewunitinfoplans?id=${data.companyId}`)
|
||||
}) |
||||
} else if (this.planData.planMode == 3) { //预案planMode=3时, 第三方网址'
|
||||
// this.http.get(`/api/Plans/${data.companyId}`).subscribe((data: any) => {
|
||||
// console.log('xxxx',data)
|
||||
// data && data.company ? this.companyData = data.company : null
|
||||
// this.threedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(url)
|
||||
// this.showType = 2
|
||||
// })
|
||||
window.location.href = `${url}?unitId=${data.company.id}&unitName=${data.company.name}&editMode=false` |
||||
} |
||||
} |
||||
} |
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,154 +1,121 @@
|
||||
import { NgModule } from "@angular/core"; |
||||
import { CommonModule } from "@angular/common"; |
||||
import { |
||||
DownloadFile, |
||||
GisLabelingComponent, |
||||
LookPlanDialog, |
||||
ShareUrlDialog, |
||||
} from "./gis-labeling/gis-labeling.component"; |
||||
import { A11yModule } from "@angular/cdk/a11y"; |
||||
import { DragDropModule } from "@angular/cdk/drag-drop"; |
||||
import { PortalModule } from "@angular/cdk/portal"; |
||||
import { ScrollingModule } from "@angular/cdk/scrolling"; |
||||
import { CdkStepperModule } from "@angular/cdk/stepper"; |
||||
import { CdkTableModule } from "@angular/cdk/table"; |
||||
import { CdkTreeModule } from "@angular/cdk/tree"; |
||||
import { MatAutocompleteModule } from "@angular/material/autocomplete"; |
||||
import { MatBadgeModule } from "@angular/material/badge"; |
||||
import { MatBottomSheetModule } from "@angular/material/bottom-sheet"; |
||||
import { MatButtonModule } from "@angular/material/button"; |
||||
import { MatButtonToggleModule } from "@angular/material/button-toggle"; |
||||
import { MatCardModule } from "@angular/material/card"; |
||||
import { MatCheckboxModule } from "@angular/material/checkbox"; |
||||
import { MatChipsModule } from "@angular/material/chips"; |
||||
import { MatStepperModule } from "@angular/material/stepper"; |
||||
import { MatDatepickerModule } from "@angular/material/datepicker"; |
||||
import { MatDialogModule } from "@angular/material/dialog"; |
||||
import { MatDividerModule } from "@angular/material/divider"; |
||||
import { MatExpansionModule } from "@angular/material/expansion"; |
||||
import { MatGridListModule } from "@angular/material/grid-list"; |
||||
import { MatIconModule } from "@angular/material/icon"; |
||||
import { MatInputModule } from "@angular/material/input"; |
||||
import { MatListModule } from "@angular/material/list"; |
||||
import { MatMenuModule } from "@angular/material/menu"; |
||||
import { |
||||
MatNativeDateModule, |
||||
MatRippleModule, |
||||
MatOption, |
||||
} from "@angular/material/core"; |
||||
import { MatPaginatorModule } from "@angular/material/paginator"; |
||||
import { MatProgressBarModule } from "@angular/material/progress-bar"; |
||||
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner"; |
||||
import { MatRadioModule } from "@angular/material/radio"; |
||||
import { MatSelectModule } from "@angular/material/select"; |
||||
import { MatSidenavModule } from "@angular/material/sidenav"; |
||||
import { MatSliderModule } from "@angular/material/slider"; |
||||
import { MatSlideToggleModule } from "@angular/material/slide-toggle"; |
||||
import { MatSnackBarModule } from "@angular/material/snack-bar"; |
||||
import { MatSortModule } from "@angular/material/sort"; |
||||
import { MatTableModule } from "@angular/material/table"; |
||||
import { MatTabsModule } from "@angular/material/tabs"; |
||||
import { MatToolbarModule } from "@angular/material/toolbar"; |
||||
import { MatTooltipModule } from "@angular/material/tooltip"; |
||||
import { MatTreeModule } from "@angular/material/tree"; |
||||
import { FormsModule, ReactiveFormsModule } from "@angular/forms"; |
||||
import { GisRoutingModule } from "./gis-management-routing.module"; |
||||
import { LeftWorkingComponent } from "./left-working/left-working.component"; |
||||
import { BasicInfoComponent } from "./basic-info/basic-info.component"; |
||||
import { FunctionPartitionComponent } from "./function-partition/function-partition.component"; |
||||
import { FireFacilitiesComponent } from "./fire-facilities/fire-facilities.component"; |
||||
import { ImagesData2 } from "./fire-facilities/imagesdata.component"; |
||||
import { AllaroundComponent } from "./allaround/allaround.component"; |
||||
import { ImgDetails } from "./allaround/imgdetails.component"; |
||||
import { KeySiteLookComponent } from "./key-site-look/key-site.component"; |
||||
import { KeySiteImgs2 } from "./key-site-look/keysiteimgs.component"; |
||||
import { RealisticPictureLookComponent } from "./realistic-picture-look/realistic-picture.component"; |
||||
import { previewImg3 } from "./realistic-picture-look/realistic-picture.component"; |
||||
import { |
||||
OpenPlanToolDialog, |
||||
PlanListComponent, |
||||
} from "./plan-list/plan-list.component"; |
||||
import { PlanManagementModule } from "../plan-management/plan-management.module"; |
||||
import { UiModule } from "../ui/ui.module"; |
||||
import { CadDrawComponent } from "./cad-draw/cad-draw.component"; |
||||
import { previewBigImg2 } from "./fire-facilities/imagesdata.component"; |
||||
import { NzAutocompleteModule } from "ng-zorro-antd/auto-complete"; |
||||
import { NgModule } from '@angular/core'; |
||||
import { CommonModule } from '@angular/common'; |
||||
import { DownloadFile, GisLabelingComponent, LookPlanDialog, ShareUrlDialog } from './gis-labeling/gis-labeling.component'; |
||||
import {A11yModule} from '@angular/cdk/a11y'; |
||||
import {DragDropModule} from '@angular/cdk/drag-drop'; |
||||
import {PortalModule} from '@angular/cdk/portal'; |
||||
import {ScrollingModule} from '@angular/cdk/scrolling'; |
||||
import {CdkStepperModule} from '@angular/cdk/stepper'; |
||||
import {CdkTableModule} from '@angular/cdk/table'; |
||||
import {CdkTreeModule} from '@angular/cdk/tree'; |
||||
import {MatAutocompleteModule} from '@angular/material/autocomplete'; |
||||
import {MatBadgeModule} from '@angular/material/badge'; |
||||
import {MatBottomSheetModule} from '@angular/material/bottom-sheet'; |
||||
import {MatButtonModule} from '@angular/material/button'; |
||||
import {MatButtonToggleModule} from '@angular/material/button-toggle'; |
||||
import {MatCardModule} from '@angular/material/card'; |
||||
import {MatCheckboxModule} from '@angular/material/checkbox'; |
||||
import {MatChipsModule} from '@angular/material/chips'; |
||||
import {MatStepperModule} from '@angular/material/stepper'; |
||||
import {MatDatepickerModule} from '@angular/material/datepicker'; |
||||
import {MatDialogModule} from '@angular/material/dialog'; |
||||
import {MatDividerModule} from '@angular/material/divider'; |
||||
import {MatExpansionModule} from '@angular/material/expansion'; |
||||
import {MatGridListModule} from '@angular/material/grid-list'; |
||||
import {MatIconModule} from '@angular/material/icon'; |
||||
import {MatInputModule} from '@angular/material/input'; |
||||
import {MatListModule} from '@angular/material/list'; |
||||
import {MatMenuModule} from '@angular/material/menu'; |
||||
import {MatNativeDateModule, MatRippleModule, MatOption} from '@angular/material/core'; |
||||
import {MatPaginatorModule} from '@angular/material/paginator'; |
||||
import {MatProgressBarModule} from '@angular/material/progress-bar'; |
||||
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; |
||||
import {MatRadioModule} from '@angular/material/radio'; |
||||
import {MatSelectModule} from '@angular/material/select'; |
||||
import {MatSidenavModule} from '@angular/material/sidenav'; |
||||
import {MatSliderModule} from '@angular/material/slider'; |
||||
import {MatSlideToggleModule} from '@angular/material/slide-toggle'; |
||||
import {MatSnackBarModule} from '@angular/material/snack-bar'; |
||||
import {MatSortModule} from '@angular/material/sort'; |
||||
import {MatTableModule} from '@angular/material/table'; |
||||
import {MatTabsModule} from '@angular/material/tabs'; |
||||
import {MatToolbarModule} from '@angular/material/toolbar'; |
||||
import {MatTooltipModule} from '@angular/material/tooltip'; |
||||
import {MatTreeModule} from '@angular/material/tree'; |
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
||||
import { GisRoutingModule } from './gis-management-routing.module'; |
||||
import { LeftWorkingComponent } from './left-working/left-working.component'; |
||||
import { BasicInfoComponent } from './basic-info/basic-info.component'; |
||||
import { FunctionPartitionComponent } from './function-partition/function-partition.component'; |
||||
import { FireFacilitiesComponent } from './fire-facilities/fire-facilities.component'; |
||||
import {ImagesData2}from './fire-facilities/imagesdata.component' |
||||
import {AllaroundComponent} from './allaround/allaround.component' |
||||
import {ImgDetails}from './allaround/imgdetails.component'; |
||||
import {KeySiteLookComponent} from './key-site-look/key-site.component' |
||||
import {KeySiteImgs2}from './key-site-look/keysiteimgs.component' |
||||
import {RealisticPictureLookComponent} from './realistic-picture-look/realistic-picture.component' |
||||
import {previewImg3} from './realistic-picture-look/realistic-picture.component' |
||||
import { OpenPlanToolDialog, PlanListComponent } from './plan-list/plan-list.component'; |
||||
import { PlanManagementModule } from '../plan-management/plan-management.module'; |
||||
import { UiModule } from '../ui/ui.module'; |
||||
import { CadDrawComponent } from './cad-draw/cad-draw.component'; |
||||
import {previewBigImg2} from './fire-facilities/imagesdata.component' |
||||
|
||||
@NgModule({ |
||||
declarations: [ |
||||
GisLabelingComponent, |
||||
LeftWorkingComponent, |
||||
FunctionPartitionComponent, |
||||
RealisticPictureLookComponent, |
||||
previewImg3, |
||||
previewBigImg2, |
||||
FireFacilitiesComponent, |
||||
ImagesData2, |
||||
AllaroundComponent, |
||||
ImgDetails, |
||||
KeySiteLookComponent, |
||||
KeySiteImgs2, |
||||
BasicInfoComponent, |
||||
FunctionPartitionComponent, |
||||
ShareUrlDialog, |
||||
PlanListComponent, |
||||
LookPlanDialog, |
||||
DownloadFile, |
||||
OpenPlanToolDialog, |
||||
CadDrawComponent, |
||||
], |
||||
declarations: [GisLabelingComponent, LeftWorkingComponent, FunctionPartitionComponent, RealisticPictureLookComponent,previewImg3,previewBigImg2, |
||||
FireFacilitiesComponent,ImagesData2,AllaroundComponent,ImgDetails,KeySiteLookComponent,KeySiteImgs2,BasicInfoComponent,FunctionPartitionComponent,ShareUrlDialog, PlanListComponent,LookPlanDialog,DownloadFile,OpenPlanToolDialog, CadDrawComponent], |
||||
|
||||
imports: [ |
||||
CommonModule, |
||||
CommonModule, |
||||
GisRoutingModule, |
||||
A11yModule, |
||||
CdkStepperModule, |
||||
CdkTableModule, |
||||
CdkTreeModule, |
||||
DragDropModule, |
||||
MatAutocompleteModule, |
||||
MatBadgeModule, |
||||
MatBottomSheetModule, |
||||
MatButtonModule, |
||||
MatButtonToggleModule, |
||||
MatCardModule, |
||||
MatCheckboxModule, |
||||
MatChipsModule, |
||||
MatStepperModule, |
||||
MatDatepickerModule, |
||||
MatDialogModule, |
||||
MatDividerModule, |
||||
MatExpansionModule, |
||||
MatGridListModule, |
||||
MatIconModule, |
||||
MatInputModule, |
||||
MatListModule, |
||||
MatMenuModule, |
||||
MatNativeDateModule, |
||||
MatPaginatorModule, |
||||
MatProgressBarModule, |
||||
MatProgressSpinnerModule, |
||||
MatRadioModule, |
||||
MatRippleModule, |
||||
MatSelectModule, |
||||
MatSidenavModule, |
||||
MatSliderModule, |
||||
MatSlideToggleModule, |
||||
MatSnackBarModule, |
||||
MatSortModule, |
||||
MatTableModule, |
||||
MatTabsModule, |
||||
MatToolbarModule, |
||||
MatTooltipModule, |
||||
MatTreeModule, |
||||
PortalModule, |
||||
ScrollingModule, |
||||
FormsModule, |
||||
ReactiveFormsModule, |
||||
PlanManagementModule, |
||||
UiModule, |
||||
NzAutocompleteModule, |
||||
], |
||||
imports: [ |
||||
CommonModule, |
||||
CommonModule, |
||||
GisRoutingModule, |
||||
A11yModule, |
||||
CdkStepperModule, |
||||
CdkTableModule, |
||||
CdkTreeModule, |
||||
DragDropModule, |
||||
MatAutocompleteModule, |
||||
MatBadgeModule, |
||||
MatBottomSheetModule, |
||||
MatButtonModule, |
||||
MatButtonToggleModule, |
||||
MatCardModule, |
||||
MatCheckboxModule, |
||||
MatChipsModule, |
||||
MatStepperModule, |
||||
MatDatepickerModule, |
||||
MatDialogModule, |
||||
MatDividerModule, |
||||
MatExpansionModule, |
||||
MatGridListModule, |
||||
MatIconModule, |
||||
MatInputModule, |
||||
MatListModule, |
||||
MatMenuModule, |
||||
MatNativeDateModule, |
||||
MatPaginatorModule, |
||||
MatProgressBarModule, |
||||
MatProgressSpinnerModule, |
||||
MatRadioModule, |
||||
MatRippleModule, |
||||
MatSelectModule, |
||||
MatSidenavModule, |
||||
MatSliderModule, |
||||
MatSlideToggleModule, |
||||
MatSnackBarModule, |
||||
MatSortModule, |
||||
MatTableModule, |
||||
MatTabsModule, |
||||
MatToolbarModule, |
||||
MatTooltipModule, |
||||
MatTreeModule, |
||||
PortalModule, |
||||
ScrollingModule, |
||||
FormsModule, |
||||
ReactiveFormsModule, |
||||
PlanManagementModule, |
||||
UiModule |
||||
] |
||||
|
||||
}) |
||||
export class GISManagementModule {} |
||||
export class GISManagementModule { } |
||||
|
@ -1,34 +1,40 @@
|
||||
import { Injectable } from "@angular/core"; |
||||
import { HttpClient } from "@angular/common/http"; |
||||
import { Injectable } from '@angular/core'; |
||||
import { HttpClient } from '@angular/common/http' |
||||
|
||||
@Injectable({ |
||||
providedIn: "root", |
||||
providedIn: 'root' |
||||
}) |
||||
|
||||
export class CacheTokenService { |
||||
constructor(private http: HttpClient) {} |
||||
|
||||
constructor(private http:HttpClient) { } |
||||
public timer; |
||||
|
||||
//刷新token令牌定时器
|
||||
startUp = (): void => { |
||||
window.clearInterval(this.timer); //清一遍定时器
|
||||
this.timer = window.setInterval(() => { |
||||
startUp = ():void=>{ |
||||
window.clearInterval(this.timer) //清一遍定时器
|
||||
this.timer = window.setInterval(()=>{ |
||||
var token = sessionStorage.getItem("token"); |
||||
var refreshToken = sessionStorage.getItem("refreshToken"); |
||||
this.http |
||||
.post("/api/Account/RefreshToken", { |
||||
token: token, |
||||
refreshToken: refreshToken, |
||||
}) |
||||
.subscribe((data: any) => { |
||||
sessionStorage.setItem("level", data.level); |
||||
sessionStorage.setItem("token", data.token); |
||||
sessionStorage.setItem("refreshToken", data.refreshToken); |
||||
}); |
||||
}, 5 * 60 * 1000); |
||||
}; |
||||
this.http.post('/api/Account/RefreshToken', { |
||||
token: token, |
||||
refreshToken: refreshToken |
||||
}).subscribe((data:any) => { |
||||
sessionStorage.setItem("level",data.level); |
||||
sessionStorage.setItem("token",data.token); |
||||
sessionStorage.setItem("refreshToken",data.refreshToken); |
||||
}) |
||||
},18*60*1000) |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
//删除定时器
|
||||
delete = (): void => { |
||||
window.clearInterval(this.timer); |
||||
}; |
||||
delete = ():void=> { |
||||
window.clearInterval(this.timer) |
||||
} |
||||
|
||||
|
||||
|
||||
} |
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,119 +0,0 @@
|
||||
<h2 mat-dialog-title>演练记录</h2> |
||||
<div class="box"> |
||||
<div class="contentItem"> |
||||
<div class="title"> |
||||
单位信息 |
||||
</div> |
||||
<div class="content"> |
||||
<div class="textbox"> |
||||
<span class="name">单位名称:</span> |
||||
<span>{{data.unitInfo.name}}</span> |
||||
</div> |
||||
<div class="textbox"> |
||||
<span class="name">单位地址:</span> |
||||
<span>{{data.unitInfo.address}}</span> |
||||
</div> |
||||
<div class="textbox"> |
||||
<span class="name">联系人:</span> |
||||
<span>{{data.unitInfo.contacts}}</span> |
||||
</div> |
||||
<div class="textbox"> |
||||
<span class="name">联系电话:</span> |
||||
<span>{{data.unitInfo.phone}}</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="contentItem"> |
||||
<div class="title"> |
||||
调研人员 |
||||
</div> |
||||
<div class="content peoplecontent"> |
||||
<div> |
||||
<span class="name">带队人员:</span> |
||||
<input [disabled]="!isEditMode" name="teamLeader" [(ngModel)]="teamLeader" nz-input |
||||
placeholder="带队人员" /> |
||||
</div> |
||||
<div> |
||||
<span class="name">熟悉时间:</span> |
||||
<nz-range-picker [disabled]="!isEditMode" [nzShowTime]="{ nzFormat: 'HH:mm' }" |
||||
nzFormat="yyyy-MM-dd HH:mm" [nzPlaceHolder]="['开始时间', '结束时间']" name="time" |
||||
[(ngModel)]="time"></nz-range-picker> |
||||
</div> |
||||
<div> |
||||
<span class="name">调研照片:</span> |
||||
<div class="uploadbox"> |
||||
<input *ngIf="isEditMode" type="file" (change)="upload($event,'调研')"> |
||||
<button *ngIf="isEditMode" nz-button nzType="default">上传照片</button> |
||||
<ul class="imgbox"> |
||||
<li *ngFor="let item of surveyPhoto;let key = index"><img [src]="item" alt="" |
||||
(click)="viewImg(item)"> |
||||
<span *ngIf="isEditMode" class="close material-icons" (click)="deleteImg(surveyPhoto,key)"> |
||||
cancel |
||||
</span> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="contentItem"> |
||||
<div class="title"> |
||||
熟悉内容 |
||||
</div> |
||||
<div class="content photocontent"> |
||||
<div> |
||||
<span class="name">水源照片:</span> |
||||
<div class="uploadbox"> |
||||
<input *ngIf="isEditMode" type="file" (change)="upload($event,'水源')"> |
||||
<button *ngIf="isEditMode" nz-button nzType="default">上传照片</button> |
||||
<ul class="imgbox"> |
||||
<li *ngFor="let item of waterPhoto;let key = index"><img [src]="item" alt="" |
||||
(click)="viewImg(item)"> |
||||
<span *ngIf="isEditMode" class="close material-icons" (click)="deleteImg(waterPhoto,key)"> |
||||
cancel |
||||
</span> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div> |
||||
<span class="name">疏散通道:</span> |
||||
<div class="uploadbox"> |
||||
<input *ngIf="isEditMode" type="file" (change)="upload($event,'疏散通道')"> |
||||
<button *ngIf="isEditMode" nz-button nzType="default">上传照片</button> |
||||
<ul class="imgbox"> |
||||
<li *ngFor="let item of routePhoto;let key = index"><img [src]="item" alt="" |
||||
(click)="viewImg(item)"> |
||||
<span *ngIf="isEditMode" class="close material-icons" (click)="deleteImg(routePhoto,key)"> |
||||
cancel |
||||
</span> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
<div> |
||||
<span class="name">消控室:</span> |
||||
<div class="uploadbox"> |
||||
<input *ngIf="isEditMode" type="file" (change)="upload($event,'消控室')"> |
||||
<button *ngIf="isEditMode" nz-button nzType="default">上传照片</button> |
||||
<ul class="imgbox"> |
||||
<li *ngFor="let item of fireControlPhoto;let key = index"><img [src]="item" alt="" |
||||
(click)="viewImg(item)"> |
||||
<span *ngIf="isEditMode" class="close material-icons" |
||||
(click)="deleteImg(fireControlPhoto,key)"> |
||||
cancel |
||||
</span> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="mask" *ngIf="isLoading"> |
||||
<mat-spinner [diameter]="30"></mat-spinner> |
||||
</div> |
||||
</div> |
||||
<mat-dialog-actions align="end"> |
||||
<button mat-button mat-dialog-close [disabled]="isLoading || isLoadingSave">取消</button> |
||||
<button mat-button cdkFocusInitial (click)="save()" [disabled]="isLoading || isLoadingSave">确定</button> |
||||
</mat-dialog-actions> |
@ -1,120 +0,0 @@
|
||||
.box { |
||||
width: 100%; |
||||
position: relative; |
||||
|
||||
.contentItem { |
||||
display: flex; |
||||
margin: 6px 0; |
||||
border-bottom: 1px dashed rgb(180, 178, 178); |
||||
|
||||
.title { |
||||
width: 75px; |
||||
color: #1890ff; |
||||
display: flex; |
||||
align-items: center; |
||||
} |
||||
|
||||
.content { |
||||
flex: 1; |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
|
||||
div { |
||||
margin-bottom: 3px; |
||||
|
||||
.name { |
||||
display: inline-block; |
||||
width: 70px; |
||||
margin-right: 3px; |
||||
text-align: right; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.peoplecontent, |
||||
.photocontent { |
||||
flex-direction: column; |
||||
|
||||
div { |
||||
display: flex; |
||||
align-items: center; |
||||
|
||||
input, |
||||
nz-range-picker { |
||||
flex: 1; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.textbox { |
||||
height: 32px; |
||||
line-height: 32px; |
||||
width: 50%; |
||||
white-space: nowrap; |
||||
overflow: hidden; |
||||
text-overflow: ellipsis; |
||||
|
||||
} |
||||
|
||||
.uploadbox { |
||||
position: relative; |
||||
display: flex; |
||||
align-items: center; |
||||
|
||||
input { |
||||
width: 88px; |
||||
height: 32px; |
||||
position: absolute; |
||||
left: 0; |
||||
top: 0; |
||||
opacity: 0; |
||||
z-index: 2; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
button { |
||||
z-index: 1; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.imgbox { |
||||
height: 100%; |
||||
display: flex; |
||||
align-items: center; |
||||
|
||||
li { |
||||
display: flex; |
||||
align-items: center; |
||||
position: relative; |
||||
} |
||||
|
||||
img { |
||||
width: 50px; |
||||
height: 50px; |
||||
margin: 0 5px; |
||||
cursor: pointer; |
||||
} |
||||
.close{ |
||||
position: absolute; |
||||
right: 0; |
||||
top: 0; |
||||
font-size: 15px; |
||||
cursor: pointer; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
.mask { |
||||
position: absolute; |
||||
width: 100%; |
||||
height: 100%; |
||||
left: 0; |
||||
top: 0; |
||||
background: rgba(0, 0, 0, 0.2); |
||||
display: flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
z-index: 3; |
||||
} |
||||
} |
@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||
|
||||
import { UploadDrillComponent } from './upload-drill.component'; |
||||
|
||||
describe('UploadDrillComponent', () => { |
||||
let component: UploadDrillComponent; |
||||
let fixture: ComponentFixture<UploadDrillComponent>; |
||||
|
||||
beforeEach(async(() => { |
||||
TestBed.configureTestingModule({ |
||||
declarations: [ UploadDrillComponent ] |
||||
}) |
||||
.compileComponents(); |
||||
})); |
||||
|
||||
beforeEach(() => { |
||||
fixture = TestBed.createComponent(UploadDrillComponent); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
||||
|
||||
it('should create', () => { |
||||
expect(component).toBeTruthy(); |
||||
}); |
||||
}); |
@ -1,203 +0,0 @@
|
||||
import { HttpClient } from "@angular/common/http"; |
||||
import { Component, OnInit, Inject } from "@angular/core"; |
||||
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog"; |
||||
import { ObjectsService } from "@src/app/services/objects.service"; |
||||
import { DatePipe } from "@angular/common"; |
||||
import { MatSnackBar } from "@angular/material/snack-bar"; |
||||
import Viewer from "viewerjs"; |
||||
@Component({ |
||||
selector: "app-upload-drill", |
||||
templateUrl: "./upload-drill.component.html", |
||||
styleUrls: ["./upload-drill.component.scss"], |
||||
providers: [DatePipe], |
||||
}) |
||||
export class UploadDrillComponent implements OnInit { |
||||
constructor( |
||||
public dialogRef: MatDialogRef<UploadDrillComponent>, |
||||
@Inject(MAT_DIALOG_DATA) public data: any, |
||||
private objectsSer: ObjectsService, |
||||
private http: HttpClient, |
||||
private datePipe: DatePipe, |
||||
public snackBar: MatSnackBar |
||||
) {} |
||||
|
||||
isEditMode = true; |
||||
|
||||
ngOnInit(): void { |
||||
console.log(this.data); |
||||
this.isEditMode = this.data.isEditMode; |
||||
this.getData(); |
||||
} |
||||
|
||||
isHttpPost; |
||||
getData() { |
||||
this.http |
||||
.get("/api/DrillRecords", { |
||||
params: { |
||||
CompanyId: this.data.unitInfo.id, |
||||
}, |
||||
}) |
||||
.subscribe((data: any) => { |
||||
console.log("演练记录数据", data); |
||||
if (data.totalCount === 0) { |
||||
this.isHttpPost = true; |
||||
} else { |
||||
this.isHttpPost = false; |
||||
let item = data.items[0]; |
||||
this.drillId = item.id; |
||||
this.teamLeader = item.teamLeader; |
||||
this.time = [item.startTime, item.endTime]; |
||||
this.surveyPhoto = JSON.parse(item.images); |
||||
this.waterPhoto = JSON.parse(item.waterSource); |
||||
this.routePhoto = JSON.parse(item.escapeRoute); |
||||
this.fireControlPhoto = JSON.parse(item.fireControlRoom); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
surveyPhoto = [ |
||||
// "../../../../assets/images/yiyuan.png",
|
||||
// "../../../../assets/images/homeHeader.png",
|
||||
// "../../../../assets/images/add.png",
|
||||
]; //调研人员照片
|
||||
waterPhoto = []; //水源照片
|
||||
routePhoto = []; //疏散照片
|
||||
fireControlPhoto = []; //消控室照片
|
||||
|
||||
//设置文件路径并上传
|
||||
postFilePath; |
||||
isLoading = false; |
||||
async upload(e, type) { |
||||
this.isLoading = true; |
||||
let file = e.target.files[0] || null; //获取上传的文件
|
||||
let fileSize = file.size || null; //上传文件的总大小
|
||||
let shardSize = 5 * 1024 * 1024; //5MB 超过5MB要分块上传
|
||||
this.postFilePath = "演练记录/" + this.data.unitInfo.id; |
||||
if (fileSize >= shardSize) { |
||||
await this.postFileByMul(file, type); |
||||
} else { |
||||
await this.postFile(file, type); |
||||
} |
||||
this.isLoading = false; |
||||
} |
||||
|
||||
//直接上传
|
||||
async postFile(file: File, type) { |
||||
await new Promise((resolve, reject) => { |
||||
this.objectsSer.postFile(this.postFilePath, file).subscribe((data) => { |
||||
let dataObj = data as any; |
||||
let filePath: string = ObjectsService.baseUrl + dataObj.objectName; |
||||
this.setFileUrl(type, filePath); |
||||
resolve("success"); |
||||
}); |
||||
}); |
||||
} |
||||
//分块上传
|
||||
async postFileByMul(file: File, type) { |
||||
await new Promise((resolve, reject) => { |
||||
this.objectsSer |
||||
.postFile_MultipartUpload(this.postFilePath, file) |
||||
.then((value) => { |
||||
console.log("分块上传成功", value); |
||||
let dataObj = value as any; |
||||
this.setFileUrl(type, dataObj.filePath + dataObj.fileName); |
||||
resolve("success"); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
setFileUrl(type, filePath) { |
||||
switch (type) { |
||||
case "调研": |
||||
this.surveyPhoto.push(filePath); |
||||
break; |
||||
case "水源": |
||||
this.waterPhoto.push(filePath); |
||||
break; |
||||
case "疏散通道": |
||||
this.routePhoto.push(filePath); |
||||
break; |
||||
case "消控室": |
||||
this.fireControlPhoto.push(filePath); |
||||
break; |
||||
} |
||||
} |
||||
deleteImg(arr, key) { |
||||
if (confirm("确认删除此照片吗")) { |
||||
arr.splice(key, 1); |
||||
} |
||||
} |
||||
teamLeader; |
||||
time; |
||||
drillId; |
||||
isLoadingSave = false; |
||||
save() { |
||||
if (!this.isEditMode) { |
||||
this.dialogRef.close(); |
||||
return; |
||||
} |
||||
|
||||
if (!this.teamLeader || !this.time) { |
||||
this.snackBar.open("请输入带队人员和熟悉时间", "确定", { |
||||
verticalPosition: "top", |
||||
duration: 3000, |
||||
}); |
||||
return; |
||||
} |
||||
this.isLoadingSave = true; |
||||
let body: any = { |
||||
companyId: this.data.unitInfo.id, |
||||
teamLeader: this.teamLeader, |
||||
startTime: this.datePipe.transform(this.time[0], "yyyy-MM-ddTHH:mm:ss"), |
||||
endTime: this.datePipe.transform(this.time[1], "yyyy-MM-ddTHH:mm:ss"), |
||||
images: JSON.stringify(this.surveyPhoto), |
||||
waterSource: JSON.stringify(this.waterPhoto), |
||||
escapeRoute: JSON.stringify(this.routePhoto), |
||||
fireControlRoom: JSON.stringify(this.fireControlPhoto), |
||||
}; |
||||
if (this.isHttpPost) { |
||||
this.http.post("/api/DrillRecords", body).subscribe((data: any) => { |
||||
this.drillId = data.id; |
||||
this.isHttpPost = false; |
||||
this.isLoadingSave = false; |
||||
this.snackBar.open("保存成功", "确定", { |
||||
verticalPosition: "top", |
||||
duration: 3000, |
||||
}); |
||||
this.dialogRef.close(); |
||||
}); |
||||
} else { |
||||
body.id = this.drillId; |
||||
this.http |
||||
.put(`/api/DrillRecords/${this.drillId}`, body) |
||||
.subscribe((data: any) => { |
||||
this.isLoadingSave = false; |
||||
this.snackBar.open("保存成功", "确定", { |
||||
verticalPosition: "top", |
||||
duration: 3000, |
||||
}); |
||||
this.dialogRef.close(); |
||||
}); |
||||
} |
||||
} |
||||
|
||||
//查看图片
|
||||
viewImg(url) { |
||||
let dom = document.getElementById(`viewerjs`); |
||||
let pObjs = dom.childNodes; |
||||
let node = document.createElement("img"); |
||||
node.style.display = "none"; |
||||
node.src = url; |
||||
node.id = "img"; |
||||
dom.appendChild(node); |
||||
setTimeout(() => { |
||||
let viewer = new Viewer(document.getElementById(`viewerjs`), { |
||||
hidden: () => { |
||||
dom.removeChild(pObjs[0]); |
||||
viewer.destroy(); |
||||
}, |
||||
}); |
||||
node.click(); |
||||
}, 0); |
||||
} |
||||
} |
@ -1,391 +1,435 @@
|
||||
import { Component, OnInit, Inject, ViewChild } from "@angular/core"; |
||||
import { HttpClient } from "@angular/common/http"; |
||||
import { |
||||
MatDialog, |
||||
MatDialogRef, |
||||
MAT_DIALOG_DATA, |
||||
} from "@angular/material/dialog"; |
||||
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 { Component, OnInit, Inject, ViewChild } from '@angular/core'; |
||||
import { HttpClient } from '@angular/common/http'; |
||||
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; |
||||
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' |
||||
|
||||
@Component({ |
||||
selector: "app-realistic-picture-look", |
||||
templateUrl: "./realistic-picture.component.html", |
||||
styleUrls: ["./realistic-picture.component.scss"], |
||||
selector: 'app-realistic-picture-look', |
||||
templateUrl: './realistic-picture.component.html', |
||||
styleUrls: ['./realistic-picture.component.scss'] |
||||
}) |
||||
export class RealisticPictureLookComponent implements OnInit { |
||||
constructor( |
||||
private router: Router, |
||||
private route: ActivatedRoute, |
||||
private http: HttpClient, |
||||
public dialog: MatDialog, |
||||
public snackBar: MatSnackBar |
||||
) {} |
||||
uploader:FileUploader = new FileUploader({ //初始化上传文件
|
||||
url: `/api/Objects/PlanPlatform/${this.route.snapshot.queryParams.id}/RealImgs`,
|
||||
method: "POST",
|
||||
itemAlias: "uploadedfile", |
||||
autoUpload: false, |
||||
removeAfterUpload:true, |
||||
});
|
||||
|
||||
constructor(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.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(); |
||||
}); |
||||
let companyId = this.route.snapshot.queryParams.id |
||||
this.http.get('/api/RealityImageGroups',{params:{ |
||||
companyId : companyId |
||||
}}).subscribe((data:any)=>{ |
||||
this.allRealPicture = data |
||||
// this.allRealPicture.unshift({
|
||||
// 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"; //每页条数
|
||||
pageSizeOptions: number[] = [12]; //设置每页条数
|
||||
PageNumber: any; //第几页
|
||||
length:any; //共多少条数据
|
||||
pageSize:any = '12'; //每页条数
|
||||
pageSizeOptions: number[] = [12] //设置每页条数
|
||||
PageNumber:any; //第几页
|
||||
|
||||
//分页切换
|
||||
chagePage(e) { |
||||
this.PageNumber = e.pageIndex + 1; |
||||
this.getAllRealPicture(); |
||||
chagePage (e) { |
||||
this.PageNumber = e.pageIndex+1 |
||||
this.getAllRealPicture() |
||||
} |
||||
|
||||
//获取所有实景图分组
|
||||
getAllGrouping() { |
||||
let companyId = this.route.snapshot.queryParams.id; |
||||
this.http |
||||
.get("/api/RealityImageGroups", { |
||||
params: { |
||||
companyId: companyId, |
||||
}, |
||||
}) |
||||
.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, |
||||
} |
||||
); |
||||
console.log("文件夹列表", this.allRealPicture); |
||||
this.selectReal = data[this.selectRealIndex]; |
||||
}); |
||||
getAllGrouping () { |
||||
let companyId = this.route.snapshot.queryParams.id |
||||
this.http.get('/api/RealityImageGroups',{params:{ |
||||
companyId : companyId
|
||||
}}).subscribe((data:any)=>{ |
||||
this.allRealPicture = data |
||||
this.selectReal = data[this.selectRealIndex] |
||||
}) |
||||
} |
||||
|
||||
//获取实景图分组对应实景图
|
||||
getAllRealPicture() { |
||||
getAllRealPicture () { |
||||
if (this.selectReal) { |
||||
if (this.selectReal.id == "安全出口") { |
||||
let params = { |
||||
companyId: this.selectReal.companyId, |
||||
let data |
||||
if(this.selectReal.id == 'xxxxxxxxxxxxx'){ |
||||
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/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; |
||||
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/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 |
||||
); //图片名称后缀
|
||||
}); |
||||
}); |
||||
} |
||||
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; |
||||
this.isDownload = false; |
||||
this.downloadList = []; |
||||
this.getAllRealPicture(); |
||||
this.selectReal = e |
||||
this.selectRealIndex = index |
||||
this.isDownload = false |
||||
this.downloadList = [] |
||||
this.getAllRealPicture() |
||||
} |
||||
} |
||||
|
||||
//选择批量下载
|
||||
download() { |
||||
this.isDownload = !this.isDownload; |
||||
if (!this.isDownload) { |
||||
//取消批量下载时数组清空
|
||||
this.allImages.forEach((element) => { |
||||
element.checked = false; |
||||
}); |
||||
this.downloadList = []; |
||||
//选择批量下载
|
||||
download () { |
||||
this.isDownload = !this.isDownload |
||||
if (!this.isDownload) { //取消批量下载时数组清空
|
||||
this.allImages.forEach(element => {element.checked = false}); |
||||
this.downloadList = [] |
||||
} |
||||
} |
||||
|
||||
|
||||
// 预览图片---批量选择图片
|
||||
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 |
||||
); |
||||
} |
||||
} else { |
||||
//预览图片
|
||||
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)} |
||||
} else { //预览图片
|
||||
let data = { |
||||
selectReal: this.selectReal, |
||||
allImages: this.allImages, |
||||
imgIndex: index, |
||||
}; |
||||
let dialogRef = this.dialog.open(previewImg3, { data }); |
||||
dialogRef.afterClosed().subscribe(); |
||||
selectReal:this.selectReal, |
||||
allImages:this.allImages, |
||||
imgIndex: index} |
||||
let dialogRef = this.dialog.open(previewImg3, |
||||
{data}); |
||||
dialogRef.afterClosed().subscribe();
|
||||
} |
||||
|
||||
} |
||||
|
||||
//新建实景图文件
|
||||
addReal() {} |
||||
addReal () { |
||||
|
||||
} |
||||
|
||||
//编辑实景图文件
|
||||
editReal() {} |
||||
editReal () { |
||||
|
||||
} |
||||
|
||||
//删除实景图文件
|
||||
delete() { |
||||
let companyId = this.route.snapshot.queryParams.id; |
||||
delete () { |
||||
let companyId = this.route.snapshot.queryParams.id |
||||
if (this.selectReal) { |
||||
let isDelete = confirm("您确定要删除吗"); |
||||
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.allRealPicture = data; |
||||
this.selectReal = data[this.selectRealIndex]; |
||||
this.allImages = []; |
||||
this.getAllRealPicture(); |
||||
}); |
||||
}); |
||||
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 = [] |
||||
this.getAllRealPicture() |
||||
}) |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
//实景图修改
|
||||
preservationImg(e) { |
||||
preservationImg (e) { |
||||
let data = { |
||||
id: e.id, |
||||
name: e.nameStart + e.nameEnd, |
||||
imageUrl: e.imageUrl, |
||||
realityImageGroupId: e.realityImageGroupId, |
||||
}; |
||||
this.http.put(`/api/RealityImages/${e.id}`, data).subscribe((data) => { |
||||
this.getAllRealPicture(); |
||||
id:e.id, |
||||
name:e.nameStart+e.nameEnd, |
||||
imageUrl:e.imageUrl, |
||||
realityImageGroupId:e.realityImageGroupId |
||||
} |
||||
this.http.put(`/api/RealityImages/${e.id}`,data).subscribe(data=>{ |
||||
this.getAllRealPicture() |
||||
const config = new MatSnackBarConfig(); |
||||
config.verticalPosition = "top"; |
||||
config.duration = 3000; |
||||
this.snackBar.open("图片修改成功", "确定", config); |
||||
}); |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 3000 |
||||
this.snackBar.open('图片修改成功','确定',config); |
||||
}) |
||||
} |
||||
|
||||
//实景图删除
|
||||
deleteImg(e) { |
||||
let isDelete = confirm("您确定要删除吗"); |
||||
deleteImg (e) { |
||||
let isDelete = confirm('您确定要删除吗') |
||||
if (isDelete) { |
||||
this.http.delete(`/api/RealityImages/${e.id}`).subscribe((data) => { |
||||
this.getAllRealPicture(); |
||||
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.http |
||||
.delete(`/api/Objects/PlanPlatform/${e.imageUrl}`) |
||||
.subscribe((data) => {}); |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 3000 |
||||
this.snackBar.open('图片删除成功','确定',config); |
||||
}) |
||||
this.http.delete(`/api/Objects/PlanPlatform/${e.imageUrl}`).subscribe(data=>{}) |
||||
} |
||||
} |
||||
|
||||
isLoading: boolean = false; //loading加载
|
||||
|
||||
|
||||
|
||||
|
||||
isLoading:boolean = false; //loading加载
|
||||
//上传文件↓
|
||||
file:any; //上传的文件
|
||||
objectName:any; //上传对象名
|
||||
uploadId:any; //上传分块上传事件编号
|
||||
|
||||
//change选择文件
|
||||
uploadFile (e) { |
||||
if (this.selectReal) { |
||||
this.file = e.target.files[0] || null //上传的文件
|
||||
let URL = window.URL.createObjectURL(this.file) |
||||
var img = new Image() |
||||
img.src = URL |
||||
let that = this |
||||
img.onload = function () { |
||||
if(img.width>=4096 || img.height>=5000 ){
|
||||
const config = new MatSnackBarConfig(); |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 3000 |
||||
that.snackBar.open('请选择分辨率小于4096*5000的图片','确定',config); |
||||
that.uploader.clearQueue(); //清空input控件文件
|
||||
(<HTMLInputElement>document.getElementById('uploadFile')).value = null //清空input框缓存
|
||||
}else{ that.startUploading() } |
||||
} //onload
|
||||
} else { |
||||
const config = new MatSnackBarConfig(); |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 3000 |
||||
this.snackBar.open('请选择或创建实景图文件夹','确定',config); |
||||
this.uploader.clearQueue(); //清空input控件文件
|
||||
(<HTMLInputElement>document.getElementById('uploadFile')).value = null //清空input框缓存
|
||||
} |
||||
} |
||||
|
||||
//上传文件
|
||||
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时
|
||||
this.uploader.queue[0].upload();//开始上传
|
||||
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 && 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.objectName = data.objectName |
||||
this.uploadId = data.uploadId |
||||
this.subsectionUploading() |
||||
}) |
||||
} |
||||
|
||||
} |
||||
|
||||
PartNumberETag:any=[]; //每次返回需要保存的信息
|
||||
//开始分段上传
|
||||
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循环
|
||||
|
||||
} |
||||
|
||||
//完成分块上传
|
||||
endUploading () { |
||||
let data = this.PartNumberETag |
||||
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 =[] //清空保存返回的信息
|
||||
}) |
||||
} |
||||
|
||||
//上传图片成功后获取url地址发送请求创建实景图
|
||||
addRealImg () { |
||||
let data = { |
||||
name: this.file.name, |
||||
imageUrl:this.objectName, |
||||
realityImageGroupId: this.selectReal.id, |
||||
} |
||||
this.http.post('/api/RealityImages',data).subscribe(data=>{ |
||||
(<HTMLInputElement>document.getElementById('uploadFile')).value = null //清空input框缓存
|
||||
this.getAllRealPicture() |
||||
const config = new MatSnackBarConfig(); |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 3000 |
||||
this.snackBar.open('图片上传成功','确定',config); |
||||
}) |
||||
} |
||||
|
||||
|
||||
|
||||
//批量下载↓
|
||||
//开始下载
|
||||
async batchDownload() { |
||||
if (this.downloadList.length) { |
||||
//开始批量循环下载
|
||||
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) => { |
||||
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); |
||||
document.body.appendChild(link); |
||||
link.click(); |
||||
result("success"); |
||||
}); |
||||
}); |
||||
if (i == this.downloadList.length - 1) { |
||||
//判断是否下载完毕
|
||||
this.isLoading = false; |
||||
this.isDownload = false; |
||||
this.allImages.forEach((element) => { |
||||
element.checked = false; |
||||
}); |
||||
this.downloadList = []; |
||||
} |
||||
async batchDownload () { |
||||
if (this.downloadList.length) { //开始批量循环下载
|
||||
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=>{
|
||||
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); |
||||
document.body.appendChild(link); |
||||
link.click(); |
||||
result('success')}) |
||||
}) |
||||
if(i == this.downloadList.length-1) { //判断是否下载完毕
|
||||
this.isLoading = false |
||||
this.isDownload = false |
||||
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); |
||||
} |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 3000 |
||||
this.snackBar.open('请选择图片','确定',config);} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
//预览图片组件
|
||||
@Component({ |
||||
selector: "app-previewImg", |
||||
templateUrl: "./previewImg.html", |
||||
styleUrls: ["./realistic-picture.component.scss"], |
||||
selector: 'app-previewImg', |
||||
templateUrl: './previewImg.html', |
||||
styleUrls: ['./realistic-picture.component.scss'] |
||||
}) |
||||
export class previewImg3 { |
||||
constructor( |
||||
private http: HttpClient, |
||||
public dialog: MatDialog, |
||||
public dialogRef: MatDialogRef<previewImg3>, |
||||
@Inject(MAT_DIALOG_DATA) public data |
||||
) {} |
||||
testSwiper: Swiper; |
||||
|
||||
constructor(private http:HttpClient,public dialog: MatDialog,public dialogRef: MatDialogRef<previewImg3>, |
||||
@Inject(MAT_DIALOG_DATA) public data) { } |
||||
testSwiper: Swiper; |
||||
|
||||
ngOnInit(): void { |
||||
this.allImages = this.data.allImages; |
||||
this.allImages.forEach((element) => { |
||||
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地址
|
||||
this.allImages = this.data.allImages |
||||
this.allImages.forEach(element => { |
||||
if( 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地址
|
||||
} |
||||
}); |
||||
} |
||||
|
||||
ngAfterViewInit() { |
||||
this.testSwiper = new Swiper(".swiper-container", { |
||||
this.testSwiper = new Swiper('.swiper-container', { |
||||
lazy: true, |
||||
initialSlide: this.data.imgIndex, |
||||
direction: "horizontal", |
||||
direction: 'horizontal', |
||||
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} |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,20 +1,20 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
||||
|
||||
import { AppKeyComponent } from './app-key.component'; |
||||
import { LoginComponent } from './login.component'; |
||||
|
||||
describe('AppKeyComponent', () => { |
||||
let component: AppKeyComponent; |
||||
let fixture: ComponentFixture<AppKeyComponent>; |
||||
describe('LoginComponent', () => { |
||||
let component: LoginComponent; |
||||
let fixture: ComponentFixture<LoginComponent>; |
||||
|
||||
beforeEach(async(() => { |
||||
TestBed.configureTestingModule({ |
||||
declarations: [ AppKeyComponent ] |
||||
declarations: [ LoginComponent ] |
||||
}) |
||||
.compileComponents(); |
||||
})); |
||||
|
||||
beforeEach(() => { |
||||
fixture = TestBed.createComponent(AppKeyComponent); |
||||
fixture = TestBed.createComponent(LoginComponent); |
||||
component = fixture.componentInstance; |
||||
fixture.detectChanges(); |
||||
}); |
@ -1,187 +1,148 @@
|
||||
import { ApplicationRef, Component, ComponentFactoryResolver, Injector, OnInit } from '@angular/core'; |
||||
import { Component, OnInit } from '@angular/core'; |
||||
import { HttpClient } from '@angular/common/http' |
||||
import { Data } from '../../interface' |
||||
import { Router, ActivatedRoute } from '@angular/router' |
||||
import { CacheTokenService } from '../../http-interceptors/cache-token.service'//引入服务
|
||||
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; |
||||
import { MatDialog, MatDialogRef } from '@angular/material/dialog'; |
||||
import { Router,ActivatedRoute } from '@angular/router' |
||||
import {CacheTokenService} from '../../http-interceptors/cache-token.service'//引入服务
|
||||
import { MatSnackBar,MatSnackBarConfig } from '@angular/material/snack-bar'; |
||||
import { MatDialog,MatDialogRef } from '@angular/material/dialog'; |
||||
|
||||
|
||||
|
||||
@Component({ |
||||
selector: 'app-login', |
||||
templateUrl: './login.component.html', |
||||
styleUrls: ['./login.component.scss'], |
||||
selector: 'app-login', |
||||
templateUrl: './login.component.html', |
||||
styleUrls: ['./login.component.scss'], |
||||
}) |
||||
export class LoginComponent implements OnInit { |
||||
|
||||
constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, public token: CacheTokenService, public snackBar: MatSnackBar, public dialog: MatDialog) { |
||||
|
||||
} |
||||
|
||||
ngOnInit() { |
||||
this.automaticLogin() |
||||
} |
||||
|
||||
errmsg: string = '' |
||||
|
||||
onSubmit(e) { |
||||
this.http.post('/api/Account/SignIn', { |
||||
name: e.name, |
||||
password: e.password |
||||
}).subscribe((data: Data) => { |
||||
sessionStorage.setItem("level", data.level); |
||||
sessionStorage.setItem("token", data.token); |
||||
sessionStorage.setItem("refreshToken", data.refreshToken); |
||||
sessionStorage.setItem("isDefaultPassword", data.isDefaultPassword);//是否需要修改默认密码
|
||||
this.http.get('/api/Account/NavMenus').subscribe((data: any) => { |
||||
let isHave = data.find(item => { return item.url == "/statisticanalysis/home" }) |
||||
let isHaveGis = data.find(item => { return item.url == "/gis" }) |
||||
if (isHave) { |
||||
this.router.navigate([`/statisticanalysis/home`]) |
||||
this.dialogChangePassword() |
||||
return |
||||
} else if (isHaveGis) { |
||||
this.router.navigate([`/gis`]) |
||||
this.dialogChangePassword() |
||||
return |
||||
} else if (data.length != 0) { |
||||
this.router.navigate([`/keyUnit`]) |
||||
this.dialogChangePassword() |
||||
return |
||||
} else { |
||||
this.snackBar.open('该用户角色未分配任何菜单', '确定', { |
||||
duration: 3000 |
||||
}); |
||||
} |
||||
|
||||
}) |
||||
if (e.notlogin) { //7天免登录时
|
||||
localStorage.setItem("isnologin", "true") |
||||
localStorage.setItem("token", data.token) |
||||
localStorage.setItem("refreshToken", data.refreshToken) |
||||
} |
||||
//调用服务中的function刷新token
|
||||
this.token.startUp() |
||||
}, |
||||
(err) => { this.errmsg = err } |
||||
) |
||||
} |
||||
|
||||
|
||||
dialogChangePassword() { |
||||
if (sessionStorage.getItem('isDefaultPassword') == 'true') { |
||||
let dialogRef = this.dialog.open(ChangepasswordComponent2, |
||||
{ width: '348px' }); |
||||
|
||||
dialogRef.afterClosed().subscribe((data) => { |
||||
sessionStorage.setItem('isDefaultPassword', 'false') |
||||
// this.lookUpdateData()
|
||||
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,public token:CacheTokenService,public snackBar: MatSnackBar, public dialog: MatDialog) { } |
||||
|
||||
ngOnInit() { |
||||
this.automaticLogin() |
||||
} |
||||
|
||||
errmsg :string = '' |
||||
|
||||
onSubmit(e){ |
||||
this.http.post('/api/Account/SignIn',{ |
||||
name: e.name, |
||||
password: e.password}).subscribe( (data: Data) => {
|
||||
sessionStorage.setItem("level",data.level); |
||||
sessionStorage.setItem("token",data.token); |
||||
sessionStorage.setItem("refreshToken",data.refreshToken); |
||||
sessionStorage.setItem("isDefaultPassword",data.isDefaultPassword);//是否需要修改默认密码
|
||||
this.http.get('/api/Account/NavMenus').subscribe((data:any)=>{ |
||||
let isHave = data.find(item=>{ return item.url == "/statisticanalysis/home"}) |
||||
let isHaveGis = data.find(item=>{ return item.url == "/gis"}) |
||||
if (isHave) { |
||||
this.router.navigate([`/statisticanalysis/home`]) |
||||
this.dialogChangePassword() |
||||
return
|
||||
} else if(isHaveGis){ |
||||
this.router.navigate([`/gis`]) |
||||
this.dialogChangePassword() |
||||
return
|
||||
} else if(data.length != 0){ |
||||
this.router.navigate([`/keyUnit`]) |
||||
this.dialogChangePassword() |
||||
return
|
||||
data.forEach(item => { |
||||
if(item.url){ |
||||
|
||||
}
|
||||
}); |
||||
} else { |
||||
// this.lookUpdateData()
|
||||
} |
||||
} |
||||
|
||||
//查看更新内容
|
||||
lookUpdateData() { |
||||
|
||||
|
||||
|
||||
let dialogRef = this.dialog.open(lookUpdateDataComponent, |
||||
{ width: '668px' }); |
||||
|
||||
dialogRef.afterClosed().subscribe((data) => { |
||||
|
||||
}); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
//7天免登录自动登录
|
||||
automaticLogin() { |
||||
let isNoLogin = localStorage.getItem("isnologin") |
||||
if (isNoLogin) { //7天免登录时
|
||||
let token = localStorage.getItem("token"); |
||||
let refreshToken = localStorage.getItem("refreshToken"); |
||||
this.http.post('/api/Account/RefreshToken', { |
||||
token: token, |
||||
refreshToken: refreshToken |
||||
}).subscribe((data: any) => { |
||||
sessionStorage.setItem("level", data.level); |
||||
sessionStorage.setItem("token", data.token); |
||||
sessionStorage.setItem("refreshToken", data.refreshToken); |
||||
this.token.startUp() |
||||
this.router.navigate(['/keyUnit']) |
||||
this.snackBar.open('已自动登录', '确定', { duration: 3000 }); |
||||
}) |
||||
} //if
|
||||
|
||||
} |
||||
|
||||
//打开弹窗
|
||||
open() { |
||||
this.snackBar.open('请联系管理员', '确定', { |
||||
duration: 3000 |
||||
}); |
||||
}else{ |
||||
this.snackBar.open('该用户角色未分配任何菜单', '确定', { |
||||
duration: 3000 |
||||
}); |
||||
} |
||||
|
||||
}) |
||||
if(e.notlogin){ //7天免登录时
|
||||
localStorage.setItem("isnologin","true") |
||||
localStorage.setItem("token",data.token) |
||||
localStorage.setItem("refreshToken",data.refreshToken) } |
||||
//调用服务中的function刷新token
|
||||
this.token.startUp() |
||||
}, |
||||
(err) => {this.errmsg = err} |
||||
) |
||||
} |
||||
|
||||
|
||||
dialogChangePassword(){ |
||||
if(sessionStorage.getItem('isDefaultPassword') == 'true'){ |
||||
let dialogRef = this.dialog.open(ChangepasswordComponent2,
|
||||
{width:'348px'}); |
||||
|
||||
dialogRef.afterClosed().subscribe((data)=>{ |
||||
sessionStorage.setItem('isDefaultPassword','false') |
||||
});
|
||||
} |
||||
} |
||||
//7天免登录自动登录
|
||||
automaticLogin () { |
||||
let isNoLogin = localStorage.getItem("isnologin") |
||||
if (isNoLogin) { //7天免登录时
|
||||
let token = localStorage.getItem("token"); |
||||
let refreshToken = localStorage.getItem("refreshToken"); |
||||
this.http.post('/api/Account/RefreshToken', { |
||||
token: token, |
||||
refreshToken: refreshToken}).subscribe((data:any)=>{ |
||||
sessionStorage.setItem("level",data.level); |
||||
sessionStorage.setItem("token",data.token); |
||||
sessionStorage.setItem("refreshToken",data.refreshToken); |
||||
this.token.startUp() |
||||
this.router.navigate(['/keyUnit']) |
||||
this.snackBar.open('已自动登录', '确定', {duration: 3000}); |
||||
}) |
||||
} //if
|
||||
|
||||
} |
||||
|
||||
//打开弹窗
|
||||
open () { |
||||
this.snackBar.open('请联系管理员', '确定', { |
||||
duration: 3000 |
||||
}); |
||||
} |
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
@Component({ |
||||
selector: 'app-changepassword', |
||||
templateUrl: './changePassword.html', |
||||
styleUrls: ['./changepassword.scss'] |
||||
selector: 'app-changepassword', |
||||
templateUrl: './changePassword.html', |
||||
styleUrls: ['./changepassword.scss'] |
||||
}) |
||||
|
||||
export class ChangepasswordComponent2 implements OnInit { |
||||
|
||||
constructor(private http: HttpClient, public snackBar: MatSnackBar, |
||||
public dialogRef: MatDialogRef<ChangepasswordComponent2>) { } |
||||
|
||||
ngOnInit() { |
||||
} |
||||
errmsg: string = '' |
||||
|
||||
onSubmit(e) { |
||||
this.http.put( |
||||
'/api/Account/Password', |
||||
{ |
||||
newPassword: e.newPassword, |
||||
password: 'SHya119!@' |
||||
} |
||||
).subscribe(data => { |
||||
this.dialogRef.close(data); |
||||
const config = new MatSnackBarConfig(); |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 3000 |
||||
this.snackBar.open('密码修改成功', '确定', config); |
||||
}, (err) => { this.errmsg = err } |
||||
) |
||||
} |
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
@Component({ |
||||
selector: 'app-lookUpdateData', |
||||
templateUrl: './lookUpdateData.html', |
||||
styleUrls: ['./lookUpdateData.scss'] |
||||
}) |
||||
|
||||
export class lookUpdateDataComponent implements OnInit { |
||||
|
||||
constructor(private http: HttpClient, public snackBar: MatSnackBar, |
||||
public dialogRef: MatDialogRef<lookUpdateDataComponent>) { } |
||||
|
||||
ngOnInit() { |
||||
} |
||||
onSubmit(e) { |
||||
|
||||
} |
||||
|
||||
constructor(private http:HttpClient,public snackBar: MatSnackBar, |
||||
public dialogRef: MatDialogRef<ChangepasswordComponent2>) { } |
||||
|
||||
ngOnInit() { |
||||
} |
||||
errmsg :string = '' |
||||
|
||||
onSubmit(e){ |
||||
this.http.put( |
||||
'/api/Account/Password',
|
||||
{ |
||||
newPassword: e.newPassword, |
||||
password: 'SHya119!@' |
||||
} |
||||
).subscribe(data=> { |
||||
this.dialogRef.close(data); |
||||
const config = new MatSnackBarConfig(); |
||||
config.verticalPosition = 'top'; |
||||
config.duration = 3000 |
||||
this.snackBar.open('密码修改成功','确定',config); |
||||
},(err) => |
||||
{this.errmsg = err} |
||||
) |
||||
} |
||||
|
||||
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
<p style="text-align: center;">更新公告</p> |
||||
<p>更新内容如下:</p> |
||||
<p>1.单位管理模块现在支持按照重点单位和一般单位进行查询。</p> |
||||
<p>2.在单位管理模块的列表中,我们将“关注/取消”改为了“重点单位/一般单位”,并且重点单位名称前面有红星标记,一般单位前面无标记,以便更好地区分。</p> |
||||
<p>3.在预案管理模块中,我们去掉了预案列表中的编制级别,并且增加了按照重点单位和一般单位进行查询的功能。在预案列表中的单位名称前面增加了一列显示栏,区分重点单位和一般单位。</p> |
||||
<p>4.预案列表页面中,预案的名称支持手动修改,同时转在线导入文档转成功后名称去掉 “转在线编制”。 </p> |
||||
<p>5.点击系统右上角的“?”下载重点单位设置说明,以便更好地了解如何设置重点单位。 </p> |
@ -1,95 +1,63 @@
|
||||
import { Pipe, PipeTransform } from "@angular/core"; |
||||
import { |
||||
isno, |
||||
PlanTypeEnum, |
||||
AuditStatusEnum, |
||||
PlanLevelEnum, |
||||
PlanAuditStatusEnum, |
||||
} from "../interface"; |
||||
@Pipe({ name: "isno" }) |
||||
import { Pipe, PipeTransform } from '@angular/core'; |
||||
import { isno, PlanTypeEnum, AuditStatusEnum, PlanLevelEnum } from '../interface' |
||||
@Pipe({ name: 'isno' }) |
||||
export class IsnoPipe implements PipeTransform { |
||||
transform(value: boolean): string { |
||||
if (value) { |
||||
var x = 0; |
||||
} else { |
||||
x = 1; |
||||
transform(value: boolean): string { |
||||
if (value) { |
||||
var x = 0 |
||||
} else { |
||||
x = 1 |
||||
} |
||||
return isno[x] |
||||
} |
||||
return isno[x]; |
||||
} |
||||
} |
||||
@Pipe({ name: "plantype" }) |
||||
@Pipe({ name: 'plantype' }) |
||||
export class PlanType implements PipeTransform { |
||||
transform(value: number): string { |
||||
return PlanTypeEnum[value]; |
||||
} |
||||
transform(value: number): string { |
||||
return PlanTypeEnum[value] |
||||
} |
||||
} |
||||
|
||||
@Pipe({ name: "auditsatus" }) |
||||
@Pipe({ name: 'auditsatus' }) |
||||
export class AuditSatus implements PipeTransform { |
||||
transform(value: number): string { |
||||
return AuditStatusEnum[value]; |
||||
} |
||||
transform(value: number): string { |
||||
return AuditStatusEnum[value] |
||||
} |
||||
} |
||||
@Pipe({ name: "planlevel" }) |
||||
@Pipe({ name: 'planlevel' }) |
||||
export class PlanLevel implements PipeTransform { |
||||
transform(value: number): string { |
||||
return PlanLevelEnum[value]; |
||||
} |
||||
transform(value: number): string { |
||||
return PlanLevelEnum[value] |
||||
} |
||||
} |
||||
|
||||
@Pipe({ name: "state" }) |
||||
@Pipe({ name: 'state' }) |
||||
export class state implements PipeTransform { |
||||
transform(value: number): string { |
||||
if (value == 3) { |
||||
return "维护中"; |
||||
} else if (value == 4) { |
||||
return "维护通过审核"; |
||||
} else if (value == 5) { |
||||
return "维护驳回审核"; |
||||
} else { |
||||
return "未维护"; |
||||
transform(value: number): string { |
||||
if (value == 3) { |
||||
return '维护中' |
||||
} else if (value == 4) { |
||||
return '维护通过审核' |
||||
} else if (value == 5) { |
||||
return '维护驳回审核' |
||||
} else { |
||||
return '未维护' |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Pipe({ name: "auditState" }) |
||||
export class auditState implements PipeTransform { |
||||
transform(value: number): string { |
||||
return PlanAuditStatusEnum[value]; |
||||
} |
||||
} |
||||
|
||||
@Pipe({ name: "differentContentTitle" }) |
||||
@Pipe({ name: 'differentContentTitle' }) |
||||
export class differentContentTitle implements PipeTransform { |
||||
transform(value: string): string { |
||||
if (typeof value == "boolean" && value) { |
||||
return "是"; |
||||
} else if (typeof value == "boolean" && !value) { |
||||
return "否"; |
||||
} else if (JSON.stringify(value) == "{}") { |
||||
return "空"; |
||||
} else if (!value) { |
||||
return "空"; |
||||
} else { |
||||
return value; |
||||
} |
||||
} |
||||
} |
||||
@Pipe({ name: "yuan" }) |
||||
export class yuan implements PipeTransform { |
||||
transform(value: string): string { |
||||
if (value == "LevelOne") { |
||||
return "一级预案"; |
||||
} else if (value == "LevelTwo") { |
||||
return "二级预案"; |
||||
} else if (value == "LevelThree") { |
||||
return "三级预案"; |
||||
} else if (value == "LevelFour") { |
||||
return "四级预案"; |
||||
} else if (value == "LevelFive") { |
||||
return "五级预案"; |
||||
} else if (value == "PlanText") { |
||||
return "文本预案"; |
||||
transform(value: string): string { |
||||
if (typeof (value) == 'boolean' && value) { |
||||
return '是' |
||||
} else if (typeof (value) == 'boolean' && !value) { |
||||
return '否' |
||||
} else if (!value) { |
||||
return '空' |
||||
} else { |
||||
return value |
||||
} |
||||
|
||||
} |
||||
} |
||||
} |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue