chenjingyu 4 years ago
parent
commit
823e6b2356
  1. 5
      angular.json
  2. 1
      src/app/app-routing.module.ts
  3. 36
      src/app/app.component.ts
  4. 12
      src/app/app.module.ts
  5. 84
      src/app/data-collection/data-collection.module.ts
  6. 108
      src/app/data-collection/fire-force/fire-force.component.ts
  7. 106
      src/app/data-collection/linkage-forces/linkage-forces.component.ts
  8. 80
      src/app/data-collection/water-collection/water-collection.component.ts
  9. 41
      src/app/external-links-plan/external-links-plan.component.ts
  10. 1316
      src/app/gis-management/gis-labeling/gis-labeling.component.ts
  11. 2
      src/app/home/home.component.ts
  12. 21
      src/app/key-unit/basicinfo-look/basicinfo.component.ts
  13. 93
      src/app/key-unit/basicinfo/basicinfo.component.ts
  14. 12
      src/app/key-unit/function-division/function-division.component.ts
  15. 36
      src/app/key-unit/router-gis/router-gis.component.ts
  16. 19
      src/app/key-unit/six-familiarity/six-familiarity.component.ts
  17. 92
      src/app/key-unit/water-road/water-road.component.ts
  18. 96
      src/app/pages/login/login.component.ts
  19. 6
      src/app/pages/pages-routing.module.ts
  20. 2
      src/app/pages/pages.component.html
  21. 47
      src/app/plan-audit/fireforce-audit/fireforce-audit.component.ts
  22. 47
      src/app/plan-audit/linkageforces-audit/linkageforces-audit.component.ts
  23. 314
      src/app/plan-audit/plan-record/plan-record.component.ts
  24. 48
      src/app/plan-audit/wait-examineer/wait-examineer.component.ts
  25. 14
      src/app/plan-audit/water-audit/water-audit.component.ts
  26. 2
      src/app/plan-management/entry-plan-look/entry-plan-look.component.html
  27. 68
      src/app/plan-management/entry-plan-look/entry-plan-look.component.ts
  28. 492
      src/app/plan-management/meet-plan/meet-plan.component.ts
  29. 493
      src/app/plan-management/onetwo-entry-plan/onetwo-entry-plan.component.ts
  30. 240
      src/app/plan-management/open-plan/open-plan.component.ts
  31. 334
      src/app/plan-management/pass-plan/pass-plan.component.ts
  32. 479
      src/app/plan-management/type-plan/type-plan.component.ts
  33. 30
      src/app/searchComponent.service.ts
  34. 114
      src/app/statistic-analysis/all-plan/all-plan.component.ts
  35. 476
      src/app/statistic-analysis/home/home.component.ts
  36. 46
      src/app/statistic-analysis/plan-analysis-by-synthesis/plan-analysis-by-synthesis.component.ts
  37. 39
      src/app/tabbar/tabbar.component.html
  38. 8
      src/app/tabbar/tabbar.component.ts
  39. 4
      src/app/ui/collection-tools-plan/addPlaneFigure.html
  40. 611
      src/app/ui/collection-tools-plan/collection-tools.component.ts
  41. 2
      src/app/working-area/model/axImageShape.ts
  42. 23
      src/app/working-area/model/axShape.ts
  43. 4
      src/app/working-area/working-area.component.ts
  44. 13
      src/assets/kmap/Kmap.config.json
  45. 81
      src/assets/kmap/kmap-service-main-kd.js
  46. 14
      src/index.html
  47. 3
      src/modules/map/declare/component/SearchDownListPlugins/SearchDownList.html
  48. 16
      src/modules/map/declare/component/SearchDownListPlugins/SearchDownList.scss
  49. 53
      src/modules/map/declare/component/SearchDownListPlugins/SearchDownList.ts
  50. 135
      src/modules/map/declare/factory.ts
  51. 488
      src/modules/map/declare/gaode-map.ts
  52. 910
      src/modules/map/declare/keda-map.ts
  53. 43
      src/modules/map/declare/map-tools.ts
  54. 200
      src/modules/map/declare/map.d.ts
  55. 12
      src/styles.scss
  56. 5
      tsconfig.json

5
angular.json

@ -35,6 +35,7 @@
"scripts": [ "scripts": [
"node_modules/echarts/dist/echarts.js", "node_modules/echarts/dist/echarts.js",
"src/assets/mTokenK1/mToken_K1.js", "src/assets/mTokenK1/mToken_K1.js",
"src/assets/kmap/kmap-service-main-kd.js",
"./node_modules/swiper/js/swiper.min.js", "./node_modules/swiper/js/swiper.min.js",
"src/assets/chartstheme/westeros.js", "src/assets/chartstheme/westeros.js",
"src/assets/chartstheme/walden.js", "src/assets/chartstheme/walden.js",
@ -62,8 +63,8 @@
"budgets": [ "budgets": [
{ {
"type": "initial", "type": "initial",
"maximumWarning": "8mb", "maximumWarning": "18mb",
"maximumError": "8mb" "maximumError": "18mb"
}, },
{ {
"type": "anyComponentStyle", "type": "anyComponentStyle",

1
src/app/app-routing.module.ts

@ -30,7 +30,6 @@ const routes: Routes = [
{path:'keyUnit',loadChildren:() => import('./key-unit/key-unit.module').then(m => m.KeyUnitModule)}, {path:'keyUnit',loadChildren:() => import('./key-unit/key-unit.module').then(m => m.KeyUnitModule)},
{path:'planManagement',loadChildren:() => import('./plan-management/plan-management.module').then(m => m.PlanManagementModule)}, {path:'planManagement',loadChildren:() => import('./plan-management/plan-management.module').then(m => m.PlanManagementModule)},
{path:'planAudit',loadChildren:() => import('./plan-audit/plan-audit.module').then(m => m.PlanAuditModule)}, {path:'planAudit',loadChildren:() => import('./plan-audit/plan-audit.module').then(m => m.PlanAuditModule)},
{path:'home',loadChildren:() => import('./pages/pages.module').then(m => m.PagesModule)},
{path:'visualization',component: HomeComponent}, {path:'visualization',component: HomeComponent},
{path:'gis',loadChildren:() => import('./gis-management/gis-management.module').then(m => m.GISManagementModule)}, {path:'gis',loadChildren:() => import('./gis-management/gis-management.module').then(m => m.GISManagementModule)},
{path:'statisticanalysis',loadChildren:() => import('./statistic-analysis/statistic-analysis.module').then(m => m.StatisticAnalysisModule)}, {path:'statisticanalysis',loadChildren:() => import('./statistic-analysis/statistic-analysis.module').then(m => m.StatisticAnalysisModule)},

36
src/app/app.component.ts

@ -1,10 +1,10 @@
import { Component } from '@angular/core'; import { Component, Inject, Injector } from '@angular/core';
import { HttpClient } from '@angular/common/http' import { HttpClient } from '@angular/common/http'
import { Data } from './interface' import { Data } from './interface'
import { Router,ActivatedRoute } from '@angular/router' import { Router, ActivatedRoute } from '@angular/router'
import {CacheTokenService} from './http-interceptors/cache-token.service'//引入服务 import { CacheTokenService } from './http-interceptors/cache-token.service'//引入服务
import { MaskLayerService } from './mask-layer.service'; import { MaskLayerService } from './mask-layer.service';
import * as global from 'globals';
@Component({ @Component({
@ -14,43 +14,45 @@ import { MaskLayerService } from './mask-layer.service';
}) })
export class AppComponent { export class AppComponent {
constructor(private maskLayerService:MaskLayerService,private http:HttpClient,private router:Router,public token:CacheTokenService) { } constructor(private maskLayerService: MaskLayerService, private http: HttpClient, private router: Router, public token: CacheTokenService, private injector: Injector) {
global.injector = injector;
}
isMaskLayerShow:boolean = false isMaskLayerShow: boolean = false
ngOnInit(): void { ngOnInit(): void {
//监听遮罩层 //监听遮罩层
this.maskLayerService.getMessage().subscribe((message: any)=>{ this.maskLayerService.getMessage().subscribe((message: any) => {
this.isMaskLayerShow = message this.isMaskLayerShow = message
}); });
var token = sessionStorage.getItem("token"); var token = sessionStorage.getItem("token");
var refreshToken = sessionStorage.getItem("refreshToken"); var refreshToken = sessionStorage.getItem("refreshToken");
if(token && refreshToken) { if (token && refreshToken) {
this.http.post('/api/Account/RefreshToken', { this.http.post('/api/Account/RefreshToken', {
token: token, token: token,
refreshToken: refreshToken refreshToken: refreshToken
}).subscribe((data: Data) => { }).subscribe((data: Data) => {
sessionStorage.setItem("level",data.level); sessionStorage.setItem("level", data.level);
sessionStorage.setItem("token",data.token); sessionStorage.setItem("token", data.token);
sessionStorage.setItem("refreshToken",data.refreshToken); sessionStorage.setItem("refreshToken", data.refreshToken);
this.token.startUp() this.token.startUp()
}) })
} }
// console.log(1234,document.documentElement.clientWidth) // console.log(1234,document.documentElement.clientWidth)
function addMeta(name,content){//手动添加mate标签 function addMeta(name, content) {//手动添加mate标签
let meta = document.createElement('meta'); let meta = document.createElement('meta');
    meta.content=content; meta.content = content;
    meta.name=name; meta.name = name;
    document.getElementsByTagName('head')[0].appendChild(meta); document.getElementsByTagName('head')[0].appendChild(meta);
} }
if(document.documentElement.clientWidth < 800){ if (document.documentElement.clientWidth < 800) {
addMeta('viewport','initial-scale=0.5, maximum-scale=0.5, minimum-scale=0.5, user-scalable=no,uc-fitscreen=yes,viewport-fit=cover') addMeta('viewport', 'initial-scale=0.5, maximum-scale=0.5, minimum-scale=0.5, user-scalable=no,uc-fitscreen=yes,viewport-fit=cover')
} }
} }

12
src/app/app.module.ts

@ -2,7 +2,7 @@ import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatIconModule } from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon';
@ -15,8 +15,8 @@ import { FormsModule } from '@angular/forms';
import { UiModule } from './ui/ui.module'; import { UiModule } from './ui/ui.module';
import { HttpClientModule } from '@angular/common/http'; import { HttpClientModule } from '@angular/common/http';
import { httpInterceptorProviders } from './http-interceptors/index' import { httpInterceptorProviders } from './http-interceptors/index'
import {CacheTokenService} from './http-interceptors/cache-token.service' import { CacheTokenService } from './http-interceptors/cache-token.service'
import { TreeService } from'./http-interceptors/tree.service'; import { TreeService } from './http-interceptors/tree.service';
import { MTokenK1Component } from './m-token-k1/m-token-k1.component' //K1秘钥 import { MTokenK1Component } from './m-token-k1/m-token-k1.component' //K1秘钥
import { CountdownModule } from 'ngx-countdown'; //倒计时插件 import { CountdownModule } from 'ngx-countdown'; //倒计时插件
import { GISManagementModule } from './gis-management/gis-management.module'; import { GISManagementModule } from './gis-management/gis-management.module';
@ -24,6 +24,7 @@ import { DataCollectionModule } from './data-collection/data-collection.module';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { TestComponent } from './test/test.component'; import { TestComponent } from './test/test.component';
import { ExternalLinksPlanComponent } from './external-links-plan/external-links-plan.component'; import { ExternalLinksPlanComponent } from './external-links-plan/external-links-plan.component';
import { SearchDownList } from '../modules/map/declare/component/SearchDownListPlugins/SearchDownList';
@NgModule({ @NgModule({
declarations: [ declarations: [
@ -31,7 +32,8 @@ import { ExternalLinksPlanComponent } from './external-links-plan/external-links
HomeComponent, HomeComponent,
MTokenK1Component, MTokenK1Component,
TestComponent, TestComponent,
ExternalLinksPlanComponent ExternalLinksPlanComponent,
SearchDownList
], ],
imports: [ imports: [
BrowserModule, BrowserModule,
@ -51,7 +53,7 @@ import { ExternalLinksPlanComponent } from './external-links-plan/external-links
MatProgressSpinnerModule, MatProgressSpinnerModule,
UiModule UiModule
], ],
providers: [httpInterceptorProviders, CacheTokenService,TreeService], providers: [httpInterceptorProviders, CacheTokenService, TreeService],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { } export class AppModule { }

84
src/app/data-collection/data-collection.module.ts

@ -1,46 +1,46 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import {A11yModule} from '@angular/cdk/a11y'; import { A11yModule } from '@angular/cdk/a11y';
import {DragDropModule} from '@angular/cdk/drag-drop'; import { DragDropModule } from '@angular/cdk/drag-drop';
import {PortalModule} from '@angular/cdk/portal'; import { PortalModule } from '@angular/cdk/portal';
import {ScrollingModule} from '@angular/cdk/scrolling'; import { ScrollingModule } from '@angular/cdk/scrolling';
import {CdkStepperModule} from '@angular/cdk/stepper'; import { CdkStepperModule } from '@angular/cdk/stepper';
import {CdkTableModule} from '@angular/cdk/table'; import { CdkTableModule } from '@angular/cdk/table';
import {CdkTreeModule} from '@angular/cdk/tree'; import { CdkTreeModule } from '@angular/cdk/tree';
import {MatAutocompleteModule} from '@angular/material/autocomplete'; import { MatAutocompleteModule } from '@angular/material/autocomplete';
import {MatBadgeModule} from '@angular/material/badge'; import { MatBadgeModule } from '@angular/material/badge';
import {MatBottomSheetModule} from '@angular/material/bottom-sheet'; import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
import {MatButtonModule} from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
import {MatButtonToggleModule} from '@angular/material/button-toggle'; import { MatButtonToggleModule } from '@angular/material/button-toggle';
import {MatCardModule} from '@angular/material/card'; import { MatCardModule } from '@angular/material/card';
import {MatCheckboxModule} from '@angular/material/checkbox'; import { MatCheckboxModule } from '@angular/material/checkbox';
import {MatChipsModule} from '@angular/material/chips'; import { MatChipsModule } from '@angular/material/chips';
import {MatStepperModule} from '@angular/material/stepper'; import { MatStepperModule } from '@angular/material/stepper';
import {MatDatepickerModule} from '@angular/material/datepicker'; import { MatDatepickerModule } from '@angular/material/datepicker';
import {MatDialogModule} from '@angular/material/dialog'; import { MatDialogModule } from '@angular/material/dialog';
import {MatDividerModule} from '@angular/material/divider'; import { MatDividerModule } from '@angular/material/divider';
import {MatExpansionModule} from '@angular/material/expansion'; import { MatExpansionModule } from '@angular/material/expansion';
import {MatGridListModule} from '@angular/material/grid-list'; import { MatGridListModule } from '@angular/material/grid-list';
import {MatIconModule} from '@angular/material/icon'; import { MatIconModule } from '@angular/material/icon';
import {MatInputModule} from '@angular/material/input'; import { MatInputModule } from '@angular/material/input';
import {MatListModule} from '@angular/material/list'; import { MatListModule } from '@angular/material/list';
import {MatMenuModule} from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
import {MatNativeDateModule, MatRippleModule, MatOption} from '@angular/material/core'; import { MatNativeDateModule, MatRippleModule, MatOption } from '@angular/material/core';
import {MatPaginatorModule} from '@angular/material/paginator'; import { MatPaginatorModule } from '@angular/material/paginator';
import {MatProgressBarModule} from '@angular/material/progress-bar'; import { MatProgressBarModule } from '@angular/material/progress-bar';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import {MatRadioModule} from '@angular/material/radio'; import { MatRadioModule } from '@angular/material/radio';
import {MatSelectModule} from '@angular/material/select'; import { MatSelectModule } from '@angular/material/select';
import {MatSidenavModule} from '@angular/material/sidenav'; import { MatSidenavModule } from '@angular/material/sidenav';
import {MatSliderModule} from '@angular/material/slider'; import { MatSliderModule } from '@angular/material/slider';
import {MatSlideToggleModule} from '@angular/material/slide-toggle'; import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import {MatSnackBarModule} from '@angular/material/snack-bar'; import { MatSnackBarModule } from '@angular/material/snack-bar';
import {MatSortModule} from '@angular/material/sort'; import { MatSortModule } from '@angular/material/sort';
import {MatTableModule} from '@angular/material/table'; import { MatTableModule } from '@angular/material/table';
import {MatTabsModule} from '@angular/material/tabs'; import { MatTabsModule } from '@angular/material/tabs';
import {MatToolbarModule} from '@angular/material/toolbar'; import { MatToolbarModule } from '@angular/material/toolbar';
import {MatTooltipModule} from '@angular/material/tooltip'; import { MatTooltipModule } from '@angular/material/tooltip';
import {MatTreeModule} from '@angular/material/tree'; import { MatTreeModule } from '@angular/material/tree';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { DataCollectionRoutingModule } from './data-collection.routing'; import { DataCollectionRoutingModule } from './data-collection.routing';
import { AddWater, WaterCollectionComponent } from './water-collection/water-collection.component'; import { AddWater, WaterCollectionComponent } from './water-collection/water-collection.component';
@ -49,7 +49,7 @@ import { AddLinkageForce, LinkageForcesComponent, ViewDetails2 } from './linkage
import { NzTreeModule } from 'ng-zorro-antd/tree'; import { NzTreeModule } from 'ng-zorro-antd/tree';
@NgModule({ @NgModule({
declarations: [WaterCollectionComponent, FireForceComponent, LinkageForcesComponent,AddWater,AddFireForce,ViewDetails,AddLinkageForce,ViewDetails2], declarations: [WaterCollectionComponent, FireForceComponent, LinkageForcesComponent, AddWater, AddFireForce, ViewDetails, AddLinkageForce, ViewDetails2],
imports: [ imports: [
CommonModule, CommonModule,
A11yModule, A11yModule,

108
src/app/data-collection/fire-force/fire-force.component.ts

@ -6,11 +6,12 @@ import { Component, OnInit } from '@angular/core';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'; import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree';
import { MapFactory } from '@src/modules/map/declare/factory';
import { IMap, IMarker, IMarkerCluster, IPlaceSearch } from '@src/modules/map/declare/map';
import { Console } from 'console'; import { Console } from 'console';
import { TreeService } from 'src/app/http-interceptors/tree.service'; import { TreeService } from 'src/app/http-interceptors/tree.service';
import Viewer from 'viewerjs' import Viewer from 'viewerjs'
declare var CryptoJS declare var CryptoJS
declare var AMap: any;
@Component({ @Component({
selector: 'app-fire-force', selector: 'app-fire-force',
@ -66,7 +67,7 @@ export class FireForceComponent implements OnInit {
} }
} }
//循环渲染出所有力量markers //循环渲染出所有力量markers
cluster:any //力量聚合实例 cluster:IMarkerCluster //力量聚合实例
createMarker(list){ createMarker(list){
let markerArrcluster = [] let markerArrcluster = []
this.cluster ? this.cluster.setData([]) : null this.cluster ? this.cluster.setData([]) : null
@ -91,11 +92,13 @@ export class FireForceComponent implements OnInit {
data : item data : item
}) : null }) : null
}) })
this.map.plugin(["AMap.MarkerClusterer"],() => {
var gridSize = 60 var gridSize = 60
var count = markerArrcluster.length; var count = markerArrcluster.length;
var _renderClusterMarker = function (context) {
var factor = Math.pow(context.count / count, 1 / 18); let render = MapFactory.RenderClusterMarkerInstance();
render.contentRender = (contextCount) => {
var factor = Math.pow(contextCount / count, 1 / 18);
var div = document.createElement('div'); var div = document.createElement('div');
var Hue = 180 - factor * 180; var Hue = 180 - factor * 180;
var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)';
@ -103,29 +106,32 @@ export class FireForceComponent implements OnInit {
var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; var borderColor = 'hsla(' + Hue + ',100%,40%,1)';
var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; var shadowColor = 'hsla(' + Hue + ',100%,90%,1)';
div.style.backgroundColor = bgColor; div.style.backgroundColor = bgColor;
var size = Math.round(30 + Math.pow(context.count / count, 1 / 5) * 20); var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20);
div.style.width = div.style.height = size + 'px'; div.style.width = div.style.height = size + 'px';
div.style.border = 'solid 1px ' + borderColor; div.style.border = 'solid 1px ' + borderColor;
div.style.borderRadius = size / 2 + 'px'; div.style.borderRadius = size / 2 + 'px';
div.style.boxShadow = '0 0 5px ' + shadowColor; div.style.boxShadow = '0 0 5px ' + shadowColor;
div.innerHTML = context.count; div.innerHTML = contextCount;
div.style.lineHeight = size + 'px'; div.style.lineHeight = size + 'px';
div.style.color = fontColor; div.style.color = fontColor;
div.style.fontSize = '14px'; div.style.fontSize = '14px';
div.style.textAlign = 'center'; div.style.textAlign = 'center';
context.marker.setOffset(new AMap.Pixel(-size / 2, -size / 2)); return div;
context.marker.setContent(div) };
render.pixelRender = (contextCount) => {
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20);
return MapFactory.PixelInstance(-size / 2, -size / 2);
}; };
var _renderMarker = (context)=>{
var content = `<img class='clusterImgCollection' src="${context.data[0].image}" alt="">`; render.contentNonRender = (src) => {
var offset = new AMap.Pixel(-15, -15); return `<img class='clusterImgCollection' src="${src}" alt="">`;
context.marker.setContent(content) };
context.marker.setOffset(offset) render.pixelNonRender = () => {
return MapFactory.PixelInstance(-15, -15);
} }
this.cluster = new AMap.MarkerCluster(this.map, markerArrcluster, { this.cluster = MapFactory.MarkerClusterInstance(this.map, markerArrcluster, {
gridSize: gridSize, // 设置网格像素大小 gridSize: gridSize, // 设置网格像素大小
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式 render: render //自定义聚合点样式, 自定义非聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
}); });
this.cluster.on('click',(e)=>{ this.cluster.on('click',(e)=>{
if(e.clusterData.length == 1){ if(e.clusterData.length == 1){
@ -185,8 +191,8 @@ export class FireForceComponent implements OnInit {
} }
}) })
} }
}) },this)
});
} }
ngOnInit(): void { ngOnInit(): void {
@ -317,10 +323,10 @@ export class FireForceComponent implements OnInit {
if(data.location && data.location.x){//如果已经标注单位坐标 if(data.location && data.location.x){//如果已经标注单位坐标
this.positionLngLat = data.location this.positionLngLat = data.location
this.map.setCenter([data.location.x,data.location.y]); this.map.setCenter([data.location.x,data.location.y]);
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [data.location.x,data.location.y], position: [data.location.x,data.location.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}) })
// 将 markers 添加到地图 // 将 markers 添加到地图
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -793,8 +799,8 @@ export class FireForceComponent implements OnInit {
this.newPositionMarker ? this.map.remove(this.newPositionMarker) : null this.newPositionMarker ? this.map.remove(this.newPositionMarker) : null
this.isGisTopBox = false this.isGisTopBox = false
} }
map:any map:IMap
placeSearch:any//构造地点查询类 placeSearch: IPlaceSearch//构造地点查询类
isMapLabel:boolean = false //是否已经标记坐标 isMapLabel:boolean = false //是否已经标记坐标
newPositionMarkerContent:any = newPositionMarkerContent:any =
'<div class="custom-content-marker">' + '<div class="custom-content-marker">' +
@ -806,9 +812,9 @@ export class FireForceComponent implements OnInit {
' <div class="btnbox"><img id="setPositionOk" src="/assets/images/ok.png"><span>|</span><img id="setPositionClose" src="/assets/images/close.png"></div>' + ' <div class="btnbox"><img id="setPositionOk" src="/assets/images/ok.png"><span>|</span><img id="setPositionClose" src="/assets/images/close.png"></div>' +
'</div>' '</div>'
//创建地图 //创建地图
newPositionMarker:any//坐标实例 newPositionMarker:IMarker//坐标实例
createMap(){ createMap(){
this.map = new AMap.Map('container', { this.map = MapFactory.MapInstance('container', {
zoom:12 zoom:12
}) })
this.map.setCity('上海市'); this.map.setCity('上海市');
@ -816,16 +822,14 @@ export class FireForceComponent implements OnInit {
var autoOptions = { var autoOptions = {
input: "tipinput" input: "tipinput"
}; };
AMap.plugin(['AMap.PlaceSearch','AMap.AutoComplete'], ()=>{ let auto = MapFactory.AutocompleteInstance(autoOptions,this);
let auto = new AMap.AutoComplete(autoOptions); this.placeSearch = MapFactory.PlaceSearchInstance(this); //构造地点查询类
this.placeSearch = new AMap.PlaceSearch(); //构造地点查询类
auto.on("select", (e)=>{ auto.on("select", (e)=>{
this.newPositionMarker.setPosition([e.poi.location.lng,e.poi.location.lat]) this.newPositionMarker.setPosition([e.poi.location.lng,e.poi.location.lat])
this.positionLngLat = {x: e.poi.location.lng, y: e.poi.location.lat} this.positionLngLat = {x: e.poi.location.lng, y: e.poi.location.lat}
this.map.setCenter([e.poi.location.lng,e.poi.location.lat]); //设置地图中心点 this.map.setCenter([e.poi.location.lng,e.poi.location.lat]); //设置地图中心点
});//注册监听,当选中某条记录时会触发 });//注册监听,当选中某条记录时会触发
});
} }
//点击位置 //点击位置
isGisTopBox:boolean = false // isGisTopBox:boolean = false //
@ -845,26 +849,26 @@ export class FireForceComponent implements OnInit {
}else{ }else{
center = this.map.getCenter(); //获取当前地图中心位置 center = this.map.getCenter(); //获取当前地图中心位置
} }
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
draggable: true, draggable: true,
position: center, position: center,
content: this.newPositionMarkerContentBtn, content: this.newPositionMarkerContentBtn,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.positionLngLat = {x: center.lng || center[0], y: center.lat || center[1]} this.positionLngLat = {x: center.lng || center[0], y: center.lat || center[1]}
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
this.isMapLabel = true this.isMapLabel = true
this.newPositionMarker.on('dragend', (e)=>{ this.newPositionMarker.on('dragend', (e)=>{
this.positionLngLat = {x: e.lnglat.lng, y: e.lnglat.lat} this.positionLngLat = {x: e.lnglat.lng, y: e.lnglat.lat}
}) },this)
//点击确定 //点击确定
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{ this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{
this.isGisTopBox = false this.isGisTopBox = false
this.map.remove(this.newPositionMarker) this.map.remove(this.newPositionMarker)
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.positionLngLat.x,this.positionLngLat.y], position: [this.positionLngLat.x,this.positionLngLat.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.atLastPositionLngLat = JSON.parse(JSON.stringify(this.positionLngLat)) this.atLastPositionLngLat = JSON.parse(JSON.stringify(this.positionLngLat))
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -878,10 +882,10 @@ export class FireForceComponent implements OnInit {
this.positionLngLat = {} this.positionLngLat = {}
this.atLastPositionLngLat = {} this.atLastPositionLngLat = {}
}else{ }else{
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.atLastPositionLngLat.x,this.atLastPositionLngLat.y], position: [this.atLastPositionLngLat.x,this.atLastPositionLngLat.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.map.setCenter([this.atLastPositionLngLat.x,this.atLastPositionLngLat.y]); //设置地图中心点 this.map.setCenter([this.atLastPositionLngLat.x,this.atLastPositionLngLat.y]); //设置地图中心点
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -891,10 +895,10 @@ export class FireForceComponent implements OnInit {
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'touchstart',(event)=>{ this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'touchstart',(event)=>{
this.isGisTopBox = false this.isGisTopBox = false
this.map.remove(this.newPositionMarker) this.map.remove(this.newPositionMarker)
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.positionLngLat.x,this.positionLngLat.y], position: [this.positionLngLat.x,this.positionLngLat.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.atLastPositionLngLat = JSON.parse(JSON.stringify(this.positionLngLat)) this.atLastPositionLngLat = JSON.parse(JSON.stringify(this.positionLngLat))
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -908,10 +912,10 @@ export class FireForceComponent implements OnInit {
this.positionLngLat = {} this.positionLngLat = {}
this.atLastPositionLngLat = {} this.atLastPositionLngLat = {}
}else{ }else{
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.atLastPositionLngLat.x,this.atLastPositionLngLat.y], position: [this.atLastPositionLngLat.x,this.atLastPositionLngLat.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.map.setCenter([this.atLastPositionLngLat.x,this.atLastPositionLngLat.y]); //设置地图中心点 this.map.setCenter([this.atLastPositionLngLat.x,this.atLastPositionLngLat.y]); //设置地图中心点
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -1143,25 +1147,13 @@ export class FireForceComponent implements OnInit {
} }
if(suffix == 'docx' || suffix == 'doc' || suffix == 'pdf'){ if(suffix == 'docx' || suffix == 'doc' || suffix == 'pdf'){
let fetchUrl = item.objectName let fetchUrl = item.objectName
let json={ if (suffix == 'docx' || suffix == 'doc') {
doc: { let arr = fetchUrl.split('.')
docId: new Date(), arr[arr.length - 1] = 'pdf'
title: item.fileName, window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
fetchUrl: `http://172.18.0.1:8000/api/Objects/PlanPlatform/`+fetchUrl }else if (suffix == 'pdf') {
}, window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
user: {
uid: "test",
nickName: "test",
avatar: "",
privilege: [
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
],
},
} }
var stringjson=JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
} }
if(suffix == 'mp4'){ if(suffix == 'mp4'){
const dialogRef = this.dialog.open(ViewDetails, {//调用open方法打开对话框并且携带参数过去 const dialogRef = this.dialog.open(ViewDetails, {//调用open方法打开对话框并且携带参数过去

106
src/app/data-collection/linkage-forces/linkage-forces.component.ts

@ -10,8 +10,10 @@ import { NzTreeNode } from 'ng-zorro-antd/tree';
import { TreeService } from 'src/app/http-interceptors/tree.service'; import { TreeService } from 'src/app/http-interceptors/tree.service';
import Viewer from 'viewerjs' import Viewer from 'viewerjs'
import Swiper from 'swiper'; import Swiper from 'swiper';
import { MapFactory } from '@src/modules/map/declare/factory';
import { IMap, IMarker } from '@src/modules/map/declare/map';
declare var CryptoJS declare var CryptoJS
declare var AMap: any;
@Component({ @Component({
selector: 'app-linkage-forces', selector: 'app-linkage-forces',
templateUrl: './linkage-forces.component.html', templateUrl: './linkage-forces.component.html',
@ -124,11 +126,13 @@ export class LinkageForcesComponent implements OnInit {
}) })
} }
}) })
this.map.plugin(["AMap.MarkerClusterer"],() => {
var gridSize = 60 var gridSize = 60
var count = markerArrcluster.length; var count = markerArrcluster.length;
var _renderClusterMarker = function (context) {
var factor = Math.pow(context.count / count, 1 / 18); let render = MapFactory.RenderClusterMarkerInstance();
render.contentRender = (contextCount) => {
var factor = Math.pow(contextCount / count, 1 / 18);
var div = document.createElement('div'); var div = document.createElement('div');
var Hue = 180 - factor * 180; var Hue = 180 - factor * 180;
var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)';
@ -136,29 +140,33 @@ export class LinkageForcesComponent implements OnInit {
var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; var borderColor = 'hsla(' + Hue + ',100%,40%,1)';
var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; var shadowColor = 'hsla(' + Hue + ',100%,90%,1)';
div.style.backgroundColor = bgColor; div.style.backgroundColor = bgColor;
var size = Math.round(30 + Math.pow(context.count / count, 1 / 5) * 20); var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20);
div.style.width = div.style.height = size + 'px'; div.style.width = div.style.height = size + 'px';
div.style.border = 'solid 1px ' + borderColor; div.style.border = 'solid 1px ' + borderColor;
div.style.borderRadius = size / 2 + 'px'; div.style.borderRadius = size / 2 + 'px';
div.style.boxShadow = '0 0 5px ' + shadowColor; div.style.boxShadow = '0 0 5px ' + shadowColor;
div.innerHTML = context.count; div.innerHTML = contextCount;
div.style.lineHeight = size + 'px'; div.style.lineHeight = size + 'px';
div.style.color = fontColor; div.style.color = fontColor;
div.style.fontSize = '14px'; div.style.fontSize = '14px';
div.style.textAlign = 'center'; div.style.textAlign = 'center';
context.marker.setOffset(new AMap.Pixel(-size / 2, -size / 2)); return div;
context.marker.setContent(div) };
render.pixelRender = (contextCount) => {
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20);
return MapFactory.PixelInstance(-size / 2, -size / 2);
}; };
var _renderMarker = (context)=> {
var content = `<img class='clusterImgCollection' src="${context.data[0].image}" alt="">`; render.contentNonRender = (src) => {
var offset = new AMap.Pixel(-15, -15); return `<img class='clusterImgCollection' src="${src}" alt="">`;
context.marker.setContent(content) };
context.marker.setOffset(offset) render.pixelNonRender = () => {
return MapFactory.PixelInstance(-15, -15);
} }
this.cluster = new AMap.MarkerCluster(this.map, markerArrcluster, {
this.cluster = MapFactory.MarkerClusterInstance(this.map, markerArrcluster, {
gridSize: gridSize, // 设置网格像素大小 gridSize: gridSize, // 设置网格像素大小
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式 render: render //自定义聚合点样式, 自定义非聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
}); });
this.cluster.on('click',(e)=>{ this.cluster.on('click',(e)=>{
if(e.clusterData.length == 1){ if(e.clusterData.length == 1){
@ -168,8 +176,8 @@ export class LinkageForcesComponent implements OnInit {
item.location?this.positionLngLat = item.location:null item.location?this.positionLngLat = item.location:null
this.AttachmentArr = JSON.parse(item.relevantInfomationData) this.AttachmentArr = JSON.parse(item.relevantInfomationData)
} }
}) },this)
});
} }
ngOnInit(): void { ngOnInit(): void {
@ -251,10 +259,10 @@ export class LinkageForcesComponent implements OnInit {
} }
if(item.location && item.location.x){//如果已经标注单位坐标 if(item.location && item.location.x){//如果已经标注单位坐标
this.map.setCenter([item.location.x,item.location.y]); this.map.setCenter([item.location.x,item.location.y]);
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [item.location.x,item.location.y], position: [item.location.x,item.location.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}) })
// 将 markers 添加到地图 // 将 markers 添加到地图
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -512,7 +520,7 @@ export class LinkageForcesComponent implements OnInit {
this.newPositionMarker ? this.map.remove(this.newPositionMarker) : null this.newPositionMarker ? this.map.remove(this.newPositionMarker) : null
this.isGisTopBox = false this.isGisTopBox = false
} }
map:any map:IMap
placeSearch:any//构造地点查询类 placeSearch:any//构造地点查询类
isMapLabel:boolean = false //是否已经标记坐标 isMapLabel:boolean = false //是否已经标记坐标
newPositionMarkerContent:any = newPositionMarkerContent:any =
@ -525,9 +533,9 @@ export class LinkageForcesComponent implements OnInit {
' <div class="btnbox"><img id="setPositionOk" src="/assets/images/ok.png"><span>|</span><img id="setPositionClose" src="/assets/images/close.png"></div>' + ' <div class="btnbox"><img id="setPositionOk" src="/assets/images/ok.png"><span>|</span><img id="setPositionClose" src="/assets/images/close.png"></div>' +
'</div>' '</div>'
//创建地图 //创建地图
newPositionMarker:any//坐标实例 newPositionMarker:IMarker//坐标实例
createMap(){ createMap(){
this.map = new AMap.Map('container', { this.map = MapFactory.MapInstance('container', {
zoom:12 zoom:12
}) })
this.map.setCity('上海市'); this.map.setCity('上海市');
@ -535,16 +543,14 @@ export class LinkageForcesComponent implements OnInit {
var autoOptions = { var autoOptions = {
input: "tipinput" input: "tipinput"
}; };
AMap.plugin(['AMap.PlaceSearch','AMap.AutoComplete'], ()=>{ let auto = MapFactory.AutocompleteInstance(autoOptions,this);
let auto = new AMap.AutoComplete(autoOptions); this.placeSearch = MapFactory.PlaceSearchInstance(this); //构造地点查询类
this.placeSearch = new AMap.PlaceSearch(); //构造地点查询类
auto.on("select", (e)=>{ auto.on("select", (e)=>{
this.newPositionMarker.setPosition([e.poi.location.lng,e.poi.location.lat]) this.newPositionMarker.setPosition([e.poi.location.lng,e.poi.location.lat])
this.positionLngLat = {x: e.poi.location.lng, y: e.poi.location.lat} this.positionLngLat = {x: e.poi.location.lng, y: e.poi.location.lat}
this.map.setCenter([e.poi.location.lng,e.poi.location.lat]); //设置地图中心点 this.map.setCenter([e.poi.location.lng,e.poi.location.lat]); //设置地图中心点
});//注册监听,当选中某条记录时会触发 });//注册监听,当选中某条记录时会触发
});
} }
//点击位置 //点击位置
isGisTopBox:boolean = false // isGisTopBox:boolean = false //
@ -564,26 +570,26 @@ export class LinkageForcesComponent implements OnInit {
}else{ }else{
center = this.map.getCenter(); //获取当前地图中心位置 center = this.map.getCenter(); //获取当前地图中心位置
} }
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
draggable: true, draggable: true,
position: center, position: center,
content: this.newPositionMarkerContentBtn, content: this.newPositionMarkerContentBtn,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.positionLngLat = {x: center.lng || center[0], y: center.lat || center[1]} this.positionLngLat = {x: center.lng || center[0], y: center.lat || center[1]}
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
this.isMapLabel = true this.isMapLabel = true
this.newPositionMarker.on('dragend', (e)=>{ this.newPositionMarker.on('dragend', (e)=>{
this.positionLngLat = {x: e.lnglat.lng, y: e.lnglat.lat} this.positionLngLat = {x: e.lnglat.lng, y: e.lnglat.lat}
}) },this)
//点击确定 //点击确定
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{ this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{
this.isGisTopBox = false this.isGisTopBox = false
this.map.remove(this.newPositionMarker) this.map.remove(this.newPositionMarker)
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.positionLngLat.x,this.positionLngLat.y], position: [this.positionLngLat.x,this.positionLngLat.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.atLastPositionLngLat = JSON.parse(JSON.stringify(this.positionLngLat)) this.atLastPositionLngLat = JSON.parse(JSON.stringify(this.positionLngLat))
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -597,10 +603,10 @@ export class LinkageForcesComponent implements OnInit {
this.positionLngLat = {} this.positionLngLat = {}
this.atLastPositionLngLat = {} this.atLastPositionLngLat = {}
}else{ }else{
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.atLastPositionLngLat.x,this.atLastPositionLngLat.y], position: [this.atLastPositionLngLat.x,this.atLastPositionLngLat.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.map.setCenter([this.atLastPositionLngLat.x,this.atLastPositionLngLat.y]); //设置地图中心点 this.map.setCenter([this.atLastPositionLngLat.x,this.atLastPositionLngLat.y]); //设置地图中心点
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -611,10 +617,10 @@ export class LinkageForcesComponent implements OnInit {
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'touchstart',(event)=>{ this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'touchstart',(event)=>{
this.isGisTopBox = false this.isGisTopBox = false
this.map.remove(this.newPositionMarker) this.map.remove(this.newPositionMarker)
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.positionLngLat.x,this.positionLngLat.y], position: [this.positionLngLat.x,this.positionLngLat.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.atLastPositionLngLat = JSON.parse(JSON.stringify(this.positionLngLat)) this.atLastPositionLngLat = JSON.parse(JSON.stringify(this.positionLngLat))
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -628,10 +634,10 @@ export class LinkageForcesComponent implements OnInit {
this.positionLngLat = {} this.positionLngLat = {}
this.atLastPositionLngLat = {} this.atLastPositionLngLat = {}
}else{ }else{
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.atLastPositionLngLat.x,this.atLastPositionLngLat.y], position: [this.atLastPositionLngLat.x,this.atLastPositionLngLat.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.map.setCenter([this.atLastPositionLngLat.x,this.atLastPositionLngLat.y]); //设置地图中心点 this.map.setCenter([this.atLastPositionLngLat.x,this.atLastPositionLngLat.y]); //设置地图中心点
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -867,25 +873,13 @@ export class LinkageForcesComponent implements OnInit {
} }
if(suffix == 'docx' || suffix == 'doc' || suffix == 'pdf'){ if(suffix == 'docx' || suffix == 'doc' || suffix == 'pdf'){
let fetchUrl = item.objectName let fetchUrl = item.objectName
let json={ if (suffix == 'docx' || suffix == 'doc') {
doc: { let arr = fetchUrl.split('.')
docId: new Date(), arr[arr.length - 1] = 'pdf'
title: item.fileName, window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
fetchUrl: `http://172.18.0.1:8000/api/Objects/PlanPlatform/`+fetchUrl }else if (suffix == 'pdf') {
}, window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
user: {
uid: "test",
nickName: "test",
avatar: "",
privilege: [
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
],
},
} }
var stringjson=JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
} }
if(suffix == 'mp4'){ if(suffix == 'mp4'){
const dialogRef = this.dialog.open(ViewDetails2, {//调用open方法打开对话框并且携带参数过去 const dialogRef = this.dialog.open(ViewDetails2, {//调用open方法打开对话框并且携带参数过去

80
src/app/data-collection/water-collection/water-collection.component.ts

@ -4,7 +4,8 @@ import { ElementRef } from '@angular/core';
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
declare var AMap: any; import { MapFactory } from '@src/modules/map/declare/factory';
import { IMap, IMarker } from '@src/modules/map/declare/map';
@Component({ @Component({
selector: 'app-water-collection', selector: 'app-water-collection',
@ -80,11 +81,13 @@ export class WaterCollectionComponent implements OnInit {
}) })
} }
}) })
this.map.plugin(["AMap.MarkerClusterer"],() => {
var gridSize = 60 var gridSize = 60
var count = markerArrcluster.length; var count = markerArrcluster.length;
var _renderClusterMarker = function (context) {
var factor = Math.pow(context.count / count, 1 / 18); let render = MapFactory.RenderClusterMarkerInstance();
render.contentRender = (contextCount) => {
var factor = Math.pow(contextCount / count, 1 / 18);
var div = document.createElement('div'); var div = document.createElement('div');
var Hue = 180 - factor * 180; var Hue = 180 - factor * 180;
var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)';
@ -92,29 +95,32 @@ export class WaterCollectionComponent implements OnInit {
var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; var borderColor = 'hsla(' + Hue + ',100%,40%,1)';
var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; var shadowColor = 'hsla(' + Hue + ',100%,90%,1)';
div.style.backgroundColor = bgColor; div.style.backgroundColor = bgColor;
var size = Math.round(30 + Math.pow(context.count / count, 1 / 5) * 20); var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20);
div.style.width = div.style.height = size + 'px'; div.style.width = div.style.height = size + 'px';
div.style.border = 'solid 1px ' + borderColor; div.style.border = 'solid 1px ' + borderColor;
div.style.borderRadius = size / 2 + 'px'; div.style.borderRadius = size / 2 + 'px';
div.style.boxShadow = '0 0 5px ' + shadowColor; div.style.boxShadow = '0 0 5px ' + shadowColor;
div.innerHTML = context.count; div.innerHTML = contextCount;
div.style.lineHeight = size + 'px'; div.style.lineHeight = size + 'px';
div.style.color = fontColor; div.style.color = fontColor;
div.style.fontSize = '14px'; div.style.fontSize = '14px';
div.style.textAlign = 'center'; div.style.textAlign = 'center';
context.marker.setOffset(new AMap.Pixel(-size / 2, -size / 2)); return div;
context.marker.setContent(div) };
render.pixelRender = (contextCount) => {
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20);
return MapFactory.PixelInstance(-size / 2, -size / 2);
};
render.contentNonRender = (src) => {
return `<img class='clusterImgCollection' src="${src}" alt="">`;
}; };
var _renderMarker = (context)=> { render.pixelNonRender = () => {
var content = `<img class='clusterImgCollection' src="${context.data[0].image}" alt="">`; return MapFactory.PixelInstance(-15, -15);
context.marker.setContent(content)
var offset = new AMap.Pixel(-15, -15);
context.marker.setOffset(offset)
} }
this.cluster = new AMap.MarkerCluster(this.map, markerArrcluster, { this.cluster = MapFactory.MarkerClusterInstance(this.map, markerArrcluster, {
gridSize: gridSize, // 设置网格像素大小 gridSize: gridSize, // 设置网格像素大小
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式 render: render //自定义聚合点样式, 自定义非聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
}); });
this.cluster.on('click',(e)=>{ this.cluster.on('click',(e)=>{
if(e.clusterData.length == 1){ if(e.clusterData.length == 1){
@ -129,8 +135,8 @@ export class WaterCollectionComponent implements OnInit {
item.waterSourceType == 2 && item.detailData ? this.naturalWaterData = JSON.parse(item.detailData) : null item.waterSourceType == 2 && item.detailData ? this.naturalWaterData = JSON.parse(item.detailData) : null
this.positionLngLat = item.location this.positionLngLat = item.location
} }
}) },this)
});
} }
ngOnInit(): void { ngOnInit(): void {
@ -226,10 +232,10 @@ export class WaterCollectionComponent implements OnInit {
if(item.location.x){//如果已经标注单位坐标 if(item.location.x){//如果已经标注单位坐标
// console.log(item) // console.log(item)
this.map.setCenter([item.location.x,item.location.y]); this.map.setCenter([item.location.x,item.location.y]);
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [item.location.x,item.location.y], position: [item.location.x,item.location.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}) })
// 将 markers 添加到地图 // 将 markers 添加到地图
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -518,7 +524,7 @@ export class WaterCollectionComponent implements OnInit {
this.newPositionMarker ? this.map.remove(this.newPositionMarker) : null this.newPositionMarker ? this.map.remove(this.newPositionMarker) : null
this.isGisTopBox = false this.isGisTopBox = false
} }
map:any map:IMap
placeSearch:any//构造地点查询类 placeSearch:any//构造地点查询类
isMapLabel:boolean = false //是否已经标记坐标 isMapLabel:boolean = false //是否已经标记坐标
newPositionMarkerContent:any = newPositionMarkerContent:any =
@ -531,9 +537,9 @@ export class WaterCollectionComponent implements OnInit {
' <div class="btnbox"><img id="setPositionOk" src="/assets/images/ok.png"><span>|</span><img id="setPositionClose" src="/assets/images/close.png"></div>' + ' <div class="btnbox"><img id="setPositionOk" src="/assets/images/ok.png"><span>|</span><img id="setPositionClose" src="/assets/images/close.png"></div>' +
'</div>' '</div>'
//创建地图 //创建地图
newPositionMarker:any//坐标实例 newPositionMarker:IMarker//坐标实例
createMap(){ createMap(){
this.map = new AMap.Map('container', { this.map = MapFactory.MapInstance('container', {
zoom:12 zoom:12
}) })
this.map.setCity('上海市'); this.map.setCity('上海市');
@ -541,16 +547,14 @@ export class WaterCollectionComponent implements OnInit {
var autoOptions = { var autoOptions = {
input: "tipinput" input: "tipinput"
}; };
AMap.plugin(['AMap.PlaceSearch','AMap.AutoComplete'], ()=>{ let auto = MapFactory.AutocompleteInstance(autoOptions,this);
let auto = new AMap.AutoComplete(autoOptions); this.placeSearch = MapFactory.PlaceSearchInstance(this); //构造地点查询类
this.placeSearch = new AMap.PlaceSearch(); //构造地点查询类
auto.on("select", (e)=>{ auto.on("select", (e)=>{
this.newPositionMarker.setPosition([e.poi.location.lng,e.poi.location.lat]) this.newPositionMarker.setPosition([e.poi.location.lng,e.poi.location.lat])
this.positionLngLat = {x: e.poi.location.lng, y: e.poi.location.lat} this.positionLngLat = {x: e.poi.location.lng, y: e.poi.location.lat}
this.map.setCenter([e.poi.location.lng,e.poi.location.lat]); //设置地图中心点 this.map.setCenter([e.poi.location.lng,e.poi.location.lat]); //设置地图中心点
});//注册监听,当选中某条记录时会触发 });//注册监听,当选中某条记录时会触发
});
} }
//点击位置 //点击位置
isGisTopBox:boolean = false // isGisTopBox:boolean = false //
@ -573,26 +577,26 @@ export class WaterCollectionComponent implements OnInit {
// console.log(3) // console.log(3)
center = this.map.getCenter(); //获取当前地图中心位置 center = this.map.getCenter(); //获取当前地图中心位置
} }
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
draggable: true, draggable: true,
position: center, position: center,
content: this.newPositionMarkerContentBtn, content: this.newPositionMarkerContentBtn,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.positionLngLat = {x: center.lng || center[0], y: center.lat || center[1]} this.positionLngLat = {x: center.lng || center[0], y: center.lat || center[1]}
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
this.isMapLabel = true this.isMapLabel = true
this.newPositionMarker.on('dragend', (e)=>{ this.newPositionMarker.on('dragend', (e)=>{
this.positionLngLat = {x: e.lnglat.lng, y: e.lnglat.lat} this.positionLngLat = {x: e.lnglat.lng, y: e.lnglat.lat}
}) },this)
//点击确定 //点击确定
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{ this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'click',(event)=>{
this.isGisTopBox = false this.isGisTopBox = false
this.map.remove(this.newPositionMarker) this.map.remove(this.newPositionMarker)
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.positionLngLat.x,this.positionLngLat.y], position: [this.positionLngLat.x,this.positionLngLat.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.atLastPositionLngLat = JSON.parse(JSON.stringify(this.positionLngLat)) this.atLastPositionLngLat = JSON.parse(JSON.stringify(this.positionLngLat))
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -606,10 +610,10 @@ export class WaterCollectionComponent implements OnInit {
this.positionLngLat = {} this.positionLngLat = {}
this.atLastPositionLngLat = {} this.atLastPositionLngLat = {}
}else{ }else{
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.atLastPositionLngLat.x,this.atLastPositionLngLat.y], position: [this.atLastPositionLngLat.x,this.atLastPositionLngLat.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.map.setCenter([this.atLastPositionLngLat.x,this.atLastPositionLngLat.y]); //设置地图中心点 this.map.setCenter([this.atLastPositionLngLat.x,this.atLastPositionLngLat.y]); //设置地图中心点
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -620,10 +624,10 @@ export class WaterCollectionComponent implements OnInit {
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'touchstart',(event)=>{ this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'),'touchstart',(event)=>{
this.isGisTopBox = false this.isGisTopBox = false
this.map.remove(this.newPositionMarker) this.map.remove(this.newPositionMarker)
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.positionLngLat.x,this.positionLngLat.y], position: [this.positionLngLat.x,this.positionLngLat.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.atLastPositionLngLat = JSON.parse(JSON.stringify(this.positionLngLat)) this.atLastPositionLngLat = JSON.parse(JSON.stringify(this.positionLngLat))
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -637,10 +641,10 @@ export class WaterCollectionComponent implements OnInit {
this.positionLngLat = {} this.positionLngLat = {}
this.atLastPositionLngLat = {} this.atLastPositionLngLat = {}
}else{ }else{
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.atLastPositionLngLat.x,this.atLastPositionLngLat.y], position: [this.atLastPositionLngLat.x,this.atLastPositionLngLat.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-15, -18) offset: MapFactory.PixelInstance(-15, -18)
}); });
this.map.setCenter([this.atLastPositionLngLat.x,this.atLastPositionLngLat.y]); //设置地图中心点 this.map.setCenter([this.atLastPositionLngLat.x,this.atLastPositionLngLat.y]); //设置地图中心点
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);

41
src/app/external-links-plan/external-links-plan.component.ts

@ -73,38 +73,17 @@ export class ExternalLinksPlanComponent implements OnInit {
iframeSrc//毕生服务器链接 iframeSrc//毕生服务器链接
src//文件存储地址 src//文件存储地址
lookWord() { lookWord() {
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://172.18.0.1: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://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`
this.iframeSrc = this.sanitizer.bypassSecurityTrustResourceUrl(this.src);
this.showType = 0 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);
} }
companyData//当前公司信息 companyData//当前公司信息

1316
src/app/gis-management/gis-labeling/gis-labeling.component.ts

File diff suppressed because it is too large Load Diff

2
src/app/home/home.component.ts

@ -1,8 +1,6 @@
import { Component, OnInit, Renderer2, ElementRef } from '@angular/core'; import { Component, OnInit, Renderer2, ElementRef } from '@angular/core';
import { HttpClient } from '@angular/common/http' import { HttpClient } from '@angular/common/http'
declare var echarts: any; declare var echarts: any;
declare var AMap: any;
declare var AMapUI: any;

21
src/app/key-unit/basicinfo-look/basicinfo.component.ts

@ -5,21 +5,16 @@ import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { AbstractControl, FormControl, NG_VALIDATORS, Validator } from '@angular/forms'; import { AbstractControl, FormControl, NG_VALIDATORS, Validator } from '@angular/forms';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import format from 'date-fns/format';
import { TreeService } from '../../http-interceptors/tree.service' import { TreeService } from '../../http-interceptors/tree.service'
import { FileUploader, FileItem } from 'ng2-file-upload' import { FileUploader, FileItem } from 'ng2-file-upload'
import { DomSanitizer } from '@angular/platform-browser' import { DomSanitizer } from '@angular/platform-browser'
import { Injectable } from "@angular/core"
import { filter } from 'rxjs/operators';
import { async } from '@angular/core/testing';
import { MatTableDataSource } from '@angular/material/table';
import { isNgTemplate } from '@angular/compiler';
import * as _ from 'lodash'; import * as _ from 'lodash';
import Swiper from 'swiper'; import Swiper from 'swiper';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { StatisticsOfFireFightingFacilities } from '../basicinfo/basicinfo.component'; import { StatisticsOfFireFightingFacilities } from '../basicinfo/basicinfo.component';
import Viewer from 'viewerjs'; import Viewer from 'viewerjs';
declare var AMap: any; import { IMap, IMarker } from '@src/modules/map/declare/map';
import { MapFactory } from '@src/modules/map/declare/factory';
@Component({ @Component({
selector: 'app-basicinfo-look', selector: 'app-basicinfo-look',
@ -131,11 +126,11 @@ export class BasicinfoLookComponent implements OnInit {
isMapLabel: boolean isMapLabel: boolean
//地图标注位置 //地图标注位置
markerPosition: any = { x: 0, y: 0 }//单位坐标 markerPosition: any = { x: 0, y: 0 }//单位坐标
map: any //地图实例 map: IMap //地图实例
isGisTopBox: boolean = false//点击位置按钮 isGisTopBox: boolean = false//点击位置按钮
isGisTopBoxTwo: boolean = false//点击位置按钮 isGisTopBoxTwo: boolean = false//点击位置按钮
oldPositionMarker: any //旧位置marker实例 oldPositionMarker: IMarker //旧位置marker实例
newPositionMarker: any //新位置marker实例 newPositionMarker: IMarker //新位置marker实例
newPositionMarkerContent: any = newPositionMarkerContent: any =
'<div class="custom-content-marker">' + '<div class="custom-content-marker">' +
@ -145,7 +140,7 @@ export class BasicinfoLookComponent implements OnInit {
//初始化地图 //初始化地图
labelGis() { labelGis() {
this.map = new AMap.Map('container', { this.map = MapFactory.MapInstance('container', {
zoom: 12 zoom: 12
}) })
this.map.on('complete', () => { this.map.on('complete', () => {
@ -156,10 +151,10 @@ export class BasicinfoLookComponent implements OnInit {
if (this.isMapLabel) {//如果已经标注单位坐标 if (this.isMapLabel) {//如果已经标注单位坐标
// console.log('已标注单位位置') // console.log('已标注单位位置')
this.map.setCenter([this.unitinfo.location.x, this.unitinfo.location.y]); this.map.setCenter([this.unitinfo.location.x, this.unitinfo.location.y]);
this.oldPositionMarker = new AMap.Marker({ this.oldPositionMarker = MapFactory.MarkerInstance({
position: [this.unitinfo.location.x, this.unitinfo.location.y], position: [this.unitinfo.location.x, this.unitinfo.location.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-34, -36) offset: MapFactory.PixelInstance(-34, -36)
}) })
// 将 markers 添加到地图 // 将 markers 添加到地图
this.map.add(this.oldPositionMarker); this.map.add(this.oldPositionMarker);

93
src/app/key-unit/basicinfo/basicinfo.component.ts

@ -5,23 +5,19 @@ import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { AbstractControl, FormControl, NG_VALIDATORS, Validator } from '@angular/forms'; import { AbstractControl, FormControl, NG_VALIDATORS, Validator } from '@angular/forms';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import format from 'date-fns/format';
import { TreeService } from '../../http-interceptors/tree.service' import { TreeService } from '../../http-interceptors/tree.service'
import { FileUploader, FileItem } from 'ng2-file-upload' import { FileUploader, FileItem } from 'ng2-file-upload'
import { AddHouseInfo } from './addhouseinfo.component' import { AddHouseInfo } from './addhouseinfo.component'
import { DomSanitizer } from '@angular/platform-browser' import { DomSanitizer } from '@angular/platform-browser'
import { Injectable } from "@angular/core"
import { filter } from 'rxjs/operators';
import { async } from '@angular/core/testing';
import { MatTableDataSource } from '@angular/material/table';
import { isNgTemplate } from '@angular/compiler';
import * as _ from 'lodash'; import * as _ from 'lodash';
import Swiper from 'swiper'; import Swiper from 'swiper';
import { LookMaster } from './lookmaster.component' import { LookMaster } from './lookmaster.component'
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service'; import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-score.service';
declare var AMap: any;
import Viewer from 'viewerjs'; import Viewer from 'viewerjs';
import { IMap, IMarker, IPlaceSearch } from '@src/modules/map/declare/map';
import { MapFactory } from '@src/modules/map/declare/factory';
@Component({ @Component({
selector: 'app-basicinfo', selector: 'app-basicinfo',
templateUrl: './basicinfo.component.html', templateUrl: './basicinfo.component.html',
@ -129,11 +125,11 @@ export class BasicinfoComponent implements OnInit {
isMapLabel: boolean isMapLabel: boolean
//地图标注位置 //地图标注位置
markerPosition: any = { x: 0, y: 0 }//单位坐标 markerPosition: any = { x: 0, y: 0 }//单位坐标
map: any //地图实例 map: IMap //地图实例
isGisTopBox: boolean = false//点击位置按钮 isGisTopBox: boolean = false//点击位置按钮
isGisTopBoxTwo: boolean = false//点击位置按钮 isGisTopBoxTwo: boolean = false//点击位置按钮
oldPositionMarker: any //旧位置marker实例 oldPositionMarker: IMarker //旧位置marker实例
newPositionMarker: any //新位置marker实例 newPositionMarker: IMarker //新位置marker实例
newPositionMarkerContent: any = newPositionMarkerContent: any =
'<div class="custom-content-marker">' + '<div class="custom-content-marker">' +
@ -152,7 +148,7 @@ export class BasicinfoComponent implements OnInit {
'</div>' '</div>'
//初始化地图 //初始化地图
searchTitle: any//搜索内容 searchTitle: any//搜索内容
placeSearch: any//地址搜索类 placeSearch: IPlaceSearch//地址搜索类
search() { search() {
this.placeSearch.search(this.searchTitle, (status, result) => { this.placeSearch.search(this.searchTitle, (status, result) => {
// 搜索成功时,result即是对应的匹配数据 // 搜索成功时,result即是对应的匹配数据
@ -169,7 +165,7 @@ export class BasicinfoComponent implements OnInit {
} }
//初始化地图 //初始化地图
labelGis() { labelGis() {
this.map = new AMap.Map('container', { this.map = MapFactory.MapInstance('container', {
zoom: 12 zoom: 12
}) })
this.map.on('complete', () => { this.map.on('complete', () => {
@ -179,26 +175,21 @@ export class BasicinfoComponent implements OnInit {
var autoOptions = { var autoOptions = {
input: "tipinput" input: "tipinput"
}; };
AMap.plugin(['AMap.PlaceSearch', 'AMap.AutoComplete'], () => { var auto = MapFactory.AutocompleteInstance(autoOptions,this);
var auto = new AMap.AutoComplete(autoOptions); this.placeSearch = MapFactory.PlaceSearchInstance(this); //构造地点查询类
this.placeSearch = new AMap.PlaceSearch(); //构造地点查询类
auto.on("select", (e) => { auto.on("select", (e) => {
// console.log(e)
// console.log( this.newPositionMarker)
this.newPositionMarker.setPosition([e.poi.location.lng, e.poi.location.lat]) this.newPositionMarker.setPosition([e.poi.location.lng, e.poi.location.lat])
this.markerPosition2 = { x: e.poi.location.lng, y: e.poi.location.lat } this.markerPosition2 = { x: e.poi.location.lng, y: e.poi.location.lat }
this.map.setCenter([e.poi.location.lng, e.poi.location.lat]); //设置地图中心点 this.map.setCenter([e.poi.location.lng, e.poi.location.lat]); //设置地图中心点
});//注册监听,当选中某条记录时会触发 });//注册监听,当选中某条记录时会触发
});
if (this.isMapLabel) {//如果已经标注单位坐标 if (this.isMapLabel) {//如果已经标注单位坐标
// console.log('已标注单位位置') // console.log('已标注单位位置')
this.map.setCenter([this.unitinfo.location.x, this.unitinfo.location.y]); this.map.setCenter([this.unitinfo.location.x, this.unitinfo.location.y]);
this.oldPositionMarker = new AMap.Marker({ this.oldPositionMarker = MapFactory.MarkerInstance({
position: [this.unitinfo.location.x, this.unitinfo.location.y], position: [this.unitinfo.location.x, this.unitinfo.location.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-34, -36) offset: MapFactory.PixelInstance(-34, -36)
}) })
// 将 markers 添加到地图 // 将 markers 添加到地图
this.map.add(this.oldPositionMarker); this.map.add(this.oldPositionMarker);
@ -222,11 +213,11 @@ export class BasicinfoComponent implements OnInit {
this.newPositionMarker.setContent(this.oldPositionMarkerContent) this.newPositionMarker.setContent(this.oldPositionMarkerContent)
} }
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
draggable: true, draggable: true,
position: [this.markerPosition.x, this.markerPosition.y], position: [this.markerPosition.x, this.markerPosition.y],
content: this.newPositionMarkerContentBtn, content: this.newPositionMarkerContentBtn,
offset: new AMap.Pixel(-34, -36) offset: MapFactory.PixelInstance(-34, -36)
}); });
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -237,24 +228,24 @@ export class BasicinfoComponent implements OnInit {
this.markerPosition2 = { x: this.map.getCenter().lng, y: this.map.getCenter().lat } //获取当前地图中心位置 this.markerPosition2 = { x: this.map.getCenter().lng, y: this.map.getCenter().lat } //获取当前地图中心位置
} }
this.newPositionMarker.on('dragend', (e) => { this.newPositionMarker.on('dragend', (e) => {
let lnglat = this.map.containerToLngLat(e.pixel) let lnglat = this.newPositionMarker.getLngLatByMarkerEvent(this.map,e);
this.markerPosition2 = { x: lnglat.KL, y: lnglat.kT } this.markerPosition2 = { x: lnglat.KL, y: lnglat.kT }
// console.log(`${lnglat.KL},${lnglat.kT}`); // console.log(`${lnglat.KL},${lnglat.kT}`);
}) },this)
this.newPositionMarker.on('dragging', (e) => { this.newPositionMarker.on('dragging', (e) => {
//console.log('dragging',e) //console.log('dragging',e)
let lnglat = this.map.containerToLngLat(e.pixel) let lnglat = this.newPositionMarker.getLngLatByMarkerEvent(this.map,e);
this.newPositionMarker.setPosition(lnglat); this.newPositionMarker.setPosition(lnglat);
}) },this)
//点击确定 //点击确定
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'), 'click', (event) => { this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'), 'click', (event) => {
this.map.clearMap(); this.map.clearMap();
this.isGisTopBox = true this.isGisTopBox = true
this.isGisTopBoxTwo = false this.isGisTopBoxTwo = false
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.markerPosition2.x, this.markerPosition2.y], position: [this.markerPosition2.x, this.markerPosition2.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-34, -36) offset: MapFactory.PixelInstance(-34, -36)
}); });
this.markerPosition = this.markerPosition2 this.markerPosition = this.markerPosition2
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -264,10 +255,10 @@ export class BasicinfoComponent implements OnInit {
this.isGisTopBox = true this.isGisTopBox = true
this.isGisTopBoxTwo = false this.isGisTopBoxTwo = false
this.map.clearMap(); this.map.clearMap();
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.markerPosition.x, this.markerPosition.y], position: [this.markerPosition.x, this.markerPosition.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-34, -36) offset: MapFactory.PixelInstance(-34, -36)
}); });
this.map.setCenter([this.markerPosition.x, this.markerPosition.y]); //设置地图中心点 this.map.setCenter([this.markerPosition.x, this.markerPosition.y]); //设置地图中心点
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -277,10 +268,10 @@ export class BasicinfoComponent implements OnInit {
this.map.clearMap(); this.map.clearMap();
this.isGisTopBox = true this.isGisTopBox = true
this.isGisTopBoxTwo = false this.isGisTopBoxTwo = false
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.markerPosition2.x, this.markerPosition2.y], position: [this.markerPosition2.x, this.markerPosition2.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-34, -36) offset: MapFactory.PixelInstance(-34, -36)
}); });
this.markerPosition = this.markerPosition2 this.markerPosition = this.markerPosition2
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -290,10 +281,10 @@ export class BasicinfoComponent implements OnInit {
this.isGisTopBox = true this.isGisTopBox = true
this.isGisTopBoxTwo = false this.isGisTopBoxTwo = false
this.map.clearMap(); this.map.clearMap();
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.markerPosition.x, this.markerPosition.y], position: [this.markerPosition.x, this.markerPosition.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-34, -36) offset: MapFactory.PixelInstance(-34, -36)
}); });
this.map.setCenter([this.markerPosition.x, this.markerPosition.y]); //设置地图中心点 this.map.setCenter([this.markerPosition.x, this.markerPosition.y]); //设置地图中心点
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -311,11 +302,11 @@ export class BasicinfoComponent implements OnInit {
this.map.setCenter(center); this.map.setCenter(center);
} }
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
draggable: true, draggable: true,
position: center, position: center,
content: this.newPositionMarkerContentBtn, content: this.newPositionMarkerContentBtn,
offset: new AMap.Pixel(-34, -36) offset: MapFactory.PixelInstance(-34, -36)
}); });
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -326,25 +317,25 @@ export class BasicinfoComponent implements OnInit {
this.markerPosition2 = { x: this.map.getCenter().lng, y: this.map.getCenter().lat } //获取当前地图中心位置 this.markerPosition2 = { x: this.map.getCenter().lng, y: this.map.getCenter().lat } //获取当前地图中心位置
} }
this.newPositionMarker.on('dragend', (e) => { this.newPositionMarker.on('dragend', (e) => {
let lnglat = this.map.containerToLngLat(e.pixel) let lnglat = this.newPositionMarker.getLngLatByMarkerEvent(this.map,e)
this.markerPosition2 = { x: lnglat.KL, y: lnglat.kT } this.markerPosition2 = { x: lnglat.KL, y: lnglat.kT }
// console.log(`${lnglat.KL},${lnglat.kT}`); // console.log(`${lnglat.KL},${lnglat.kT}`);
}) },this)
this.newPositionMarker.on('dragging', (e) => { this.newPositionMarker.on('dragging', (e) => {
//console.log('dragging',e) //console.log('dragging',e)
let lnglat = this.map.containerToLngLat(e.pixel) let lnglat = this.newPositionMarker.getLngLatByMarkerEvent(this.map,e)
this.newPositionMarker.setPosition(lnglat); this.newPositionMarker.setPosition(lnglat);
}) },this)
//点击确定 //点击确定
this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'), 'click', (event) => { this.renderer2.listen(this.elementRef.nativeElement.querySelector('#setPositionOk'), 'click', (event) => {
this.isGisTopBox = true this.isGisTopBox = true
this.isGisTopBoxTwo = false this.isGisTopBoxTwo = false
this.markerPosition = this.markerPosition2 this.markerPosition = this.markerPosition2
this.map.clearMap(); this.map.clearMap();
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.markerPosition.x, this.markerPosition.y], position: [this.markerPosition.x, this.markerPosition.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-34, -36) offset: MapFactory.PixelInstance(-34, -36)
}); });
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
}) })
@ -353,10 +344,10 @@ export class BasicinfoComponent implements OnInit {
this.isGisTopBoxTwo = false this.isGisTopBoxTwo = false
this.markerPosition = this.markerPosition2 this.markerPosition = this.markerPosition2
this.map.clearMap(); this.map.clearMap();
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.markerPosition.x, this.markerPosition.y], position: [this.markerPosition.x, this.markerPosition.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-34, -36) offset: MapFactory.PixelInstance(-34, -36)
}); });
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
}) })
@ -365,10 +356,10 @@ export class BasicinfoComponent implements OnInit {
this.isGisTopBox = true this.isGisTopBox = true
this.isGisTopBoxTwo = false this.isGisTopBoxTwo = false
if (this.markerPosition.x && this.markerPosition.x != 0) {//说明之前标过点 if (this.markerPosition.x && this.markerPosition.x != 0) {//说明之前标过点
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.markerPosition.x, this.markerPosition.y], position: [this.markerPosition.x, this.markerPosition.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-34, -36) offset: MapFactory.PixelInstance(-34, -36)
}); });
this.map.setCenter([this.markerPosition.x, this.markerPosition.y]); //设置地图中心点 this.map.setCenter([this.markerPosition.x, this.markerPosition.y]); //设置地图中心点
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -379,10 +370,10 @@ export class BasicinfoComponent implements OnInit {
this.isGisTopBox = true this.isGisTopBox = true
this.isGisTopBoxTwo = false this.isGisTopBoxTwo = false
if (this.markerPosition.x && this.markerPosition.x != 0) {//说明之前标过点 if (this.markerPosition.x && this.markerPosition.x != 0) {//说明之前标过点
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.markerPosition.x, this.markerPosition.y], position: [this.markerPosition.x, this.markerPosition.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-34, -36) offset: MapFactory.PixelInstance(-34, -36)
}); });
this.map.setCenter([this.markerPosition.x, this.markerPosition.y]); //设置地图中心点 this.map.setCenter([this.markerPosition.x, this.markerPosition.y]); //设置地图中心点
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -1048,10 +1039,6 @@ export class BasicinfoComponent implements OnInit {
//提交建筑信息 //提交建筑信息
onSubmitBuildingInfo(value, item, key, invalid) { onSubmitBuildingInfo(value, item, key, invalid) {
// console.log(1,item)
// console.log(2,invalid)
// console.log(3,value)
// console.log(4,this.allunittype)
if (invalid) { if (invalid) {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';

12
src/app/key-unit/function-division/function-division.component.ts

@ -133,12 +133,14 @@ export class FunctionDivisionComponent implements OnInit {
noDataList = [] //没有 创建功能分区 的建筑 noDataList = [] //没有 创建功能分区 的建筑
//获得所有建筑的功能分区 //获得所有建筑的功能分区
getAllBuildingFunctionalZoning () { async getAllBuildingFunctionalZoning () {
this.selectBuildingFunctionalZoning = [] this.selectBuildingFunctionalZoning = []
this.allBuildingFunctionalZoning = [] this.allBuildingFunctionalZoning = []
this.noDataList = [] this.noDataList = []
this.allBuilding.forEach((element,index) => { for (let index = 0; index < this.allBuilding.length; index++) {
const element = this.allBuilding[index];
let data={buildingId: element.id} let data={buildingId: element.id}
await new Promise((resolve,reject)=>{
this.http.get(`/api/BuildingFunctionalDivisions`,{params:data}).subscribe((data:any)=>{ this.http.get(`/api/BuildingFunctionalDivisions`,{params:data}).subscribe((data:any)=>{
if (data.length) { if (data.length) {
element.functionalZoning = data element.functionalZoning = data
@ -149,8 +151,12 @@ export class FunctionDivisionComponent implements OnInit {
this.noDataList.push(false) this.noDataList.push(false)
} }
if (this.noDataList.length === this.allBuilding.length) { this.addVoluntarilyPartition() } if (this.noDataList.length === this.allBuilding.length) { this.addVoluntarilyPartition() }
resolve(data)
}) })
}); })
}
} }
// 没有 创建 建筑功能分区时 自动创建 // 没有 创建 建筑功能分区时 自动创建

36
src/app/key-unit/router-gis/router-gis.component.ts

@ -2,6 +2,8 @@ import { HttpClient } from '@angular/common/http';
import { Component, EventEmitter, NgZone, OnInit, Output } from '@angular/core'; import { Component, EventEmitter, NgZone, OnInit, Output } from '@angular/core';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { MapFactory } from '@src/modules/map/declare/factory';
import { IDriving, IMap } from '@src/modules/map/declare/map';
declare var AMap: any; declare var AMap: any;
@Component({ @Component({
@ -31,14 +33,14 @@ export class RouterGISComponent implements OnInit {
this.http.get(`/api/Companies/${this.route.snapshot.queryParams.id}`).subscribe((data:any)=>{ this.http.get(`/api/Companies/${this.route.snapshot.queryParams.id}`).subscribe((data:any)=>{
if (data.driveRouteStartPoint && data.driveRouteStartPoint.x && data.driveRouteStartPoint.y && data.driveRouteStartName) { //开始坐标 名称 if (data.driveRouteStartPoint && data.driveRouteStartPoint.x && data.driveRouteStartPoint.y && data.driveRouteStartName) { //开始坐标 名称
this.routeStart = data.driveRouteStartName this.routeStart = data.driveRouteStartName
this.startCoordinate = [data.driveRouteStartPoint.x,data.driveRouteStartPoint.y] this.startCoordinate = MapFactory.LngLatInstance(data.driveRouteStartPoint.x, data.driveRouteStartPoint.y)
} }
if (data.driveRouteEndPoint && data.driveRouteEndPoint.x && data.driveRouteEndPoint.y && data.driveRouteEndName) { //结束坐标 名称 if (data.driveRouteEndPoint && data.driveRouteEndPoint.x && data.driveRouteEndPoint.y && data.driveRouteEndName) { //结束坐标 名称
this.routeEnd = data.driveRouteEndName this.routeEnd = data.driveRouteEndName
this.endCoordinate = [data.driveRouteEndPoint.x,data.driveRouteEndPoint.y] this.endCoordinate = MapFactory.LngLatInstance(data.driveRouteEndPoint.x, data.driveRouteEndPoint.y)
} else if (data.location && data.location.x && data.location.y) { } else if (data.location && data.location.x && data.location.y) {
this.routeEnd = data.name this.routeEnd = data.name
this.endCoordinate = [data.location.x,data.location.y] this.endCoordinate = MapFactory.LngLatInstance(data.location.x, data.location.y)
} }
resolve('success') resolve('success')
}) //http }) //http
@ -88,29 +90,27 @@ export class RouterGISComponent implements OnInit {
//地图初始化 //地图初始化
mapInit () { mapInit () {
let that = this let that = this
var layer = new AMap.createDefaultLayer({ var layer = MapFactory.LayerInstance({
zooms:[3,20], //可见级别 zooms:[3,20], //可见级别
visible:true, //是否可见 visible:true, //是否可见
opacity:1, //透明度 opacity:1, //透明度
zIndex:0, //叠加层级 zIndex:0, //叠加层级
resizeEnable: true //是否监控地图容器尺寸变化, resizeEnable: true //是否监控地图容器尺寸变化,
}) })
that.map = new AMap.Map('map',{ that.map = MapFactory.MapInstance('map',{
layers:[layer], //当只想显示标准图层时layers属性可缺省, layers:[layer], //当只想显示标准图层时layers属性可缺省,
}); });
that.map.setCity('上海市'); that.map.setCity('上海市');
AMap.plugin('AMap.Driving', function() {
that.startCoordinate && that.endCoordinate? that.queryGISRoute() : null that.startCoordinate && that.endCoordinate? that.queryGISRoute() : null
})
} }
map:any; //地图实例 map:IMap; //地图实例
routeStart:any; //起点 routeStart:any; //起点
routeStartList:any = [] //起点 搜索结果 routeStartList:any = [] //起点 搜索结果
routeEnd:any; //终点 routeEnd:any; //终点
routeEndList:any = [] //终点 搜索结果 routeEndList:any = [] //终点 搜索结果
timeout:any; //延时器 timeout:any; //延时器
routeGIS:any; //查询结果 规划路线 routeGIS:IDriving; //查询结果 规划路线
selectType:boolean = true; //路线选择 推荐方案/躲避用拥堵 selectType:boolean = true; //路线选择 推荐方案/躲避用拥堵
routes:any = { distance: 0, time: 0, steps: [], };//导航查询结果 路线规划 routes:any = { distance: 0, time: 0, steps: [], };//导航查询结果 路线规划
startCoordinate:any//开始坐标 startCoordinate:any//开始坐标
@ -123,11 +123,10 @@ export class RouterGISComponent implements OnInit {
this.timeout = window.setTimeout(()=>{ this.timeout = window.setTimeout(()=>{
that.map.getCity( function(info){ //获取当前 city that.map.getCity( function(info){ //获取当前 city
AMap.plugin(['AMap.AutoComplete'], () =>{
var autoOptions = {city: info.city} var autoOptions = {city: info.city}
let keywords let keywords
e == 0 ? keywords = that.routeStart : keywords = that.routeEnd e == 0 ? keywords = that.routeStart : keywords = that.routeEnd
var autoComplete = new AMap.Autocomplete(autoOptions); var autoComplete = MapFactory.AutocompleteInstance(autoOptions,that);
autoComplete.search(keywords, function(status, result) { autoComplete.search(keywords, function(status, result) {
if (result && result.tips && result.tips.length) { //搜索到数据时 if (result && result.tips && result.tips.length) { //搜索到数据时
that._ngZone.run(()=>{ that._ngZone.run(()=>{
@ -137,20 +136,19 @@ export class RouterGISComponent implements OnInit {
for (let index = 0; index < result.tips.length; index++) { for (let index = 0; index < result.tips.length; index++) {
const element = result.tips[index]; const element = result.tips[index];
if(element.location){ if(element.location){
that.startCoordinate = new AMap.LngLat(element.location.lng, element.location.lat) that.startCoordinate = MapFactory.LngLatInstance(element.location.lng, element.location.lat)
return return
} }
} }
} }
}else{ }else{
that.routeEndList = result.tips that.routeEndList = result.tips
that.endCoordinate = new AMap.LngLat(result.tips[0].location.lng, result.tips[0].location.lat) that.endCoordinate = MapFactory.LngLatInstance(result.tips[0].location.lng, result.tips[0].location.lat)
} }
}); });
} //if } //if
}) })
})
}); //获取当前 city }); //获取当前 city
},500) },500)
@ -201,7 +199,7 @@ export class RouterGISComponent implements OnInit {
let that = this let that = this
this.selectType = true this.selectType = true
this.routeGIS? this.routeGIS.clear() : null this.routeGIS? this.routeGIS.clear() : null
this.routeGIS = new AMap.Driving({ this.routeGIS = MapFactory.DrivingInstance({
map: this.map, map: this.map,
}); });
if(!this.startCoordinate){ if(!this.startCoordinate){
@ -217,7 +215,7 @@ export class RouterGISComponent implements OnInit {
this.snackBar.open('未查询到终点坐标信息,请输入有效地址','确定',config); this.snackBar.open('未查询到终点坐标信息,请输入有效地址','确定',config);
return return
}else{ }else{
this.routeGIS.search(this.startCoordinate,this.endCoordinate, this.routeGIS.search(this,this.startCoordinate,this.endCoordinate,
function(status, result) { function(status, result) {
if (status === 'complete') { if (status === 'complete') {
that.routes = result.routes[0] that.routes = result.routes[0]
@ -239,12 +237,12 @@ export class RouterGISComponent implements OnInit {
if (this.selectType != e) { if (this.selectType != e) {
this.selectType = e this.selectType = e
this.routeGIS? this.routeGIS.clear() : null this.routeGIS? this.routeGIS.clear() : null
this.routeGIS = new AMap.Driving({ this.routeGIS = MapFactory.DrivingInstance({
map: this.map, map: this.map,
policy: e==true? AMap.DrivingPolicy.LEAST_TIME : AMap.DrivingPolicy.REAL_TRAFFIC policy: e==true? AMap.DrivingPolicy.LEAST_TIME : AMap.DrivingPolicy.REAL_TRAFFIC
}); });
// 根据起终点名称规划驾车导航路线 // 根据起终点名称规划驾车导航路线
this.routeGIS.search(this.startCoordinate,this.endCoordinate, this.routeGIS.search(this,this.startCoordinate,this.endCoordinate,
function(status, result) { function(status, result) {
if (status === 'complete') { if (status === 'complete') {
that.routes = result.routes[0] that.routes = result.routes[0]

19
src/app/key-unit/six-familiarity/six-familiarity.component.ts

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
declare var AMap: any; import { MapFactory } from '@src/modules/map/declare/factory';
@Component({ @Component({
selector: 'app-six-familiarity', selector: 'app-six-familiarity',
@ -47,26 +47,11 @@ export class routerMapComponent implements OnInit {
//地图初始化 //地图初始化
mapInit () { mapInit () {
//创建地图 //创建地图
let map = new AMap.Map('contentMap', { let map = MapFactory.MapInstance('contentMap', {
resizeEnable: true, resizeEnable: true,
cursor: 'default', cursor: 'default',
zooms:[6,18], zooms:[6,18],
}); });
//构造路线导航类 实际路线
let driving = new AMap.Driving({
map: map,
showTraffic: true,
isOutline: true,
});
driving.search( [{keyword: '广西消防总队',city:'广西'},{keyword: '万科公园里',city:'广西'},{keyword: '南宁明安医院',city:'广西'}], );
//构造路线导航类 导航路线
let drivingTwo = new AMap.Driving({
map: map,
showTraffic: false,
});
drivingTwo.search( [{keyword: '广西消防总队',city:'广西'},{keyword: '南宁明安医院',city:'广西'}], );
//function (status,result) { console.log(status,result) } //地图路线 匹配起始点回调函数
//new AMap.LngLat(116.379028, 39.865042), new AMap.LngLat(116.427281, 39.903719) / [{keyword: '淄博站',city:'山东'},{keyword: '淄博北站',city:'山东'}], //路线可搜索, 可用坐标
} }

92
src/app/key-unit/water-road/water-road.component.ts

@ -4,6 +4,8 @@ import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { MapFactory } from '@src/modules/map/declare/factory';
import { ICircle, IMap, IMarker } from '@src/modules/map/declare/map';
declare var AMap: any; declare var AMap: any;
declare var html2canvas: any; declare var html2canvas: any;
@Component({ @Component({
@ -29,17 +31,17 @@ export class WaterRoadComponent implements OnInit {
}) })
} }
map: any //地图 map:IMap //地图
watertForm: FormGroup //gis右上角水源表单 watertForm:FormGroup //gis右上角水源表单
waterList = [ waterList = [
{ id: '0', name: '消火栓', selected: true }, {id:'0',name:'消火栓',selected:true},
{ id: '1', name: '消防水池', selected: true }, {id:'1',name:'消防水池',selected:true},
{ id: '2', name: '天然水源', selected: true }, {id:'2',name:'天然水源',selected:true},
{ id: '3', name: '总队', selected: true }, {id:'3',name:'总队',selected:true},
{ id: '4', name: '支队', selected: true }, {id:'4',name:'支队',selected:true},
{ id: '5', name: '大队', selected: true }, {id:'5',name:'大队',selected:true},
{ id: '6', name: '中队(消防站)', selected: true }, {id:'6',name:'中队(消防站)',selected:true},
{ id: '7', name: '其他消防队伍', selected: true } {id:'7',name:'其他消防队伍',selected:true}
] ]
fireForceList: any[] = [ fireForceList: any[] = [
@ -48,7 +50,7 @@ export class WaterRoadComponent implements OnInit {
waterAreaDefault: any = '5000' //默认水源范围 waterAreaDefault: any = '5000' //默认水源范围
selectedWaterList: any = [] //选择提交的水源 selectedWaterList: any = [] //选择提交的水源
//地图范围圆圈---水源 //地图范围圆圈---水源
circleofwater = new AMap.Circle({ circleofwater:ICircle = MapFactory.CircleInstance({
center: null, center: null,
radius: 0, //半径 radius: 0, //半径
strokeOpacity: 1, strokeOpacity: 1,
@ -111,7 +113,7 @@ export class WaterRoadComponent implements OnInit {
this.circleofwater.setMap(this.map) this.circleofwater.setMap(this.map)
let Distance let Distance
let lnglat = new AMap.LngLat(this.unitData.location.x, this.unitData.location.y) // lng, lat 替换成传入的坐标 let lnglat = MapFactory.LngLatInstance(this.unitData.location.x, this.unitData.location.y) // lng, lat 替换成传入的坐标
//如果选择当前的视野范围算出查询半径 //如果选择当前的视野范围算出查询半径
if (this.waterAreaDefault == '0') { if (this.waterAreaDefault == '0') {
@ -223,11 +225,12 @@ export class WaterRoadComponent implements OnInit {
} }
}) })
this.map.plugin(["AMap.MarkerClusterer"], () => {
var gridSize = 60 var gridSize = 60
var count = waterMarkerArrcluster.length; var count = waterMarkerArrcluster.length;
var _renderClusterMarker = function (context) {
var factor = Math.pow(context.count / count, 1 / 18); let render = MapFactory.RenderClusterMarkerInstance();
render.contentRender = (contextCount) => {
var factor = Math.pow(contextCount / count, 1 / 18);
var div = document.createElement('div'); var div = document.createElement('div');
var Hue = 180 - factor * 180; var Hue = 180 - factor * 180;
var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)'; var bgColor = 'hsla(' + Hue + ',100%,40%,0.7)';
@ -235,36 +238,38 @@ export class WaterRoadComponent implements OnInit {
var borderColor = 'hsla(' + Hue + ',100%,40%,1)'; var borderColor = 'hsla(' + Hue + ',100%,40%,1)';
var shadowColor = 'hsla(' + Hue + ',100%,90%,1)'; var shadowColor = 'hsla(' + Hue + ',100%,90%,1)';
div.style.backgroundColor = bgColor; div.style.backgroundColor = bgColor;
var size = Math.round(30 + Math.pow(context.count / count, 1 / 5) * 20); var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20);
div.style.width = div.style.height = size + 'px'; div.style.width = div.style.height = size + 'px';
div.style.border = 'solid 1px ' + borderColor; div.style.border = 'solid 1px ' + borderColor;
div.style.borderRadius = size / 2 + 'px'; div.style.borderRadius = size / 2 + 'px';
// div.style.boxShadow = '0 0 5px ' + shadowColor; div.style.boxShadow = '0 0 5px ' + shadowColor;
div.innerHTML = context.count; div.innerHTML = contextCount;
div.style.lineHeight = size + 'px'; div.style.lineHeight = size + 'px';
div.style.color = fontColor; div.style.color = fontColor;
div.style.fontSize = '14px'; div.style.fontSize = '14px';
div.style.textAlign = 'center'; div.style.textAlign = 'center';
context.marker.setOffset(new AMap.Pixel(-size / 2, -size / 2)); return div;
context.marker.setContent(div) };
render.pixelRender = (contextCount) => {
var size = Math.round(30 + Math.pow(contextCount / count, 1 / 5) * 20);
return MapFactory.PixelInstance(-size / 2, -size / 2);
};
render.contentNonRender = (src) => {
return `<img class='clusterImgCollection' src="${src}" alt="">`;
}; };
var _renderMarker = (context) => { render.pixelNonRender = () => {
var content = `<img class='clusterImgCollection' src="${context.data[0].image}" alt="">`; return MapFactory.PixelInstance(-15, -15);
var offset = new AMap.Pixel(-12.5, -12.5);
context.marker.setContent(content)
context.marker.setOffset(offset)
} }
this.waterCluster = new AMap.MarkerCluster(this.map, waterMarkerArrcluster, { this.waterCluster = MapFactory.MarkerClusterInstance(this.map, waterMarkerArrcluster, {
gridSize: gridSize, // 设置网格像素大小 gridSize: gridSize, // 设置网格像素大小
renderClusterMarker: _renderClusterMarker, // 自定义聚合点样式 render: render //自定义聚合点样式, 自定义非聚合点样式
renderMarker: _renderMarker, // 自定义非聚合点样式
}); });
this.waterCluster.on('click', (e) => { this.waterCluster.on('click',(e)=>{
if (e.clusterData.length == 1) { if(e.clusterData.length == 1){
} }
}) },this)
});
} }
@ -273,7 +278,7 @@ export class WaterRoadComponent implements OnInit {
this.watertForm.reset() this.watertForm.reset()
this.watertForm.controls.areaWater.setValue('0') this.watertForm.controls.areaWater.setValue('0')
this.map.remove(this.circleofwater) this.map.remove(this.circleofwater)
this.waterCluster.setData([]) this.waterCluster? this.waterCluster.setData([]) : null
} }
//计算两地距离 //计算两地距离
@ -281,8 +286,7 @@ export class WaterRoadComponent implements OnInit {
let p1 = [bounds.northEast.lng, bounds.northEast.lat]; let p1 = [bounds.northEast.lng, bounds.northEast.lat];
let p2 = [bounds.northEast.lng, bounds.southWest.lat]; let p2 = [bounds.northEast.lng, bounds.southWest.lat];
// 返回 p1 到 p2 间的地面距离,单位:米 // 返回 p1 到 p2 间的地面距离,单位:米
let dis = AMap.GeometryUtil.distance(p1, p2); return this.map.distance(p1, p2);
return dis
} }
//构造水源checkbox控制器 //构造水源checkbox控制器
@ -294,24 +298,24 @@ export class WaterRoadComponent implements OnInit {
} }
//地图初始化 //地图初始化
unitMarker: any//单位标点 unitMarker:IMarker//单位标点
newPositionMarkerContent: any = newPositionMarkerContent:any =
'<div class="custom-content-marker">' + '<div class="custom-content-marker">' +
' <img style="width:20px;height:26px" src="/assets/images/dingwei.png">' + ' <img style="width:20px;height:26px" src="/assets/images/dingwei.png">' +
'</div>' '</div>'
creatMap() { creatMap(){
this.map = new AMap.Map('center', { this.map = MapFactory.MapInstance('center',{
zoom: 13, //初始地图级别 zoom: 13, //初始地图级别
WebGLParams: { WebGLParams: {
preserveDrawingBuffer: true preserveDrawingBuffer: true
} }
}); });
if (this.unitData.location && this.unitData.location.x) { if(this.unitData.location && this.unitData.location.x){
this.map.setCenter([this.unitData.location.x, this.unitData.location.y]); this.map.setCenter([this.unitData.location.x,this.unitData.location.y]);
this.unitMarker = new AMap.Marker({ this.unitMarker = MapFactory.MarkerInstance({
position: [this.unitData.location.x, this.unitData.location.y], position: [this.unitData.location.x,this.unitData.location.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-10, -13) offset: MapFactory.PixelInstance(-10, -13)
}) })
// 将 markers 添加到地图 // 将 markers 添加到地图
this.map.add(this.unitMarker); this.map.add(this.unitMarker);

96
src/app/pages/login/login.component.ts

@ -1,12 +1,10 @@
import { Component, OnInit } from '@angular/core'; import { ApplicationRef, Component, ComponentFactoryResolver, Injector, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http' import { HttpClient } from '@angular/common/http'
import { Data } from '../../interface' import { Data } from '../../interface'
import { Router,ActivatedRoute } from '@angular/router' import { Router, ActivatedRoute } from '@angular/router'
import {CacheTokenService} from '../../http-interceptors/cache-token.service'//引入服务 import { CacheTokenService } from '../../http-interceptors/cache-token.service'//引入服务
import { MatSnackBar,MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { MatDialog,MatDialogRef } from '@angular/material/dialog'; import { MatDialog, MatDialogRef } from '@angular/material/dialog';
@Component({ @Component({
selector: 'app-login', selector: 'app-login',
@ -15,93 +13,98 @@ import { MatDialog,MatDialogRef } from '@angular/material/dialog';
}) })
export class LoginComponent implements OnInit { export class LoginComponent implements OnInit {
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,public token:CacheTokenService,public snackBar: MatSnackBar, public dialog: MatDialog) { } constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, public token: CacheTokenService, public snackBar: MatSnackBar, public dialog: MatDialog) {
}
ngOnInit() { ngOnInit() {
this.automaticLogin() this.automaticLogin()
} }
errmsg :string = '' errmsg: string = ''
onSubmit(e){ onSubmit(e) {
this.http.post('/api/Account/SignIn',{ this.http.post('/api/Account/SignIn', {
name: e.name, name: e.name,
password: e.password}).subscribe( (data: Data) => { password: e.password
sessionStorage.setItem("level",data.level); }).subscribe((data: Data) => {
sessionStorage.setItem("token",data.token); sessionStorage.setItem("level", data.level);
sessionStorage.setItem("refreshToken",data.refreshToken); sessionStorage.setItem("token", data.token);
sessionStorage.setItem("isDefaultPassword",data.isDefaultPassword);//是否需要修改默认密码 sessionStorage.setItem("refreshToken", data.refreshToken);
this.http.get('/api/Account/NavMenus').subscribe((data:any)=>{ sessionStorage.setItem("isDefaultPassword", data.isDefaultPassword);//是否需要修改默认密码
let isHave = data.find(item=>{ return item.url == "/statisticanalysis/home"}) this.http.get('/api/Account/NavMenus').subscribe((data: any) => {
let isHaveGis = data.find(item=>{ return item.url == "/gis"}) let isHave = data.find(item => { return item.url == "/statisticanalysis/home" })
let isHaveGis = data.find(item => { return item.url == "/gis" })
if (isHave) { if (isHave) {
this.router.navigate([`/statisticanalysis/home`]) this.router.navigate([`/statisticanalysis/home`])
this.dialogChangePassword() this.dialogChangePassword()
return return
} else if(isHaveGis){ } else if (isHaveGis) {
this.router.navigate([`/gis`]) this.router.navigate([`/gis`])
this.dialogChangePassword() this.dialogChangePassword()
return return
} else if(data.length != 0){ } else if (data.length != 0) {
this.router.navigate([`/keyUnit`]) this.router.navigate([`/keyUnit`])
this.dialogChangePassword() this.dialogChangePassword()
return return
data.forEach(item => { data.forEach(item => {
if(item.url){ if (item.url) {
} }
}); });
}else{ } else {
this.snackBar.open('该用户角色未分配任何菜单', '确定', { this.snackBar.open('该用户角色未分配任何菜单', '确定', {
duration: 3000 duration: 3000
}); });
} }
}) })
if(e.notlogin){ //7天免登录时 if (e.notlogin) { //7天免登录时
localStorage.setItem("isnologin","true") localStorage.setItem("isnologin", "true")
localStorage.setItem("token",data.token) localStorage.setItem("token", data.token)
localStorage.setItem("refreshToken",data.refreshToken) } localStorage.setItem("refreshToken", data.refreshToken)
}
//调用服务中的function刷新token //调用服务中的function刷新token
this.token.startUp() this.token.startUp()
}, },
(err) => {this.errmsg = err} (err) => { this.errmsg = err }
) )
} }
dialogChangePassword(){ dialogChangePassword() {
if(sessionStorage.getItem('isDefaultPassword') == 'true'){ if (sessionStorage.getItem('isDefaultPassword') == 'true') {
let dialogRef = this.dialog.open(ChangepasswordComponent2, let dialogRef = this.dialog.open(ChangepasswordComponent2,
{width:'348px'}); { width: '348px' });
dialogRef.afterClosed().subscribe((data)=>{ dialogRef.afterClosed().subscribe((data) => {
sessionStorage.setItem('isDefaultPassword','false') sessionStorage.setItem('isDefaultPassword', 'false')
}); });
} }
} }
//7天免登录自动登录 //7天免登录自动登录
automaticLogin () { automaticLogin() {
let isNoLogin = localStorage.getItem("isnologin") let isNoLogin = localStorage.getItem("isnologin")
if (isNoLogin) { //7天免登录时 if (isNoLogin) { //7天免登录时
let token = localStorage.getItem("token"); let token = localStorage.getItem("token");
let refreshToken = localStorage.getItem("refreshToken"); let refreshToken = localStorage.getItem("refreshToken");
this.http.post('/api/Account/RefreshToken', { this.http.post('/api/Account/RefreshToken', {
token: token, token: token,
refreshToken: refreshToken}).subscribe((data:any)=>{ refreshToken: refreshToken
sessionStorage.setItem("level",data.level); }).subscribe((data: any) => {
sessionStorage.setItem("token",data.token); sessionStorage.setItem("level", data.level);
sessionStorage.setItem("refreshToken",data.refreshToken); sessionStorage.setItem("token", data.token);
sessionStorage.setItem("refreshToken", data.refreshToken);
this.token.startUp() this.token.startUp()
this.router.navigate(['/keyUnit']) this.router.navigate(['/keyUnit'])
this.snackBar.open('已自动登录', '确定', {duration: 3000}); this.snackBar.open('已自动登录', '确定', { duration: 3000 });
}) })
} //if } //if
} }
//打开弹窗 //打开弹窗
open () { open() {
this.snackBar.open('请联系管理员', '确定', { this.snackBar.open('请联系管理员', '确定', {
duration: 3000 duration: 3000
}); });
@ -119,28 +122,27 @@ export class LoginComponent implements OnInit {
export class ChangepasswordComponent2 implements OnInit { export class ChangepasswordComponent2 implements OnInit {
constructor(private http:HttpClient,public snackBar: MatSnackBar, constructor(private http: HttpClient, public snackBar: MatSnackBar,
public dialogRef: MatDialogRef<ChangepasswordComponent2>) { } public dialogRef: MatDialogRef<ChangepasswordComponent2>) { }
ngOnInit() { ngOnInit() {
} }
errmsg :string = '' errmsg: string = ''
onSubmit(e){ onSubmit(e) {
this.http.put( this.http.put(
'/api/Account/Password', '/api/Account/Password',
{ {
newPassword: e.newPassword, newPassword: e.newPassword,
password: 'SHya119!@' password: 'SHya119!@'
} }
).subscribe(data=> { ).subscribe(data => {
this.dialogRef.close(data); this.dialogRef.close(data);
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('密码修改成功','确定',config); this.snackBar.open('密码修改成功', '确定', config);
},(err) => }, (err) => { this.errmsg = err }
{this.errmsg = err}
) )
} }

6
src/app/pages/pages-routing.module.ts

@ -1,10 +1,8 @@
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { HomeComponent } from './home/home.component';
import { HomedetailComponent } from './homedetail/homedetail.component';
const routes: Routes = [ const routes: Routes = [
{ path: '', component: HomeComponent},
{ path: 'detail', component: HomedetailComponent},
]; ];
@NgModule({ @NgModule({

2
src/app/pages/pages.component.html

@ -1 +1 @@
<p>pages works!</p>

47
src/app/plan-audit/fireforce-audit/fireforce-audit.component.ts

@ -2,10 +2,12 @@ import { HttpClient } from '@angular/common/http';
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { MapFactory } from '@src/modules/map/declare/factory';
import { IMap, IMarker } from '@src/modules/map/declare/map';
import Viewer from 'viewerjs' import Viewer from 'viewerjs'
import { ViewDetailsComponent } from '../view-details/view-details.component'; import { ViewDetailsComponent } from '../view-details/view-details.component';
declare var CryptoJS declare var CryptoJS
declare var AMap: any;
@Component({ @Component({
selector: 'app-fireforce-audit', selector: 'app-fireforce-audit',
templateUrl: './fireforce-audit.component.html', templateUrl: './fireforce-audit.component.html',
@ -37,16 +39,16 @@ export class FireforceAuditComponent implements OnInit {
this.FireForceDetailInfo.RelevantInfomationData ? this.AttachmentArr = JSON.parse(this.FireForceDetailInfo.RelevantInfomationData) : null this.FireForceDetailInfo.RelevantInfomationData ? this.AttachmentArr = JSON.parse(this.FireForceDetailInfo.RelevantInfomationData) : null
console.log(789,this.ZongcontactData) console.log(789,this.ZongcontactData)
setTimeout(() => { setTimeout(() => {
this.map = new AMap.Map('container', { this.map = MapFactory.MapInstance('container', {
zoom:18 zoom:18
}) })
if(this.FireForceDetailInfo.location && this.FireForceDetailInfo.location.x){ if(this.FireForceDetailInfo.location && this.FireForceDetailInfo.location.x){
this.map.setCenter([this.FireForceDetailInfo.location.x,this.FireForceDetailInfo.location.y]); this.map.setCenter([this.FireForceDetailInfo.location.x,this.FireForceDetailInfo.location.y]);
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.FireForceDetailInfo.location.x,this.FireForceDetailInfo.location.y], position: [this.FireForceDetailInfo.location.x,this.FireForceDetailInfo.location.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-10, -12) offset: MapFactory.PixelInstance(-10, -12)
}) })
// 将 markers 添加到地图 // 将 markers 添加到地图
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -56,8 +58,8 @@ export class FireforceAuditComponent implements OnInit {
}, 0); }, 0);
} }
map:any map:IMap
newPositionMarker:any newPositionMarker:IMarker
newPositionMarkerContent:any = newPositionMarkerContent:any =
'<div class="custom-content-marker">' + '<div class="custom-content-marker">' +
' <img style="width:20px;height:24px" src="/assets/images/dingwei.png">' + ' <img style="width:20px;height:24px" src="/assets/images/dingwei.png">' +
@ -161,32 +163,13 @@ export class FireforceAuditComponent implements OnInit {
} }
if(suffix == 'docx' || suffix == 'doc' || suffix == 'pdf'){ if(suffix == 'docx' || suffix == 'doc' || suffix == 'pdf'){
let fetchUrl = item.objectName let fetchUrl = item.objectName
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl); if (suffix == 'docx' || suffix == 'doc') {
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray); let arr = fetchUrl.split('.')
arr[arr.length - 1] = 'pdf'
let jwt = sessionStorage.getItem("token"); window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); }else if (suffix == 'pdf') {
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
let identityJsonparse=JSON.parse(identityJson) }
let json={
doc: {
docId: docId,
title: item.fileName,
fetchUrl: `http://172.18.0.1:8000/api/Objects/PlanPlatform/`+fetchUrl
},
user: {
uid: identityJsonparse.sub,
nickName: identityJsonparse.name,
avatar: "",
privilege: [
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
],
},
}
var stringjson=JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
} }
if(suffix == 'mp4'){ if(suffix == 'mp4'){
const dialogRef = this.dialog.open(ViewDetailsComponent, {//调用open方法打开对话框并且携带参数过去 const dialogRef = this.dialog.open(ViewDetailsComponent, {//调用open方法打开对话框并且携带参数过去

47
src/app/plan-audit/linkageforces-audit/linkageforces-audit.component.ts

@ -4,8 +4,10 @@ import { ViewDetailsComponent } from '../view-details/view-details.component';
import Viewer from 'viewerjs' import Viewer from 'viewerjs'
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { MapFactory } from '@src/modules/map/declare/factory';
import { IMap, IMarker } from '@src/modules/map/declare/map';
declare var CryptoJS declare var CryptoJS
declare var AMap: any;
@Component({ @Component({
selector: 'app-linkageforces-audit', selector: 'app-linkageforces-audit',
templateUrl: './linkageforces-audit.component.html', templateUrl: './linkageforces-audit.component.html',
@ -33,8 +35,8 @@ export class LinkageforcesAuditComponent implements OnInit {
{id:14,name:'住建',imgUrl:'/assets/linkageForces/zhujian.png',isChecked:false} {id:14,name:'住建',imgUrl:'/assets/linkageForces/zhujian.png',isChecked:false}
] ]
AttachmentArr:any//附件 AttachmentArr:any//附件
map:any map:IMap
newPositionMarker:any newPositionMarker:IMarker
newPositionMarkerContent:any = newPositionMarkerContent:any =
'<div class="custom-content-marker">' + '<div class="custom-content-marker">' +
' <img style="width:20px;height:24px" src="/assets/images/dingwei.png">' + ' <img style="width:20px;height:24px" src="/assets/images/dingwei.png">' +
@ -43,16 +45,16 @@ export class LinkageforcesAuditComponent implements OnInit {
this.AttachmentArr = JSON.parse(this.LinkageForceDetailInfo.relevantInfomationData) this.AttachmentArr = JSON.parse(this.LinkageForceDetailInfo.relevantInfomationData)
this.LinkageForceDetailInfo.location ? null : this.LinkageForceDetailInfo.location={x:null,y:null} this.LinkageForceDetailInfo.location ? null : this.LinkageForceDetailInfo.location={x:null,y:null}
setTimeout(() => { setTimeout(() => {
this.map = new AMap.Map('container', { this.map = MapFactory.MapInstance('container', {
zoom:18 zoom:18
}) })
if(this.LinkageForceDetailInfo.location && this.LinkageForceDetailInfo.location.x){ if(this.LinkageForceDetailInfo.location && this.LinkageForceDetailInfo.location.x){
this.map.setCenter([this.LinkageForceDetailInfo.location.x,this.LinkageForceDetailInfo.location.y]); this.map.setCenter([this.LinkageForceDetailInfo.location.x,this.LinkageForceDetailInfo.location.y]);
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.LinkageForceDetailInfo.location.x,this.LinkageForceDetailInfo.location.y], position: [this.LinkageForceDetailInfo.location.x,this.LinkageForceDetailInfo.location.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-10, -12) offset: MapFactory.PixelInstance(-10, -12)
}) })
// 将 markers 添加到地图 // 将 markers 添加到地图
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);
@ -171,32 +173,13 @@ export class LinkageforcesAuditComponent implements OnInit {
} }
if(suffix == 'docx' || suffix == 'doc' || suffix == 'pdf'){ if(suffix == 'docx' || suffix == 'doc' || suffix == 'pdf'){
let fetchUrl = item.objectName let fetchUrl = item.objectName
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl); if (suffix == 'docx' || suffix == 'doc') {
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray); let arr = fetchUrl.split('.')
arr[arr.length - 1] = 'pdf'
let jwt = sessionStorage.getItem("token"); window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); }else if (suffix == 'pdf') {
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
let identityJsonparse=JSON.parse(identityJson) }
let json={
doc: {
docId: docId,
title: item.fileName,
fetchUrl: `http://172.18.0.1:8000/api/Objects/PlanPlatform/`+fetchUrl
},
user: {
uid: identityJsonparse.sub,
nickName: identityJsonparse.name,
avatar: "",
privilege: [
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
],
},
}
var stringjson=JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
} }
if(suffix == 'mp4'){ if(suffix == 'mp4'){
const dialogRef = this.dialog.open(ViewDetailsComponent, {//调用open方法打开对话框并且携带参数过去 const dialogRef = this.dialog.open(ViewDetailsComponent, {//调用open方法打开对话框并且携带参数过去

314
src/app/plan-audit/plan-record/plan-record.component.ts

@ -6,10 +6,10 @@
* @LastEditors: sueRimn * @LastEditors: sueRimn
* @LastEditTime: 2021-07-08 09:35:53 * @LastEditTime: 2021-07-08 09:35:53
*/ */
import { Component, OnInit,Inject } from '@angular/core'; import { Component, OnInit, Inject } from '@angular/core';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { HttpClient } from '@angular/common/http' import { HttpClient } from '@angular/common/http'
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
import { Viewer } from 'photo-sphere-viewer'; import { Viewer } from 'photo-sphere-viewer';
@ -22,69 +22,69 @@ declare var CryptoJS
}) })
export class PlanRecordComponent implements OnInit { export class PlanRecordComponent implements OnInit {
constructor(private http:HttpClient,public snackBar: MatSnackBar,private sanitizer: DomSanitizer,public dialog: MatDialog) { } constructor(private http: HttpClient, public snackBar: MatSnackBar, private sanitizer: DomSanitizer, public dialog: MatDialog) { }
pcshow pcshow
ngOnInit(): void { ngOnInit(): void {
if(window.matchMedia("(max-width: 1300px)").matches){ if (window.matchMedia("(max-width: 1300px)").matches) {
this.pcshow=false this.pcshow = false
}else{ } else {
this.pcshow=true this.pcshow = true
} }
let level = sessionStorage.getItem("level"); let level = sessionStorage.getItem("level");
if(level == "0"){//如果是总队 if (level == "0") {//如果是总队
this.preparelevels = [ this.preparelevels = [
{name:"总队",value:"0"}, { name: "总队", value: "0" },
{name:"支队",value:"1"}, { name: "支队", value: "1" },
{name:"大队",value:"2"}, { name: "大队", value: "2" },
{name:"中队",value:"3"} { name: "中队", value: "3" }
] ]
} }
if(level == "1"){//如果是支队 if (level == "1") {//如果是支队
this.preparelevels = [ this.preparelevels = [
{name:"支队",value:"1"}, { name: "支队", value: "1" },
{name:"大队",value:"2"}, { name: "大队", value: "2" },
{name:"中队",value:"3"} { name: "中队", value: "3" }
] ]
} }
if(level == "2"){//如果是大队 if (level == "2") {//如果是大队
this.preparelevels = [ this.preparelevels = [
{name:"大队",value:"2"}, { name: "大队", value: "2" },
{name:"中队",value:"3"} { name: "中队", value: "3" }
] ]
} }
if(level == "3"){//如果是中队 if (level == "3") {//如果是中队
this.preparelevels = [ this.preparelevels = [
{name:"中队",value:"3"} { name: "中队", value: "3" }
] ]
} }
this.iframeSrc=this.sanitizer.bypassSecurityTrustResourceUrl(this.src); this.iframeSrc = this.sanitizer.bypassSecurityTrustResourceUrl(this.src);
this.getAlltabledate() this.getAlltabledate()
} }
wordShow=true wordShow = true
iframeSrc iframeSrc
src='' src = ''
selected = new FormControl(0); //选项卡 实例 selected = new FormControl(0); //选项卡 实例
preparelevels:any preparelevels: any
level=''//类型 level = ''//类型
verifyState=''//审核状态 verifyState = ''//审核状态
projectlevel//组织机构 projectlevel//组织机构
PlanLevel//编制级别 PlanLevel//编制级别
addtime//时间 addtime//时间
endtime//结束时间 endtime//结束时间
count//一共多少条 count//一共多少条
tableDate tableDate
showPvt=false//全景图是否显示 showPvt = false//全景图是否显示
shenheTable=[]//选中要审核的对象 shenheTable = []//选中要审核的对象
chuorzhong//判断初审还是终审 chuorzhong//判断初审还是终审
radioid//选中的id radioid//选中的id
showtype=-1//0:word,1:全景图,2:二维三维,3:重点单位 showtype = -1//0:word,1:全景图,2:二维三维,3:重点单位
compantData={name:'',buildingTypes:[],address:''} compantData = { name: '', buildingTypes: [], address: '' }
organizationName organizationName
planData planData
id id
@ -94,122 +94,122 @@ export class PlanRecordComponent implements OnInit {
companyName companyName
//获取表格数据 //获取表格数据
getAlltabledate(){ getAlltabledate() {
let paramsdata:any = { let paramsdata: any = {
Operation:this.level||[], Operation: this.level || [],
ContentType:Number(this.projectlevel)||[], ContentType: Number(this.projectlevel) || [],
Level:this.PlanLevel||[], Level: this.PlanLevel || [],
verifyState:this.verifyState||[1,2,4,5], verifyState: this.verifyState || [1, 2, 4, 5],
QueryStartTime:this.addtime||'', QueryStartTime: this.addtime || '',
QueryEndTime:this.endtime||'' QueryEndTime: this.endtime || ''
} }
this.http.get("/api/ContentVerifies",{params:paramsdata}).subscribe((data:any)=>{ this.http.get("/api/ContentVerifies", { params: paramsdata }).subscribe((data: any) => {
//console.log(data) //console.log(data)
this.tableDate=data.items this.tableDate = data.items
this.count=data.totalCount this.count = data.totalCount
}) })
} }
//提交查询 //提交查询
onSubmit(value){ onSubmit(value) {
//console.log(value) //console.log(value)
this.getAlltabledate() this.getAlltabledate()
} }
//刷新 //刷新
record(){ record() {
this.verifyState='' this.verifyState = ''
this.level='' this.level = ''
this.projectlevel='' this.projectlevel = ''
this.addtime='' this.addtime = ''
this.endtime='' this.endtime = ''
let level = sessionStorage.getItem("level"); let level = sessionStorage.getItem("level");
this.PlanLevel='' this.PlanLevel = ''
this.getAlltabledate() this.getAlltabledate()
} }
//表格点击事件 //表格点击事件
viewer//全景图对象 viewer//全景图对象
waterData:any//需要传递给子组件的水源信息 waterData: any//需要传递给子组件的水源信息
LinkageForceDetailInfo:any//需要传递给子组件的联动力量信息 LinkageForceDetailInfo: any//需要传递给子组件的联动力量信息
fireForceDetailInfo:any//需要传递给子组件的消防力量信息 fireForceDetailInfo: any//需要传递给子组件的消防力量信息
postlevel:any postlevel: any
bianzhi=false bianzhi = false
tableClick(e,item){ tableClick(e, item) {
this.showtype = -1 this.showtype = -1
//e.target.parentElement.bgColor='#2196F3' //e.target.parentElement.bgColor='#2196F3'
// console.log(item) // console.log(item)
this.organizationName='' this.organizationName = ''
this.itemid=item.itemId this.itemid = item.itemId
this.id=item.id this.id = item.id
this.fetchUrl='' this.fetchUrl = ''
this.viewer={} this.viewer = {}
if(item.contentType == 11){ if (item.contentType == 11) {
this.bianzhi=false this.bianzhi = false
window.setTimeout(()=>{ window.setTimeout(() => {
this.showtype = 3 this.showtype = 3
sessionStorage.setItem('companyId',item.itemId) sessionStorage.setItem('companyId', item.itemId)
},0) }, 0)
}else if(item.contentType == 12){ } else if (item.contentType == 12) {
this.bianzhi=false this.bianzhi = false
//水源 //水源
this.http.get(`/api/WaterSources/${item.itemId}`).subscribe((data)=>{ this.http.get(`/api/WaterSources/${item.itemId}`).subscribe((data) => {
this.waterData = data this.waterData = data
this.showtype = 12 this.showtype = 12
}) })
}else if(item.contentType == 13){ } else if (item.contentType == 13) {
this.bianzhi=false this.bianzhi = false
//消防力量 //消防力量
this.http.get(`/api/CustomFireForce/${item.itemId}`).subscribe((data:any)=>{ this.http.get(`/api/CustomFireForce/${item.itemId}`).subscribe((data: any) => {
if(data.forceType != 0){//如果是其他消防力量 if (data.forceType != 0) {//如果是其他消防力量
this.postlevel = 4 this.postlevel = 4
}else{ } else {
this.postlevel = data.level this.postlevel = data.level
} }
// console.log('xxx',data) // console.log('xxx',data)
data.fireForceDetailInfo.location ? null : data.fireForceDetailInfo.location={x:null,y:null} data.fireForceDetailInfo.location ? null : data.fireForceDetailInfo.location = { x: null, y: null }
this.fireForceDetailInfo = data.fireForceDetailInfo this.fireForceDetailInfo = data.fireForceDetailInfo
this.showtype = 13 this.showtype = 13
}) })
}else if(item.contentType == 14){ } else if (item.contentType == 14) {
this.bianzhi=false this.bianzhi = false
//联动力量 //联动力量
this.http.get(`/api/LinkageForces/${item.itemId}`).subscribe((data:any)=>{ this.http.get(`/api/LinkageForces/${item.itemId}`).subscribe((data: any) => {
data.location ? null : data.location={x:null,y:null} data.location ? null : data.location = { x: null, y: null }
this.LinkageForceDetailInfo = data this.LinkageForceDetailInfo = data
this.showtype = 14 this.showtype = 14
}) })
}else{ } else {
this.http.get(`/api/PlanComponents/${item.itemId}`).subscribe((data:any)=>{ this.http.get(`/api/PlanComponents/${item.itemId}`).subscribe((data: any) => {
this.companyId=data.companyId this.companyId = data.companyId
this.companyName=data.companyName this.companyName = data.companyName
if(data.planMode==2){ if (data.planMode == 2) {
this.bianzhi=true this.bianzhi = true
this.src=`/planManagement/createplanonlinefive?navIsOpen=false&companyId=${data.companyId}&planName=${data.name}&unitName=${data.companyName}&planCategory=${data.planCategory}&planId=${data.id}&unitTypeId=${data.company.buildingTypes[0].id}&orName=${data.company.organizationName}&orId=${data.company.organizationId}&pattern=false` this.src = `/planManagement/createplanonlinefive?navIsOpen=false&companyId=${data.companyId}&planName=${data.name}&unitName=${data.companyName}&planCategory=${data.planCategory}&planId=${data.id}&unitTypeId=${data.company.buildingTypes[0].id}&orName=${data.company.organizationName}&orId=${data.company.organizationId}&pattern=false`
//this.src=`/keyUnit/viewunitinfoplan?id=${data.companyId}&orName=${data.company.organizationId}&orId=${data.company.organizationName}` //this.src=`/keyUnit/viewunitinfoplan?id=${data.companyId}&orName=${data.company.organizationId}&orId=${data.company.organizationName}`
}else{ } else {
this.bianzhi=false this.bianzhi = false
if(data.planType!=2&&data.planType!=1){ if (data.planType != 2 && data.planType != 1) {
this.fetchUrl=data.attachmentUrls[0] this.fetchUrl = data.attachmentUrls[0]
var index=this.fetchUrl.indexOf("\/") var index = this.fetchUrl.indexOf("\/")
if(this.fetchUrl.substr(0,index)=='psw'){ if (this.fetchUrl.substr(0, index) == 'psw') {
this.showtype=1 this.showtype = 1
var obj=document.getElementById('viewer') var obj = document.getElementById('viewer')
if(obj!=null){ if (obj != null) {
obj.innerHTML='' obj.innerHTML = ''
} }
window.setTimeout(()=>{ window.setTimeout(() => {
this.viewer = new Viewer({ this.viewer = new Viewer({
container: document.querySelector('#viewer'), container: document.querySelector('#viewer'),
panorama:'/api/Objects/PlanPlatform/'+ this.fetchUrl, panorama: '/api/Objects/PlanPlatform/' + this.fetchUrl,
}); });
}) })
}else{ } else {
this.lookWord() this.lookWord()
} }
}else{ } else {
this.organizationName=item.organizationName this.organizationName = item.organizationName
this.planData = data this.planData = data
this.handleData() this.handleData()
return return
@ -227,59 +227,37 @@ export class PlanRecordComponent implements OnInit {
if(e.checked){ if (e.checked) {
this.shenheTable.push(item) this.shenheTable.push(item)
} }
else{ else {
for(var i=0;i<this.shenheTable.length;i++ ){ for (var i = 0; i < this.shenheTable.length; i++) {
if(this.shenheTable[i].id==item.id){ if (this.shenheTable[i].id == item.id) {
this.shenheTable.splice(i,1) this.shenheTable.splice(i, 1)
} }
} }
} }
this.radioid=item.itemId this.radioid = item.itemId
/* this.chuorzhong=item.verifyState /* this.chuorzhong=item.verifyState
this.radioid=item.itemId */ this.radioid=item.itemId */
} }
//毕升 //毕升
lookWord(){ lookWord() {
this.showtype=0 this.showtype = 0
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + this.fetchUrl); let src
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray); let suffix = this.fetchUrl.split('.')[this.fetchUrl.split('.').length - 1].toLowerCase()
let jwt = sessionStorage.getItem("token"); if (suffix == 'docx' || suffix == 'doc') {
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); let arr = this.fetchUrl.split('.')
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); arr[arr.length - 1] = 'pdf'
let identityJsonparse=JSON.parse(identityJson) src = `/api/Objects/PlanPlatform/` + arr.join('.')
let filename:string } else if (suffix == 'pdf') {
this.http.get(`/api/ObjectMetadata/PlanPlatform/${this.fetchUrl}`).subscribe((data:any)=>{ src = `/api/Objects/PlanPlatform/` + this.fetchUrl
filename=data.fileName
let json={
doc: {
docId: docId,
title: filename,
//title: filename,
fetchUrl: `http://172.18.0.1: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) this.iframeSrc = this.sanitizer.bypassSecurityTrustResourceUrl(src);
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
this.src=`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`
this.iframeSrc=this.sanitizer.bypassSecurityTrustResourceUrl(this.src);
//window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
})
} }
//查看按钮跳转 //查看按钮跳转
lookNew(){ lookNew() {
window.open(this.src) window.open(this.src)
} }
@ -287,37 +265,37 @@ export class PlanRecordComponent implements OnInit {
thirdPartyURL thirdPartyURL
planType planType
twoOrthree twoOrthree
handleData () { handleData() {
this.compantData={name:'',buildingTypes:[],address:''} this.compantData = { name: '', buildingTypes: [], address: '' }
this.planType = this.planData.planMode this.planType = this.planData.planMode
let data = this.planData let data = this.planData
// console.log(data) // console.log(data)
if(data.planType==1){ if (data.planType == 1) {
this.twoOrthree=2 this.twoOrthree = 2
}else if(data.planType==2){ } else if (data.planType == 2) {
this.twoOrthree=3 this.twoOrthree = 3
} }
if (this.planData.planMode==0) { //预案planMode=0时, 查看word if (this.planData.planMode == 0) { //预案planMode=0时, 查看word
//this.lookWord() //this.lookWord()
} else if (this.planData.planMode==1) { //预案planMode=1时, 解析文档 } else if (this.planData.planMode == 1) { //预案planMode=1时, 解析文档
} else if (this.planData.planMode==2) { //预案planMode=2时, 跳查看页面组件 } else if (this.planData.planMode == 2) { //预案planMode=2时, 跳查看页面组件
this.showtype=2 this.showtype = 2
this.http.get(`/api/Plans/${data.companyId}`).subscribe((data:any)=>{ this.http.get(`/api/Plans/${data.companyId}`).subscribe((data: any) => {
data && data.company? this.compantData = data.company : null data && data.company ? this.compantData = data.company : null
}) })
sessionStorage.setItem("buildingTypeId", this.compantData.buildingTypes.length? this.compantData.buildingTypes[0].id: undefined); sessionStorage.setItem("buildingTypeId", this.compantData.buildingTypes.length ? this.compantData.buildingTypes[0].id : undefined);
sessionStorage.setItem("companyId",this.companyId); sessionStorage.setItem("companyId", this.companyId);
sessionStorage.setItem("planId",this.itemid); sessionStorage.setItem("planId", this.itemid);
sessionStorage.setItem("editable",'0'); sessionStorage.setItem("editable", '0');
sessionStorage.setItem("planName",data.name) sessionStorage.setItem("planName", data.name)
let companyId = sessionStorage.getItem("companyId") let companyId = sessionStorage.getItem("companyId")
this.thirdPartyURL=this.sanitizer.bypassSecurityTrustResourceUrl(`/keyUnit/viewunitinfoplans?id=${companyId}`); this.thirdPartyURL = this.sanitizer.bypassSecurityTrustResourceUrl(`/keyUnit/viewunitinfoplans?id=${companyId}`);
//window.open(`/keyUnit/viewunitinfoplan?id=${companyId}`) //window.open(`/keyUnit/viewunitinfoplan?id=${companyId}`)
} else if (this.planData.planMode==3) { //预案planMode=3时, 第三方网址' } else if (this.planData.planMode == 3) { //预案planMode=3时, 第三方网址'
this.showtype=2 this.showtype = 2
this.http.get(`/api/Plans/${data.companyId}`).subscribe((data:any)=>{ this.http.get(`/api/Plans/${data.companyId}`).subscribe((data: any) => {
data && data.company? this.compantData = data.company : null data && data.company ? this.compantData = data.company : null
}) })
//this.dialog.open(show3D,{width:'1350px',height:'700px',data:{url:data.url}}); //打开图片弹窗 //this.dialog.open(show3D,{width:'1350px',height:'700px',data:{url:data.url}}); //打开图片弹窗
this.thirdPartyURL = this.sanitizer.bypassSecurityTrustResourceUrl(data.url) this.thirdPartyURL = this.sanitizer.bypassSecurityTrustResourceUrl(data.url)
@ -326,8 +304,8 @@ export class PlanRecordComponent implements OnInit {
} }
//打开三维预案弹窗 //打开三维预案弹窗
oopen3Dshow(){ oopen3Dshow() {
this.dialog.open(recordshow3D,{width:'1650px',height:'850px',data:{url:this.thirdPartyURL,twoOrthree:this.twoOrthree}}); this.dialog.open(recordshow3D, { width: '1650px', height: '850px', data: { url: this.thirdPartyURL, twoOrthree: this.twoOrthree } });
} }
} }
@ -337,11 +315,11 @@ export class PlanRecordComponent implements OnInit {
templateUrl: './show3D.html', templateUrl: './show3D.html',
styleUrls: ['./plan-record.component.scss'] styleUrls: ['./plan-record.component.scss']
}) })
export class recordshow3D{ export class recordshow3D {
constructor(private sanitizer: DomSanitizer,public dialogRef: MatDialogRef<recordshow3D>,@Inject(MAT_DIALOG_DATA) public data,public dialog: MatDialog) {} constructor(private sanitizer: DomSanitizer, public dialogRef: MatDialogRef<recordshow3D>, @Inject(MAT_DIALOG_DATA) public data, public dialog: MatDialog) { }
ngOnInit(): void { ngOnInit(): void {
// console.log(this.data) // console.log(this.data)
this.threedUrl=this.sanitizer.bypassSecurityTrustResourceUrl(this.data.url.changingThisBreaksApplicationSecurity) this.threedUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.data.url.changingThisBreaksApplicationSecurity)
} }
threedUrl threedUrl
} }

48
src/app/plan-audit/wait-examineer/wait-examineer.component.ts

@ -133,7 +133,7 @@ export class WaitExamineerComponent implements OnInit {
this.getAlltabledate() this.getAlltabledate()
} }
lookImg(imgUrl){ lookImg(imgUrl) {
console.log(imgUrl) console.log(imgUrl)
let dom = document.getElementById(`viewerjs`) let dom = document.getElementById(`viewerjs`)
let pObjs = dom.childNodes; let pObjs = dom.childNodes;
@ -144,7 +144,7 @@ export class WaitExamineerComponent implements OnInit {
dom.appendChild(node) dom.appendChild(node)
setTimeout(() => { setTimeout(() => {
let viewer = new Viewer(document.getElementById(`viewerjs`), { let viewer = new Viewer(document.getElementById(`viewerjs`), {
hidden:()=>{ hidden: () => {
dom.removeChild(pObjs[0]); dom.removeChild(pObjs[0]);
viewer.destroy(); viewer.destroy();
} }
@ -170,7 +170,7 @@ export class WaitExamineerComponent implements OnInit {
this.selectedItem = item this.selectedItem = item
console.log(item) console.log(item)
// console.log('当前选择的信息',JSON.parse(this.selectedItem.differentContent) ) // console.log('当前选择的信息',JSON.parse(this.selectedItem.differentContent) )
if(item.contentType == 11 && this.selectedItem.differentContent){ if (item.contentType == 11 && this.selectedItem.differentContent) {
let differentContent = JSON.parse(this.selectedItem.differentContent) let differentContent = JSON.parse(this.selectedItem.differentContent)
@ -319,38 +319,16 @@ export class WaitExamineerComponent implements OnInit {
//毕升 //毕升
lookWord() { lookWord() {
this.showtype = 0 this.showtype = 0
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + this.fetchUrl); let src
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray); let suffix = this.fetchUrl.split('.')[this.fetchUrl.split('.').length - 1].toLowerCase()
let jwt = sessionStorage.getItem("token"); if (suffix == 'docx' || suffix == 'doc') {
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); let arr = this.fetchUrl.split('.')
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); arr[arr.length - 1] = 'pdf'
let identityJsonparse=JSON.parse(identityJson) src = `/api/Objects/PlanPlatform/` + arr.join('.')
let filename:string }else if (suffix == 'pdf') {
this.http.get(`/api/ObjectMetadata/PlanPlatform/${this.fetchUrl}`).subscribe((data:any)=>{ src = `/api/Objects/PlanPlatform/` + this.fetchUrl
filename=data.fileName }
let json={ this.iframeSrc = this.sanitizer.bypassSecurityTrustResourceUrl(src);
doc: {
docId: docId,
title: filename,
//title: filename,
fetchUrl: `http://172.18.0.1: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://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`
this.iframeSrc=this.sanitizer.bypassSecurityTrustResourceUrl(this.src);
//window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
})
} }
//查看按钮跳转 //查看按钮跳转
lookNew() { lookNew() {

14
src/app/plan-audit/water-audit/water-audit.component.ts

@ -1,5 +1,7 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
declare var AMap: any; import { MapFactory } from '@src/modules/map/declare/factory';
import { IMap, IMarker } from '@src/modules/map/declare/map';
@Component({ @Component({
selector: 'app-water-audit', selector: 'app-water-audit',
templateUrl: './water-audit.component.html', templateUrl: './water-audit.component.html',
@ -8,8 +10,8 @@ declare var AMap: any;
export class WaterAuditComponent implements OnInit { export class WaterAuditComponent implements OnInit {
@Input() public waterData: any;//data名字根据引用场景自定义 @Input() public waterData: any;//data名字根据引用场景自定义
constructor() { } constructor() { }
map:any map:IMap
newPositionMarker:any newPositionMarker:IMarker
newPositionMarkerContent:any = newPositionMarkerContent:any =
'<div class="custom-content-marker">' + '<div class="custom-content-marker">' +
' <img style="width:20px;height:24px" src="/assets/images/dingwei.png">' + ' <img style="width:20px;height:24px" src="/assets/images/dingwei.png">' +
@ -22,16 +24,16 @@ export class WaterAuditComponent implements OnInit {
this.poolData = this.waterData.detailData this.poolData = this.waterData.detailData
this.naturalWaterData = this.waterData.detailData this.naturalWaterData = this.waterData.detailData
setTimeout(() => { setTimeout(() => {
this.map = new AMap.Map('container', { this.map = MapFactory.MapInstance('container', {
zoom:18 zoom:18
}) })
if(this.waterData.location && this.waterData.location.x){ if(this.waterData.location && this.waterData.location.x){
this.map.setCenter([this.waterData.location.x,this.waterData.location.y]); this.map.setCenter([this.waterData.location.x,this.waterData.location.y]);
this.newPositionMarker = new AMap.Marker({ this.newPositionMarker = MapFactory.MarkerInstance({
position: [this.waterData.location.x,this.waterData.location.y], position: [this.waterData.location.x,this.waterData.location.y],
content: this.newPositionMarkerContent, content: this.newPositionMarkerContent,
offset: new AMap.Pixel(-10, -12) offset: MapFactory.PixelInstance(-10, -12)
}) })
// 将 markers 添加到地图 // 将 markers 添加到地图
this.map.add(this.newPositionMarker); this.map.add(this.newPositionMarker);

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

@ -80,7 +80,7 @@
<span (click)="changeName(element)" *ngIf="element.auditStatus==8">改名</span> <span (click)="changeName(element)" *ngIf="element.auditStatus==8">改名</span>
<span (click)="editPlan(element)" <span (click)="editPlan(element)"
[ngClass]="{'grey': !(element.auditStatus!='16' && element.auditStatus != '1')}">编辑</span> [ngClass]="{'grey': !(element.auditStatus!='16' && element.auditStatus != '1')}">编辑</span>
<span (click)="lookPlan(element)" *ngIf="element.planType == 2">查看</span> <span (click)="lookPlan(element)" *ngIf="element.planType == 2 || element.planType == 16">查看</span>
<span (click)="readFile(element)" <span (click)="readFile(element)"
[ngClass]="{'grey': element.planMode == '2' || element.planMode == '3'}">下载</span> [ngClass]="{'grey': element.planMode == '2' || element.planMode == '3'}">下载</span>
<span (click)="deletePlan(element)" *ngIf="element.auditStatus==8">删除</span> <span (click)="deletePlan(element)" *ngIf="element.auditStatus==8">删除</span>

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

@ -106,8 +106,8 @@ export class EntryPlanLookComponent implements OnInit {
} }
//查看预案 //查看预案
lookPlan(e) { lookPlan(e) {
console.log(e)
if (e.planType == 16 || e.planType == 4 || e.planType == 8) { if (e.planType == 16 || e.planType == 4 || e.planType == 8) {
// console.log(e.attachmentUrls)
var index = e.attachmentUrls[0].indexOf("\/") var index = e.attachmentUrls[0].indexOf("\/")
if (e.attachmentUrls[0].substr(0, index) == 'psw') { if (e.attachmentUrls[0].substr(0, index) == 'psw') {
const dialogRef = this.dialog.open(PsViewer, { const dialogRef = this.dialog.open(PsViewer, {
@ -121,54 +121,27 @@ export class EntryPlanLookComponent implements OnInit {
data: data.attachmentUrls, data: data.attachmentUrls,
}); });
dialogRef.afterClosed().subscribe(); dialogRef.afterClosed().subscribe();
} } else {
else /* if(e.attachmentUrls[0].substr(e.attachmentUrls[0].length-4,e.attachmentUrls[0].length-1)=='docx'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='pdf'
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='doc'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='DOC'
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='txt'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='JPG') */ {
let filename: string
let fetchUrl = e.attachmentUrls[0] let fetchUrl = e.attachmentUrls[0]
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl); if (fetchUrl) {
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray); let suffix = fetchUrl.split('.')[fetchUrl.split('.').length - 1].toLowerCase()
let jwt = sessionStorage.getItem("token"); if (suffix == 'docx' || suffix == 'doc') {
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); let arr = fetchUrl.split('.')
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); arr[arr.length - 1] = 'pdf'
let identityJsonparse = JSON.parse(identityJson) window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data: any) => { } else if (suffix == 'pdf') {
filename = data.fileName window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
let json = { } else {
doc: { let config = new MatSnackBarConfig();
docId: docId, config.verticalPosition = 'top';
title: filename, config.duration = 3000
fetchUrl: `http://172.18.0.1:8000/api/Objects/PlanPlatform/` + fetchUrl, this.snackBar.open('该文件类型暂不支持在线查看', '确定', config);
}, }
user: { } else {
uid: identityJsonparse.sub, window.open(`/planManagement/createplanonlinefive?navIsOpen=false&companyId=${this.companyId}&planName=${e.name}&unitName=${this.unitdata.unitname}&planCategory=${e.planCategory}&planId=${e.id}&unitTypeId=${this.compantData.buildingTypes[0].id}&orName=${this.compantData.organizationName}&orId=${this.compantData.organizationId}`)
nickName: identityJsonparse.name,
avatar: "",
privilege: e.auditStatus != '1' && e.auditStatus != '16' ? [
'FILE_READ', 'FILE_WRITE', 'FILE_DOWNLOAD', 'FILE_PRINT'
] : [
'FILE_READ', 'FILE_DOWNLOAD', 'FILE_PRINT'
],
},
}
var stringjson = JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
})
} }
} }
/* if(e.planType == 4){
var index=e.attachmentUrls[0].indexOf("\/")
if(e.attachmentUrls[0].substr(0,index)=='psw'){
const dialogRef = this.dialog.open(PsViewer, {
width: '1500px',
height:'800px',
data: e.attachmentUrls[0]
});
} }
} */
if (e.planType == 1) { //如果是在线编辑 if (e.planType == 1) { //如果是在线编辑
let id = e.id let id = e.id
sessionStorage.setItem("planId", id) sessionStorage.setItem("planId", id)
@ -193,7 +166,7 @@ export class EntryPlanLookComponent implements OnInit {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
if(e.auditStatus==8){ if (e.auditStatus == 8) {
if (e.planType == 1) { //如果是在线编辑 if (e.planType == 1) { //如果是在线编辑
let id = e.id let id = e.id
sessionStorage.setItem("planId", id) sessionStorage.setItem("planId", id)
@ -206,7 +179,6 @@ export class EntryPlanLookComponent implements OnInit {
} }
else if (e.planType == 16) { else if (e.planType == 16) {
if (e.attachmentUrls == null) { if (e.attachmentUrls == null) {
console.log(this.compantData)
window.open(`/planManagement/createplanonlinefive?navIsOpen=false&companyId=${this.companyId}&planName=${e.name}&unitName=${this.unitdata.unitname}&planCategory=${e.planCategory}&planId=${e.id}&unitTypeId=${this.compantData.buildingTypes[0].id}&orName=${this.compantData.organizationName}&orId=${this.compantData.organizationId}`) window.open(`/planManagement/createplanonlinefive?navIsOpen=false&companyId=${this.companyId}&planName=${e.name}&unitName=${this.unitdata.unitname}&planCategory=${e.planCategory}&planId=${e.id}&unitTypeId=${this.compantData.buildingTypes[0].id}&orName=${this.compantData.organizationName}&orId=${this.compantData.organizationId}`)
} }
else { else {
@ -231,7 +203,7 @@ export class EntryPlanLookComponent implements OnInit {
this.snackBar.open('只有二维预案和文本预案可以编辑!', '确定', config); this.snackBar.open('只有二维预案和文本预案可以编辑!', '确定', config);
} }
}else{ } else {
let isTrue = confirm('编辑后审核状态会成为未审核状态,您确定要编辑吗') let isTrue = confirm('编辑后审核状态会成为未审核状态,您确定要编辑吗')
if (isTrue) { if (isTrue) {
if (e.planType == 1) { //如果是在线编辑 if (e.planType == 1) { //如果是在线编辑

492
src/app/plan-management/meet-plan/meet-plan.component.ts

@ -4,7 +4,7 @@ import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'
import { MatPaginator } from '@angular/material/paginator'; import { MatPaginator } from '@angular/material/paginator';
import { FlatTreeControl } from '@angular/cdk/tree'; import { FlatTreeControl } from '@angular/cdk/tree';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { Router,ActivatedRoute } from '@angular/router' import { Router, ActivatedRoute } from '@angular/router'
import { PageEvent } from '@angular/material/paginator'; import { PageEvent } from '@angular/material/paginator';
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
@ -17,52 +17,52 @@ declare var CryptoJS
}) })
export class MeetPlanComponent implements OnInit { export class MeetPlanComponent implements OnInit {
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,private tree: TreeService,public dialog: MatDialog,public snackBar: MatSnackBar) { } constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, private tree: TreeService, public dialog: MatDialog, public snackBar: MatSnackBar) { }
ngOnInit(): void { ngOnInit(): void {
//console.log(window.matchMedia("(max-width: 1300px)").matches&&window.matchMedia("(max-height: 700px)").matches) //console.log(window.matchMedia("(max-width: 1300px)").matches&&window.matchMedia("(max-height: 700px)").matches)
if(window.matchMedia("(max-width: 1400px)").matches){ if (window.matchMedia("(max-width: 1400px)").matches) {
this.pcMore=false this.pcMore = false
this.padMore=true this.padMore = true
this.pcfind=false this.pcfind = false
this.padjt=true this.padjt = true
}else{ } else {
this.pcfind=true this.pcfind = true
this.pcMore=true this.pcMore = true
this.padMore=false this.padMore = false
this.padjt=false this.padjt = false
} }
this.levels = sessionStorage.getItem("level"); this.levels = sessionStorage.getItem("level");
if(this.levels == "0"){//如果是总队 if (this.levels == "0") {//如果是总队
this.preparelevels = [ this.preparelevels = [
{name:"总队",value:"1"}, { name: "总队", value: "1" },
{name:"支队",value:"2"}, { name: "支队", value: "2" },
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(this.levels == "1"){//如果是支队 if (this.levels == "1") {//如果是支队
this.preparelevels = [ this.preparelevels = [
{name:"支队",value:"2"}, { name: "支队", value: "2" },
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(this.levels == "2"){//如果是大队 if (this.levels == "2") {//如果是大队
this.preparelevels = [ this.preparelevels = [
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(this.levels == "3"){//如果是中队 if (this.levels == "3") {//如果是中队
this.preparelevels = [ this.preparelevels = [
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
this.getAlltabledate() this.getAlltabledate()
} }
//生成word //生成word
word(id,fileName){ word(id, fileName) {
/* id :文档dom节点 fileName:文件名称(.doc) */ /* id :文档dom节点 fileName:文件名称(.doc) */
var header = "<html xmlns:o='urn:schemas-microsoft-com:office:office' " + var header = "<html xmlns:o='urn:schemas-microsoft-com:office:office' " +
"xmlns:w='urn:schemas-microsoft-com:office:word' >" + "xmlns:w='urn:schemas-microsoft-com:office:word' >" +
@ -80,9 +80,9 @@ export class MeetPlanComponent implements OnInit {
} }
levels levels
preparelevels:any preparelevels: any
plcheck:boolean //编制级别勾选框 plcheck: boolean //编制级别勾选框
displayedColumns: string[] = ['unitname','level','addname','addtime', 'plantype', 'passstate','isopen','projectlevel','operation']; displayedColumns: string[] = ['unitname', 'level', 'addname', 'addtime', 'plantype', 'passstate', 'isopen', 'projectlevel', 'operation'];
tabledataSource tabledataSource
typePlan//新预案类型 typePlan//新预案类型
unitname//预案名称 unitname//预案名称
@ -95,72 +95,72 @@ export class MeetPlanComponent implements OnInit {
unitstate//审核状态 unitstate//审核状态
projectlevel//编制级别 projectlevel//编制级别
//分页 //分页
@ViewChild(MatPaginator, {static: true}) @ViewChild(MatPaginator, { static: true })
pageEvent: PageEvent; pageEvent: PageEvent;
paginator: MatPaginator; paginator: MatPaginator;
length:any; //共多少条数据 length: any; //共多少条数据
pageSize:any; //每页条数 pageSize: any; //每页条数
pageSizeOptions: number[] = [10] //设置每页条数 pageSizeOptions: number[] = [10] //设置每页条数
PageNumber:any; //第几页 PageNumber: any; //第几页
pcMore//pc更多 pcMore//pc更多
pcput=false//pc收起 pcput = false//pc收起
pcfind//pc查询 pcfind//pc查询
padjt=false padjt = false
padMore=true//pad收缩控制 padMore = true//pad收缩控制
padput=false//pad收起按钮 padput = false//pad收起按钮
imgsrcopen="../../../assets/images/routdown2.png" imgsrcopen = "../../../assets/images/routdown2.png"
imgsrcdown="../../../assets/images/routup2.png" imgsrcdown = "../../../assets/images/routup2.png"
pcInfo(){ pcInfo() {
this.pcMore=!this.pcMore this.pcMore = !this.pcMore
this.pcput=!this.pcput this.pcput = !this.pcput
} }
padInfo(){ padInfo() {
this.padMore=!this.padMore this.padMore = !this.padMore
this.padput=!this.padput this.padput = !this.padput
} }
//获取表格数据 //获取表格数据
getAlltabledate(){ getAlltabledate() {
let reservePlanType let reservePlanType
this.reservePlanType ? reservePlanType = JSON.parse(JSON.stringify(this.reservePlanType)) : reservePlanType = '' this.reservePlanType ? reservePlanType = JSON.parse(JSON.stringify(this.reservePlanType)) : reservePlanType = ''
if(this.reservePlanType && this.reservePlanType.length != 0){ if (this.reservePlanType && this.reservePlanType.length != 0) {
reservePlanType = eval(this.reservePlanType.join("|")) reservePlanType = eval(this.reservePlanType.join("|"))
} }
let paramsdata:any = { let paramsdata: any = {
Name:this.unitname||'', Name: this.unitname || '',
planCategories:this.level||[6,7], planCategories: this.level || [6, 7],
//PlanType:reservePlanType||'', //PlanType:reservePlanType||'',
DisasterType:this.typePlan||'', DisasterType: this.typePlan || '',
CreatorName:this.addname||'', CreatorName: this.addname || '',
AuditStatus:this.unitstate|| '', AuditStatus: this.unitstate || '',
CreationTimeRangeStart:this.addtime||'', CreationTimeRangeStart: this.addtime || '',
CreationTimeRangeEnd:this.endtime||'', CreationTimeRangeEnd: this.endtime || '',
PlanLevel:this.projectlevel||'', PlanLevel: this.projectlevel || '',
HasChildrenPlanLevel:this.plcheck||'', HasChildrenPlanLevel: this.plcheck || '',
PageNumber: this.PageNumber || '1', PageNumber: this.PageNumber || '1',
PageSize: this.pageSizeOptions[0], PageSize: this.pageSizeOptions[0],
} }
this.http.get("/api/PlanComponentsMajor",{params:paramsdata}).subscribe((data:any)=>{ this.http.get("/api/PlanComponentsMajor", { params: paramsdata }).subscribe((data: any) => {
this.length = data.totalCount this.length = data.totalCount
this.tabledataSource = data.items this.tabledataSource = data.items
}) })
} }
//分页事件 //分页事件
changePage(e){ changePage(e) {
this.PageNumber = e.pageIndex+1 this.PageNumber = e.pageIndex + 1
this.getAlltabledate() this.getAlltabledate()
} }
//查询 //查询
onSubmit (value) { onSubmit(value) {
if(this.endtime!=undefined&&this.addtime>this.endtime){ if (this.endtime != undefined && this.addtime > this.endtime) {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('开始时间不能大于结束时间!','确定',config); this.snackBar.open('开始时间不能大于结束时间!', '确定', config);
}else{ } else {
this.PageNumber = 1 this.PageNumber = 1
this.pageEvent.pageIndex = 0 this.pageEvent.pageIndex = 0
this.getAlltabledate(); this.getAlltabledate();
@ -168,24 +168,24 @@ export class MeetPlanComponent implements OnInit {
} }
//删除预案 //删除预案
deletePlan(id){ deletePlan(id) {
let isTrue = confirm('您确定要删除吗') let isTrue = confirm('您确定要删除吗')
if(isTrue){ if (isTrue) {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.http.delete(`/api/PlanComponentsMajor/${id}`).subscribe(data=>{ this.http.delete(`/api/PlanComponentsMajor/${id}`).subscribe(data => {
this.snackBar.open('删除成功!','确定',config); this.snackBar.open('删除成功!', '确定', config);
this.getAlltabledate() this.getAlltabledate()
},err => { }, err => {
this.snackBar.open(err,'确定',config); this.snackBar.open(err, '确定', config);
}) })
} }
} }
//提交审核 //提交审核
submitAudit(element){ submitAudit(element) {
// console.log(element) // console.log(element)
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
@ -193,83 +193,64 @@ export class MeetPlanComponent implements OnInit {
/* if(element.auditStatus == 4){ /* if(element.auditStatus == 4){
this.snackBar.open('审核退回的预案需要修改后方可再次提交审核!','确定',config); this.snackBar.open('审核退回的预案需要修改后方可再次提交审核!','确定',config);
} */ } */
this.http.put(`/api/PlanComponentsMajor/${element.id}/Commit`,"").subscribe(data=>{ this.http.put(`/api/PlanComponentsMajor/${element.id}/Commit`, "").subscribe(data => {
this.getAlltabledate() this.getAlltabledate()
},err => { }, err => {
this.snackBar.open(err,'确定',config); this.snackBar.open(err, '确定', config);
}) })
} }
//撤销审核 //撤销审核
cancelAudit(element){ cancelAudit(element) {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.http.put(`/api/PlanComponentsMajor/${element.id}/Cancel`,"").subscribe(data=>{ this.http.put(`/api/PlanComponentsMajor/${element.id}/Cancel`, "").subscribe(data => {
this.getAlltabledate() this.getAlltabledate()
},err => { }, err => {
this.snackBar.open(err,'确定',config); this.snackBar.open(err, '确定', config);
}) })
} }
//查看预案 //查看预案
openPlan(element){ openPlan(element) {
//fetchUrl: `http://172.18.0.1:8000/api/Objects/PlanPlatform/`+fetchUrl
let filename:string
let fetchUrl = element.attachmentUrls[0] let fetchUrl = element.attachmentUrls[0]
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl); let suffix = fetchUrl.split('.')[fetchUrl.split('.').length - 1].toLowerCase()
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray); if (suffix == 'docx' || suffix == 'doc') {
let jwt = sessionStorage.getItem("token"); let arr = fetchUrl.split('.')
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); arr[arr.length - 1] = 'pdf'
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
let identityJsonparse=JSON.parse(identityJson) } else if (suffix == 'pdf') {
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{ window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
filename=data.fileName } else {
let json={ let config = new MatSnackBarConfig();
doc: { config.verticalPosition = 'top';
docId: docId, config.duration = 3000
title: filename, this.snackBar.open('该文件类型暂不支持在线查看', '确定', config);
fetchUrl: `http://172.18.0.1:8000/api/Objects/PlanPlatform/`+fetchUrl, }
},
user: {
uid: identityJsonparse.sub,
nickName: identityJsonparse.name,
avatar: "",
privilege:element.auditStatus!='1'&&element.auditStatus!='16'?[
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
]:[
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
],
},
}
var stringjson=JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
})
} }
//下载↓ //下载↓
selectDownloadFile:any; //选择下载的文件 selectDownloadFile: any; //选择下载的文件
download:any; //下载文件元数据 download: any; //下载文件元数据
downloadisLoading:boolean = false; //进度条loading加载 downloadisLoading: boolean = false; //进度条loading加载
downloadProgress:number=0; //进度条进度 downloadProgress: number = 0; //进度条进度
downloadFileName:any downloadFileName: any
fileUrls:any //当前预案附件地址 fileUrls: any //当前预案附件地址
fileDatas:any = [] fileDatas: any = []
selectedFileIndex : any = 0 selectedFileIndex: any = 0
selectedFileData : any selectedFileData: any
uploadFileLonging:any uploadFileLonging: any
//读取下载文件信息 //读取下载文件信息
readFile (element) { readFile(element) {
this.uploadFileLonging = element this.uploadFileLonging = element
element.attachmentUrls.forEach(item=>{ element.attachmentUrls.forEach(item => {
this.http.get('/api/ObjectMetadata/PlanPlatform/'+item).subscribe((data:any)=>{ this.http.get('/api/ObjectMetadata/PlanPlatform/' + item).subscribe((data: any) => {
data.filePige = (data.fileLength / (1024*1024)).toFixed(2) data.filePige = (data.fileLength / (1024 * 1024)).toFixed(2)
this.download = data this.download = data
this.downloadFile() this.downloadFile()
}) })
@ -278,24 +259,24 @@ export class MeetPlanComponent implements OnInit {
} }
//初始化下载 //初始化下载
downloadFile () { downloadFile() {
this.downloadProgress = 0 this.downloadProgress = 0
let file = this.download let file = this.download
let fileSize = file.fileLength//下载文件的总大小 let fileSize = file.fileLength//下载文件的总大小
let shardSize = 10 * 1024 * 1024 //文件大小是否大于10MB let shardSize = 10 * 1024 * 1024 //文件大小是否大于10MB
if (file && fileSize<=shardSize) { //<=10MB时直接下载 if (file && fileSize <= shardSize) { //<=10MB时直接下载
this.downloadisLoading = true this.downloadisLoading = true
// this.setFileLoading() // this.setFileLoading()
this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`,{responseType: 'blob'},).subscribe(data=>{ this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`, { responseType: 'blob' },).subscribe(data => {
let url = window.URL.createObjectURL(new Blob([data])); //createObjectURL创建一个下载Blob的url地址 let url = window.URL.createObjectURL(new Blob([data])); //createObjectURL创建一个下载Blob的url地址
let link = document.createElement("a"); let link = document.createElement("a");
link.style.display = "none"; link.style.display = "none";
link.href = url; link.href = url;
let suffix = file.objectName.substring(file.objectName.lastIndexOf(".")+1,file.objectName.length) ; let suffix = file.objectName.substring(file.objectName.lastIndexOf(".") + 1, file.objectName.length);
link.setAttribute("download", file.fileName + "-" +this.uploadFileLonging.name + "." + suffix); link.setAttribute("download", file.fileName + "-" + this.uploadFileLonging.name + "." + suffix);
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
this.downloadisLoading = false this.downloadisLoading = false
@ -310,31 +291,32 @@ export class MeetPlanComponent implements OnInit {
} }
//分段下载并合并 //分段下载并合并
async blockingDownload () { async blockingDownload() {
let file = this.download let file = this.download
let fileSize = file.fileLength //下载文件的总大小 let fileSize = file.fileLength //下载文件的总大小
let shardSize = 3 * 1024 * 1024 //3MB一个分片 let shardSize = 3 * 1024 * 1024 //3MB一个分片
let allSlice = Math.ceil(fileSize / shardSize) //总文件/3MB===共分多少段 let allSlice = Math.ceil(fileSize / shardSize) //总文件/3MB===共分多少段
let allFile:any = [] //所有的file分段 let allFile: any = [] //所有的file分段
for (let i=0;i<allSlice;i++) { for (let i = 0; i < allSlice; i++) {
let start = i * shardSize //每次下载文件开始位置 let start = i * shardSize //每次下载文件开始位置
let end = Math.min(fileSize, start + shardSize-1); //每次下载文件结束为止 let end = Math.min(fileSize, start + shardSize - 1); //每次下载文件结束为止
let result = await new Promise ((result,reject)=>{ let result = await new Promise((result, reject) => {
this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`,{headers:{'range':`bytes= ${start}-${end}`},responseType:'blob'}).subscribe(data=>{ this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`, { headers: { 'range': `bytes= ${start}-${end}` }, responseType: 'blob' }).subscribe(data => {
result(data) }) result(data)
})
}) })
allFile.push(result) allFile.push(result)
this.downloadProgress = Number((i/allSlice).toFixed(2))*100 this.downloadProgress = Number((i / allSlice).toFixed(2)) * 100
if (allFile.length === allSlice) { //合并文件输出给浏览器 if (allFile.length === allSlice) { //合并文件输出给浏览器
let url = window.URL.createObjectURL(new Blob(allFile)); //createObjectURL创建一个下载Blob的url地址 let url = window.URL.createObjectURL(new Blob(allFile)); //createObjectURL创建一个下载Blob的url地址
let link = document.createElement("a"); let link = document.createElement("a");
link.style.display = "none"; link.style.display = "none";
link.href = url; link.href = url;
let suffix = file.objectName.substring(file.objectName.lastIndexOf(".")+1,file.objectName.length) ; let suffix = file.objectName.substring(file.objectName.lastIndexOf(".") + 1, file.objectName.length);
link.setAttribute("download", file.fileName + "-" +this.uploadFileLonging.name + "." + suffix); link.setAttribute("download", file.fileName + "-" + this.uploadFileLonging.name + "." + suffix);
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
// this.downloadProgress = 0 // this.downloadProgress = 0
@ -347,29 +329,29 @@ export class MeetPlanComponent implements OnInit {
} }
//取消分块下载 //取消分块下载
cancelDowload () { cancelDowload() {
} }
//重置 //重置
reset(){ reset() {
this.typePlan='' this.typePlan = ''
this.unitname='' this.unitname = ''
this.level='' this.level = ''
this.addname='' this.addname = ''
this.addtime='' this.addtime = ''
this.endtime='' this.endtime = ''
this.reservePlanType='' this.reservePlanType = ''
this.unitstate='' this.unitstate = ''
this.projectlevel='' this.projectlevel = ''
this.plcheck=false this.plcheck = false
this.getAlltabledate() this.getAlltabledate()
} }
//新增预案弹窗 //新增预案弹窗
addunit(){ addunit() {
const dialogRef = this.dialog.open(newunitMeet, { const dialogRef = this.dialog.open(newunitMeet, {
width: '340px', width: '340px',
height:'490px', height: '490px',
disableClose:true disableClose: true
//data: paperDataInfo //data: paperDataInfo
}); });
dialogRef.afterClosed().subscribe(result => { dialogRef.afterClosed().subscribe(result => {
@ -379,12 +361,12 @@ export class MeetPlanComponent implements OnInit {
} }
//审核结果 //审核结果
auditResult(element){ auditResult(element) {
// console.log(element) // console.log(element)
const dialogRef = this.dialog.open(meetAuditResult, { const dialogRef = this.dialog.open(meetAuditResult, {
width:"400px", width: "400px",
//height:"300px", //height:"300px",
data: {element:element} data: { element: element }
}); });
} }
@ -396,8 +378,8 @@ export class MeetPlanComponent implements OnInit {
templateUrl: './newunit.html', templateUrl: './newunit.html',
styleUrls: ['./newunit.scss'] styleUrls: ['./newunit.scss']
}) })
export class newunitMeet{ export class newunitMeet {
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<newunitMeet>,@Inject(MAT_DIALOG_DATA) public data: any) {} constructor(private router: Router, private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<newunitMeet>, @Inject(MAT_DIALOG_DATA) public data: any) { }
unitname//预案名称 unitname//预案名称
level//预案级别 level//预案级别
addname//添加人 addname//添加人
@ -407,83 +389,83 @@ export class newunitMeet{
projectlevel//编制级别 projectlevel//编制级别
//上传文件↓ //上传文件↓
file:any; //上传的文件 file: any; //上传的文件
fileName:any; //上传文件name fileName: any; //上传文件name
uploadisLoading:boolean = false; //进度条loading加载 uploadisLoading: boolean = false; //进度条loading加载
uploadProgress:number=0; //进度条进度 uploadProgress: number = 0; //进度条进度
objectName:any; //上传对象名 objectName: any; //上传对象名
uploadId:any; //上传分块上传事件编号 uploadId: any; //上传分块上传事件编号
uploadover:any = false //上传完成之后提示 uploadover: any = false //上传完成之后提示
selectedPLanType:any//所选预案类型 selectedPLanType: any//所选预案类型
selectedPLanName:any//所选预案名称 selectedPLanName: any//所选预案名称
localup:boolean = false //本地上传 localup: boolean = false //本地上传
defaultisshow = '0' //默认显示上传input框 defaultisshow = '0' //默认显示上传input框
//上传 //上传
upload(){ upload() {
document.getElementById('up').click() document.getElementById('up').click()
} }
//上传文件input //上传文件input
filechange(e){ filechange(e) {
this.file = e.target.files[0] || null //上传的文件 this.file = e.target.files[0] || null //上传的文件
//console.log(this.file) //console.log(this.file)
} }
//上传文件 //上传文件
startUploading (planType) { startUploading(planType) {
let file = this.file || null //获取上传的文件 let file = this.file || null //获取上传的文件
let fileSize = file.size || null //上传文件的总大小 let fileSize = file.size || null //上传文件的总大小
let shardSize = 5 * 1024 * 1024 //5MB一个分片 let shardSize = 5 * 1024 * 1024 //5MB一个分片
if (file && fileSize<=shardSize) { //上传文件<=5MB时 if (file && fileSize <= shardSize) { //上传文件<=5MB时
let formData = new FormData() let formData = new FormData()
formData.append("file",file) formData.append("file", file)
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
let level = sessionStorage.getItem("level") let level = sessionStorage.getItem("level")
// console.log(level) // console.log(level)
let PlanLevel let PlanLevel
if(level == '0'){ if (level == '0') {
PlanLevel = 1 PlanLevel = 1
} }
if(level == '1'){ if (level == '1') {
PlanLevel = 2 PlanLevel = 2
} }
if(level == '2'){ if (level == '2') {
PlanLevel = 4 PlanLevel = 4
} }
if(level == '3'){ if (level == '3') {
PlanLevel = 8 PlanLevel = 8
} }
this.http.post('/api/Objects/PlanPlatform/meetClass',formData).subscribe((data:any)=>{ this.http.post('/api/Objects/PlanPlatform/meetClass', formData).subscribe((data: any) => {
this.objectName = data.objectName this.objectName = data.objectName
//this.snackBar.open('上传成功!','确定',config); //this.snackBar.open('上传成功!','确定',config);
let body:any = { let body: any = {
Name:this.unitname||'', Name: this.unitname || '',
PlanCategory:Number(this.level)||'', PlanCategory: Number(this.level) || '',
disasterType: this.reservePlanType, disasterType: this.reservePlanType,
PlanLevel:PlanLevel, PlanLevel: PlanLevel,
PlanMode:1, PlanMode: 1,
planType:16, planType: 16,
attachmentUrls:[`${this.objectName}`] attachmentUrls: [`${this.objectName}`]
} }
// console.log(body) // console.log(body)
this.http.post("/api/PlanComponentsMajor",body).subscribe((data:any)=>{ this.http.post("/api/PlanComponentsMajor", body).subscribe((data: any) => {
this.snackBar.open('创建成功!','确定',config); this.snackBar.open('创建成功!', '确定', config);
//console.log(data) //console.log(data)
this.dialogRef.close(); this.dialogRef.close();
},err=>{ }, err => {
this.snackBar.open('创建失败!','确定',config); this.snackBar.open('创建失败!', '确定', config);
}) })
},err=>{ }, err => {
this.snackBar.open('上传失败!','确定',config); this.snackBar.open('上传失败!', '确定', config);
}) })
} else if (file && fileSize>shardSize) { //上传文件>5MB时,分块上传 } else if (file && fileSize > shardSize) { //上传文件>5MB时,分块上传
let data = {filename: file.name} let data = { filename: file.name }
this.uploadisLoading = true this.uploadisLoading = true
this.http.post('/api/NewMultipartUpload/PlanPlatform/meetClass',{},{params:data}).subscribe((data:any)=>{ //初始化分段上传 this.http.post('/api/NewMultipartUpload/PlanPlatform/meetClass', {}, { params: data }).subscribe((data: any) => { //初始化分段上传
this.objectName = data.objectName this.objectName = data.objectName
this.uploadId = data.uploadId this.uploadId = data.uploadId
this.subsectionUploading(planType) this.subsectionUploading(planType)
@ -491,98 +473,100 @@ export class newunitMeet{
} }
} }
PartNumberETag:any=[]; //每次返回需要保存的信息 PartNumberETag: any = []; //每次返回需要保存的信息
//开始分段上传 //开始分段上传
async subsectionUploading (planType) { async subsectionUploading(planType) {
let file = this.file || null //获取上传的文件 let file = this.file || null //获取上传的文件
let fileSize = file.size || null //上传文件的总大小 let fileSize = file.size || null //上传文件的总大小
let shardSize = 5 * 1024 * 1024 //5MB一个分片 let shardSize = 5 * 1024 * 1024 //5MB一个分片
let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段 向上取整 let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段 向上取整
for (let i = 0;i < allSlice;i++) { //循环分段上传 for (let i = 0; i < allSlice; i++) { //循环分段上传
let start = i * shardSize //切割文件开始位置 let start = i * shardSize //切割文件开始位置
let end = Math.min(fileSize, start + shardSize); //切割文件结束位置 (对比取小数) let end = Math.min(fileSize, start + shardSize); //切割文件结束位置 (对比取小数)
let formData = new FormData() let formData = new FormData()
formData.append("file",file.slice(start, end)) formData.append("file", file.slice(start, end))
//同步写法实现异步调用 //同步写法实现异步调用
let result = await new Promise((resolve, reject) => { let result = await new Promise((resolve, reject) => {
// await 需要后面返回一个 promise 对象 // await 需要后面返回一个 promise 对象
this.http.post(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}&partNumber=${i+1}`,formData).subscribe((data:any)=>{ this.http.post(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => {
let msg = { let msg = {
"partNumber":data.partNumber || null, "partNumber": data.partNumber || null,
"eTag": data.eTag || null} "eTag": data.eTag || null
}
resolve(msg) // 调用 promise 内置方法处理成功 resolve(msg) // 调用 promise 内置方法处理成功
}) })
}); });
this.PartNumberETag.push(result) this.PartNumberETag.push(result)
this.uploadProgress = Number((i/allSlice).toFixed(2))*100 this.uploadProgress = Number((i / allSlice).toFixed(2)) * 100
if (this.PartNumberETag.length === allSlice) { if (this.PartNumberETag.length === allSlice) {
this.uploadProgress = 100 this.uploadProgress = 100
this.endUploading(planType)} this.endUploading(planType)
}
}//for循环 }//for循环
} }
//完成分块上传 //完成分块上传
endUploading (planType) { endUploading(planType) {
let data = this.PartNumberETag let data = this.PartNumberETag
let paramsData = {uploadId:this.uploadId} let paramsData = { uploadId: this.uploadId }
this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`,data,{params:paramsData}).subscribe(data=>{ this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`, data, { params: paramsData }).subscribe(data => {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
//this.snackBar.open('上传成功!','确定',config); //this.snackBar.open('上传成功!','确定',config);
this.uploadProgress = 0; this.uploadProgress = 0;
this.uploadisLoading = false this.uploadisLoading = false
this.PartNumberETag =[] //清空保存返回的信息 this.PartNumberETag = [] //清空保存返回的信息
this.uploadover = true this.uploadover = true
let level = sessionStorage.getItem("level") let level = sessionStorage.getItem("level")
// console.log(level) // console.log(level)
let PlanLevel let PlanLevel
if(level == '0'){ if (level == '0') {
PlanLevel = 1 PlanLevel = 1
} }
if(level == '1'){ if (level == '1') {
PlanLevel = 2 PlanLevel = 2
} }
if(level == '2'){ if (level == '2') {
PlanLevel = 4 PlanLevel = 4
} }
if(level == '3'){ if (level == '3') {
PlanLevel = 8 PlanLevel = 8
} }
let body:any = { let body: any = {
Name:this.unitname||'', Name: this.unitname || '',
PlanCategory:Number(this.level)||'', PlanCategory: Number(this.level) || '',
disasterType: this.reservePlanType, disasterType: this.reservePlanType,
PlanLevel:PlanLevel, PlanLevel: PlanLevel,
PlanMode:1, PlanMode: 1,
planType:16, planType: 16,
attachmentUrls:[`${this.objectName}`] attachmentUrls: [`${this.objectName}`]
} }
this.http.post("/api/PlanComponentsMajor",body).subscribe((data:any)=>{ this.http.post("/api/PlanComponentsMajor", body).subscribe((data: any) => {
this.snackBar.open('创建成功!','确定',config); this.snackBar.open('创建成功!', '确定', config);
this.dialogRef.close(); this.dialogRef.close();
},err=>{ }, err => {
this.snackBar.open('创建失败!','确定',config); this.snackBar.open('创建失败!', '确定', config);
}) })
}) })
} }
//取消分块上传 //取消分块上传
cancel () { cancel() {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000; config.duration = 3000;
this.http.delete(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}`).subscribe(data=>{ this.http.delete(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}`).subscribe(data => {
this.uploadProgress = 0; this.uploadProgress = 0;
this.uploadisLoading= false; this.uploadisLoading = false;
(<HTMLInputElement>document.getElementById('up')).value = null (<HTMLInputElement>document.getElementById('up')).value = null
this.PartNumberETag =[] //清空保存返回的信息 this.PartNumberETag = [] //清空保存返回的信息
this.snackBar.open('取消上传成功!','确定',config); this.snackBar.open('取消上传成功!', '确定', config);
this.uploadover = false this.uploadover = false
this.file = null this.file = null
}) })
@ -590,27 +574,27 @@ export class newunitMeet{
//创建预案 //创建预案
newplan(){ newplan() {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
if(this.unitname==undefined||this.unitname==''){ if (this.unitname == undefined || this.unitname == '') {
this.snackBar.open('请输入预案名称!','确定',config); this.snackBar.open('请输入预案名称!', '确定', config);
} }
else if(this.reservePlanType==undefined||this.reservePlanType==''){ else if (this.reservePlanType == undefined || this.reservePlanType == '') {
this.snackBar.open('请输入预案类型!','确定',config); this.snackBar.open('请输入预案类型!', '确定', config);
} }
else if(this.level==undefined||this.level==''){ else if (this.level == undefined || this.level == '') {
this.snackBar.open('请输入预案级别!','确定',config); this.snackBar.open('请输入预案级别!', '确定', config);
} }
else if(this.file==undefined){ else if (this.file == undefined) {
this.snackBar.open('请先上传文件!','确定',config); this.snackBar.open('请先上传文件!', '确定', config);
} }
else{ else {
if(this.reservePlanType!='1'){ if (this.reservePlanType != '1') {
this.startUploading("非二维") this.startUploading("非二维")
} }
else{this.startUploading("二维")} else { this.startUploading("二维") }
} }
@ -618,7 +602,7 @@ export class newunitMeet{
} }
//取消 //取消
close(){ close() {
this.dialogRef.close(); this.dialogRef.close();
} }
} }
@ -629,15 +613,15 @@ export class newunitMeet{
templateUrl: './resultmeetPlan.html', templateUrl: './resultmeetPlan.html',
styleUrls: ['./meet-plan.component.scss'] styleUrls: ['./meet-plan.component.scss']
}) })
export class meetAuditResult{ export class meetAuditResult {
constructor(private http: HttpClient,public dialogRef: MatDialogRef<meetAuditResult>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} constructor(private http: HttpClient, public dialogRef: MatDialogRef<meetAuditResult>, @Inject(MAT_DIALOG_DATA) public data, public snackBar: MatSnackBar) { }
planName:any = this.data.element.name planName: any = this.data.element.name
commitTime:any = this.data.element.committedTime commitTime: any = this.data.element.committedTime
commitOrganizationName:any = this.data.element.committerOrganizationName commitOrganizationName: any = this.data.element.committerOrganizationName
auditOrganizationName:any = this.data.element.auditorOrganizationName auditOrganizationName: any = this.data.element.auditorOrganizationName
auditResult:any = this.data.element.auditStatus auditResult: any = this.data.element.auditStatus
auditOpinion:any = this.data.element.auditOpinion auditOpinion: any = this.data.element.auditOpinion
ngOnInit(): void { ngOnInit(): void {
} }
onNoClick(): void { onNoClick(): void {

493
src/app/plan-management/onetwo-entry-plan/onetwo-entry-plan.component.ts

@ -13,7 +13,7 @@ import { MatPaginator } from '@angular/material/paginator';
import { FlatTreeControl } from '@angular/cdk/tree'; import { FlatTreeControl } from '@angular/cdk/tree';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { Router,ActivatedRoute } from '@angular/router' import { Router, ActivatedRoute } from '@angular/router'
import { PageEvent } from '@angular/material/paginator'; import { PageEvent } from '@angular/material/paginator';
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
@ -30,72 +30,72 @@ declare var CryptoJS
}) })
export class OnetwoEntryPlanComponent implements OnInit { export class OnetwoEntryPlanComponent implements OnInit {
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,private tree: TreeService,public dialog: MatDialog,public snackBar: MatSnackBar) { } constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, private tree: TreeService, public dialog: MatDialog, public snackBar: MatSnackBar) { }
ngOnInit(): void { ngOnInit(): void {
if(window.matchMedia("(max-width: 1400px)").matches){ if (window.matchMedia("(max-width: 1400px)").matches) {
this.pcMore=false this.pcMore = false
this.padMore=true this.padMore = true
this.pcfind=false this.pcfind = false
this.padjt=true this.padjt = true
}else{ } else {
this.pcfind=true this.pcfind = true
this.pcMore=true this.pcMore = true
this.padMore=false this.padMore = false
this.padjt=false this.padjt = false
} }
this.levels = sessionStorage.getItem("level"); this.levels = sessionStorage.getItem("level");
if(this.levels == "0"){//如果是总队 if (this.levels == "0") {//如果是总队
this.preparelevels = [ this.preparelevels = [
{name:"总队",value:"1"}, { name: "总队", value: "1" },
{name:"支队",value:"2"}, { name: "支队", value: "2" },
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(this.levels == "1"){//如果是支队 if (this.levels == "1") {//如果是支队
this.preparelevels = [ this.preparelevels = [
{name:"支队",value:"2"}, { name: "支队", value: "2" },
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(this.levels == "2"){//如果是大队 if (this.levels == "2") {//如果是大队
this.preparelevels = [ this.preparelevels = [
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(this.levels == "3"){//如果是中队 if (this.levels == "3") {//如果是中队
this.preparelevels = [ this.preparelevels = [
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
this.url=window.location.href.substring(window.location.href.length-1,window.location.href.length) this.url = window.location.href.substring(window.location.href.length - 1, window.location.href.length)
this.getAlltabledate() this.getAlltabledate()
} }
pcMore//pc更多 pcMore//pc更多
pcput=false//pc收起 pcput = false//pc收起
pcfind//pc查询 pcfind//pc查询
padjt=false padjt = false
padMore=true//pad收缩控制 padMore = true//pad收缩控制
padput=false//pad收起按钮 padput = false//pad收起按钮
imgsrcopen="../../../assets/images/routdown2.png" imgsrcopen = "../../../assets/images/routdown2.png"
imgsrcdown="../../../assets/images/routup2.png" imgsrcdown = "../../../assets/images/routup2.png"
pcInfo(){ pcInfo() {
this.pcMore=!this.pcMore this.pcMore = !this.pcMore
this.pcput=!this.pcput this.pcput = !this.pcput
} }
padInfo(){ padInfo() {
this.padMore=!this.padMore this.padMore = !this.padMore
this.padput=!this.padput this.padput = !this.padput
} }
levels levels
url url
preparelevels:any preparelevels: any
plcheck:boolean //编制级别勾选框 plcheck: boolean //编制级别勾选框
displayedColumns: string[] = ['unitname','level','addname','addtime', 'plantype', 'passstate','isopen','projectlevel','operation']; displayedColumns: string[] = ['unitname', 'level', 'addname', 'addtime', 'plantype', 'passstate', 'isopen', 'projectlevel', 'operation'];
tabledataSource tabledataSource
unitname//预案名称 unitname//预案名称
level//预案级别 level//预案级别
@ -107,71 +107,71 @@ export class OnetwoEntryPlanComponent implements OnInit {
projectlevel//编制级别 projectlevel//编制级别
typePlan//新预案类型 typePlan//新预案类型
//分页 //分页
@ViewChild(MatPaginator, {static: true}) @ViewChild(MatPaginator, { static: true })
pageEvent: PageEvent; pageEvent: PageEvent;
paginator: MatPaginator; paginator: MatPaginator;
length:any; //共多少条数据 length: any; //共多少条数据
pageSize:any; //每页条数 pageSize: any; //每页条数
pageSizeOptions: number[] = [10] //设置每页条数 pageSizeOptions: number[] = [10] //设置每页条数
PageNumber:any; //第几页 PageNumber: any; //第几页
//获取表格数据 //获取表格数据
getAlltabledate(){ getAlltabledate() {
let reservePlanType let reservePlanType
this.reservePlanType ? reservePlanType = JSON.parse(JSON.stringify(this.reservePlanType)) : reservePlanType = '' this.reservePlanType ? reservePlanType = JSON.parse(JSON.stringify(this.reservePlanType)) : reservePlanType = ''
if(this.reservePlanType && this.reservePlanType.length != 0){ if (this.reservePlanType && this.reservePlanType.length != 0) {
reservePlanType = eval(this.reservePlanType.join("|")) reservePlanType = eval(this.reservePlanType.join("|"))
} }
let paramsdata:any = { let paramsdata: any = {
Name:this.unitname||'', Name: this.unitname || '',
planCategories:this.url=='2'?2:1, planCategories: this.url == '2' ? 2 : 1,
//PlanType:reservePlanType||'', //PlanType:reservePlanType||'',
DisasterType:this.typePlan||'', DisasterType: this.typePlan || '',
CreatorName:this.addname||'', CreatorName: this.addname || '',
AuditStatus:this.unitstate|| '', AuditStatus: this.unitstate || '',
CreationTimeRangeStart:this.addtime||'', CreationTimeRangeStart: this.addtime || '',
CreationTimeRangeEnd:this.endtime||'', CreationTimeRangeEnd: this.endtime || '',
PlanLevel:this.projectlevel||'', PlanLevel: this.projectlevel || '',
HasChildrenPlanLevel:this.plcheck||'', HasChildrenPlanLevel: this.plcheck || '',
PageNumber: this.PageNumber || '1', PageNumber: this.PageNumber || '1',
PageSize: this.pageSizeOptions[0], PageSize: this.pageSizeOptions[0],
} }
this.http.get("/api/PlanComponentsMajor",{params:paramsdata}).subscribe((data:any)=>{ this.http.get("/api/PlanComponentsMajor", { params: paramsdata }).subscribe((data: any) => {
this.length = data.totalCount this.length = data.totalCount
this.tabledataSource = data.items this.tabledataSource = data.items
}) })
} }
//分页事件 //分页事件
changePage(e){ changePage(e) {
this.PageNumber = e.pageIndex+1 this.PageNumber = e.pageIndex + 1
this.getAlltabledate() this.getAlltabledate()
} }
//重置 //重置
reset(){ reset() {
this.typePlan='' this.typePlan = ''
this.unitname='' this.unitname = ''
this.level='' this.level = ''
this.addname='' this.addname = ''
this.addtime='' this.addtime = ''
this.endtime='' this.endtime = ''
this.reservePlanType='' this.reservePlanType = ''
this.unitstate='' this.unitstate = ''
this.projectlevel='' this.projectlevel = ''
this.plcheck=false this.plcheck = false
this.getAlltabledate() this.getAlltabledate()
} }
//查询 //查询
onSubmit (value) { onSubmit(value) {
//console.log(value) //console.log(value)
if(this.endtime!=undefined&&this.addtime>this.endtime){ if (this.endtime != undefined && this.addtime > this.endtime) {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('开始时间不能大于结束时间!','确定',config); this.snackBar.open('开始时间不能大于结束时间!', '确定', config);
}else{ } else {
this.PageNumber = 1 this.PageNumber = 1
this.pageEvent.pageIndex = 0 this.pageEvent.pageIndex = 0
this.getAlltabledate(); this.getAlltabledate();
@ -179,24 +179,24 @@ export class OnetwoEntryPlanComponent implements OnInit {
} }
//删除预案 //删除预案
deletePlan(id){ deletePlan(id) {
let isTrue = confirm('您确定要删除吗') let isTrue = confirm('您确定要删除吗')
if(isTrue){ if (isTrue) {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.http.delete(`/api/PlanComponentsMajor/${id}`).subscribe(data=>{ this.http.delete(`/api/PlanComponentsMajor/${id}`).subscribe(data => {
this.snackBar.open('删除成功!','确定',config); this.snackBar.open('删除成功!', '确定', config);
this.getAlltabledate() this.getAlltabledate()
},err => { }, err => {
this.snackBar.open(err,'确定',config); this.snackBar.open(err, '确定', config);
}) })
} }
} }
//提交审核 //提交审核
submitAudit(element){ submitAudit(element) {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
@ -206,69 +206,49 @@ export class OnetwoEntryPlanComponent implements OnInit {
config.duration = 3000 config.duration = 3000
this.snackBar.open('审核退回的预案需要修改后方可再次提交审核!','确定',config); this.snackBar.open('审核退回的预案需要修改后方可再次提交审核!','确定',config);
} */ } */
this.http.put(`/api/PlanComponentsMajor/${element.id}/Commit`,"").subscribe(data=>{ this.http.put(`/api/PlanComponentsMajor/${element.id}/Commit`, "").subscribe(data => {
this.getAlltabledate() this.getAlltabledate()
},err => { }, err => {
this.snackBar.open(err,'确定',config); this.snackBar.open(err, '确定', config);
}) })
} }
//撤销审核 //撤销审核
cancelAudit(element){ cancelAudit(element) {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.http.put(`/api/PlanComponentsMajor/${element.id}/Cancel`,"").subscribe(data=>{ this.http.put(`/api/PlanComponentsMajor/${element.id}/Cancel`, "").subscribe(data => {
this.getAlltabledate() this.getAlltabledate()
},err => { }, err => {
this.snackBar.open(err,'确定',config); this.snackBar.open(err, '确定', config);
}) })
} }
//查看预案 //查看预案
openPlan(element){ openPlan(element) {
let filename:string
let fetchUrl = element.attachmentUrls[0] let fetchUrl = element.attachmentUrls[0]
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl); let suffix = fetchUrl.split('.')[fetchUrl.split('.').length - 1].toLowerCase()
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray); if (suffix == 'docx' || suffix == 'doc') {
let jwt = sessionStorage.getItem("token"); let arr = fetchUrl.split('.')
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); arr[arr.length - 1] = 'pdf'
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
let identityJsonparse=JSON.parse(identityJson) }else if (suffix == 'pdf') {
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{ window.open(`/api/Objects/PlanPlatform/` + element.attachmentUrls[0])
filename=data.fileName }else{
let json={ let config = new MatSnackBarConfig();
doc: { config.verticalPosition = 'top';
docId: docId, config.duration = 3000
title: filename, this.snackBar.open('该文件类型暂不支持在线查看', '确定', config);
fetchUrl: `http://172.18.0.1:8000/api/Objects/PlanPlatform/`+fetchUrl, }
},
user: {
uid: identityJsonparse.sub,
nickName: identityJsonparse.name,
avatar: "",
privilege:element.auditStatus!='1'&&element.auditStatus!='16'?[
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
]:[
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
],
},
}
var stringjson=JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
})
} }
//新增预案弹窗 //新增预案弹窗
addunit(){ addunit() {
const dialogRef = this.dialog.open(newunitComponent, { const dialogRef = this.dialog.open(newunitComponent, {
width: '340px', width: '340px',
height:'410px', height: '410px',
disableClose:true disableClose: true
//data: paperDataInfo //data: paperDataInfo
}); });
dialogRef.afterClosed().subscribe(result => { dialogRef.afterClosed().subscribe(result => {
@ -278,33 +258,33 @@ export class OnetwoEntryPlanComponent implements OnInit {
} }
//审核结果 //审核结果
auditResult(element){ auditResult(element) {
// console.log(element) // console.log(element)
const dialogRef = this.dialog.open(onetwoAuditResult, { const dialogRef = this.dialog.open(onetwoAuditResult, {
width:"400px", width: "400px",
//height:"300px", //height:"300px",
data: {element:element} data: { element: element }
}); });
} }
//下载↓ //下载↓
selectDownloadFile:any; //选择下载的文件 selectDownloadFile: any; //选择下载的文件
download:any; //下载文件元数据 download: any; //下载文件元数据
downloadisLoading:boolean = false; //进度条loading加载 downloadisLoading: boolean = false; //进度条loading加载
downloadProgress:number=0; //进度条进度 downloadProgress: number = 0; //进度条进度
downloadFileName:any downloadFileName: any
fileUrls:any //当前预案附件地址 fileUrls: any //当前预案附件地址
fileDatas:any = [] fileDatas: any = []
selectedFileIndex : any = 0 selectedFileIndex: any = 0
selectedFileData : any selectedFileData: any
uploadFileLonging:any uploadFileLonging: any
//读取下载文件信息 //读取下载文件信息
readFile (element) { readFile(element) {
this.uploadFileLonging = element this.uploadFileLonging = element
element.attachmentUrls.forEach(item=>{ element.attachmentUrls.forEach(item => {
this.http.get('/api/ObjectMetadata/PlanPlatform/'+item).subscribe((data:any)=>{ this.http.get('/api/ObjectMetadata/PlanPlatform/' + item).subscribe((data: any) => {
data.filePige = (data.fileLength / (1024*1024)).toFixed(2) data.filePige = (data.fileLength / (1024 * 1024)).toFixed(2)
//console.log(data) //console.log(data)
this.download = data this.download = data
this.downloadFile() this.downloadFile()
@ -314,24 +294,24 @@ export class OnetwoEntryPlanComponent implements OnInit {
} }
//初始化下载 //初始化下载
downloadFile () { downloadFile() {
this.downloadProgress = 0 this.downloadProgress = 0
let file = this.download let file = this.download
let fileSize = file.fileLength//下载文件的总大小 let fileSize = file.fileLength//下载文件的总大小
let shardSize = 10 * 1024 * 1024 //文件大小是否大于10MB let shardSize = 10 * 1024 * 1024 //文件大小是否大于10MB
if (file && fileSize<=shardSize) { //<=10MB时直接下载 if (file && fileSize <= shardSize) { //<=10MB时直接下载
this.downloadisLoading = true this.downloadisLoading = true
// this.setFileLoading() // this.setFileLoading()
this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`,{responseType: 'blob'},).subscribe(data=>{ this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`, { responseType: 'blob' },).subscribe(data => {
let url = window.URL.createObjectURL(new Blob([data])); //createObjectURL创建一个下载Blob的url地址 let url = window.URL.createObjectURL(new Blob([data])); //createObjectURL创建一个下载Blob的url地址
let link = document.createElement("a"); let link = document.createElement("a");
link.style.display = "none"; link.style.display = "none";
link.href = url; link.href = url;
let suffix = file.objectName.substring(file.objectName.lastIndexOf(".")+1,file.objectName.length) ; let suffix = file.objectName.substring(file.objectName.lastIndexOf(".") + 1, file.objectName.length);
link.setAttribute("download", file.fileName + "-" +this.uploadFileLonging.name + "." + suffix); link.setAttribute("download", file.fileName + "-" + this.uploadFileLonging.name + "." + suffix);
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
this.downloadisLoading = false this.downloadisLoading = false
@ -346,31 +326,32 @@ export class OnetwoEntryPlanComponent implements OnInit {
} }
//分段下载并合并 //分段下载并合并
async blockingDownload () { async blockingDownload() {
let file = this.download let file = this.download
let fileSize = file.fileLength //下载文件的总大小 let fileSize = file.fileLength //下载文件的总大小
let shardSize = 3 * 1024 * 1024 //3MB一个分片 let shardSize = 3 * 1024 * 1024 //3MB一个分片
let allSlice = Math.ceil(fileSize / shardSize) //总文件/3MB===共分多少段 let allSlice = Math.ceil(fileSize / shardSize) //总文件/3MB===共分多少段
let allFile:any = [] //所有的file分段 let allFile: any = [] //所有的file分段
for (let i=0;i<allSlice;i++) { for (let i = 0; i < allSlice; i++) {
let start = i * shardSize //每次下载文件开始位置 let start = i * shardSize //每次下载文件开始位置
let end = Math.min(fileSize, start + shardSize-1); //每次下载文件结束为止 let end = Math.min(fileSize, start + shardSize - 1); //每次下载文件结束为止
let result = await new Promise ((result,reject)=>{ let result = await new Promise((result, reject) => {
this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`,{headers:{'range':`bytes= ${start}-${end}`},responseType:'blob'}).subscribe(data=>{ this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`, { headers: { 'range': `bytes= ${start}-${end}` }, responseType: 'blob' }).subscribe(data => {
result(data) }) result(data)
})
}) })
allFile.push(result) allFile.push(result)
this.downloadProgress = Number((i/allSlice).toFixed(2))*100 this.downloadProgress = Number((i / allSlice).toFixed(2)) * 100
if (allFile.length === allSlice) { //合并文件输出给浏览器 if (allFile.length === allSlice) { //合并文件输出给浏览器
let url = window.URL.createObjectURL(new Blob(allFile)); //createObjectURL创建一个下载Blob的url地址 let url = window.URL.createObjectURL(new Blob(allFile)); //createObjectURL创建一个下载Blob的url地址
let link = document.createElement("a"); let link = document.createElement("a");
link.style.display = "none"; link.style.display = "none";
link.href = url; link.href = url;
let suffix = file.objectName.substring(file.objectName.lastIndexOf(".")+1,file.objectName.length) ; let suffix = file.objectName.substring(file.objectName.lastIndexOf(".") + 1, file.objectName.length);
link.setAttribute("download", file.fileName + "-" +this.uploadFileLonging.name + "." + suffix); link.setAttribute("download", file.fileName + "-" + this.uploadFileLonging.name + "." + suffix);
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
// this.downloadProgress = 0 // this.downloadProgress = 0
@ -383,14 +364,14 @@ export class OnetwoEntryPlanComponent implements OnInit {
} }
//取消分块下载 //取消分块下载
cancelDowload () { cancelDowload() {
} }
//查看预案按钮跳转 //查看预案按钮跳转
routerTo(element){ routerTo(element) {
sessionStorage.setItem("companyName",element.unitname) sessionStorage.setItem("companyName", element.unitname)
window.open(`/planManagement/entryPlandetail?unitId=${element.company.id}&unitTypeId=${element.company.buildingTypes.length == 0 ? null :element.company.buildingTypes[0].id}&operation=true&pagetype=entryplan&unitName=${element.company.name}&orName=${element.company.organizationName}&unitType=${element.company.buildingTypes.length == 0 ? null :element.company.buildingTypes[0].name}&unitAdd=${element.company.address}`); window.open(`/planManagement/entryPlandetail?unitId=${element.company.id}&unitTypeId=${element.company.buildingTypes.length == 0 ? null : element.company.buildingTypes[0].id}&operation=true&pagetype=entryplan&unitName=${element.company.name}&orName=${element.company.organizationName}&unitType=${element.company.buildingTypes.length == 0 ? null : element.company.buildingTypes[0].name}&unitAdd=${element.company.address}`);
} }
} }
@ -401,10 +382,10 @@ export class OnetwoEntryPlanComponent implements OnInit {
templateUrl: './newunit.html', templateUrl: './newunit.html',
styleUrls: ['./newunit.scss'] styleUrls: ['./newunit.scss']
}) })
export class newunitComponent{ export class newunitComponent {
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<newunitComponent>,@Inject(MAT_DIALOG_DATA) public data: any) {} constructor(private router: Router, private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<newunitComponent>, @Inject(MAT_DIALOG_DATA) public data: any) { }
ngOnInit(): void { ngOnInit(): void {
this.url=window.location.href.substring(window.location.href.length-1,window.location.href.length) this.url = window.location.href.substring(window.location.href.length - 1, window.location.href.length)
} }
url url
unitname//预案名称 unitname//预案名称
@ -416,80 +397,80 @@ export class newunitComponent{
projectlevel//编制级别 projectlevel//编制级别
//上传文件↓ //上传文件↓
file:any; //上传的文件 file: any; //上传的文件
fileName:any; //上传文件name fileName: any; //上传文件name
uploadisLoading:boolean = false; //进度条loading加载 uploadisLoading: boolean = false; //进度条loading加载
uploadProgress:number=0; //进度条进度 uploadProgress: number = 0; //进度条进度
objectName:any; //上传对象名 objectName: any; //上传对象名
uploadId:any; //上传分块上传事件编号 uploadId: any; //上传分块上传事件编号
uploadover:any = false //上传完成之后提示 uploadover: any = false //上传完成之后提示
selectedPLanType:any//所选预案类型 selectedPLanType: any//所选预案类型
selectedPLanName:any//所选预案名称 selectedPLanName: any//所选预案名称
localup:boolean = false //本地上传 localup: boolean = false //本地上传
defaultisshow = '0' //默认显示上传input框 defaultisshow = '0' //默认显示上传input框
//上传 //上传
upload(){ upload() {
document.getElementById('up').click() document.getElementById('up').click()
} }
//上传文件input //上传文件input
filechange(e){ filechange(e) {
this.file = e.target.files[0] || null //上传的文件 this.file = e.target.files[0] || null //上传的文件
} }
//上传文件 //上传文件
startUploading (planType) { startUploading(planType) {
let file = this.file || null //获取上传的文件 let file = this.file || null //获取上传的文件
let fileSize = file.size || null //上传文件的总大小 let fileSize = file.size || null //上传文件的总大小
let shardSize = 5 * 1024 * 1024 //5MB一个分片 let shardSize = 5 * 1024 * 1024 //5MB一个分片
if (file && fileSize<=shardSize) { //上传文件<=5MB时 if (file && fileSize <= shardSize) { //上传文件<=5MB时
let formData = new FormData() let formData = new FormData()
formData.append("file",file) formData.append("file", file)
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.http.post(this.url=='2'?`/api/Objects/PlanPlatform/twoClass`:'/api/Objects/PlanPlatform/oneClass',formData).subscribe((data:any)=>{ this.http.post(this.url == '2' ? `/api/Objects/PlanPlatform/twoClass` : '/api/Objects/PlanPlatform/oneClass', formData).subscribe((data: any) => {
this.objectName = data.objectName this.objectName = data.objectName
//this.snackBar.open('上传成功!','确定',config); //this.snackBar.open('上传成功!','确定',config);
let level = sessionStorage.getItem("level") let level = sessionStorage.getItem("level")
// console.log(level) // console.log(level)
let PlanLevel let PlanLevel
if(level == '0'){ if (level == '0') {
PlanLevel = 1 PlanLevel = 1
} }
if(level == '1'){ if (level == '1') {
PlanLevel = 2 PlanLevel = 2
} }
if(level == '2'){ if (level == '2') {
PlanLevel = 4 PlanLevel = 4
} }
if(level == '3'){ if (level == '3') {
PlanLevel = 8 PlanLevel = 8
} }
let body:any = { let body: any = {
Name:this.unitname||'', Name: this.unitname || '',
PlanCategory:this.url=='2'?2:1, PlanCategory: this.url == '2' ? 2 : 1,
disasterType: this.reservePlanType, disasterType: this.reservePlanType,
PlanLevel:PlanLevel, PlanLevel: PlanLevel,
PlanMode:1, PlanMode: 1,
planType:16, planType: 16,
attachmentUrls:[`${this.objectName}`] attachmentUrls: [`${this.objectName}`]
} }
this.http.post("/api/PlanComponentsMajor",body).subscribe((data:any)=>{ this.http.post("/api/PlanComponentsMajor", body).subscribe((data: any) => {
this.snackBar.open('创建成功!','确定',config); this.snackBar.open('创建成功!', '确定', config);
this.dialogRef.close(); this.dialogRef.close();
},err=>{ }, err => {
this.snackBar.open('创建失败!','确定',config); this.snackBar.open('创建失败!', '确定', config);
}) })
},err=>{ }, err => {
this.snackBar.open('上传失败!','确定',config); this.snackBar.open('上传失败!', '确定', config);
}) })
} else if (file && fileSize>shardSize) { //上传文件>5MB时,分块上传 } else if (file && fileSize > shardSize) { //上传文件>5MB时,分块上传
let data = {filename: file.name} let data = { filename: file.name }
this.uploadisLoading = true this.uploadisLoading = true
this.http.post(this.url=='2'?`/api/NewMultipartUpload/PlanPlatform/twoClass`:'/api/NewMultipartUpload/PlanPlatform/oneClass',{},{params:data}).subscribe((data:any)=>{ //初始化分段上传 this.http.post(this.url == '2' ? `/api/NewMultipartUpload/PlanPlatform/twoClass` : '/api/NewMultipartUpload/PlanPlatform/oneClass', {}, { params: data }).subscribe((data: any) => { //初始化分段上传
this.objectName = data.objectName this.objectName = data.objectName
this.uploadId = data.uploadId this.uploadId = data.uploadId
this.subsectionUploading(planType) this.subsectionUploading(planType)
@ -497,99 +478,101 @@ export class newunitComponent{
} }
} }
PartNumberETag:any=[]; //每次返回需要保存的信息 PartNumberETag: any = []; //每次返回需要保存的信息
//开始分段上传 //开始分段上传
async subsectionUploading (planType) { async subsectionUploading(planType) {
let file = this.file || null //获取上传的文件 let file = this.file || null //获取上传的文件
let fileSize = file.size || null //上传文件的总大小 let fileSize = file.size || null //上传文件的总大小
let shardSize = 5 * 1024 * 1024 //5MB一个分片 let shardSize = 5 * 1024 * 1024 //5MB一个分片
let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段 向上取整 let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段 向上取整
for (let i = 0;i < allSlice;i++) { //循环分段上传 for (let i = 0; i < allSlice; i++) { //循环分段上传
let start = i * shardSize //切割文件开始位置 let start = i * shardSize //切割文件开始位置
let end = Math.min(fileSize, start + shardSize); //切割文件结束位置 (对比取小数) let end = Math.min(fileSize, start + shardSize); //切割文件结束位置 (对比取小数)
let formData = new FormData() let formData = new FormData()
formData.append("file",file.slice(start, end)) formData.append("file", file.slice(start, end))
//同步写法实现异步调用 //同步写法实现异步调用
let result = await new Promise((resolve, reject) => { let result = await new Promise((resolve, reject) => {
// await 需要后面返回一个 promise 对象 // await 需要后面返回一个 promise 对象
this.http.post(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}&partNumber=${i+1}`,formData).subscribe((data:any)=>{ this.http.post(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => {
let msg = { let msg = {
"partNumber":data.partNumber || null, "partNumber": data.partNumber || null,
"eTag": data.eTag || null} "eTag": data.eTag || null
}
resolve(msg) // 调用 promise 内置方法处理成功 resolve(msg) // 调用 promise 内置方法处理成功
}) })
}); });
this.PartNumberETag.push(result) this.PartNumberETag.push(result)
this.uploadProgress = Number((i/allSlice).toFixed(2))*100 this.uploadProgress = Number((i / allSlice).toFixed(2)) * 100
if (this.PartNumberETag.length === allSlice) { if (this.PartNumberETag.length === allSlice) {
this.uploadProgress = 100 this.uploadProgress = 100
this.endUploading(planType)} this.endUploading(planType)
}
}//for循环 }//for循环
} }
//完成分块上传 //完成分块上传
endUploading (planType) { endUploading(planType) {
let data = this.PartNumberETag let data = this.PartNumberETag
let paramsData = {uploadId:this.uploadId} let paramsData = { uploadId: this.uploadId }
this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`,data,{params:paramsData}).subscribe(data=>{ this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`, data, { params: paramsData }).subscribe(data => {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
//this.snackBar.open('上传成功!','确定',config); //this.snackBar.open('上传成功!','确定',config);
this.uploadProgress = 0; this.uploadProgress = 0;
this.uploadisLoading = false this.uploadisLoading = false
this.PartNumberETag =[] //清空保存返回的信息 this.PartNumberETag = [] //清空保存返回的信息
this.uploadover = true this.uploadover = true
let level = sessionStorage.getItem("level") let level = sessionStorage.getItem("level")
// console.log(level) // console.log(level)
let PlanLevel let PlanLevel
if(level == '0'){ if (level == '0') {
PlanLevel = 1 PlanLevel = 1
} }
if(level == '1'){ if (level == '1') {
PlanLevel = 2 PlanLevel = 2
} }
if(level == '2'){ if (level == '2') {
PlanLevel = 4 PlanLevel = 4
} }
if(level == '3'){ if (level == '3') {
PlanLevel = 8 PlanLevel = 8
} }
let body:any = { let body: any = {
Name:this.unitname||'', Name: this.unitname || '',
PlanCategory:this.url=='2'?2:1, PlanCategory: this.url == '2' ? 2 : 1,
disasterType: this.reservePlanType, disasterType: this.reservePlanType,
PlanLevel:PlanLevel, PlanLevel: PlanLevel,
PlanMode:1, PlanMode: 1,
planType:16, planType: 16,
attachmentUrls:[`${this.objectName}`] attachmentUrls: [`${this.objectName}`]
} }
this.http.post("/api/PlanComponentsMajor",body).subscribe((data:any)=>{ this.http.post("/api/PlanComponentsMajor", body).subscribe((data: any) => {
this.snackBar.open('创建成功!','确定',config); this.snackBar.open('创建成功!', '确定', config);
this.dialogRef.close(); this.dialogRef.close();
},err=>{ }, err => {
this.snackBar.open('创建失败!','确定',config); this.snackBar.open('创建失败!', '确定', config);
}) })
}) })
} }
//取消分块上传 //取消分块上传
cancel () { cancel() {
this.http.delete(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}`).subscribe(data=>{ this.http.delete(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}`).subscribe(data => {
this.uploadProgress = 0; this.uploadProgress = 0;
this.uploadisLoading= false; this.uploadisLoading = false;
(<HTMLInputElement>document.getElementById('up')).value = null (<HTMLInputElement>document.getElementById('up')).value = null
this.PartNumberETag =[] //清空保存返回的信息 this.PartNumberETag = [] //清空保存返回的信息
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('取消上传成功!','确定',config); this.snackBar.open('取消上传成功!', '确定', config);
this.uploadover = false this.uploadover = false
this.file = null this.file = null
}) })
@ -597,21 +580,21 @@ export class newunitComponent{
//创建预案 //创建预案
newplan(){ newplan() {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
if(this.unitname==undefined||this.reservePlanType==undefined){ if (this.unitname == undefined || this.reservePlanType == undefined) {
this.snackBar.open('请输入预案名称或类型!','确定',config); this.snackBar.open('请输入预案名称或类型!', '确定', config);
} }
else if(this.file==undefined){ else if (this.file == undefined) {
this.snackBar.open('请先上传文件!','确定',config); this.snackBar.open('请先上传文件!', '确定', config);
} }
else{ else {
if(this.reservePlanType!='1'){ if (this.reservePlanType != '1') {
this.startUploading("非二维") this.startUploading("非二维")
} }
else{this.startUploading("二维")} else { this.startUploading("二维") }
} }
@ -619,7 +602,7 @@ export class newunitComponent{
} }
//取消按钮 //取消按钮
close(){ close() {
this.dialogRef.close(); this.dialogRef.close();
} }
} }
@ -630,15 +613,15 @@ export class newunitComponent{
templateUrl: './resultPlanonetwo.html', templateUrl: './resultPlanonetwo.html',
styleUrls: ['./onetwo-entry-plan.component.scss'] styleUrls: ['./onetwo-entry-plan.component.scss']
}) })
export class onetwoAuditResult{ export class onetwoAuditResult {
constructor(private http: HttpClient,public dialogRef: MatDialogRef<onetwoAuditResult>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} constructor(private http: HttpClient, public dialogRef: MatDialogRef<onetwoAuditResult>, @Inject(MAT_DIALOG_DATA) public data, public snackBar: MatSnackBar) { }
planName:any = this.data.element.name planName: any = this.data.element.name
commitTime:any = this.data.element.committedTime commitTime: any = this.data.element.committedTime
commitOrganizationName:any = this.data.element.committerOrganizationName commitOrganizationName: any = this.data.element.committerOrganizationName
auditOrganizationName:any = this.data.element.auditorOrganizationName auditOrganizationName: any = this.data.element.auditorOrganizationName
auditResult:any = this.data.element.auditStatus auditResult: any = this.data.element.auditStatus
auditOpinion:any = this.data.element.auditOpinion auditOpinion: any = this.data.element.auditOpinion
ngOnInit(): void { ngOnInit(): void {
} }
onNoClick(): void { onNoClick(): void {

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

@ -4,7 +4,7 @@ import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'
import { MatPaginator } from '@angular/material/paginator'; import { MatPaginator } from '@angular/material/paginator';
import { FlatTreeControl } from '@angular/cdk/tree'; import { FlatTreeControl } from '@angular/cdk/tree';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { Router,ActivatedRoute } from '@angular/router' import { Router, ActivatedRoute } from '@angular/router'
import { PageEvent } from '@angular/material/paginator'; import { PageEvent } from '@angular/material/paginator';
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
@ -18,7 +18,7 @@ declare var CryptoJS
}) })
export class OpenPlanComponent implements OnInit { export class OpenPlanComponent implements OnInit {
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,private tree: TreeService,public dialog: MatDialog,public snackBar: MatSnackBar) { } constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, private tree: TreeService, public dialog: MatDialog, public snackBar: MatSnackBar) { }
private _transformer = (node, level: number) => { //初始化tree private _transformer = (node, level: number) => { //初始化tree
return { return {
@ -36,99 +36,99 @@ export class OpenPlanComponent implements OnInit {
myControl = new FormControl(); myControl = new FormControl();
hasChild = (_: number, node: any) => node.expandable; hasChild = (_: number, node: any) => node.expandable;
//分页 //分页
@ViewChild(MatPaginator, {static: true}) @ViewChild(MatPaginator, { static: true })
pageEvent: PageEvent; pageEvent: PageEvent;
paginator: MatPaginator; paginator: MatPaginator;
length:any; //共多少条数据 length: any; //共多少条数据
pageSize:any; //每页条数 pageSize: any; //每页条数
pageSizeOptions: number[] = [10] //设置每页条数 pageSizeOptions: number[] = [10] //设置每页条数
PageNumber:any; //第几页 PageNumber: any; //第几页
displayedColumns: string[] = ['unitname', 'planname', 'addpeople','addtime','plantype','auditStatus','openRange','projectlevel','operation']; displayedColumns: string[] = ['unitname', 'planname', 'addpeople', 'addtime', 'plantype', 'auditStatus', 'openRange', 'projectlevel', 'operation'];
allorganizations:any //所有组织机构 allorganizations: any //所有组织机构
allunittype:any //所有单位类型 allunittype: any //所有单位类型
tabledataSource:any //表格数据 tabledataSource: any //表格数据
preparelevels:any //编制级别 preparelevels: any //编制级别
ngOnInit(): void { ngOnInit(): void {
if(window.matchMedia("(max-width: 1400px)").matches){ if (window.matchMedia("(max-width: 1400px)").matches) {
this.pcMore=false this.pcMore = false
this.padMore=true this.padMore = true
this.pcfind=false this.pcfind = false
this.padjt=true this.padjt = true
}else{ } else {
this.pcfind=true this.pcfind = true
this.pcMore=true this.pcMore = true
this.padMore=false this.padMore = false
this.padjt=false this.padjt = false
} }
this.getunitdata(); this.getunitdata();
this.getOrganizations(); this.getOrganizations();
this.getUnittype(); this.getUnittype();
this.getAllPlanInfo(); //得到所有单位 this.getAllPlanInfo(); //得到所有单位
let level = sessionStorage.getItem("level"); let level = sessionStorage.getItem("level");
if(level == "0"){//如果是总队 if (level == "0") {//如果是总队
this.preparelevels = [ this.preparelevels = [
{name:"总队",value:"1"}, { name: "总队", value: "1" },
{name:"支队",value:"2"}, { name: "支队", value: "2" },
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(level == "1"){//如果是支队 if (level == "1") {//如果是支队
this.preparelevels = [ this.preparelevels = [
{name:"支队",value:"2"}, { name: "支队", value: "2" },
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(level == "2"){//如果是大队 if (level == "2") {//如果是大队
this.preparelevels = [ this.preparelevels = [
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(level == "3"){//如果是中队 if (level == "3") {//如果是中队
this.preparelevels = [ this.preparelevels = [
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
} }
pcMore//pc更多 pcMore//pc更多
pcput=false//pc收起 pcput = false//pc收起
pcfind//pc查询 pcfind//pc查询
padjt=false padjt = false
padMore=true//pad收缩控制 padMore = true//pad收缩控制
padput=false//pad收起按钮 padput = false//pad收起按钮
imgsrcopen="../../../assets/images/routdown2.png" imgsrcopen = "../../../assets/images/routdown2.png"
imgsrcdown="../../../assets/images/routup2.png" imgsrcdown = "../../../assets/images/routup2.png"
pcInfo(){ pcInfo() {
this.pcMore=!this.pcMore this.pcMore = !this.pcMore
this.pcput=!this.pcput this.pcput = !this.pcput
} }
padInfo(){ padInfo() {
this.padMore=!this.padMore this.padMore = !this.padMore
this.padput=!this.padput this.padput = !this.padput
} }
allPlanInfo:any //存储所有预案信息 allPlanInfo: any //存储所有预案信息
//获得所有预案信息 //获得所有预案信息
getAllPlanInfo(){ getAllPlanInfo() {
let paramsdata:any = { let paramsdata: any = {
CompanyName: this.companyName || '', CompanyName: this.companyName || '',
OrganizationId: '', OrganizationId: '',
HasChildrenOrganization:'', HasChildrenOrganization: '',
BuildingTypeId: this.unittype || '', BuildingTypeId: this.unittype || '',
PlanType: this.reservePlanType || '', PlanType: this.reservePlanType || '',
AuditStatus:'', //审核状态 AuditStatus: '', //审核状态
PlanLevel: this.preparelevel || '', PlanLevel: this.preparelevel || '',
HasChildrenPlanLevel: this.plcheck || '', HasChildrenPlanLevel: this.plcheck || '',
PageNumber: this.PageNumber || '1', PageNumber: this.PageNumber || '1',
PageSize: this.pageSizeOptions[0], PageSize: this.pageSizeOptions[0],
Sort: '' Sort: ''
} }
this.http.get("/api/PublicPlans",{params:paramsdata}).subscribe((data:any)=>{ this.http.get("/api/PublicPlans", { params: paramsdata }).subscribe((data: any) => {
// console.log(111,data) // console.log(111,data)
this.length = data.totalCount this.length = data.totalCount
this.allPlanInfo = data this.allPlanInfo = data
@ -136,44 +136,44 @@ export class OpenPlanComponent implements OnInit {
}) })
} }
//得到当前单位信息 //得到当前单位信息
getunitdata(){ getunitdata() {
this.http.get("/api/Account/Profiles").subscribe( this.http.get("/api/Account/Profiles").subscribe(
(data:any)=>{ (data: any) => {
this.organizationName = data.organizationName this.organizationName = data.organizationName
} }
) )
} }
organizationName:any //当前单位组织机构名称 organizationName: any //当前单位组织机构名称
treedata:any //组织机构树型数据 treedata: any //组织机构树型数据
newArr:any = [] newArr: any = []
newallorganizations:any //用于存储在原始数据基础上的每个机构增加children字段 newallorganizations: any //用于存储在原始数据基础上的每个机构增加children字段
//得到当前单位所在组织机构的tree型数据 //得到当前单位所在组织机构的tree型数据
getpresentOrganization(){ getpresentOrganization() {
this.newallorganizations = this.allorganizations this.newallorganizations = this.allorganizations
this.newallorganizations.forEach(item => { this.newallorganizations.forEach(item => {
item.children = [] item.children = []
this.newallorganizations.forEach(element => { this.newallorganizations.forEach(element => {
if(element.parentId == item.id){ if (element.parentId == item.id) {
item.children.push(element) item.children.push(element)
} }
}); });
}); });
// console.log(666,this.organizationName) // console.log(666,this.organizationName)
if(this.organizationName){ if (this.organizationName) {
this.newallorganizations.forEach(item => { this.newallorganizations.forEach(item => {
if(item.name == this.organizationName){ if (item.name == this.organizationName) {
this.dataSource.data = [item] this.dataSource.data = [item]
} }
}); });
}else{ } else {
this.dataSource.data = this.tree.toTree(this.treedata); this.dataSource.data = this.tree.toTree(this.treedata);
} }
} }
//获得所有组织机构 //获得所有组织机构
getOrganizations(){ getOrganizations() {
this.http.get('/api/Organizations').subscribe( this.http.get('/api/Organizations').subscribe(
(data:any)=>{ (data: any) => {
this.allorganizations = data this.allorganizations = data
this.treedata = this.tree.toTree(data); this.treedata = this.tree.toTree(data);
this.getpresentOrganization(); this.getpresentOrganization();
@ -182,87 +182,69 @@ export class OpenPlanComponent implements OnInit {
} }
//获得所有单位类型 //获得所有单位类型
getUnittype(){ getUnittype() {
this.http.get('/api/BuildingTypes/Simple').subscribe( this.http.get('/api/BuildingTypes/Simple').subscribe(
data=>{ data => {
this.allunittype = data this.allunittype = data
} }
) )
} }
//跳转查看预案页面 公开预案 //跳转查看预案页面 公开预案
routerTo(e){ routerTo(e) {
/* sessionStorage.setItem("companyName",element.companyName) /* sessionStorage.setItem("companyName",element.companyName)
window.open(`/planAudit/planpass?id=${element.companyId}&companyName=${element.companyName}&auditPlanId=${element.id}&auditStatus=${element.auditStatus}&type=6&planType=2`); */ window.open(`/planAudit/planpass?id=${element.companyId}&companyName=${element.companyName}&auditPlanId=${element.id}&auditStatus=${element.auditStatus}&type=6&planType=2`); */
// console.log(e) // console.log(e)
if(e.planMode == 0||e.planMode == 1){ if (e.planMode == 0 || e.planMode == 1) {
//console.log(e.attachmentUrls) //console.log(e.attachmentUrls)
var index=e.attachmentUrls[0].indexOf("\/") var index = e.attachmentUrls[0].indexOf("\/")
if(e.attachmentUrls[0].substr(0,index)=='psw'){ if (e.attachmentUrls[0].substr(0, index) == 'psw') {
const dialogRef = this.dialog.open(GkhtmlPsViewer, { const dialogRef = this.dialog.open(GkhtmlPsViewer, {
width: '1500px', width: '1500px',
height:'800px', height: '800px',
data: e.attachmentUrls[0] data: e.attachmentUrls[0]
}); });
} }
else /* if(e.attachmentUrls[0].substr(e.attachmentUrls[0].length-4,e.attachmentUrls[0].length-1)=='docx'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='pdf' else {
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='doc'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='DOC'
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='txt'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='JPG') */{
let filename:string
let fetchUrl = e.attachmentUrls[0] let fetchUrl = e.attachmentUrls[0]
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl); let suffix = fetchUrl.split('.')[fetchUrl.split('.').length - 1].toLowerCase()
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray); if (suffix == 'docx' || suffix == 'doc') {
let jwt = sessionStorage.getItem("token"); let arr = fetchUrl.split('.')
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); arr[arr.length - 1] = 'pdf'
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
let identityJsonparse=JSON.parse(identityJson) } else if (suffix == 'pdf') {
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{ window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
filename=data.fileName } else {
let json={ let config = new MatSnackBarConfig();
doc: { config.verticalPosition = 'top';
docId: docId, config.duration = 3000
title: filename, this.snackBar.open('该文件类型暂不支持在线查看', '确定', config);
fetchUrl: `http://172.18.0.1:8000/api/Objects/PlanPlatform/`+fetchUrl, }
},
user: {
uid: identityJsonparse.sub,
nickName: identityJsonparse.name,
avatar: "",
privilege: [
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
],
},
}
var stringjson=JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
})
} }
} }
if(e.planMode == 2){ //如果是在线编辑 if (e.planMode == 2) { //如果是在线编辑
let id = e.id let id = e.id
sessionStorage.setItem("planId",id) sessionStorage.setItem("planId", id)
sessionStorage.setItem("companyId",e.companyId) sessionStorage.setItem("companyId", e.companyId)
//sessionStorage.setItem("buildingTypeId",this.unittypeId) //sessionStorage.setItem("buildingTypeId",this.unittypeId)
sessionStorage.setItem("editable","0") sessionStorage.setItem("editable", "0")
sessionStorage.setItem("planName",e.name) sessionStorage.setItem("planName", e.name)
let companyId = sessionStorage.getItem("companyId") let companyId = sessionStorage.getItem("companyId")
window.open(`/keyUnit/viewunitinfoplan?id=${companyId}`); window.open(`/keyUnit/viewunitinfoplan?id=${companyId}`);
} }
if(e.planMode == 3){ //如果是跳转网页 if (e.planMode == 3) { //如果是跳转网页
sessionStorage.setItem("url",e.url) sessionStorage.setItem("url", e.url)
window.open(`/planManagement/webLook`) window.open(`/planManagement/webLook`)
} }
} }
//分页事件 //分页事件
chagePage(e){ chagePage(e) {
this.PageNumber = e.pageIndex+1 this.PageNumber = e.pageIndex + 1
this.getAllPlanInfo(); this.getAllPlanInfo();
} }
//辖区中队div是否显示 //辖区中队div是否显示
isorganizationbox:boolean = false isorganizationbox: boolean = false
//点击辖区中队树,将选择的辖区中队添加到变量 //点击辖区中队树,将选择的辖区中队添加到变量
add(node) { add(node) {
this.isorganizationbox = false this.isorganizationbox = false
@ -278,23 +260,23 @@ export class OpenPlanComponent implements OnInit {
this.isorganizationbox = true this.isorganizationbox = true
} }
//关闭出现的组织机构div //关闭出现的组织机构div
closediv(){ closediv() {
this.isorganizationbox = false this.isorganizationbox = false
} }
//查询 //查询
onSubmit (e) { onSubmit(e) {
this.getAllPlanInfo() this.getAllPlanInfo()
} }
companyName:any //单位名称 companyName: any //单位名称
js:any //所选组织机构 js: any //所选组织机构
jsId:any //所选组织机构的id jsId: any //所选组织机构的id
// jscheck:boolean //所选组织机构勾选框 // jscheck:boolean //所选组织机构勾选框
unittype:any //单位类型 unittype: any //单位类型
reservePlanType:any //预案类型 reservePlanType: any //预案类型
preparelevel:any //编制级别 preparelevel: any //编制级别
plcheck:boolean //编制级别勾选框 plcheck: boolean //编制级别勾选框
//重置 //重置
reset(){ reset() {
this.companyName = '' this.companyName = ''
// this.js = '' // this.js = ''
// this.jsId = '' // this.jsId = ''
@ -316,13 +298,13 @@ export class OpenPlanComponent implements OnInit {
templateUrl: './PsvShow.html', templateUrl: './PsvShow.html',
styleUrls: ['./open-plan.component.scss'] styleUrls: ['./open-plan.component.scss']
}) })
export class GkhtmlPsViewer{ export class GkhtmlPsViewer {
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<GkhtmlPsViewer>,@Inject(MAT_DIALOG_DATA) public data: any) {} constructor(private router: Router, private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<GkhtmlPsViewer>, @Inject(MAT_DIALOG_DATA) public data: any) { }
ngOnInit(): void { ngOnInit(): void {
// console.log(this.data) // console.log(this.data)
const viewer = new Viewer({ const viewer = new Viewer({
container: document.querySelector('#viewer'), container: document.querySelector('#viewer'),
panorama:'/api/Objects/PlanPlatform/'+ this.data, panorama: '/api/Objects/PlanPlatform/' + this.data,
}); });
} }

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

@ -4,7 +4,7 @@ import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'
import { MatPaginator } from '@angular/material/paginator'; import { MatPaginator } from '@angular/material/paginator';
import { FlatTreeControl } from '@angular/cdk/tree'; import { FlatTreeControl } from '@angular/cdk/tree';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { Router,ActivatedRoute } from '@angular/router' import { Router, ActivatedRoute } from '@angular/router'
import { PageEvent } from '@angular/material/paginator'; import { PageEvent } from '@angular/material/paginator';
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
@ -18,7 +18,7 @@ declare var CryptoJS
}) })
export class PassPlanComponent implements OnInit { export class PassPlanComponent implements OnInit {
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,private tree: TreeService,public dialog: MatDialog,public snackBar: MatSnackBar) { } constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, private tree: TreeService, public dialog: MatDialog, public snackBar: MatSnackBar) { }
private _transformer = (node, level: number) => { //初始化tree private _transformer = (node, level: number) => { //初始化tree
return { return {
@ -36,116 +36,116 @@ export class PassPlanComponent implements OnInit {
myControl = new FormControl(); myControl = new FormControl();
hasChild = (_: number, node: any) => node.expandable; hasChild = (_: number, node: any) => node.expandable;
//分页 //分页
@ViewChild(MatPaginator, {static: true}) @ViewChild(MatPaginator, { static: true })
pageEvent: PageEvent; pageEvent: PageEvent;
paginator: MatPaginator; paginator: MatPaginator;
length:any; //共多少条数据 length: any; //共多少条数据
pageSize:any; //每页条数 pageSize: any; //每页条数
pageSizeOptions: number[] = [10] //设置每页条数 pageSizeOptions: number[] = [10] //设置每页条数
PageNumber:any; //第几页 PageNumber: any; //第几页
displayedColumns: string[] = ['planname', 'addpeople','level','addtime','plantype','auditStatus','openRange','projectlevel','operation']; displayedColumns: string[] = ['planname', 'addpeople', 'level', 'addtime', 'plantype', 'auditStatus', 'openRange', 'projectlevel', 'operation'];
allorganizations:any //所有组织机构 allorganizations: any //所有组织机构
allunittype:any //所有单位类型 allunittype: any //所有单位类型
tabledataSource:any //表格数据 tabledataSource: any //表格数据
url url
preparelevels:any preparelevels: any
ngOnInit(): void { ngOnInit(): void {
if(window.matchMedia("(max-width: 1400px)").matches){ if (window.matchMedia("(max-width: 1400px)").matches) {
this.pcMore=false this.pcMore = false
this.padMore=true this.padMore = true
this.pcfind=false this.pcfind = false
this.padjt=true this.padjt = true
}else{ } else {
this.pcfind=true this.pcfind = true
this.pcMore=true this.pcMore = true
this.padMore=false this.padMore = false
this.padjt=false this.padjt = false
} }
this.getunitdata(); this.getunitdata();
this.getOrganizations(); this.getOrganizations();
this.getUnittype(); this.getUnittype();
this.getAllPlanInfo(); this.getAllPlanInfo();
let level = sessionStorage.getItem("level"); let level = sessionStorage.getItem("level");
if(level == "0"){//如果是总队 if (level == "0") {//如果是总队
this.preparelevels = [ this.preparelevels = [
{name:"总队",value:"1"}, { name: "总队", value: "1" },
{name:"支队",value:"2"}, { name: "支队", value: "2" },
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(level == "1"){//如果是支队 if (level == "1") {//如果是支队
this.preparelevels = [ this.preparelevels = [
{name:"支队",value:"2"}, { name: "支队", value: "2" },
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(level == "2"){//如果是大队 if (level == "2") {//如果是大队
this.preparelevels = [ this.preparelevels = [
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(level == "3"){//如果是中队 if (level == "3") {//如果是中队
this.preparelevels = [ this.preparelevels = [
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
this.url=window.location.href.substring(window.location.href.length-1,window.location.href.length) this.url = window.location.href.substring(window.location.href.length - 1, window.location.href.length)
//console.log(this.url) //console.log(this.url)
} }
pcMore//pc更多 pcMore//pc更多
pcput=false//pc收起 pcput = false//pc收起
pcfind//pc查询 pcfind//pc查询
padjt=false padjt = false
padMore=true//pad收缩控制 padMore = true//pad收缩控制
padput=false//pad收起按钮 padput = false//pad收起按钮
imgsrcopen="../../../assets/images/routdown2.png" imgsrcopen = "../../../assets/images/routdown2.png"
imgsrcdown="../../../assets/images/routup2.png" imgsrcdown = "../../../assets/images/routup2.png"
pcInfo(){ pcInfo() {
this.pcMore=!this.pcMore this.pcMore = !this.pcMore
this.pcput=!this.pcput this.pcput = !this.pcput
} }
padInfo(){ padInfo() {
this.padMore=!this.padMore this.padMore = !this.padMore
this.padput=!this.padput this.padput = !this.padput
} }
allPlanInfo:any //存储所有预案信息 allPlanInfo: any //存储所有预案信息
//获得所有预案信息 //获得所有预案信息
getAllPlanInfo(){ getAllPlanInfo() {
let reservePlanType let reservePlanType
this.reservePlanType ? reservePlanType = JSON.parse(JSON.stringify(this.reservePlanType)) : reservePlanType = '' this.reservePlanType ? reservePlanType = JSON.parse(JSON.stringify(this.reservePlanType)) : reservePlanType = ''
if(this.reservePlanType && this.reservePlanType.length != 0){ if (this.reservePlanType && this.reservePlanType.length != 0) {
reservePlanType = eval(this.reservePlanType.join("|")) reservePlanType = eval(this.reservePlanType.join("|"))
} }
let paramsdata:any = { let paramsdata: any = {
CompanyName: this.companyName || '', CompanyName: this.companyName || '',
OrganizationId: this.jsId || '', OrganizationId: this.jsId || '',
HasChildrenOrganization:this.jscheck || '', HasChildrenOrganization: this.jscheck || '',
BuildingTypeId: this.unittype || '', BuildingTypeId: this.unittype || '',
PlanType: this.reservePlanType || '', PlanType: this.reservePlanType || '',
AuditStatus:'', //审核状态 AuditStatus: '', //审核状态
PlanLevel: this.preparelevel || '', PlanLevel: this.preparelevel || '',
HasChildrenPlanLevel: this.plcheck || '', HasChildrenPlanLevel: this.plcheck || '',
CreationTimeRangeStart:this.addtime||'', CreationTimeRangeStart: this.addtime || '',
CreationTimeRangeEnd:this.endtime||'', CreationTimeRangeEnd: this.endtime || '',
PageNumber: this.PageNumber || '1', PageNumber: this.PageNumber || '1',
PageSize: this.pageSizeOptions[0], PageSize: this.pageSizeOptions[0],
Sort: '', Sort: '',
PlanCategories:this.planCategory PlanCategories: this.planCategory
} }
this.http.get("/api/ApprovedPlans",{params:paramsdata}).subscribe((data:any)=>{ this.http.get("/api/ApprovedPlans", { params: paramsdata }).subscribe((data: any) => {
this.length = data.totalCount this.length = data.totalCount
this.allPlanInfo = data this.allPlanInfo = data
this.tabledataSource = data.items this.tabledataSource = data.items
}) })
} }
colorRgb(sColor){ colorRgb(sColor) {
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/; var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
var sColor = sColor.toLowerCase(); var sColor = sColor.toLowerCase();
if (sColor && reg.test(sColor)) { if (sColor && reg.test(sColor)) {
@ -166,14 +166,14 @@ export class PassPlanComponent implements OnInit {
return sColor; return sColor;
} }
} }
colorHex(rgb){ colorHex(rgb) {
var _this = rgb; var _this = rgb;
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/; var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
if (/^(rgb|RGB)/.test(_this)) { if (/^(rgb|RGB)/.test(_this)) {
var aColor = _this.replace(/(?:(|)|rgb|RGB)*/g, "").split(","); var aColor = _this.replace(/(?:(|)|rgb|RGB)*/g, "").split(",");
var strHex = "#"; var strHex = "#";
for (var i = 0; i < aColor.length; i++) { for (var i = 0; i < aColor.length; i++) {
var hex:any = Number(aColor[i]).toString(16); var hex: any = Number(aColor[i]).toString(16);
hex = hex < 10 ? 0 + '' + hex : hex;// 保证每个rgb的值为2位 hex = hex < 10 ? 0 + '' + hex : hex;// 保证每个rgb的值为2位
if (hex === "0") { if (hex === "0") {
hex += hex; hex += hex;
@ -219,54 +219,54 @@ export class PassPlanComponent implements OnInit {
var colorArr = []; var colorArr = [];
for (var i = 0; i < step; i++) { for (var i = 0; i < step; i++) {
//计算每一步的hex值 //计算每一步的hex值
var hex = _this.colorHex('rgb('+ parseInt((sR * i + startR))+ ',' + parseInt((sG * i + startG))+ ',' + parseInt((sB * i + startB)) + ')'); var hex = _this.colorHex('rgb(' + parseInt((sR * i + startR)) + ',' + parseInt((sG * i + startG)) + ',' + parseInt((sB * i + startB)) + ')');
colorArr.push(hex); colorArr.push(hex);
} }
return colorArr; return colorArr;
} }
integrity(width){ integrity(width) {
let _this = this let _this = this
let style:any = {} let style: any = {}
style.width = width +'%'; style.width = width + '%';
if(width < 30){ if (width < 30) {
let colorArr = this.gradientColor('#D50000', '#E53935', 30); let colorArr = this.gradientColor('#D50000', '#E53935', 30);
for(let i = 0; i < 30; i++){ for (let i = 0; i < 30; i++) {
if( i == width){ if (i == width) {
style.background = colorArr[i] style.background = colorArr[i]
} }
} }
} }
if(width >= 30 && width < 60){ if (width >= 30 && width < 60) {
let colorArr = this.gradientColor('#FF9800', '#E65100', 30); let colorArr = this.gradientColor('#FF9800', '#E65100', 30);
for(let i = 30; i < 60; i++){ for (let i = 30; i < 60; i++) {
if( i == width){ if (i == width) {
style.background = colorArr[i-30] style.background = colorArr[i - 30]
} }
} }
} }
if(width >= 60){ if (width >= 60) {
let colorArr = this.gradientColor('#81C784', '#2E7D32', 41); let colorArr = this.gradientColor('#81C784', '#2E7D32', 41);
for(let i = 60; i <= 100; i++){ for (let i = 60; i <= 100; i++) {
if( i == width){ if (i == width) {
style.background = colorArr[i-60] style.background = colorArr[i - 60]
} }
} }
} }
return style return style
} }
integrityDetails(width,zong){ integrityDetails(width, zong) {
let style:any = {} let style: any = {}
style.width = (width/zong)*100 +'%'; style.width = (width / zong) * 100 + '%';
return style return style
} }
//得到当前单位信息 //得到当前单位信息
getunitdata(){ getunitdata() {
this.http.get("/api/Account/Profiles").subscribe( this.http.get("/api/Account/Profiles").subscribe(
(data:any)=>{ (data: any) => {
this.organizationName = data.organizationName this.organizationName = data.organizationName
} }
) )
@ -275,31 +275,31 @@ export class PassPlanComponent implements OnInit {
endtime//结束时间 endtime//结束时间
integrityScoreMin//完整度最小值 integrityScoreMin//完整度最小值
integrityScoreMax//完整度最大值 integrityScoreMax//完整度最大值
organizationName:any //当前单位组织机构名称 organizationName: any //当前单位组织机构名称
treedata:any //组织机构树型数据 treedata: any //组织机构树型数据
newArr:any = [] newArr: any = []
newallorganizations:any //用于存储在原始数据基础上的每个机构增加children字段 newallorganizations: any //用于存储在原始数据基础上的每个机构增加children字段
//得到当前单位所在组织机构的tree型数据 //得到当前单位所在组织机构的tree型数据
getpresentOrganization(){ getpresentOrganization() {
this.newallorganizations = this.allorganizations this.newallorganizations = this.allorganizations
this.newallorganizations.forEach(item => { this.newallorganizations.forEach(item => {
item.children = [] item.children = []
this.newallorganizations.forEach(element => { this.newallorganizations.forEach(element => {
if(element.parentId == item.id){ if (element.parentId == item.id) {
item.children.push(element) item.children.push(element)
} }
}); });
}); });
this.http.get("/api/Account/Profiles").subscribe( this.http.get("/api/Account/Profiles").subscribe(
(data:any)=>{ (data: any) => {
this.organizationName = data.organizationName this.organizationName = data.organizationName
if(this.organizationName){ if (this.organizationName) {
this.newallorganizations.forEach(item => { this.newallorganizations.forEach(item => {
if(item.name == this.organizationName){ if (item.name == this.organizationName) {
this.dataSource.data = [item] this.dataSource.data = [item]
} }
}); });
}else{ } else {
this.dataSource.data = this.tree.toTree(this.treedata); this.dataSource.data = this.tree.toTree(this.treedata);
} }
} }
@ -307,9 +307,9 @@ export class PassPlanComponent implements OnInit {
} }
//获得所有组织机构 //获得所有组织机构
getOrganizations(){ getOrganizations() {
this.http.get('/api/Organizations').subscribe( this.http.get('/api/Organizations').subscribe(
(data:any)=>{ (data: any) => {
this.allorganizations = data this.allorganizations = data
this.treedata = this.tree.toTree(data); this.treedata = this.tree.toTree(data);
this.getpresentOrganization(); this.getpresentOrganization();
@ -318,120 +318,102 @@ export class PassPlanComponent implements OnInit {
} }
//获得所有单位类型 //获得所有单位类型
getUnittype(){ getUnittype() {
this.http.get('/api/BuildingTypes/Simple').subscribe( this.http.get('/api/BuildingTypes/Simple').subscribe(
data=>{ data => {
this.allunittype = data this.allunittype = data
} }
) )
} }
//查看单位信息 //查看单位信息
lookUnitInfo(element){ lookUnitInfo(element) {
// console.log(element) // console.log(element)
// const dialogRef = this.dialog.open(UnitInfo, { // const dialogRef = this.dialog.open(UnitInfo, {
// width: '1500px', // width: '1500px',
// height:'800px' // height:'800px'
// }); // });
sessionStorage.setItem("editable","0") sessionStorage.setItem("editable", "0")
sessionStorage.setItem("companyName",element.company.name) sessionStorage.setItem("companyName", element.company.name)
sessionStorage.setItem("companyId",element.company.id) sessionStorage.setItem("companyId", element.company.id)
sessionStorage.setItem(element.company.id,JSON.stringify(element.company.companyIntegrityScore)) sessionStorage.setItem(element.company.id, JSON.stringify(element.company.companyIntegrityScore))
window.open(`/keyUnit/viewunitinfo?id=${element.company.id}&usci=${element.company.usci}`,'_blank'); window.open(`/keyUnit/viewunitinfo?id=${element.company.id}&usci=${element.company.usci}`, '_blank');
} }
//跳转查看预案页面 审核通过预案 //跳转查看预案页面 审核通过预案
routerTo(e){ routerTo(e) {
// console.log(e) // console.log(e)
if(e.planMode == 0||e.planMode == 1){ if (e.planMode == 0 || e.planMode == 1) {
//console.log(e.attachmentUrls) //console.log(e.attachmentUrls)
var index=e.attachmentUrls[0].indexOf("\/") var index = e.attachmentUrls[0].indexOf("\/")
if(e.attachmentUrls[0].substr(0,index)=='psw'){ if (e.attachmentUrls[0].substr(0, index) == 'psw') {
const dialogRef = this.dialog.open(GkPsViewer, { const dialogRef = this.dialog.open(GkPsViewer, {
width: '1500px', width: '1500px',
height:'800px', height: '800px',
data: e.attachmentUrls[0] data: e.attachmentUrls[0]
}); });
} }
else /* if(e.attachmentUrls[0].substr(e.attachmentUrls[0].length-4,e.attachmentUrls[0].length-1)=='docx'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='pdf' else {
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='doc'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='DOC'
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='txt'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='JPG') */{
let filename:string
let fetchUrl = e.attachmentUrls[0] let fetchUrl = e.attachmentUrls[0]
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl); let suffix = fetchUrl.split('.')[fetchUrl.split('.').length - 1].toLowerCase()
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray); if (suffix == 'docx' || suffix == 'doc') {
let jwt = sessionStorage.getItem("token"); let arr = fetchUrl.split('.')
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); arr[arr.length - 1] = 'pdf'
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
let identityJsonparse=JSON.parse(identityJson) } else if (suffix == 'pdf') {
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{ window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
filename=data.fileName } else {
let json={ let config = new MatSnackBarConfig();
doc: { config.verticalPosition = 'top';
docId: docId, config.duration = 3000
title: filename, this.snackBar.open('该文件类型暂不支持在线查看', '确定', config);
fetchUrl: `http://172.18.0.1:8000/api/Objects/PlanPlatform/`+fetchUrl, }
},
user: {
uid: identityJsonparse.sub,
nickName: identityJsonparse.name,
avatar: "",
privilege: [
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
],
},
}
var stringjson=JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
})
} }
} }
if(e.planMode == 2){ //如果是在线编辑 if (e.planMode == 2) { //如果是在线编辑
let id = e.id let id = e.id
sessionStorage.setItem("planId",id) sessionStorage.setItem("planId", id)
sessionStorage.setItem("companyId",e.companyId) sessionStorage.setItem("companyId", e.companyId)
//sessionStorage.setItem("buildingTypeId",this.unittypeId) //sessionStorage.setItem("buildingTypeId",this.unittypeId)
sessionStorage.setItem("editable","0") sessionStorage.setItem("editable", "0")
sessionStorage.setItem("planName",e.name) sessionStorage.setItem("planName", e.name)
let companyId = sessionStorage.getItem("companyId") let companyId = sessionStorage.getItem("companyId")
window.open(`/keyUnit/viewunitinfoplan?id=${companyId}`); window.open(`/keyUnit/viewunitinfoplan?id=${companyId}`);
} }
if(e.planMode == 3){ //如果是跳转网页 if (e.planMode == 3) { //如果是跳转网页
sessionStorage.setItem("url",e.url) sessionStorage.setItem("url", e.url)
window.open(`/planManagement/webLook`) window.open(`/planManagement/webLook`)
} }
} }
//预案公开 //预案公开
openReserve (e) { openReserve(e) {
this.http.put(`/api/PlanAudits/${e.id}/Public`,[]).subscribe(data=>{ this.http.put(`/api/PlanAudits/${e.id}/Public`, []).subscribe(data => {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('预案已公开','确定',config); this.snackBar.open('预案已公开', '确定', config);
}) })
} }
//预案取消公开 //预案取消公开
closeReserve (e) { closeReserve(e) {
this.http.put(`/api/PlanAudits/${e.id}/Unpublic`,[]).subscribe(data=>{ this.http.put(`/api/PlanAudits/${e.id}/Unpublic`, []).subscribe(data => {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('预案已取消公开','确定',config); this.snackBar.open('预案已取消公开', '确定', config);
}) })
} }
//分页事件 //分页事件
chagePage(e){ chagePage(e) {
this.PageNumber = e.pageIndex+1 this.PageNumber = e.pageIndex + 1
this.getAllPlanInfo(); this.getAllPlanInfo();
} }
//辖区中队div是否显示 //辖区中队div是否显示
isorganizationbox:boolean = false isorganizationbox: boolean = false
//点击辖区中队树,将选择的辖区中队添加到变量 //点击辖区中队树,将选择的辖区中队添加到变量
add(node) { add(node) {
this.isorganizationbox = false this.isorganizationbox = false
@ -447,26 +429,26 @@ export class PassPlanComponent implements OnInit {
this.isorganizationbox = true this.isorganizationbox = true
} }
//关闭出现的组织机构div //关闭出现的组织机构div
closediv(){ closediv() {
this.isorganizationbox = false this.isorganizationbox = false
} }
//查询 //查询
onSubmit (e) { onSubmit(e) {
this.PageNumber = 1 this.PageNumber = 1
this.pageEvent.pageIndex = 0 this.pageEvent.pageIndex = 0
this.getAllPlanInfo(); this.getAllPlanInfo();
} }
companyName:any //单位名称 companyName: any //单位名称
js:any //所选组织机构 js: any //所选组织机构
jsId:any //所选组织机构的id jsId: any //所选组织机构的id
jscheck:boolean //所选组织机构勾选框 jscheck: boolean //所选组织机构勾选框
unittype:any //单位类型 unittype: any //单位类型
reservePlanType:any //预案类型 reservePlanType: any //预案类型
preparelevel:any //编制级别 preparelevel: any //编制级别
plcheck:boolean //编制级别勾选框 plcheck: boolean //编制级别勾选框
planCategory=[]//预案级别 planCategory = []//预案级别
//重置 //重置
reset(){ reset() {
this.companyName = '' this.companyName = ''
this.js = '' this.js = ''
this.jsId = '' this.jsId = ''
@ -474,13 +456,13 @@ export class PassPlanComponent implements OnInit {
this.unittype = '' this.unittype = ''
this.reservePlanType = '' this.reservePlanType = ''
this.preparelevel = '' this.preparelevel = ''
this.addtime='' this.addtime = ''
this.endtime='' this.endtime = ''
this.plcheck = false this.plcheck = false
//重新获取初始化列表 //重新获取初始化列表
this.pageEvent.pageIndex = 0 this.pageEvent.pageIndex = 0
this.PageNumber = 1 this.PageNumber = 1
this.planCategory=[] this.planCategory = []
this.getAllPlanInfo(); this.getAllPlanInfo();
} }
} }
@ -490,13 +472,13 @@ export class PassPlanComponent implements OnInit {
templateUrl: './PsvShow.html', templateUrl: './PsvShow.html',
styleUrls: ['./pass-plan.component.scss'] styleUrls: ['./pass-plan.component.scss']
}) })
export class GkPsViewer{ export class GkPsViewer {
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<GkPsViewer>,@Inject(MAT_DIALOG_DATA) public data: any) {} constructor(private router: Router, private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<GkPsViewer>, @Inject(MAT_DIALOG_DATA) public data: any) { }
ngOnInit(): void { ngOnInit(): void {
// console.log(this.data) // console.log(this.data)
const viewer = new Viewer({ const viewer = new Viewer({
container: document.querySelector('#viewer'), container: document.querySelector('#viewer'),
panorama:'/api/Objects/PlanPlatform/'+ this.data, panorama: '/api/Objects/PlanPlatform/' + this.data,
}); });
} }
@ -508,8 +490,8 @@ export class GkPsViewer{
templateUrl: './unitInfo.html', templateUrl: './unitInfo.html',
styleUrls: ['./pass-plan.component.scss'] styleUrls: ['./pass-plan.component.scss']
}) })
export class UnitInfo{ export class UnitInfo {
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<UnitInfo>,@Inject(MAT_DIALOG_DATA) public data: any) {} constructor(private router: Router, private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<UnitInfo>, @Inject(MAT_DIALOG_DATA) public data: any) { }
ngOnInit(): void { ngOnInit(): void {
// console.log(this.data) // console.log(this.data)
} }

479
src/app/plan-management/type-plan/type-plan.component.ts

@ -12,7 +12,7 @@ import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'
import { MatPaginator } from '@angular/material/paginator'; import { MatPaginator } from '@angular/material/paginator';
import { FlatTreeControl } from '@angular/cdk/tree'; import { FlatTreeControl } from '@angular/cdk/tree';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { Router,ActivatedRoute } from '@angular/router' import { Router, ActivatedRoute } from '@angular/router'
import { PageEvent } from '@angular/material/paginator'; import { PageEvent } from '@angular/material/paginator';
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
@ -26,70 +26,70 @@ declare var CryptoJS
}) })
export class TypePlanComponent implements OnInit { export class TypePlanComponent implements OnInit {
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,private tree: TreeService,public dialog: MatDialog,public snackBar: MatSnackBar) { } constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, private tree: TreeService, public dialog: MatDialog, public snackBar: MatSnackBar) { }
ngOnInit(): void { ngOnInit(): void {
if(window.matchMedia("(max-width: 1400px)").matches){ if (window.matchMedia("(max-width: 1400px)").matches) {
this.pcMore=false this.pcMore = false
this.padMore=true this.padMore = true
this.pcfind=false this.pcfind = false
this.padjt=true this.padjt = true
}else{ } else {
this.pcfind=true this.pcfind = true
this.pcMore=true this.pcMore = true
this.padMore=false this.padMore = false
this.padjt=false this.padjt = false
} }
this.levels = sessionStorage.getItem("level"); this.levels = sessionStorage.getItem("level");
if(this.levels == "0"){//如果是总队 if (this.levels == "0") {//如果是总队
this.preparelevels = [ this.preparelevels = [
{name:"总队",value:"1"}, { name: "总队", value: "1" },
{name:"支队",value:"2"}, { name: "支队", value: "2" },
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(this.levels == "1"){//如果是支队 if (this.levels == "1") {//如果是支队
this.preparelevels = [ this.preparelevels = [
{name:"支队",value:"2"}, { name: "支队", value: "2" },
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(this.levels == "2"){//如果是大队 if (this.levels == "2") {//如果是大队
this.preparelevels = [ this.preparelevels = [
{name:"大队",value:"4"}, { name: "大队", value: "4" },
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
if(this.levels == "3"){//如果是中队 if (this.levels == "3") {//如果是中队
this.preparelevels = [ this.preparelevels = [
{name:"中队",value:"8"} { name: "中队", value: "8" }
] ]
} }
this.getAlltabledate() this.getAlltabledate()
} }
pcMore//pc更多 pcMore//pc更多
pcput=false//pc收起 pcput = false//pc收起
pcfind//pc查询 pcfind//pc查询
padjt=false padjt = false
padMore=true//pad收缩控制 padMore = true//pad收缩控制
padput=false//pad收起按钮 padput = false//pad收起按钮
imgsrcopen="../../../assets/images/routdown2.png" imgsrcopen = "../../../assets/images/routdown2.png"
imgsrcdown="../../../assets/images/routup2.png" imgsrcdown = "../../../assets/images/routup2.png"
pcInfo(){ pcInfo() {
this.pcMore=!this.pcMore this.pcMore = !this.pcMore
this.pcput=!this.pcput this.pcput = !this.pcput
} }
padInfo(){ padInfo() {
this.padMore=!this.padMore this.padMore = !this.padMore
this.padput=!this.padput this.padput = !this.padput
} }
levels levels
preparelevels:any preparelevels: any
plcheck:boolean //编制级别勾选框 plcheck: boolean //编制级别勾选框
displayedColumns: string[] = ['unitname','addname','addtime', 'plantype', 'passstate','isopen','projectlevel','operation']; displayedColumns: string[] = ['unitname', 'addname', 'addtime', 'plantype', 'passstate', 'isopen', 'projectlevel', 'operation'];
tabledataSource tabledataSource
unitname//预案名称 unitname//预案名称
level//预案级别 level//预案级别
@ -100,61 +100,61 @@ export class TypePlanComponent implements OnInit {
unitstate//审核状态 unitstate//审核状态
projectlevel//编制级别 projectlevel//编制级别
//分页 //分页
@ViewChild(MatPaginator, {static: true}) @ViewChild(MatPaginator, { static: true })
pageEvent: PageEvent; pageEvent: PageEvent;
paginator: MatPaginator; paginator: MatPaginator;
length:any; //共多少条数据 length: any; //共多少条数据
pageSize:any; //每页条数 pageSize: any; //每页条数
pageSizeOptions: number[] = [10] //设置每页条数 pageSizeOptions: number[] = [10] //设置每页条数
PageNumber:any; //第几页 PageNumber: any; //第几页
//获取表格数据 //获取表格数据
getAlltabledate(){ getAlltabledate() {
let paramsdata:any = { let paramsdata: any = {
Name:this.unitname||'', Name: this.unitname || '',
planCategories:8, planCategories: 8,
CreatorName:this.addname||'', CreatorName: this.addname || '',
AuditStatus:this.unitstate|| '', AuditStatus: this.unitstate || '',
CreationTimeRangeStart:this.addtime||'', CreationTimeRangeStart: this.addtime || '',
CreationTimeRangeEnd:this.endtime||'', CreationTimeRangeEnd: this.endtime || '',
PlanLevel:this.projectlevel||'', PlanLevel: this.projectlevel || '',
HasChildrenPlanLevel:this.plcheck||'', HasChildrenPlanLevel: this.plcheck || '',
PageNumber: this.PageNumber || '1', PageNumber: this.PageNumber || '1',
PageSize: this.pageSizeOptions[0], PageSize: this.pageSizeOptions[0],
} }
this.http.get("/api/PlanComponentsMajor",{params:paramsdata}).subscribe((data:any)=>{ this.http.get("/api/PlanComponentsMajor", { params: paramsdata }).subscribe((data: any) => {
this.length = data.totalCount this.length = data.totalCount
this.tabledataSource = data.items this.tabledataSource = data.items
}) })
} }
//分页事件 //分页事件
changePage(e){ changePage(e) {
this.PageNumber = e.pageIndex+1 this.PageNumber = e.pageIndex + 1
this.getAlltabledate() this.getAlltabledate()
} }
//重置 //重置
reset(){ reset() {
this.unitname='' this.unitname = ''
this.level='' this.level = ''
this.addname='' this.addname = ''
this.addtime='' this.addtime = ''
this.endtime='' this.endtime = ''
this.unitstate='' this.unitstate = ''
this.projectlevel='' this.projectlevel = ''
this.plcheck=false this.plcheck = false
this.getAlltabledate() this.getAlltabledate()
} }
//查询 //查询
onSubmit (value) { onSubmit(value) {
if(this.endtime!=undefined&&this.addtime>this.endtime){ if (this.endtime != undefined && this.addtime > this.endtime) {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('开始时间不能大于结束时间!','确定',config); this.snackBar.open('开始时间不能大于结束时间!', '确定', config);
}else{ } else {
this.PageNumber = 1 this.PageNumber = 1
this.pageEvent.pageIndex = 0 this.pageEvent.pageIndex = 0
this.getAlltabledate(); this.getAlltabledate();
@ -163,92 +163,72 @@ export class TypePlanComponent implements OnInit {
} }
//删除预案 //删除预案
deletePlan(id){ deletePlan(id) {
let isTrue = confirm('您确定要删除吗') let isTrue = confirm('您确定要删除吗')
if(isTrue){ if (isTrue) {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.http.delete(`/api/PlanComponentsMajor/${id}`).subscribe(data=>{ this.http.delete(`/api/PlanComponentsMajor/${id}`).subscribe(data => {
this.snackBar.open('删除成功!','确定',config); this.snackBar.open('删除成功!', '确定', config);
this.getAlltabledate() this.getAlltabledate()
},err => { }, err => {
this.snackBar.open(err,'确定',config); this.snackBar.open(err, '确定', config);
}) })
} }
} }
//提交审核 //提交审核
submitAudit(element){ submitAudit(element) {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
/* if(element.auditStatus == 4){ /* if(element.auditStatus == 4){
this.snackBar.open('审核退回的预案需要修改后方可再次提交审核!','确定',config); this.snackBar.open('审核退回的预案需要修改后方可再次提交审核!','确定',config);
} */ } */
this.http.put(`/api/PlanComponentsMajor/${element.id}/Commit`,"").subscribe(data=>{ this.http.put(`/api/PlanComponentsMajor/${element.id}/Commit`, "").subscribe(data => {
this.getAlltabledate() this.getAlltabledate()
},err => { }, err => {
this.snackBar.open(err,'确定',config); this.snackBar.open(err, '确定', config);
}) })
} }
//撤销审核 //撤销审核
cancelAudit(element){ cancelAudit(element) {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.http.put(`/api/PlanComponentsMajor/${element.id}/Cancel`,"").subscribe(data=>{ this.http.put(`/api/PlanComponentsMajor/${element.id}/Cancel`, "").subscribe(data => {
this.getAlltabledate() this.getAlltabledate()
},err => { }, err => {
this.snackBar.open(err,'确定',config); this.snackBar.open(err, '确定', config);
}) })
} }
//查看预案 //查看预案
openPlan(element){ openPlan(element) {
let filename:string
let fetchUrl = element.attachmentUrls[0] let fetchUrl = element.attachmentUrls[0]
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl); let suffix = fetchUrl.split('.')[fetchUrl.split('.').length - 1].toLowerCase()
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray); if (suffix == 'docx' || suffix == 'doc') {
let jwt = sessionStorage.getItem("token"); let arr = fetchUrl.split('.')
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); arr[arr.length - 1] = 'pdf'
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
let identityJsonparse=JSON.parse(identityJson) } else if (suffix == 'pdf') {
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{ window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
filename=data.fileName } else {
let json={ let config = new MatSnackBarConfig();
doc: { config.verticalPosition = 'top';
docId: docId, config.duration = 3000
title: filename, this.snackBar.open('该文件类型暂不支持在线查看', '确定', config);
fetchUrl: `http://172.18.0.1:8000/api/Objects/PlanPlatform/`+fetchUrl, }
},
user: {
uid: identityJsonparse.sub,
nickName: identityJsonparse.name,
avatar: "",
privilege: element.auditStatus!='1'&&element.auditStatus!='16'?[
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
]:[
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
],
},
}
var stringjson=JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
})
} }
//新增预案弹窗 //新增预案弹窗
addunit(){ addunit() {
const dialogRef = this.dialog.open(newunitType, { const dialogRef = this.dialog.open(newunitType, {
width: '340px', width: '340px',
height:'330px', height: '330px',
disableClose:true disableClose: true
//data: paperDataInfo //data: paperDataInfo
}); });
dialogRef.afterClosed().subscribe(result => { dialogRef.afterClosed().subscribe(result => {
@ -258,34 +238,34 @@ export class TypePlanComponent implements OnInit {
} }
//审核结果 //审核结果
auditResult(element){ auditResult(element) {
// console.log(element) // console.log(element)
const dialogRef = this.dialog.open(typeAuditResult, { const dialogRef = this.dialog.open(typeAuditResult, {
width:"400px", width: "400px",
//height:"300px", //height:"300px",
data: {element:element} data: { element: element }
}); });
} }
//下载↓ //下载↓
selectDownloadFile:any; //选择下载的文件 selectDownloadFile: any; //选择下载的文件
download:any; //下载文件元数据 download: any; //下载文件元数据
downloadisLoading:boolean = false; //进度条loading加载 downloadisLoading: boolean = false; //进度条loading加载
downloadProgress:number=0; //进度条进度 downloadProgress: number = 0; //进度条进度
downloadFileName:any downloadFileName: any
fileUrls:any //当前预案附件地址 fileUrls: any //当前预案附件地址
fileDatas:any = [] fileDatas: any = []
selectedFileIndex : any = 0 selectedFileIndex: any = 0
selectedFileData : any selectedFileData: any
uploadFileLonging:any uploadFileLonging: any
//读取下载文件信息 //读取下载文件信息
readFile (element) { readFile(element) {
this.uploadFileLonging = element this.uploadFileLonging = element
element.attachmentUrls.forEach(item=>{ element.attachmentUrls.forEach(item => {
this.http.get('/api/ObjectMetadata/PlanPlatform/'+item).subscribe((data:any)=>{ this.http.get('/api/ObjectMetadata/PlanPlatform/' + item).subscribe((data: any) => {
data.filePige = (data.fileLength / (1024*1024)).toFixed(2) data.filePige = (data.fileLength / (1024 * 1024)).toFixed(2)
//console.log(data) //console.log(data)
this.download = data this.download = data
this.downloadFile() this.downloadFile()
@ -295,24 +275,24 @@ export class TypePlanComponent implements OnInit {
} }
//初始化下载 //初始化下载
downloadFile () { downloadFile() {
this.downloadProgress = 0 this.downloadProgress = 0
let file = this.download let file = this.download
let fileSize = file.fileLength//下载文件的总大小 let fileSize = file.fileLength//下载文件的总大小
let shardSize = 10 * 1024 * 1024 //文件大小是否大于10MB let shardSize = 10 * 1024 * 1024 //文件大小是否大于10MB
if (file && fileSize<=shardSize) { //<=10MB时直接下载 if (file && fileSize <= shardSize) { //<=10MB时直接下载
this.downloadisLoading = true this.downloadisLoading = true
// this.setFileLoading() // this.setFileLoading()
this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`,{responseType: 'blob'},).subscribe(data=>{ this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`, { responseType: 'blob' },).subscribe(data => {
let url = window.URL.createObjectURL(new Blob([data])); //createObjectURL创建一个下载Blob的url地址 let url = window.URL.createObjectURL(new Blob([data])); //createObjectURL创建一个下载Blob的url地址
let link = document.createElement("a"); let link = document.createElement("a");
link.style.display = "none"; link.style.display = "none";
link.href = url; link.href = url;
let suffix = file.objectName.substring(file.objectName.lastIndexOf(".")+1,file.objectName.length) ; let suffix = file.objectName.substring(file.objectName.lastIndexOf(".") + 1, file.objectName.length);
link.setAttribute("download", file.fileName + "-" +this.uploadFileLonging.name + "." + suffix); link.setAttribute("download", file.fileName + "-" + this.uploadFileLonging.name + "." + suffix);
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
this.downloadisLoading = false this.downloadisLoading = false
@ -327,31 +307,32 @@ export class TypePlanComponent implements OnInit {
} }
//分段下载并合并 //分段下载并合并
async blockingDownload () { async blockingDownload() {
let file = this.download let file = this.download
let fileSize = file.fileLength //下载文件的总大小 let fileSize = file.fileLength //下载文件的总大小
let shardSize = 3 * 1024 * 1024 //3MB一个分片 let shardSize = 3 * 1024 * 1024 //3MB一个分片
let allSlice = Math.ceil(fileSize / shardSize) //总文件/3MB===共分多少段 let allSlice = Math.ceil(fileSize / shardSize) //总文件/3MB===共分多少段
let allFile:any = [] //所有的file分段 let allFile: any = [] //所有的file分段
for (let i=0;i<allSlice;i++) { for (let i = 0; i < allSlice; i++) {
let start = i * shardSize //每次下载文件开始位置 let start = i * shardSize //每次下载文件开始位置
let end = Math.min(fileSize, start + shardSize-1); //每次下载文件结束为止 let end = Math.min(fileSize, start + shardSize - 1); //每次下载文件结束为止
let result = await new Promise ((result,reject)=>{ let result = await new Promise((result, reject) => {
this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`,{headers:{'range':`bytes= ${start}-${end}`},responseType:'blob'}).subscribe(data=>{ this.http.get(`/api/Objects/PlanPlatform/${file.objectName}`, { headers: { 'range': `bytes= ${start}-${end}` }, responseType: 'blob' }).subscribe(data => {
result(data) }) result(data)
})
}) })
allFile.push(result) allFile.push(result)
this.downloadProgress = Number((i/allSlice).toFixed(2))*100 this.downloadProgress = Number((i / allSlice).toFixed(2)) * 100
if (allFile.length === allSlice) { //合并文件输出给浏览器 if (allFile.length === allSlice) { //合并文件输出给浏览器
let url = window.URL.createObjectURL(new Blob(allFile)); //createObjectURL创建一个下载Blob的url地址 let url = window.URL.createObjectURL(new Blob(allFile)); //createObjectURL创建一个下载Blob的url地址
let link = document.createElement("a"); let link = document.createElement("a");
link.style.display = "none"; link.style.display = "none";
link.href = url; link.href = url;
let suffix = file.objectName.substring(file.objectName.lastIndexOf(".")+1,file.objectName.length) ; let suffix = file.objectName.substring(file.objectName.lastIndexOf(".") + 1, file.objectName.length);
link.setAttribute("download", file.fileName + "-" +this.uploadFileLonging.name + "." + suffix); link.setAttribute("download", file.fileName + "-" + this.uploadFileLonging.name + "." + suffix);
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
// this.downloadProgress = 0 // this.downloadProgress = 0
@ -364,7 +345,7 @@ export class TypePlanComponent implements OnInit {
} }
//取消分块下载 //取消分块下载
cancelDowload () { cancelDowload() {
} }
} }
@ -375,8 +356,8 @@ export class TypePlanComponent implements OnInit {
templateUrl: './newunit.html', templateUrl: './newunit.html',
styleUrls: ['./newunit.scss'] styleUrls: ['./newunit.scss']
}) })
export class newunitType{ export class newunitType {
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<newunitType>,@Inject(MAT_DIALOG_DATA) public data: any) {} constructor(private router: Router, private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<newunitType>, @Inject(MAT_DIALOG_DATA) public data: any) { }
unitname//预案名称 unitname//预案名称
level//预案级别 level//预案级别
addname//添加人 addname//添加人
@ -386,80 +367,80 @@ export class newunitType{
projectlevel//编制级别 projectlevel//编制级别
reservePlanType//预案类型 reservePlanType//预案类型
//上传 //上传
upload(){ upload() {
document.getElementById('up').click() document.getElementById('up').click()
} }
//上传文件↓ //上传文件↓
file:any; //上传的文件 file: any; //上传的文件
fileName:any; //上传文件name fileName: any; //上传文件name
uploadisLoading:boolean = false; //进度条loading加载 uploadisLoading: boolean = false; //进度条loading加载
uploadProgress:number=0; //进度条进度 uploadProgress: number = 0; //进度条进度
objectName:any; //上传对象名 objectName: any; //上传对象名
uploadId:any; //上传分块上传事件编号 uploadId: any; //上传分块上传事件编号
uploadover:any = false //上传完成之后提示 uploadover: any = false //上传完成之后提示
selectedPLanType:any//所选预案类型 selectedPLanType: any//所选预案类型
selectedPLanName:any//所选预案名称 selectedPLanName: any//所选预案名称
localup:boolean = false //本地上传 localup: boolean = false //本地上传
defaultisshow = '0' //默认显示上传input框 defaultisshow = '0' //默认显示上传input框
//上传文件input //上传文件input
filechange(e){ filechange(e) {
this.file = e.target.files[0] || null //上传的文件 this.file = e.target.files[0] || null //上传的文件
} }
//上传文件 //上传文件
startUploading (planType) { startUploading(planType) {
let file = this.file || null //获取上传的文件 let file = this.file || null //获取上传的文件
let fileSize = file.size || null //上传文件的总大小 let fileSize = file.size || null //上传文件的总大小
let shardSize = 5 * 1024 * 1024 //5MB一个分片 let shardSize = 5 * 1024 * 1024 //5MB一个分片
if (file && fileSize<=shardSize) { //上传文件<=5MB时 if (file && fileSize <= shardSize) { //上传文件<=5MB时
let formData = new FormData() let formData = new FormData()
formData.append("file",file) formData.append("file", file)
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
let level = sessionStorage.getItem("level") let level = sessionStorage.getItem("level")
// console.log(level) // console.log(level)
let PlanLevel let PlanLevel
if(level == '0'){ if (level == '0') {
PlanLevel = 1 PlanLevel = 1
} }
if(level == '1'){ if (level == '1') {
PlanLevel = 2 PlanLevel = 2
} }
if(level == '2'){ if (level == '2') {
PlanLevel = 4 PlanLevel = 4
} }
if(level == '3'){ if (level == '3') {
PlanLevel = 8 PlanLevel = 8
} }
this.http.post(`/api/Objects/PlanPlatform/typeClass`,formData).subscribe((data:any)=>{ this.http.post(`/api/Objects/PlanPlatform/typeClass`, formData).subscribe((data: any) => {
this.objectName = data.objectName this.objectName = data.objectName
//console.log('上传成功') //console.log('上传成功')
let body:any = { let body: any = {
Name:this.unitname||'', Name: this.unitname || '',
PlanCategory:8, PlanCategory: 8,
PlanLevel:PlanLevel, PlanLevel: PlanLevel,
PlanMode:1, PlanMode: 1,
PlanType:8, PlanType: 8,
planType:16, planType: 16,
attachmentUrls:[`${this.objectName}`] attachmentUrls: [`${this.objectName}`]
} }
this.http.post("/api/PlanComponentsMajor",body).subscribe((data:any)=>{ this.http.post("/api/PlanComponentsMajor", body).subscribe((data: any) => {
this.snackBar.open('创建成功!','确定',config); this.snackBar.open('创建成功!', '确定', config);
this.dialogRef.close(); this.dialogRef.close();
},err=>{ }, err => {
this.snackBar.open('创建失败!','确定',config); this.snackBar.open('创建失败!', '确定', config);
}) })
},err=>{ }, err => {
this.snackBar.open('上传失败!','确定',config); this.snackBar.open('上传失败!', '确定', config);
}) })
} else if (file && fileSize>shardSize) { //上传文件>5MB时,分块上传 } else if (file && fileSize > shardSize) { //上传文件>5MB时,分块上传
let data = {filename: file.name} let data = { filename: file.name }
this.uploadisLoading = true this.uploadisLoading = true
this.http.post(`/api/NewMultipartUpload/PlanPlatform/typeClass`,{},{params:data}).subscribe((data:any)=>{ //初始化分段上传 this.http.post(`/api/NewMultipartUpload/PlanPlatform/typeClass`, {}, { params: data }).subscribe((data: any) => { //初始化分段上传
this.objectName = data.objectName this.objectName = data.objectName
this.uploadId = data.uploadId this.uploadId = data.uploadId
this.subsectionUploading(planType) this.subsectionUploading(planType)
@ -467,120 +448,122 @@ export class newunitType{
} }
} }
PartNumberETag:any=[]; //每次返回需要保存的信息 PartNumberETag: any = []; //每次返回需要保存的信息
//开始分段上传 //开始分段上传
async subsectionUploading (planType) { async subsectionUploading(planType) {
let file = this.file || null //获取上传的文件 let file = this.file || null //获取上传的文件
let fileSize = file.size || null //上传文件的总大小 let fileSize = file.size || null //上传文件的总大小
let shardSize = 5 * 1024 * 1024 //5MB一个分片 let shardSize = 5 * 1024 * 1024 //5MB一个分片
let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段 向上取整 let allSlice = Math.ceil(fileSize / shardSize) //总文件/5MB===共分多少段 向上取整
for (let i = 0;i < allSlice;i++) { //循环分段上传 for (let i = 0; i < allSlice; i++) { //循环分段上传
let start = i * shardSize //切割文件开始位置 let start = i * shardSize //切割文件开始位置
let end = Math.min(fileSize, start + shardSize); //切割文件结束位置 (对比取小数) let end = Math.min(fileSize, start + shardSize); //切割文件结束位置 (对比取小数)
let formData = new FormData() let formData = new FormData()
formData.append("file",file.slice(start, end)) formData.append("file", file.slice(start, end))
//同步写法实现异步调用 //同步写法实现异步调用
let result = await new Promise((resolve, reject) => { let result = await new Promise((resolve, reject) => {
// await 需要后面返回一个 promise 对象 // await 需要后面返回一个 promise 对象
this.http.post(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}&partNumber=${i+1}`,formData).subscribe((data:any)=>{ this.http.post(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}&partNumber=${i + 1}`, formData).subscribe((data: any) => {
let msg = { let msg = {
"partNumber":data.partNumber || null, "partNumber": data.partNumber || null,
"eTag": data.eTag || null} "eTag": data.eTag || null
}
resolve(msg) // 调用 promise 内置方法处理成功 resolve(msg) // 调用 promise 内置方法处理成功
}) })
}); });
this.PartNumberETag.push(result) this.PartNumberETag.push(result)
this.uploadProgress = Number((i/allSlice).toFixed(2))*100 this.uploadProgress = Number((i / allSlice).toFixed(2)) * 100
if (this.PartNumberETag.length === allSlice) { if (this.PartNumberETag.length === allSlice) {
this.uploadProgress = 100 this.uploadProgress = 100
this.endUploading(planType)} this.endUploading(planType)
}
}//for循环 }//for循环
} }
//完成分块上传 //完成分块上传
endUploading (planType) { endUploading(planType) {
let data = this.PartNumberETag let data = this.PartNumberETag
let paramsData = {uploadId:this.uploadId} let paramsData = { uploadId: this.uploadId }
this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`,data,{params:paramsData}).subscribe(data=>{ this.http.post(`/api/CompleteMultipartUpload/PlanPlatform/${this.objectName}`, data, { params: paramsData }).subscribe(data => {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
//console.log('创建成功') //console.log('创建成功')
this.uploadProgress = 0; this.uploadProgress = 0;
this.uploadisLoading = false this.uploadisLoading = false
this.PartNumberETag =[] //清空保存返回的信息 this.PartNumberETag = [] //清空保存返回的信息
this.uploadover = true this.uploadover = true
let level = sessionStorage.getItem("level") let level = sessionStorage.getItem("level")
// console.log(level) // console.log(level)
let PlanLevel let PlanLevel
if(level == '0'){ if (level == '0') {
PlanLevel = 1 PlanLevel = 1
} }
if(level == '1'){ if (level == '1') {
PlanLevel = 2 PlanLevel = 2
} }
if(level == '2'){ if (level == '2') {
PlanLevel = 4 PlanLevel = 4
} }
if(level == '3'){ if (level == '3') {
PlanLevel = 8 PlanLevel = 8
} }
let body:any = { let body: any = {
Name:this.unitname||'', Name: this.unitname || '',
PlanCategory:8, PlanCategory: 8,
PlanLevel:PlanLevel, PlanLevel: PlanLevel,
PlanMode:1, PlanMode: 1,
PlanType:8, PlanType: 8,
planType:16, planType: 16,
attachmentUrls:[`${this.objectName}`] attachmentUrls: [`${this.objectName}`]
} }
this.http.post("/api/PlanComponentsMajor",body).subscribe((data:any)=>{ this.http.post("/api/PlanComponentsMajor", body).subscribe((data: any) => {
this.snackBar.open('创建成功!','确定',config); this.snackBar.open('创建成功!', '确定', config);
this.dialogRef.close(); this.dialogRef.close();
},err=>{ }, err => {
this.snackBar.open('创建失败!','确定',config); this.snackBar.open('创建失败!', '确定', config);
}) })
}) })
} }
//取消分块上传 //取消分块上传
cancel () { cancel() {
this.http.delete(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}`).subscribe(data=>{ this.http.delete(`/api/MultipartUpload/PlanPlatform/${this.objectName}?uploadId=${this.uploadId}`).subscribe(data => {
this.uploadProgress = 0; this.uploadProgress = 0;
this.uploadisLoading= false; this.uploadisLoading = false;
(<HTMLInputElement>document.getElementById('up')).value = null (<HTMLInputElement>document.getElementById('up')).value = null
this.PartNumberETag =[] //清空保存返回的信息 this.PartNumberETag = [] //清空保存返回的信息
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
this.snackBar.open('取消上传成功!','确定',config); this.snackBar.open('取消上传成功!', '确定', config);
this.uploadover = false this.uploadover = false
this.file = null this.file = null
}) })
} }
//创建预案 //创建预案
newplan(){ newplan() {
const config = new MatSnackBarConfig(); const config = new MatSnackBarConfig();
config.verticalPosition = 'top'; config.verticalPosition = 'top';
config.duration = 3000 config.duration = 3000
if(this.unitname==undefined||this.unitname==''){ if (this.unitname == undefined || this.unitname == '') {
this.snackBar.open('请输入预案名称!','确定',config); this.snackBar.open('请输入预案名称!', '确定', config);
} }
else if(this.file==undefined){ else if (this.file == undefined) {
this.snackBar.open('请先上传文件!','确定',config); this.snackBar.open('请先上传文件!', '确定', config);
} }
else{ else {
if(this.reservePlanType!='1'){ if (this.reservePlanType != '1') {
this.startUploading("非二维") this.startUploading("非二维")
} }
else{this.startUploading("二维")} else { this.startUploading("二维") }
} }
@ -588,7 +571,7 @@ export class newunitType{
} }
//取消按钮 //取消按钮
close(){ close() {
this.dialogRef.close(); this.dialogRef.close();
} }
} }
@ -599,15 +582,15 @@ export class newunitType{
templateUrl: './resulttypePlan.html', templateUrl: './resulttypePlan.html',
styleUrls: ['./type-plan.component.scss'] styleUrls: ['./type-plan.component.scss']
}) })
export class typeAuditResult{ export class typeAuditResult {
constructor(private http: HttpClient,public dialogRef: MatDialogRef<typeAuditResult>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {} constructor(private http: HttpClient, public dialogRef: MatDialogRef<typeAuditResult>, @Inject(MAT_DIALOG_DATA) public data, public snackBar: MatSnackBar) { }
planName:any = this.data.element.name planName: any = this.data.element.name
commitTime:any = this.data.element.committedTime commitTime: any = this.data.element.committedTime
commitOrganizationName:any = this.data.element.committerOrganizationName commitOrganizationName: any = this.data.element.committerOrganizationName
auditOrganizationName:any = this.data.element.auditorOrganizationName auditOrganizationName: any = this.data.element.auditorOrganizationName
auditResult:any = this.data.element.auditStatus auditResult: any = this.data.element.auditStatus
auditOpinion:any = this.data.element.auditOpinion auditOpinion: any = this.data.element.auditOpinion
ngOnInit(): void { ngOnInit(): void {
} }
onNoClick(): void { onNoClick(): void {

30
src/app/searchComponent.service.ts

@ -0,0 +1,30 @@
import { ApplicationRef, ComponentFactoryResolver, ComponentRef, EmbeddedViewRef, Injectable, Injector } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class SearchService {
constructor(private componentFactoryResolver: ComponentFactoryResolver, private applicationRef: ApplicationRef, private injector: Injector,) { }
//angular 动态添加组件
appendComponentToBody<T>(component: any): ComponentRef<T> {
//create a component reference
const componentRef = this.componentFactoryResolver.resolveComponentFactory(component).create(this.injector);
// attach component to the appRef so that so that it will be dirty checked.
this.applicationRef.attachView(componentRef.hostView);
// get DOM element from component
const domElem = (componentRef.hostView as EmbeddedViewRef<any>).rootNodes[0] as HTMLElement;
document.body.appendChild(domElem);
return componentRef as ComponentRef<T>;
}
//删除组件
removeComponentFromBody(componentRef: ComponentRef<any>) {
this.applicationRef.detachView(componentRef.hostView);
componentRef.destroy();
}
}

114
src/app/statistic-analysis/all-plan/all-plan.component.ts

@ -12,7 +12,7 @@ import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree'
import { MatPaginator } from '@angular/material/paginator'; import { MatPaginator } from '@angular/material/paginator';
import { FlatTreeControl } from '@angular/cdk/tree'; import { FlatTreeControl } from '@angular/cdk/tree';
import { FormControl } from '@angular/forms'; import { FormControl } from '@angular/forms';
import { Router,ActivatedRoute } from '@angular/router' import { Router, ActivatedRoute } from '@angular/router'
import { PageEvent } from '@angular/material/paginator'; import { PageEvent } from '@angular/material/paginator';
import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
@ -28,102 +28,84 @@ declare var CryptoJS
}) })
export class AllPlanComponent implements OnInit { export class AllPlanComponent implements OnInit {
constructor(private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public route: ActivatedRoute,private router: Router) { } constructor(private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public route: ActivatedRoute, private router: Router) { }
ngOnInit(): void { ngOnInit(): void {
this.route.queryParams.subscribe(params => { this.route.queryParams.subscribe(params => {
this.titlename = params['name']; this.titlename = params['name'];
this.type = params['type']; this.type = params['type'];
this.jsId=params['id'] this.jsId = params['id']
this.tid=params.tid this.tid = params.tid
}); });
this.getAlltabledate() this.getAlltabledate()
} }
tid tid
displayedColumns: string[] = ['unitname','modifiedTime','organizationName','buildingTypes','operation']; displayedColumns: string[] = ['unitname', 'modifiedTime', 'organizationName', 'buildingTypes', 'operation'];
tabledataSource tabledataSource
titlename //上个页面传过来的名称 titlename //上个页面传过来的名称
type //上个页面传过来:1重点单位 2预案 type //上个页面传过来:1重点单位 2预案
jsId //组织机构id jsId //组织机构id
//分页 //分页
@ViewChild(MatPaginator, {static: true}) @ViewChild(MatPaginator, { static: true })
pageEvent: PageEvent; pageEvent: PageEvent;
paginator: MatPaginator; paginator: MatPaginator;
length:any; //共多少条数据 length: any; //共多少条数据
pageSize:any; //每页条数 pageSize: any; //每页条数
pageSizeOptions: number[] = [10] //设置每页条数 pageSizeOptions: number[] = [10] //设置每页条数
PageNumber:any; //第几页 PageNumber: any; //第几页
//分页事件 //分页事件
changePage(e){ changePage(e) {
this.PageNumber = e.pageIndex+1 this.PageNumber = e.pageIndex + 1
this.getAlltabledate() this.getAlltabledate()
} }
//返回 //返回
goBack () { goBack() {
sessionStorage.setItem('refresh', 'true'); sessionStorage.setItem('refresh', 'true');
history.go(-1); history.go(-1);
//this.echartsData.statefulInspectionToggle = true //this.echartsData.statefulInspectionToggle = true
} }
//获得所有预案 //获得所有预案
getAlltabledate(){ getAlltabledate() {
let paramtedate:any={ let paramtedate: any = {
organizationId:this.jsId||'', organizationId: this.jsId || '',
planStatus:this.tid=='pieone'?'': this.type, planStatus: this.tid == 'pieone' ? '' : this.type,
PlanCategory:this.tid=='pieone'?this.type:'', PlanCategory: this.tid == 'pieone' ? this.type : '',
PageNumber: this.PageNumber || '1', PageNumber: this.PageNumber || '1',
PageSize: this.pageSizeOptions[0] PageSize: this.pageSizeOptions[0]
} }
this.http.get(`/api/Plans/Organizations`,{params:paramtedate}).subscribe((data:any)=>{ this.http.get(`/api/Plans/Organizations`, { params: paramtedate }).subscribe((data: any) => {
this.length = data.totalCount this.length = data.totalCount
this.tabledataSource=data.items this.tabledataSource = data.items
//console.log(this.tabledataSource) //console.log(this.tabledataSource)
}) })
} }
//查看详情 //查看详情
lookPlan(e){ lookPlan(e) {
if(e.planType == 16||e.planType == 4||e.planType == 8){ if (e.planType == 16 || e.planType == 4 || e.planType == 8) {
var index=e.attachmentUrls[0].indexOf("\/") var index = e.attachmentUrls[0].indexOf("\/")
if(e.attachmentUrls[0].substr(0,index)=='psw'){ if (e.attachmentUrls[0].substr(0, index) == 'psw') {
const dialogRef = this.dialog.open(PsViewer, { const dialogRef = this.dialog.open(PsViewer, {
width: '1500px', width: '1500px',
height:'800px', height: '800px',
data: e.attachmentUrls[0] data: e.attachmentUrls[0]
}); });
} }
else /* if(e.attachmentUrls[0].substr(e.attachmentUrls[0].length-4,e.attachmentUrls[0].length-1)=='docx'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='pdf' else {
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='doc'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='DOC'
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='txt'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='JPG') */{
let filename:string
let fetchUrl = e.attachmentUrls[0] let fetchUrl = e.attachmentUrls[0]
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl); let suffix = fetchUrl.split('.')[fetchUrl.split('.').length - 1].toLowerCase()
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray); if (suffix == 'docx' || suffix == 'doc') {
let jwt = sessionStorage.getItem("token"); let arr = fetchUrl.split('.')
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); arr[arr.length - 1] = 'pdf'
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
let identityJsonparse=JSON.parse(identityJson) } else if (suffix == 'pdf') {
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data:any)=>{ window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
filename=data.fileName } else {
let json={ let config = new MatSnackBarConfig();
doc: { config.verticalPosition = 'top';
docId: docId, config.duration = 3000
title: filename, this.snackBar.open('该文件类型暂不支持在线查看', '确定', config);
fetchUrl: `http://172.18.0.1:8000/api/Objects/PlanPlatform/`+fetchUrl,
},
user: {
uid: identityJsonparse.sub,
nickName: identityJsonparse.name,
avatar: "",
privilege: [
'FILE_READ','FILE_DOWNLOAD', 'FILE_PRINT'
],
},
} }
var stringjson=JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
})
} }
} }
/* if(e.planType == 4){ /* if(e.planType == 4){
@ -136,18 +118,18 @@ export class AllPlanComponent implements OnInit {
}); });
} }
} */ } */
if(e.planType == 1){ //如果是在线编辑 if (e.planType == 1) { //如果是在线编辑
let id = e.id let id = e.id
sessionStorage.setItem("planId",id) sessionStorage.setItem("planId", id)
sessionStorage.setItem("companyId",e.company.id) sessionStorage.setItem("companyId", e.company.id)
sessionStorage.setItem("buildingTypeId",e.company.buildingTypes[0].id) sessionStorage.setItem("buildingTypeId", e.company.buildingTypes[0].id)
sessionStorage.setItem("editable","0") sessionStorage.setItem("editable", "0")
sessionStorage.setItem("planName",e.name) sessionStorage.setItem("planName", e.name)
let companyId = sessionStorage.getItem("companyId") let companyId = sessionStorage.getItem("companyId")
window.open(`/keyUnit/viewunitinfoplan?id=${companyId}&orName=${this.route.snapshot.queryParams.orName}&orId=${this.route.snapshot.queryParams.orId}`); window.open(`/keyUnit/viewunitinfoplan?id=${companyId}&orName=${this.route.snapshot.queryParams.orName}&orId=${this.route.snapshot.queryParams.orId}`);
} }
if(e.planType == 2){ //如果是跳转网页 if (e.planType == 2) { //如果是跳转网页
sessionStorage.setItem("url",e.url) sessionStorage.setItem("url", e.url)
window.open(`/planManagement/webLook`) window.open(`/planManagement/webLook`)
} }
} }
@ -160,12 +142,12 @@ export class AllPlanComponent implements OnInit {
templateUrl: './Photo-Sphere-Viewer.html', templateUrl: './Photo-Sphere-Viewer.html',
styleUrls: ['./all-plan.component.scss'] styleUrls: ['./all-plan.component.scss']
}) })
export class PsViewer{ export class PsViewer {
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<PsViewer>,@Inject(MAT_DIALOG_DATA) public data: any) {} constructor(private router: Router, private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef<PsViewer>, @Inject(MAT_DIALOG_DATA) public data: any) { }
ngOnInit(): void { ngOnInit(): void {
const viewer = new Viewer({ const viewer = new Viewer({
container: document.querySelector('#viewer'), container: document.querySelector('#viewer'),
panorama:'/api/Objects/PlanPlatform/'+ this.data, panorama: '/api/Objects/PlanPlatform/' + this.data,
}); });
} }

476
src/app/statistic-analysis/home/home.component.ts

@ -2,9 +2,10 @@ import { Component, OnInit, Renderer2, ElementRef } from '@angular/core';
import { HttpClient } from '@angular/common/http' import { HttpClient } from '@angular/common/http'
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { EchartsDataService } from '../echarts-data.service'; import { EchartsDataService } from '../echarts-data.service';
import { MapFactory } from '@src/modules/map/declare/factory';
import { IMap } from '@src/modules/map/declare/map';
declare var echarts: any; declare var echarts: any;
declare var AMap: any;
declare var AMapUI: any;
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
templateUrl: './home.component.html', templateUrl: './home.component.html',
@ -12,32 +13,18 @@ declare var AMapUI: any;
}) })
export class HomeComponent implements OnInit { export class HomeComponent implements OnInit {
constructor(private http:HttpClient, private render2: Renderer2,public element: ElementRef,private router: Router,public emitService: EchartsDataService) { } constructor(private http: HttpClient, private render2: Renderer2, public element: ElementRef, private router: Router, public emitService: EchartsDataService) { }
map:any; //地图 map: IMap; //地图
yuandata yuandata
ngOnInit() { ngOnInit() {
this.level=sessionStorage.getItem("level")
this.getechartsdata() this.getechartsdata()
/* this.emitService.eventEmit.subscribe((value: any) => { window.setTimeout(() => {
if (value == 'echarts') {
setTimeout(() => {
this.updateEcharts()
}, 500);
}
});
window.addEventListener('resize', () => {
setTimeout(() => {
this.updateEcharts()
}, 0);
}) */
window.setTimeout(()=>{
/* this.unitType() /* this.unitType()
this.unitData() this.unitData()
this.keyUnit() */ this.keyUnit() */
this.mapInit() //初始化地图 this.mapInit() //初始化地图
},0) }, 0)
} }
//更新echarts视图 //更新echarts视图
@ -50,44 +37,44 @@ export class HomeComponent implements OnInit {
//获取数据 //获取数据
ordata ordata
buildtableData buildtableData
lengthdata=[]//建筑提示数据 lengthdata = []//建筑提示数据
buildcount=0//建筑总数 buildcount = 0//建筑总数
indexData=[]//建筑所有数据 indexData = []//建筑所有数据
async getechartsdata(){ async getechartsdata() {
let paramsdata:any = { let paramsdata: any = {
OrganizationId:this.orid||'', OrganizationId: this.orid || '',
//organizationId:'1' //organizationId:'1'
} }
//获取组织机构数据 //获取组织机构数据
await this.emitService.getData(paramsdata,`/api/StatisticsAnalysis/Companies`) await this.emitService.getData(paramsdata, `/api/StatisticsAnalysis/Companies`)
this.ordata=JSON.parse(JSON.stringify(this.emitService.allDate)) this.ordata = JSON.parse(JSON.stringify(this.emitService.allDate))
console.log(this.ordata) console.log(this.ordata)
this.keyUnitNum=this.ordata[0].organizationStatistics.totalCount this.keyUnitNum = this.ordata[0].organizationStatistics.totalCount
this.unitData() this.unitData()
//获取预案状态统计数据 //获取预案状态统计数据
await this.emitService.getData(paramsdata,`/api/StatisticsAnalysis/Plans`) await this.emitService.getData(paramsdata, `/api/StatisticsAnalysis/Plans`)
this.unitType() this.unitType()
//获取建筑类型统计数据 //获取建筑类型统计数据
await this.emitService.getData(paramsdata,`/api/StatisticsAnalysis/BuildingTypes`) await this.emitService.getData(paramsdata, `/api/StatisticsAnalysis/BuildingTypes`)
this.keyUnit() this.keyUnit()
} }
threePlan(){ threePlan() {
// this.router.navigate(['/planManagement/entryPlan']) // this.router.navigate(['/planManagement/entryPlan'])
} }
twoPlan(){ twoPlan() {
// this.router.navigate(['/planManagement/entryPlan']) // this.router.navigate(['/planManagement/entryPlan'])
} }
cardPlan(){ cardPlan() {
// this.router.navigate(['/planManagement/entryPlan']) // this.router.navigate(['/planManagement/entryPlan'])
} }
otherPlan(){ otherPlan() {
// this.router.navigate(['/planManagement/entryPlan']) // this.router.navigate(['/planManagement/entryPlan'])
} }
//计划更新页面跳转 //计划更新页面跳转
scheduled(){ scheduled() {
this.router.navigate(['/statisticanalysis/scheduledUpdates']) this.router.navigate(['/statisticanalysis/scheduledUpdates'])
} }
@ -101,232 +88,38 @@ export class HomeComponent implements OnInit {
} }
//初始化地图 //初始化地图
adcode:any //行政编码 adcode: any //行政编码
level//组织级别 level = sessionStorage.getItem("level")//组织级别
orid orid
mapInit () {
//创建地图
this.map = new AMap.Map('chartMap', {
cursor: 'default',
zooms:[8,16],
mapStyle:"amap://styles/grey",
// bubble: true
});
let colors = [
"#3366cc", "#dc3912", "#ff9900", "#109618", "#990099", "#0099c6", "#dd4477", "#66aa00",
"#b82e2e", "#316395", "#994499", "#22aa99", "#aaaa11", "#6633cc", "#e67300", "#8b0707",
"#651067", "#329262", "#5574a6", "#3b3eac"
];
AMapUI.loadUI(['geo/DistrictExplorer'], (DistrictExplorer)=> {
//创建一个实例 //封装Gaode
let districtExplorer = new DistrictExplorer({ getEchartsData(data) {
map: this.map, return new Promise((resolve, reject) => {
eventSupport: true, //打开事件支持 let paramsdata: any = {
}); name: data.properties.name,
level: Number(this.level) + 1
// let adcode = this.adcode; //行政编码
let adcode
if(sessionStorage.getItem("realName") == "上海总队"){
adcode = 310000
}else{
adcode = 310000
} }
this.http.get("/api/Organizations/GetIdByName", { params: paramsdata }).subscribe((data: any) => {
districtExplorer.loadAreaNode(adcode, (error, areaNode)=> { this.orid = data[0]
//更新地图视野
this.map.setBounds(areaNode.getBounds(), null, null, true);
//设置定位节点,支持鼠标位置识别
//注意节点的顺序,前面的高优先级
districtExplorer.setAreaNodesForLocating(areaNode);
//清除已有的绘制内容
districtExplorer.clearFeaturePolygons();
//绘制子区域
districtExplorer.renderSubFeatures(areaNode, (feature, i) =>{
// console.log(123,feature,i)
let fillColor = colors[i % colors.length];
let strokeColor = colors[colors.length - 1 - i % colors.length];
return {
cursor: 'default',
bubble: true,
strokeColor: strokeColor, //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线宽
fillColor: fillColor, //填充色
fillOpacity: 0.5, //填充透明度
};
});
//绘制父区域
districtExplorer.renderParentFeature(areaNode, {
cursor: 'default',
bubble: true,
strokeColor: 'black', //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线宽
fillColor: null, //填充色
fillOpacity: 0.5, //填充透明度
});
// 更新地图视野以适合区划面
this.map.setFitView(districtExplorer.getAllFeaturePolygons());
});
if(this.level=="0"||this.level=="1"||this.level=="2"){
//区域内点击
districtExplorer.on('featureClick', (e, feature) =>{
//console.log(feature)
let paramsdata:any ={
name:feature.properties.name,
level:Number(this.level)+1
}
this.http.get("/api/Organizations/GetIdByName",{params:paramsdata}).subscribe((data:any)=>{
console.log(data)
this.orid=data[0]
this.getechartsdata() this.getechartsdata()
resolve('success')
}) })
let props = feature.properties;
adcode = props.adcode
let fillColor2
if(props.level == 'city'){
fillColor2 = null
}else{
fillColor2 = '#d0daee'
}
districtExplorer.loadAreaNode(adcode, (error, areaNode)=> {
//更新地图视野
// this.map.setBounds(areaNode.getBounds(), null, null, true);
//设置定位节点,支持鼠标位置识别
//注意节点的顺序,前面的高优先级
districtExplorer.setAreaNodesForLocating(areaNode);
//清除已有的绘制内容
districtExplorer.clearFeaturePolygons();
//绘制子区域
districtExplorer.renderSubFeatures(areaNode, (feature, i) =>{
let fillColor = colors[i % colors.length];
// console.log(111,fillColor)
let strokeColor = colors[colors.length - 1 - i % colors.length];
return {
cursor: 'default',
bubble: true,
strokeColor: strokeColor, //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线宽
fillColor: fillColor, //填充色
fillOpacity: 0.5, //填充透明度
};
});
//绘制父区域
districtExplorer.renderParentFeature(areaNode, {
cursor: 'default',
bubble: true,
strokeColor: 'black', //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线宽
fillColor: fillColor2, //填充色
fillOpacity: 0.5, //填充透明度
});
// 更新地图视野以适合区划面
this.map.setFitView(districtExplorer.getAllFeaturePolygons());
});
//this.planState.setOption(this.planStateOptionsZhong);
//this.chartDwsjcj.setOption(this.chartDwsjcjOptionsZhong);
//this.chartZdgzqy.setOption(this.chartZdgzqyOptionsZhong);
/* this.planNum = ["0","0","3","1","6","5"]
this.keyUnitNum = 666 */
//this.dataGetNum = 456
/* this.threePlanNum = "867"
this.twoPlanNum = "485"
this.cardPlanNum = "756"
this.otherPlanNum = "658" */
});
districtExplorer.on('outsideClick', (e) => {
this.orid=''
this.getechartsdata()
// console.log('区域外点击');
let adcode
if(sessionStorage.getItem("realName") == "上海总队"){
adcode = 310000
}else{
adcode = 310000
}
districtExplorer.loadAreaNode(adcode, (error, areaNode)=> {
//更新地图视野
// this.map.setBounds(areaNode.getBounds(), null, null, true);
//设置定位节点,支持鼠标位置识别
//注意节点的顺序,前面的高优先级
districtExplorer.setAreaNodesForLocating(areaNode);
//清除已有的绘制内容
districtExplorer.clearFeaturePolygons();
//绘制子区域
districtExplorer.renderSubFeatures(areaNode, (feature, i) =>{
let fillColor = colors[i % colors.length];
// console.log(111,fillColor)
let strokeColor = colors[colors.length - 1 - i % colors.length];
return {
cursor: 'default',
bubble: true,
strokeColor: strokeColor, //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线宽
fillColor: fillColor, //填充色
fillOpacity: 0.5, //填充透明度
};
});
//绘制父区域
districtExplorer.renderParentFeature(areaNode, {
cursor: 'default',
bubble: true,
strokeColor: 'black', //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线宽
fillColor: null, //填充色
fillOpacity: 0.5, //填充透明度
});
// 更新地图视野以适合区划面
this.map.setFitView(districtExplorer.getAllFeaturePolygons());
});
/* this.planState.setOption(this.planStateOptionsZhi);
this.chartDwsjcj.setOption(this.chartDwsjcjOptionsZhi);
this.chartZdgzqy.setOption(this.chartZdgzqyOptionsZhi); */
/* this.planNum = ["0","2","2","6","7","8"]
this.keyUnitNum = 8036
this.dataGetNum = 6578 */
/* this.threePlanNum = "4374"
this.twoPlanNum = "9693"
this.cardPlanNum = "6403"
this.otherPlanNum = "2208" */
}) })
} }
setEchartsData() {
this.orid = ''
this.getechartsdata()
}
//封装Gaode
mapInit() {
//创建地图
this.map = MapFactory.MapInstance('chartMap', {
cursor: 'default',
zooms: [8, 16],
mapStyle: "amap://styles/grey",
}); });
this.map.setAdministrativeAreaStyle(this, this.getEchartsData, this.setEchartsData)
} }
planNum = [] planNum = []
keyUnitNum keyUnitNum
@ -337,7 +130,6 @@ export class HomeComponent implements OnInit {
cardPlanNum = "0" cardPlanNum = "0"
otherPlanNum = "0" otherPlanNum = "0"
aPlan = '0' aPlan = '0'
bPlan = '0' bPlan = '0'
cPlan = '0' cPlan = '0'
@ -352,51 +144,51 @@ export class HomeComponent implements OnInit {
//预案状态统计 //预案状态统计
pagedata pagedata
pagedataCount pagedataCount
unitType () { unitType() {
this.planNum=[] this.planNum = []
this.pagedata=JSON.parse(JSON.stringify(this.emitService.allDate)) this.pagedata = JSON.parse(JSON.stringify(this.emitService.allDate))
console.log(this.pagedata) console.log(this.pagedata)
this.pagedataCount=String(this.pagedata[0].planStatusStatistics.totalCount) this.pagedataCount = String(this.pagedata[0].planStatusStatistics.totalCount)
for(var i=0;i<this.pagedataCount.length;i++){ for (var i = 0; i < this.pagedataCount.length; i++) {
this.planNum.push(this.pagedataCount[i]) this.planNum.push(this.pagedataCount[i])
} }
//this.planNum.push(this.pagedataCount.split(',')) //this.planNum.push(this.pagedataCount.split(','))
if(this.pagedata[0].planTypeStatistics.planTypes.length<=0){ if (this.pagedata[0].planTypeStatistics.planTypes.length <= 0) {
this.threePlanNum='0' this.threePlanNum = '0'
this.twoPlanNum='0' this.twoPlanNum = '0'
this.cardPlanNum='0' this.cardPlanNum = '0'
this.otherPlanNum='0' this.otherPlanNum = '0'
}else{ } else {
this.pagedata[0].planTypeStatistics.planTypes.forEach((value,index,array) => { this.pagedata[0].planTypeStatistics.planTypes.forEach((value, index, array) => {
if(array[index].planTypeName=='Plan2D'){ if (array[index].planTypeName == 'Plan2D') {
this.twoPlanNum=array[index].count this.twoPlanNum = array[index].count
}else if(array[index].planTypeName=='Plan3D'){ } else if (array[index].planTypeName == 'Plan3D') {
this.threePlanNum=array[index].count this.threePlanNum = array[index].count
}else if(array[index].planTypeName=='Other'){ } else if (array[index].planTypeName == 'Other') {
this.otherPlanNum=array[index].count this.otherPlanNum = array[index].count
}else if(array[index].planTypeName=='PlanText'){ } else if (array[index].planTypeName == 'PlanText') {
this.cardPlanNum=array[index].count this.cardPlanNum = array[index].count
} }
}); });
} }
if(this.pagedata[0].planCategoryStatistics.planCategories.length<=0){ if (this.pagedata[0].planCategoryStatistics.planCategories.length <= 0) {
this.aPlan='0' this.aPlan = '0'
this.bPlan='0' this.bPlan = '0'
this.cPlan='0' this.cPlan = '0'
this.dPlan='0' this.dPlan = '0'
this.ePlan='0' this.ePlan = '0'
}else{ } else {
this.pagedata[0].planCategoryStatistics.planCategories.forEach((value,index,array) => { this.pagedata[0].planCategoryStatistics.planCategories.forEach((value, index, array) => {
if(array[index].planCategoryName=='LevelOne'){ if (array[index].planCategoryName == 'LevelOne') {
this.aPlan=array[index].count this.aPlan = array[index].count
}else if(array[index].planCategoryName=='LevelTwo'){ } else if (array[index].planCategoryName == 'LevelTwo') {
this.bPlan=array[index].count this.bPlan = array[index].count
}else if(array[index].planCategoryName=='LevelThree'){ } else if (array[index].planCategoryName == 'LevelThree') {
this.cPlan=array[index].count this.cPlan = array[index].count
}else if(array[index].planCategoryName=='LevelFour'){ } else if (array[index].planCategoryName == 'LevelFour') {
this.dPlan=array[index].count this.dPlan = array[index].count
}else if(array[index].planCategoryName=='LevelFive'){ } else if (array[index].planCategoryName == 'LevelFive') {
this.ePlan=array[index].count this.ePlan = array[index].count
} }
}); });
} }
@ -407,9 +199,9 @@ export class HomeComponent implements OnInit {
title: { title: {
text: `预案状态统计(${this.pagedata[0].planStatusStatistics.totalCount}份)`, text: `预案状态统计(${this.pagedata[0].planStatusStatistics.totalCount}份)`,
left: 'left', left: 'left',
textStyle:{ textStyle: {
color:'#fff', color: '#fff',
fontWeight:'normal' fontWeight: 'normal'
} }
}, },
tooltip: { tooltip: {
@ -422,10 +214,10 @@ export class HomeComponent implements OnInit {
type: 'pie', type: 'pie',
radius: '60%', radius: '60%',
center: ['50%', '58%'], center: ['50%', '58%'],
label:{ label: {
show:true, show: true,
//fontSize:10, //fontSize:10,
formatter:'{b}\n{d|{c}份}', formatter: '{b}\n{d|{c}份}',
rich: { rich: {
d: { d: {
align: 'center', align: 'center',
@ -434,11 +226,11 @@ export class HomeComponent implements OnInit {
}, },
data: [ data: [
{value:this.pagedata[0].planStatusStatistics.planStatuses[0]!=undefined? this.pagedata[0].planStatusStatistics.planStatuses[0].count:0, name: '预案新增',type:1,planStatusName:this.pagedata[0].planStatusStatistics.planStatuses[0]!=undefined?this.pagedata[0].planStatusStatistics.planStatuses[0].planStatusName:''}, { value: this.pagedata[0].planStatusStatistics.planStatuses[0] != undefined ? this.pagedata[0].planStatusStatistics.planStatuses[0].count : 0, name: '预案新增', type: 1, planStatusName: this.pagedata[0].planStatusStatistics.planStatuses[0] != undefined ? this.pagedata[0].planStatusStatistics.planStatuses[0].planStatusName : '' },
{value:this.pagedata[0].planStatusStatistics.planStatuses[2]!=undefined? this.pagedata[0].planStatusStatistics.planStatuses[2].count:0, name: '预案审核通过',type:3,planStatusName:this.pagedata[0].planStatusStatistics.planStatuses[2]!=undefined? this.pagedata[0].planStatusStatistics.planStatuses[2].planStatusName:''}, { value: this.pagedata[0].planStatusStatistics.planStatuses[2] != undefined ? this.pagedata[0].planStatusStatistics.planStatuses[2].count : 0, name: '预案审核通过', type: 3, planStatusName: this.pagedata[0].planStatusStatistics.planStatuses[2] != undefined ? this.pagedata[0].planStatusStatistics.planStatuses[2].planStatusName : '' },
{value:this.pagedata[0].planStatusStatistics.planStatuses[4]!=undefined? this.pagedata[0].planStatusStatistics.planStatuses[4].count:0, name: '预案编制',type:5,planStatusName:this.pagedata[0].planStatusStatistics.planStatuses[4]!=undefined?this.pagedata[0].planStatusStatistics.planStatuses[4].planStatusName:''}, { value: this.pagedata[0].planStatusStatistics.planStatuses[4] != undefined ? this.pagedata[0].planStatusStatistics.planStatuses[4].count : 0, name: '预案编制', type: 5, planStatusName: this.pagedata[0].planStatusStatistics.planStatuses[4] != undefined ? this.pagedata[0].planStatusStatistics.planStatuses[4].planStatusName : '' },
{value:this.pagedata[0].planStatusStatistics.planStatuses[3]!=undefined? this.pagedata[0].planStatusStatistics.planStatuses[3].count:0, name: '预案审核退回',type:4,planStatusName:this.pagedata[0].planStatusStatistics.planStatuses[3]!=undefined? this.pagedata[0].planStatusStatistics.planStatuses[3].planStatusName:''}, { value: this.pagedata[0].planStatusStatistics.planStatuses[3] != undefined ? this.pagedata[0].planStatusStatistics.planStatuses[3].count : 0, name: '预案审核退回', type: 4, planStatusName: this.pagedata[0].planStatusStatistics.planStatuses[3] != undefined ? this.pagedata[0].planStatusStatistics.planStatuses[3].planStatusName : '' },
{value:this.pagedata[0].planStatusStatistics.planStatuses[1]!=undefined? this.pagedata[0].planStatusStatistics.planStatuses[1].count:0, name: '预案审核中',type:2,planStatusName:this.pagedata[0].planStatusStatistics.planStatuses[1]!=undefined? this.pagedata[0].planStatusStatistics.planStatuses[1].planStatusName:''} { value: this.pagedata[0].planStatusStatistics.planStatuses[1] != undefined ? this.pagedata[0].planStatusStatistics.planStatuses[1].count : 0, name: '预案审核中', type: 2, planStatusName: this.pagedata[0].planStatusStatistics.planStatuses[1] != undefined ? this.pagedata[0].planStatusStatistics.planStatuses[1].planStatusName : '' }
], ],
emphasis: { emphasis: {
itemStyle: { itemStyle: {
@ -452,7 +244,7 @@ export class HomeComponent implements OnInit {
}; };
this.planState = echarts.init(document.getElementById('chartHynyxf'), 'walden'); this.planState = echarts.init(document.getElementById('chartHynyxf'), 'walden');
this.planState.setOption(planStateOptionsZhi); this.planState.setOption(planStateOptionsZhi);
this.planState.on("click",(params) => { this.planState.on("click", (params) => {
this.router.navigate(['/statisticanalysis/statePageOne']) this.router.navigate(['/statisticanalysis/statePageOne'])
}) })
} }
@ -460,8 +252,8 @@ export class HomeComponent implements OnInit {
//新增、删除单位统计 //新增、删除单位统计
chartDwsjcj chartDwsjcj
addtable addtable
addxdata=[] addxdata = []
addydata=[] addydata = []
chartDwsjcjOptionsZhong = { chartDwsjcjOptionsZhong = {
// color: ['#FB33C2', '#00CFF0', '#2C3DE0'], // color: ['#FB33C2', '#00CFF0', '#2C3DE0'],
// 标题 // 标题
@ -469,9 +261,9 @@ export class HomeComponent implements OnInit {
text: '新增、删除单位统计', text: '新增、删除单位统计',
left: 0, left: 0,
top: 0, top: 0,
textStyle:{ textStyle: {
color:'#fff', color: '#fff',
fontWeight:'normal' fontWeight: 'normal'
}, },
}, },
grid: { grid: {
@ -481,7 +273,7 @@ export class HomeComponent implements OnInit {
//图例 //图例
legend: { legend: {
top: 0, top: 0,
data: ['新增单位', '删除单位', ], data: ['新增单位', '删除单位',],
icon: 'circle', icon: 'circle',
itemGap: 20, itemGap: 20,
}, },
@ -492,11 +284,11 @@ export class HomeComponent implements OnInit {
// x轴 // x轴
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ["浦东中队","黄浦中队","徐汇中队","长宁中队","静安中队","普陀中队","虹口中队","杨浦中队","闵行中队","宝山中队","嘉定中队","松江中队","金山中队","崇明中队"], data: ["浦东中队", "黄浦中队", "徐汇中队", "长宁中队", "静安中队", "普陀中队", "虹口中队", "杨浦中队", "闵行中队", "宝山中队", "嘉定中队", "松江中队", "金山中队", "崇明中队"],
axisLabel: { axisLabel: {
interval: 0, interval: 0,
formatter:function(value){ formatter: function (value) {
var ret = "";//拼接加\n返回的类目项 var ret = "";//拼接加\n返回的类目项
var maxLength = 5;//每项显示文字个数 var maxLength = 5;//每项显示文字个数
var valLength = value.length;//X轴类目项的文字个数 var valLength = value.length;//X轴类目项的文字个数
@ -511,7 +303,7 @@ export class HomeComponent implements OnInit {
ret += temp; ret += temp;
} //凭借最终的字符串 } //凭借最终的字符串
return ret; return ret;
}else { } else {
return value; return value;
} }
} //function } //function
@ -553,11 +345,11 @@ export class HomeComponent implements OnInit {
} }
], ],
}; };
unitData () { unitData() {
this.addxdata=[] this.addxdata = []
this.addydata=[] this.addydata = []
this.addtable=JSON.parse(JSON.stringify(this.emitService.allDate)) this.addtable = JSON.parse(JSON.stringify(this.emitService.allDate))
this.addtable[0].organizationStatistics.organizations.forEach((value,index,array) => { this.addtable[0].organizationStatistics.organizations.forEach((value, index, array) => {
this.addxdata.push(array[index].organizationName) this.addxdata.push(array[index].organizationName)
this.addydata.push(array[index].count) this.addydata.push(array[index].count)
}); });
@ -567,16 +359,16 @@ export class HomeComponent implements OnInit {
text: `新增单位统计(${this.addtable[0].totalCount}家)`, text: `新增单位统计(${this.addtable[0].totalCount}家)`,
left: 0, left: 0,
top: 0, top: 0,
textStyle:{ textStyle: {
color:'#fff', color: '#fff',
fontWeight:'normal' fontWeight: 'normal'
}, },
}, },
grid: { grid: {
//containLabel:true, //containLabel:true,
left: 30, left: 30,
right: 0, right: 0,
bottom:30 bottom: 30
}, },
//图例 //图例
/* legend: { /* legend: {
@ -596,7 +388,7 @@ export class HomeComponent implements OnInit {
axisLabel: { axisLabel: {
interval: 0, interval: 0,
formatter:function(value){ formatter: function (value) {
var ret = "";//拼接加\n返回的类目项 var ret = "";//拼接加\n返回的类目项
var maxLength = 5;//每项显示文字个数 var maxLength = 5;//每项显示文字个数
var valLength = value.length;//X轴类目项的文字个数 var valLength = value.length;//X轴类目项的文字个数
@ -611,7 +403,7 @@ export class HomeComponent implements OnInit {
ret += temp; ret += temp;
} //凭借最终的字符串 } //凭借最终的字符串
return ret; return ret;
}else { } else {
return value; return value;
} }
} //function } //function
@ -640,7 +432,7 @@ export class HomeComponent implements OnInit {
formatter: '{c}', formatter: '{c}',
color: "#fff", color: "#fff",
}, },
barMaxWidth:'20%' barMaxWidth: '20%'
} }
/* , { /* , {
name: '删除单位', name: '删除单位',
@ -655,9 +447,9 @@ export class HomeComponent implements OnInit {
} */ } */
], ],
}; };
this.chartDwsjcj = echarts.init(document.getElementById('chartDwsjcj'),'walden'); this.chartDwsjcj = echarts.init(document.getElementById('chartDwsjcj'), 'walden');
this.chartDwsjcj.setOption(chartDwsjcjOptionsZhi); this.chartDwsjcj.setOption(chartDwsjcjOptionsZhi);
this.chartDwsjcj.on("click",(params) => { this.chartDwsjcj.on("click", (params) => {
this.router.navigate(['/statisticanalysis/addUnit_one']) this.router.navigate(['/statisticanalysis/addUnit_one'])
}) })
} }
@ -666,25 +458,25 @@ export class HomeComponent implements OnInit {
//建筑类型统计 //建筑类型统计
keyUnit () { keyUnit() {
this.buildcount=0 this.buildcount = 0
this.buildtableData=JSON.parse(JSON.stringify(this.emitService.allDate)) this.buildtableData = JSON.parse(JSON.stringify(this.emitService.allDate))
//console.log(this.buildtableData) //console.log(this.buildtableData)
for(var i=0;i<this.buildtableData[0].buildingTypes.length;i++){ for (var i = 0; i < this.buildtableData[0].buildingTypes.length; i++) {
this.lengthdata.push(this.buildtableData[0].buildingTypes[i].buildingTypeName) this.lengthdata.push(this.buildtableData[0].buildingTypes[i].buildingTypeName)
this.buildcount=this.buildcount+this.buildtableData[0].buildingTypes[i].count this.buildcount = this.buildcount + this.buildtableData[0].buildingTypes[i].count
this.indexData.push(this.buildtableData[0].buildingTypes[i]) this.indexData.push(this.buildtableData[0].buildingTypes[i])
} }
//JSON.parse(JSON.stringify(this.indexData).replace(/buildingTypeName/g, 'name')) //JSON.parse(JSON.stringify(this.indexData).replace(/buildingTypeName/g, 'name'))
this.indexData=this.indexData.map(v=>{return {name: v.buildingTypeName,value:v.count,id:v.buildingTypeId}}) this.indexData = this.indexData.map(v => { return { name: v.buildingTypeName, value: v.count, id: v.buildingTypeId } })
let chartZdgzqyOptionsZhi = { let chartZdgzqyOptionsZhi = {
title: { title: {
text: `建筑类型统计(${this.buildcount}家)`, text: `建筑类型统计(${this.buildcount}家)`,
top: -5, top: -5,
left: 'left', left: 'left',
textStyle:{ textStyle: {
color:'#fff', color: '#fff',
fontWeight:'normal' fontWeight: 'normal'
} }
}, },
tooltip: { tooltip: {
@ -703,10 +495,10 @@ export class HomeComponent implements OnInit {
type: 'pie', type: 'pie',
radius: '70%', radius: '70%',
center: ['50%', '61%'], center: ['50%', '61%'],
label:{ label: {
show:true, show: true,
// fontSize:13, // fontSize:13,
formatter:'{b}{c}家', formatter: '{b}{c}家',
rich: { rich: {
d: { d: {
align: 'center', align: 'center',
@ -726,13 +518,13 @@ export class HomeComponent implements OnInit {
}; };
this.chartZdgzqy = echarts.init(document.getElementById('chartZdgzqy'), 'walden'); this.chartZdgzqy = echarts.init(document.getElementById('chartZdgzqy'), 'walden');
this.chartZdgzqy.setOption(chartZdgzqyOptionsZhi); this.chartZdgzqy.setOption(chartZdgzqyOptionsZhi);
this.chartZdgzqy.on("click",(params) => { this.chartZdgzqy.on("click", (params) => {
this.router.navigate(['/statisticanalysis/buildingType_one']) this.router.navigate(['/statisticanalysis/buildingType_one'])
}) })
} }
isNumList:boolean = true isNumList: boolean = true
changeNumList(){ changeNumList() {
this.isNumList = !this.isNumList this.isNumList = !this.isNumList
} }
} }

46
src/app/statistic-analysis/plan-analysis-by-synthesis/plan-analysis-by-synthesis.component.ts

@ -353,39 +353,21 @@ export class PlanAnalysisBySynthesisComponent implements OnInit {
data: e.attachmentUrls[0] data: e.attachmentUrls[0]
}); });
} }
else /* if(e.attachmentUrls[0].substr(e.attachmentUrls[0].length-4,e.attachmentUrls[0].length-1)=='docx'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='pdf' else {
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='doc'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='DOC'
||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='txt'||e.attachmentUrls[0].substr(e.attachmentUrls[0].length-3,e.attachmentUrls[0].length)=='JPG') */ {
let filename: string
let fetchUrl = e.attachmentUrls[0] let fetchUrl = e.attachmentUrls[0]
let docIdWordArray = CryptoJS.enc.Utf8.parse(`PlanPlatform/` + fetchUrl); let suffix = fetchUrl.split('.')[fetchUrl.split('.').length - 1].toLowerCase()
let docId = CryptoJS.enc.Base64.stringify(docIdWordArray); if (suffix == 'docx' || suffix == 'doc') {
let jwt = sessionStorage.getItem("token"); let arr = fetchUrl.split('.')
let rawJwt = CryptoJS.enc.Base64.parse(jwt.split('.')[1]); arr[arr.length - 1] = 'pdf'
let identityJson = CryptoJS.enc.Utf8.stringify(rawJwt); window.open(`/api/Objects/PlanPlatform/` + arr.join('.'))
let identityJsonparse = JSON.parse(identityJson) } else if (suffix == 'pdf') {
this.http.get(`/api/ObjectMetadata/PlanPlatform/${fetchUrl}`).subscribe((data: any) => { window.open(`/api/Objects/PlanPlatform/` + fetchUrl)
filename = data.fileName } else {
let json = { let config = new MatSnackBarConfig();
doc: { config.verticalPosition = 'top';
docId: docId, config.duration = 3000
title: filename, this.snackBar.open('该文件类型暂不支持在线查看', '确定', config);
fetchUrl: `http://172.18.0.1:8000/api/Objects/PlanPlatform/` + fetchUrl, }
},
user: {
uid: identityJsonparse.sub,
nickName: identityJsonparse.name,
avatar: "",
privilege: [
'FILE_READ', 'FILE_DOWNLOAD', 'FILE_PRINT'
],
},
}
var stringjson = JSON.stringify(json)
var wordArray = CryptoJS.enc.Utf8.parse(stringjson);
var base64 = CryptoJS.enc.Base64.stringify(wordArray);
window.open(`http://10.81.73.39:18080/apps/editor/openPreview?data=${base64}`)
})
} }
} }

39
src/app/tabbar/tabbar.component.html

@ -134,7 +134,6 @@
<p *ngIf="!isUpdates" style="font-size: 16px;position: absolute; right: 233px;">欢迎您, {{realName}}</p> <p *ngIf="!isUpdates" style="font-size: 16px;position: absolute; right: 233px;">欢迎您, {{realName}}</p>
<div class="scoringRule" *ngIf="companyIntegrityScore"> <div class="scoringRule" *ngIf="companyIntegrityScore">
<span class="name" (click)="scoringRule()"> <span class="name" (click)="scoringRule()">
信息完整度规则 信息完整度规则
@ -158,60 +157,62 @@
<td>规则说明</td> <td>规则说明</td>
</tr> </tr>
<tr> <tr>
<td>单位名称</td> <td>单位信息</td>
<td class="bulecolor">5%</td> <td class="bulecolor">5%</td>
<td>按填录入内容评判</td> <td>填写项平分该项占比分值,信息填写完整即可</td>
</tr> </tr>
<tr> <tr>
<td>建筑信息</td> <td>建筑信息</td>
<td class="bulecolor">10%</td> <td class="bulecolor">10%</td>
<td>根据创建的建筑个数平分该分值,每个建筑根据实际填写的完整度再进行评判</td> <td>根据创建的建筑个数平分该分值,每个建筑根据实际填写的完整度再进行评判</td>
</tr> </tr>
<tr>
<td>平面图</td>
<td class="bulecolor">10%</td>
<td>总平面图<span class="bulecolor">1</span>张,层平面图<span class="bulecolor">1</span></td>
</tr>
<tr> <tr>
<td>四周毗邻</td> <td>四周毗邻</td>
<td class="bulecolor">10%</td> <td class="bulecolor">10%</td>
<td><span class="bulecolor">4</span>个方向均分,每个方向的属性信息要填写完整才能得分</td> <td><span class="bulecolor">4</span>个方向均分,每个方向的属性信息要填写完整,并且包含图片</td>
</tr> </tr>
<tr> <tr>
<td>消防设施</td> <td>消防设施</td>
<td class="bulecolor">25%</td> <td class="bulecolor">25%</td>
<td>消防水源占<span class="bulecolor">30%</span> &nbsp;&nbsp;&nbsp; 安全疏散占<span <td>消防水源占<span class="bulecolor">30%</span> &nbsp;&nbsp;安全疏散设施/消防泡沫系统/安全疏散模块占<span
class="bulecolor">30%</span> <br> 消防水系统占<span class="bulecolor">30%</span> class="bulecolor">30%</span> <br> 消防水系统/自动消防设施/消防设施/消防灭火给水系统/消火栓系统模块占<span
class="bulecolor">30%</span>
&nbsp;&nbsp;&nbsp; 内部消防力量占<span class="bulecolor">10%</span></td> &nbsp;&nbsp;&nbsp; 内部消防力量占<span class="bulecolor">10%</span></td>
</tr> </tr>
<tr> <tr>
<td>重点部位</td> <td>重点部位</td>
<td class="bulecolor">10%</td> <td class="bulecolor">10%</td>
<td><span>根据耐火等级做区分</span>:一级:添加<span class="bulecolor">3</span>个重点部位(1个50%,2个80%,3个满分)<span <td>层平面图中重点部位数量大于1个,并且属性信息填写完整(包含图片)</td>
class="bulecolor">二级</span>:添加<span class="bulecolor">2</span>个重点部位(一个占50%)<span
class="bulecolor">三级</span> 添加<span class="bulecolor">1</span>个重点部位 其它:填写重点提示自动满分</td>
</tr> </tr>
<tr> <tr>
<td>功能分区</td> <td>功能分区</td>
<td class="bulecolor">10%</td> <td class="bulecolor">10%</td>
<td>创建<span class="bulecolor">2</span>条并填写完整得满分</td> <td>任意建筑下功能分区信息填写两条以上并且信息填写完整</td>
</tr> </tr>
<tr> <tr>
<td>实景图</td> <td>实景图</td>
<td class="bulecolor">10%</td> <td class="bulecolor">10%</td>
<td>外观,保证有<span class="bulecolor">2</span>张照片(占<span class="bulecolor">30%</span>); 重点部位,保证有<span <td>外观,保证有<span class="bulecolor">2</span>张照片(占<span class="bulecolor">30%</span>);
class="bulecolor">2</span>张照片(占<span class="bulecolor">30%</span>);安全出口,保证有<span 重点部位,保证有<span class="bulecolor">2</span>张照片(占<span
class="bulecolor">2</span>张照片(占<span class="bulecolor">40%</span></td> class="bulecolor">30%</span>);安全出口,保证有<span class="bulecolor">2</span>张照片(占<span
class="bulecolor">40%</span></td>
</tr> </tr>
<tr> <tr>
<td>CAD上传</td> <td>CAD上传</td>
<td class="bulecolor">10%</td> <td class="bulecolor">10%</td>
<td>上传<span class="bulecolor">2</span>个cad文件</td> <td>保证至少有<span class="bulecolor">1</span>个文件,格式不限</td>
</tr>
<tr>
<td>平面图</td>
<td class="bulecolor">10%</td>
<td>总平面图<span class="bulecolor">1</span>张,建筑平面图<span class="bulecolor">1</span></td>
</tr> </tr>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
<div class="isUpdates" *ngIf="isUpdates"> <div class="isUpdates" *ngIf="isUpdates">
<span class="name" (click)="submitAudit()" <span class="name" (click)="submitAudit()"
*ngIf="!contentVerify || contentVerify.verifyState == 5 || contentVerify.verifyState == 4">提交审核</span> *ngIf="!contentVerify || contentVerify.verifyState == 5 || contentVerify.verifyState == 4">提交审核</span>

8
src/app/tabbar/tabbar.component.ts

@ -76,11 +76,9 @@ export class TabbarComponent implements OnInit {
} }
//根据usci获取当前单位的分数信息 //根据usci获取当前单位的分数信息
getIntegrityScore(){ getIntegrityScore(){
let params:any = { let unitId = sessionStorage.getItem('companyId')
USCI : this.route.snapshot.queryParams.usci this.http.get(`/api/Companies/${unitId}`).subscribe((data:any) => {
} this.companyIntegrityScore = data.companyIntegrityScore
this.http.get('/api/Companies',{params:params}).subscribe((data:any) => {
this.companyIntegrityScore = data.items[0].companyIntegrityScore
}) })
} }
isSpinner:boolean = false//下载帮助文档进度 isSpinner:boolean = false//下载帮助文档进度

4
src/app/ui/collection-tools-plan/addPlaneFigure.html

@ -12,9 +12,9 @@
</mat-form-field> </mat-form-field>
</div> </div>
<!-- <div class="keyMargin"> <div class="keyMargin">
<a href="javascript:;" class="uploadBackGround" (click)='toGIS()' [ngClass]="{'uploadBackGroundSelected': selectedType == 'gis'}">导入GIS地图</a> <a href="javascript:;" class="uploadBackGround" (click)='toGIS()' [ngClass]="{'uploadBackGroundSelected': selectedType == 'gis'}">导入GIS地图</a>
</div> --> </div>
<div class="keyMargin"> <div class="keyMargin">
<a href="javascript:;" class="uploadBackGround" [ngClass]="{'uploadBackGroundSelected': selectedType == 'image'}"> <a href="javascript:;" class="uploadBackGround" [ngClass]="{'uploadBackGroundSelected': selectedType == 'image'}">

611
src/app/ui/collection-tools-plan/collection-tools.component.ts

@ -17,8 +17,11 @@ import { TabbarAndScoreService } from 'src/app/http-interceptors/tabbar-and-scor
import { MaskLayerService } from 'src/app/mask-layer.service'; import { MaskLayerService } from 'src/app/mask-layer.service';
import * as ObjectID from 'bson-objectid'; import * as ObjectID from 'bson-objectid';
import { AxMessageSystem } from 'src/app/working-area/model/axMessageSystem'; import { AxMessageSystem } from 'src/app/working-area/model/axMessageSystem';
import { MapFactory } from 'src/modules/map/declare/factory';
import { IMap, IMarker, IMarkOptions } from 'src/modules/map/declare/map';
declare var AMap: any declare var AMap: any
declare var html2canvas: any; declare var html2canvas: any;
declare global { declare global {
interface Window { interface Window {
deleteMarker: any; deleteMarker: any;
@ -86,7 +89,7 @@ export class CollectionToolsPlanComponent implements OnInit {
gallery//viewerJs实例 gallery//viewerJs实例
//设置属性框 //设置属性框
setAssetsProperty(obj) { setAssetsProperty(obj) {
// console.log('传进来的属性信息', obj) console.log('传进来的属性信息', obj)
//初始化viewerJs实例 //初始化viewerJs实例
setTimeout(() => { setTimeout(() => {
obj.PropertyInfos.forEach(item => { obj.PropertyInfos.forEach(item => {
@ -165,11 +168,7 @@ export class CollectionToolsPlanComponent implements OnInit {
resetZoom() { resetZoom() {
this.canvas.resetCamera2D() this.canvas.resetCamera2D()
} }
//放大图标
iconScale() {
let number = Number(this.selected)
this.canvas.setIconScale(number)
}
//消防要素div边框高度调节 //消防要素div边框高度调节
firecategoriesDivMouseDown(e) { firecategoriesDivMouseDown(e) {
@ -189,6 +188,7 @@ export class CollectionToolsPlanComponent implements OnInit {
document.onmouseup = null; document.onmouseup = null;
} }
} }
//左侧div边框宽度调节 //左侧div边框宽度调节
leftDivMouseDown(e) { leftDivMouseDown(e) {
document.onmousemove = (ev) => { document.onmousemove = (ev) => {
@ -205,6 +205,8 @@ export class CollectionToolsPlanComponent implements OnInit {
document.onmouseup = null; document.onmouseup = null;
} }
} }
//右侧div边框宽度调节 //右侧div边框宽度调节
rightDivMouseDown(e) { rightDivMouseDown(e) {
document.onmousemove = (ev) => { document.onmousemove = (ev) => {
@ -222,10 +224,12 @@ export class CollectionToolsPlanComponent implements OnInit {
} }
} }
//判断是否是数字类型 //放大图标
myIsNaN(value) { iconScale() {
return typeof value === 'number' && !isNaN(value); let number = Number(this.selected)
this.canvas.setIconScale(number)
} }
//素材宽度输入框改变 //素材宽度输入框改变
assetWidthIunput() { assetWidthIunput() {
this.canvasAssetObj.Width = this.assetWidth this.canvasAssetObj.Width = this.assetWidth
@ -233,7 +237,9 @@ export class CollectionToolsPlanComponent implements OnInit {
if (!this.isGis) { if (!this.isGis) {
this.canvas.refreshIcon(this.canvasAssetObj.Id) this.canvas.refreshIcon(this.canvasAssetObj.Id)
} }
} }
//素材高度输入框改变 //素材高度输入框改变
assetHeightIunput() { assetHeightIunput() {
this.canvasAssetObj.Height = this.assetHeight this.canvasAssetObj.Height = this.assetHeight
@ -242,6 +248,7 @@ export class CollectionToolsPlanComponent implements OnInit {
this.canvas.refreshIcon(this.canvasAssetObj.Id) this.canvas.refreshIcon(this.canvasAssetObj.Id)
} }
} }
//素材角度输入框改变 //素材角度输入框改变
assetAngleIunput() { assetAngleIunput() {
this.canvasAssetObj.Angle = this.sliderValue this.canvasAssetObj.Angle = this.sliderValue
@ -250,6 +257,7 @@ export class CollectionToolsPlanComponent implements OnInit {
this.canvas.refreshIcon(this.canvasAssetObj.Id) this.canvas.refreshIcon(this.canvasAssetObj.Id)
} }
} }
//素材厚度输入框改变 //素材厚度输入框改变
assetThicknessIunput() { assetThicknessIunput() {
this.canvasAssetObj.Thickness = this.sliderValueThickness this.canvasAssetObj.Thickness = this.sliderValueThickness
@ -258,6 +266,7 @@ export class CollectionToolsPlanComponent implements OnInit {
this.canvas.refreshIcon(this.canvasAssetObj.Id) this.canvas.refreshIcon(this.canvasAssetObj.Id)
} }
} }
//素材是否高亮改变----->本地操作行为 //素材是否高亮改变----->本地操作行为
assetHighLightIunput() { assetHighLightIunput() {
// console.log(this.isHighLight,this.canvasAssetObj) // console.log(this.isHighLight,this.canvasAssetObj)
@ -266,6 +275,10 @@ export class CollectionToolsPlanComponent implements OnInit {
// this.canvas.setHighlight(arr) // this.canvas.setHighlight(arr)
} }
//判断是否是数字类型
myIsNaN(value) {
return typeof value === 'number' && !isNaN(value);
}
//动态属性素材input框值改变 //动态属性素材input框值改变
assetInputChange(i, e) { assetInputChange(i, e) {
let index = this.canvasAssetObj.PropertyInfos.findIndex((item) => { let index = this.canvasAssetObj.PropertyInfos.findIndex((item) => {
@ -404,6 +417,7 @@ export class CollectionToolsPlanComponent implements OnInit {
config.duration = 3000 config.duration = 3000
this.snackBar.open('图片数量已达上限', '确定', config); this.snackBar.open('图片数量已达上限', '确定', config);
} }
//删除素材属性图片 //删除素材属性图片
deleteImg() { deleteImg() {
if (this.imagesArr.length == 0) { if (this.imagesArr.length == 0) {
@ -475,110 +489,8 @@ export class CollectionToolsPlanComponent implements OnInit {
}//多个素材共同属性 }//多个素材共同属性
multipleAssetData: any//当前多选的素材 multipleAssetData: any//当前多选的素材
firstMultipleAssetData: any//当前多选的第一个素材 firstMultipleAssetData: any//当前多选的第一个素材
//多选宽度共同改变
multipleAssetWidthInput() {
this.multipleAssetData.forEach(item => {
item.assetData.Width = this.multipleAsset.Width
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选高度共同改变
multipleAssetHeightInput() {
this.multipleAssetData.forEach(item => {
item.assetData.Height = this.multipleAsset.Height
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选角度共同改变
multipleAssetAngleInput() {
this.multipleAssetData.forEach(item => {
item.assetData.Angle = this.multipleAsset.Angle
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选厚度共同改变
multipleAssetThicknessInput() {
this.multipleAssetData.forEach(item => {
item.assetData.Thickness = this.multipleAsset.Thickness
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选颜色共同改变
multipleSelectedcolor: any
multipleAssetSelectcolor(item, key) {
//在当前透明度基础上改变颜色
this.multipleSelectedcolor = item
this.multipleAssetData.forEach(item => {
item.assetData.Color = this.multipleSelectedcolor
this.canvasData.isChange = true
this.canvas.refreshIcon(item.assetData.Id)
})
}
//多选颜色滑竿改变
multipleColorDivSliderChange() {
let colorOpacity = Math.round(255 * this.colorDivSliderValue * 0.01)
//根据滑竿值改变16进制颜色后两位
function replacepos(text, start, stop, replacetext) {
let mystr = text.substring(0, stop - 1) + replacetext + text.substring(stop + 1);
return mystr;
}
this.multipleAssetData.forEach(item => {
this.multipleSelectedcolor = replacepos(this.multipleSelectedcolor, 7, 8, colorOpacity.toString(16))
item.assetData.Color = this.multipleSelectedcolor
this.canvasData.isChange = true
this.canvas.refreshIcon(item.assetData.Id)
})
}
//多选状态动态属性素材input框值改变
multipleAssetInputChange(i, e) {
e.stopPropagation()
setTimeout(() => {
this.multipleAssetData.forEach(item => {
item.assetData.PropertyInfos.forEach(element => {
if (element.PropertyName == i.PropertyName) {
if (this.myIsNaN(i.PropertyValue)) {
i.PropertyValue = String(i.PropertyValue)
}
element.PropertyValue = i.PropertyValue
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}, 0);
}
//多选状态动态属性素材radio框值改变
multipleAssetRadioChange(i, value) {
// e.stopPropagation()
this.multipleAssetData.forEach(item => {
// console.log(item)
item.assetData.PropertyInfos.forEach(element => {
if (element.PropertyName == i.PropertyName) {
element.PropertyValue = value
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}
//多选状态动态属性素材下拉框值改变
multipleSupplyArea(i, e) {
e.stopPropagation()
this.multipleAssetData.forEach(item => {
item.assetData.PropertyInfos.forEach(element => {
if (element.PropertyName == i.PropertyName) {
element.PropertyValue = i.PropertyValue
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}
ngOnInit(): void { ngOnInit(): void {
let _this = this let _this = this
AxMessageSystem.addListener('selectionChanged', () => { AxMessageSystem.addListener('selectionChanged', () => {
if (this.canvas.selection.size() == 1) {//如果是单选 if (this.canvas.selection.size() == 1) {//如果是单选
@ -641,7 +553,7 @@ export class CollectionToolsPlanComponent implements OnInit {
} }
//gis模块平面图 //gis模块平面图
if ((this.router.url.indexOf("gis") != -1 || this.router.url.indexOf("waitexamineergis") != -1 || this.router.url.indexOf("createplanonlinefive") != -1) && sessionStorage.getItem("gisplan") == "look") { if ((this.router.url.indexOf("gis") != -1 || this.router.url.indexOf("waitexamineergis") != -1) && sessionStorage.getItem("gisplan") == "look") {
this.isEditPattern = false this.isEditPattern = false
this.isediticon = false this.isediticon = false
this.canvasData.gameMode = GameMode.Assignment this.canvasData.gameMode = GameMode.Assignment
@ -679,12 +591,114 @@ export class CollectionToolsPlanComponent implements OnInit {
// 删除建筑数据 // 删除建筑数据
delete this.canvasData.originalcompanyBuildingData.data[this.clickId]; delete this.canvasData.originalcompanyBuildingData.data[this.clickId];
// console.log('originalcompanyBuildingData', this.canvasData.originalcompanyBuildingData) console.log('originalcompanyBuildingData', this.canvasData.originalcompanyBuildingData)
// console.log('originaleveryStoreyData', this.canvasData.originaleveryStoreyData) console.log('originaleveryStoreyData', this.canvasData.originaleveryStoreyData)
} }
} }
//多选宽度共同改变
multipleAssetWidthInput() {
this.multipleAssetData.forEach(item => {
item.assetData.Width = this.multipleAsset.Width
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选高度共同改变
multipleAssetHeightInput() {
this.multipleAssetData.forEach(item => {
item.assetData.Height = this.multipleAsset.Height
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选角度共同改变
multipleAssetAngleInput() {
this.multipleAssetData.forEach(item => {
item.assetData.Angle = this.multipleAsset.Angle
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选厚度共同改变
multipleAssetThicknessInput() {
this.multipleAssetData.forEach(item => {
item.assetData.Thickness = this.multipleAsset.Thickness
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
})
}
//多选颜色共同改变
multipleSelectedcolor: any
multipleAssetSelectcolor(item, key) {
//在当前透明度基础上改变颜色
this.multipleSelectedcolor = item
this.multipleAssetData.forEach(item => {
item.assetData.Color = this.multipleSelectedcolor
this.canvasData.isChange = true
this.canvas.refreshIcon(item.assetData.Id)
})
}
//多选颜色滑竿改变
multipleColorDivSliderChange() {
let colorOpacity = Math.round(255 * this.colorDivSliderValue * 0.01)
//根据滑竿值改变16进制颜色后两位
function replacepos(text, start, stop, replacetext) {
let mystr = text.substring(0, stop - 1) + replacetext + text.substring(stop + 1);
return mystr;
}
this.multipleAssetData.forEach(item => {
this.multipleSelectedcolor = replacepos(this.multipleSelectedcolor, 7, 8, colorOpacity.toString(16))
item.assetData.Color = this.multipleSelectedcolor
this.canvasData.isChange = true
this.canvas.refreshIcon(item.assetData.Id)
})
}
//多选状态动态属性素材input框值改变
multipleAssetInputChange(i, e) {
e.stopPropagation()
setTimeout(() => {
this.multipleAssetData.forEach(item => {
item.assetData.PropertyInfos.forEach(element => {
if (element.PropertyName == i.PropertyName) {
if (this.myIsNaN(i.PropertyValue)) {
i.PropertyValue = String(i.PropertyValue)
}
element.PropertyValue = i.PropertyValue
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}, 0);
}
//多选状态动态属性素材radio框值改变
multipleAssetRadioChange(i, value) {
// e.stopPropagation()
this.multipleAssetData.forEach(item => {
// console.log(item)
item.assetData.PropertyInfos.forEach(element => {
if (element.PropertyName == i.PropertyName) {
element.PropertyValue = value
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}
//多选状态动态属性素材下拉框值改变
multipleSupplyArea(i, e) {
e.stopPropagation()
this.multipleAssetData.forEach(item => {
item.assetData.PropertyInfos.forEach(element => {
if (element.PropertyName == i.PropertyName) {
element.PropertyValue = i.PropertyValue
this.canvas.refreshIcon(item.assetData.Id)
this.canvasData.isChange = true
}
})
})
}
ngAfterViewInit(): void { ngAfterViewInit(): void {
//不是gis模块平面图 //不是gis模块平面图
@ -704,6 +718,7 @@ export class CollectionToolsPlanComponent implements OnInit {
let buildingId = this.beforeOneCheckedBuilding.id let buildingId = this.beforeOneCheckedBuilding.id
let floorId = this.selectingSitePlan.id let floorId = this.selectingSitePlan.id
this.canvas.paste(companyId, buildingId, floorId) this.canvas.paste(companyId, buildingId, floorId)
// this.renovateTreeData(false)
} }
//截图 //截图
takeScreenshot() { takeScreenshot() {
@ -755,6 +770,11 @@ export class CollectionToolsPlanComponent implements OnInit {
this.canvas.setNameVisible(this.basicInfo, 0) this.canvas.setNameVisible(this.basicInfo, 0)
} }
//点击想定作业名称
wantToWorkClick() {
this.wantToWork = !this.wantToWork
this.canvas.setNameVisible(this.wantToWork, 1)
}
isEditPattern: boolean = true //是否为编辑模式 isEditPattern: boolean = true //是否为编辑模式
//进入编辑模式 //进入编辑模式
@ -779,7 +799,6 @@ export class CollectionToolsPlanComponent implements OnInit {
saveNum: any = [] saveNum: any = []
saveSite() { saveSite() {
//更新用于统计的数据 //更新用于统计的数据
this.canvasData.updateBuildingData() this.canvasData.updateBuildingData()
if (this.selectingSitePlan && this.selectingSitePlan.id) { if (this.selectingSitePlan && this.selectingSitePlan.id) {
@ -792,11 +811,12 @@ export class CollectionToolsPlanComponent implements OnInit {
CompanyData.data = JSON.stringify(CompanyData.data) CompanyData.data = JSON.stringify(CompanyData.data)
let object = this.canvasData.originalcompanyBuildingData.data let object = this.canvasData.originalcompanyBuildingData.data
console.log('建筑数据',object)
let adjoinArr = [] //毗邻数组 let adjoinArr = [] //毗邻数组
if (this.pattern) {//如果是基本信息编辑模式 if (this.pattern) {//如果是基本信息编辑模式
for (const key in object) { for (const key in object) {
if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻 if (object[key].Name == "毗邻") {//如果是相同楼层,则筛选出毗邻
object[key].PropertyInfos.forEach(element => { object[key].PropertyInfos.forEach(element => {
if (element.PropertyName == "方向") { if (element.PropertyName == "方向") {
adjoinArr.push(element.PropertyValue) adjoinArr.push(element.PropertyValue)
@ -804,7 +824,6 @@ export class CollectionToolsPlanComponent implements OnInit {
}); });
} }
} }
console.log('adjoinArr',adjoinArr)
if ((new Set(adjoinArr)).size != adjoinArr.length) { if ((new Set(adjoinArr)).size != adjoinArr.length) {
this.maskLayerService.sendMessage(false) this.maskLayerService.sendMessage(false)
let config = new MatSnackBarConfig(); let config = new MatSnackBarConfig();
@ -815,6 +834,7 @@ export class CollectionToolsPlanComponent implements OnInit {
} else { } else {
//如果是单位 总平面图 //如果是单位 总平面图
if (this.checkedBuildingIndex == -1) { if (this.checkedBuildingIndex == -1) {
if (this.isGis) { if (this.isGis) {
let data = JSON.parse(JSON.stringify(this.selectingSitePlan)) let data = JSON.parse(JSON.stringify(this.selectingSitePlan))
data.zoomLevel = this.map.getZoom(), data.zoomLevel = this.map.getZoom(),
@ -863,9 +883,6 @@ export class CollectionToolsPlanComponent implements OnInit {
}) })
//保存建筑数据 //保存建筑数据
// console.log('CompanyData',CompanyData)
// CompanyData.data = "{\"图例\":{\"Id\":\"图例\",\"Name\":\"图例\",\"Angle\":0,\"Color\":\"#066EED80\",\"Point\":{\"x\":200,\"y\":200},\"Scale\":1,\"Width\":32,\"Border\":null,\"Height\":32,\"PivotX\":0,\"PivotY\":0,\"Enabled\":true,\"FloorId\":\"60d43256660b093f1c3b5aa5\",\"DrawMode\":null,\"FillMode\":null,\"GameMode\":0,\"ImageUrl\":null,\"FixedSize\":null,\"Thickness\":null,\"MultiPoint\":null,\"TemplateId\":null,\"FireElementId\":null,\"PropertyInfos\":[{\"Tag\":\"\",\"Order\":0,\"Enabled\":true,\"Visible\":true,\"Required\":false,\"RuleName\":\"\",\"RuleValue\":\"\",\"PhysicalUnit\":\"\",\"PropertyName\":\"列\",\"PropertyType\":2,\"PropertyValue\":\"2\"}],\"IsFromBuilding\":null,\"InteractiveMode\":null}}"
this.http.post("/api/CompanyData", CompanyData, { this.http.post("/api/CompanyData", CompanyData, {
params: { params: {
companyId: this.params.companyId companyId: this.params.companyId
@ -955,6 +972,7 @@ export class CollectionToolsPlanComponent implements OnInit {
}).subscribe(data => { }).subscribe(data => {
this.saveNum.push("1") this.saveNum.push("1")
if (this.saveNum.length == 5) { if (this.saveNum.length == 5) {
this.maskLayerService.sendMessage(false)
this.maskLayerService.sendMessage(false) this.maskLayerService.sendMessage(false)
this.canvasData.isChange = false this.canvasData.isChange = false
let config = new MatSnackBarConfig(); let config = new MatSnackBarConfig();
@ -1118,6 +1136,7 @@ export class CollectionToolsPlanComponent implements OnInit {
}) })
} }
//创建建筑 //创建建筑
createBuilding() { createBuilding() {
let data = { let data = {
@ -1236,9 +1255,11 @@ export class CollectionToolsPlanComponent implements OnInit {
} }
} }
} }
storeyData //将建筑素材和当前楼层素材合二为一 storeyData //将建筑素材和当前楼层素材合二为一
//处理 tree 数据结构 //处理 tree 数据结构
handleTreeData(storeyData) { handleTreeData(storeyData) {
this.storeyData = storeyData this.storeyData = storeyData
let data = this.allFireElements //所有消防要素模板 let data = this.allFireElements //所有消防要素模板
let treeData = [] //tree型 处理完成后的数据 let treeData = [] //tree型 处理完成后的数据
@ -1280,6 +1301,7 @@ export class CollectionToolsPlanComponent implements OnInit {
this.treeControl.expandAll() this.treeControl.expandAll()
} }
//点击树节点 //点击树节点
clickTreeNode(node) { clickTreeNode(node) {
if (this.canvasData.originalcompanyBuildingData.data[node.id]) { if (this.canvasData.originalcompanyBuildingData.data[node.id]) {
@ -1323,12 +1345,15 @@ export class CollectionToolsPlanComponent implements OnInit {
//点击数节点的显示隐藏icon //点击数节点的显示隐藏icon
clickLookItem(node) { clickLookItem(node) {
//修改真实素材islook属性 //修改真实素材islook属性
for (let key in this.storeyData.data) { for (let key in this.storeyData.data) {
if (key == node.id) { if (key == node.id) {
this.storeyData.data[key].isLook = !this.storeyData.data[key].isLook this.storeyData.data[key].isLook = !this.storeyData.data[key].isLook
} }
} }
//所有消防要素模板变化islook值 //所有消防要素模板变化islook值
if (node.isTemplate) { if (node.isTemplate) {
this.allFireElements.forEach(item => { this.allFireElements.forEach(item => {
@ -1337,6 +1362,7 @@ export class CollectionToolsPlanComponent implements OnInit {
}) })
} }
//子节点跟随父节点的islook变化 //子节点跟随父节点的islook变化
if (node.children && node.children.length != 0) { if (node.children && node.children.length != 0) {
node.children.forEach(item => { node.children.forEach(item => {
@ -1349,6 +1375,7 @@ export class CollectionToolsPlanComponent implements OnInit {
}) })
} }
const nodes = this.treeControl.dataNodes; const nodes = this.treeControl.dataNodes;
const expandNodes = []; const expandNodes = [];
nodes.forEach((item) => { nodes.forEach((item) => {
@ -1356,7 +1383,9 @@ export class CollectionToolsPlanComponent implements OnInit {
expandNodes.push(item.id); expandNodes.push(item.id);
} }
}); });
this.dataSource.data = [...this.dataSource.data] this.dataSource.data = [...this.dataSource.data]
let newNodes = this.treeControl.dataNodes; let newNodes = this.treeControl.dataNodes;
newNodes = newNodes.filter(n => { newNodes = newNodes.filter(n => {
return expandNodes.indexOf(n.id) >= 0; return expandNodes.indexOf(n.id) >= 0;
@ -1386,6 +1415,7 @@ export class CollectionToolsPlanComponent implements OnInit {
//封装 刷新 tree 数据 //封装 刷新 tree 数据
async renovateTreeData(isRefresh: boolean = true) { async renovateTreeData(isRefresh: boolean = true) {
// this.allFireElements[this.allFireElements.length-1].children = []
if (!this.selectingSitePlan.isGis) { if (!this.selectingSitePlan.isGis) {
isRefresh ? await this.canvas.refresh() : null isRefresh ? await this.canvas.refresh() : null
this.canvas.setNameVisible(this.basicInfo, 0) this.canvas.setNameVisible(this.basicInfo, 0)
@ -1416,9 +1446,9 @@ export class CollectionToolsPlanComponent implements OnInit {
} }
this.handleTreeData(storeyData) //处理tree数据结构 this.handleTreeData(storeyData) //处理tree数据结构
} }
map: any map: IMap
toLoadGis() { toLoadGis() {
this.map = new AMap.Map('planContainer', { this.map = MapFactory.MapInstance("planContainer", {
viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D', viewMode: '2D', // 默认使用 2D 模式,如果希望使用带有俯仰角的 3D 模式,请设置 viewMode: '3D',
zoom: 11, //初始化地图层级 zoom: 11, //初始化地图层级
WebGLParams: { WebGLParams: {
@ -1434,7 +1464,7 @@ export class CollectionToolsPlanComponent implements OnInit {
this.map.on('click', (e) => { this.map.on('click', (e) => {
this.showInfoClick(e) this.showInfoClick(e)
}); },this);
this.map.on("complete", () => { this.map.on("complete", () => {
for (const key in this.canvasData.originaleveryStoreyData.data) { for (const key in this.canvasData.originaleveryStoreyData.data) {
if (Object.prototype.hasOwnProperty.call(this.canvasData.originaleveryStoreyData.data, key)) { if (Object.prototype.hasOwnProperty.call(this.canvasData.originaleveryStoreyData.data, key)) {
@ -1455,26 +1485,28 @@ export class CollectionToolsPlanComponent implements OnInit {
} }
// 将 icon 传入 marker // 将 icon 传入 marker
let startMarker = new AMap.Marker({ let startMarker = MapFactory.MarkerInstance({
position: new AMap.LngLat(element.Point.x, element.Point.y), position: MapFactory.LngLatInstance(element.Point.x, element.Point.y),
// 将 html 传给 content // 将 html 传给 content
content: markerContent, content: markerContent,
// 以 icon 的 [center bottom] 为原点 // 以 icon 的 [center bottom] 为原点
offset: new AMap.Pixel(-13, -30), //offset: MapFactory.PixelInstance(-13,-30,
offset: MapFactory.PixelInstance(-13, 30),
draggable: editable == '1' ? true : false, draggable: editable == '1' ? true : false,
}); } as IMarkOptions)
startMarker.id = element.Id startMarker.id = element.Id
startMarker.on('click', (e) => { startMarker.on('click', (e) => {
console.log(e)
this.clickId = e.target.id this.clickId = e.target.id
this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[e.target.id]) this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[e.target.id])
}); },this);
startMarker.on('dragend', (e) => { startMarker.on('dragend', (e) => {
// console.log('拖拽完成', e) // console.log('拖拽完成', e)
this.canvasData.isChange = true this.canvasData.isChange = true
this.clickId = e.target.id this.clickId = e.target.id
this.canvasData.originaleveryStoreyData.data[e.target.id].Point = { x: e.lnglat.lng, y: e.lnglat.lat } this.canvasData.originaleveryStoreyData.data[e.target.id].Point = { x: e.lnglat.lng, y: e.lnglat.lat }
}); },this);
this.planDataMarkers.push(startMarker) this.planDataMarkers.push(startMarker)
this.map.add(startMarker); this.map.add(startMarker);
} }
@ -1486,6 +1518,12 @@ export class CollectionToolsPlanComponent implements OnInit {
} }
//陈鹏飞↓↓↓ //陈鹏飞↓↓↓
//陈鹏飞↓↓↓ //陈鹏飞↓↓↓
//陈鹏飞↓↓↓ //陈鹏飞↓↓↓
@ -1642,7 +1680,7 @@ export class CollectionToolsPlanComponent implements OnInit {
//点击选中 平面图 楼层/区域 时 //点击选中 平面图 楼层/区域 时
isGis: boolean isGis: boolean
selectSitePlan(item, index) { selectSitePlan(item, index) {
// console.log('点击楼层', item) console.log('点击楼层', item)
if (item.isGis) { if (item.isGis) {
this.isGis = true this.isGis = true
} else { } else {
@ -1699,6 +1737,7 @@ export class CollectionToolsPlanComponent implements OnInit {
}, 0); }, 0);
} }
} }
hoverSitePlan(item,key){ hoverSitePlan(item,key){
if(key == this.selectSitePlanIndex){ if(key == this.selectSitePlanIndex){
if (this.element.nativeElement.querySelector('#rightOperate')) { if (this.element.nativeElement.querySelector('#rightOperate')) {
@ -1711,6 +1750,7 @@ export class CollectionToolsPlanComponent implements OnInit {
} }
} }
//新增平面图 楼层/区域 //新增平面图 楼层/区域
foundPanel(e) { foundPanel(e) {
e.stopPropagation() e.stopPropagation()
@ -1845,13 +1885,29 @@ export class CollectionToolsPlanComponent implements OnInit {
const isDelete = confirm('您确定要删除吗'); const isDelete = confirm('您确定要删除吗');
if (isDelete) { if (isDelete) {
if (this.checkedBuildingIndex == -1) { //总平面图 if (this.checkedBuildingIndex == -1) { //总平面图
let isHave = this.canvasData.allDisposalNode.find(items => { return items.sitePlanId === item.id })
if (isHave == undefined) {
this.http.delete(`/api/SitePlans/${item.id}`).subscribe(data => { this.http.delete(`/api/SitePlans/${item.id}`).subscribe(data => {
this.deleteShareData(item, -1) this.deleteShareData(item, -1)
}) })
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('含有数据节点的楼层不允许删除', '确定', config);
}
} else { //楼层/区域 } else { //楼层/区域
let isHave = this.canvasData.allDisposalNode.find(items => { return items.buildingAreaId === item.id })
if (isHave == undefined) {
this.http.delete(`/api/BuildingAreas/${item.id}`).subscribe(data => { this.http.delete(`/api/BuildingAreas/${item.id}`).subscribe(data => {
this.deleteShareData(item, 1) this.deleteShareData(item, 1)
}) })
} else {
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('含有数据节点的楼层不允许删除', '确定', config);
}
} }
} }
} }
@ -1870,17 +1926,13 @@ export class CollectionToolsPlanComponent implements OnInit {
delete data.data[key] delete data.data[key]
} }
} }
console.log('删除e',e)
console.log('删除建筑数据',data)
let newData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData)); let newData = JSON.parse(JSON.stringify(this.canvasData.originalcompanyBuildingData));
newData.data = JSON.stringify(newData.data) // 转换JSON 数据格式 newData.data = JSON.stringify(newData.data) // 转换JSON 数据格式
this.selectingSitePlan = this.sitePlanData[0] || {} this.selectingSitePlan = this.sitePlanData[0] || {}
this.sitePlanData[0] ? this.isGis = this.sitePlanData[0].isGis : null
this.canvasData.selectStorey = this.sitePlanData[0] || {} //服务中 存一份数据 this.canvasData.selectStorey = this.sitePlanData[0] || {} //服务中 存一份数据
this.selectSitePlanIndex = 0 this.selectSitePlanIndex = 0
this.canvasData.isChange = false this.canvasData.isChange = false
if (isCompany === -1) { if (isCompany === -1) {
console.log('保存建筑数据',newData)
this.http.post("/api/CompanyData", newData).subscribe(data => { }) this.http.post("/api/CompanyData", newData).subscribe(data => { })
this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据 this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据
} else { } else {
@ -1914,12 +1966,6 @@ export class CollectionToolsPlanComponent implements OnInit {
item.name = item.name + '(副本)' item.name = item.name + '(副本)'
item.order = this.sitePlanData[this.sitePlanData.length - 1].order + 1 item.order = this.sitePlanData[this.sitePlanData.length - 1].order + 1
this.http.post('/api/SitePlans', item).subscribe((data: any) => { this.http.post('/api/SitePlans', item).subscribe((data: any) => {
for (const key in paramsData) {
if (Object.prototype.hasOwnProperty.call(paramsData, key)) {
const element = paramsData[key];
element.FloorId = data.id
}
}
let newData = { let newData = {
version: "2.0", version: "2.0",
id: "", id: "",
@ -1976,12 +2022,6 @@ export class CollectionToolsPlanComponent implements OnInit {
item.name = item.name + '(副本)' item.name = item.name + '(副本)'
item.order = this.sitePlanData[this.sitePlanData.length - 1].order + 1 item.order = this.sitePlanData[this.sitePlanData.length - 1].order + 1
this.http.post('/api/BuildingAreas', item, { params: this.params }).subscribe((data: any) => { this.http.post('/api/BuildingAreas', item, { params: this.params }).subscribe((data: any) => {
for (const key in paramsData) {
if (Object.prototype.hasOwnProperty.call(paramsData, key)) {
const element = paramsData[key];
element.FloorId = data.id
}
}
let newData = { let newData = {
version: "2.0", version: "2.0",
id: "", id: "",
@ -2225,7 +2265,7 @@ export class CollectionToolsPlanComponent implements OnInit {
// console.log('选中图片',this.selectImage) // console.log('选中图片',this.selectImage)
this.selectImageIndex = index this.selectImageIndex = index
if (this.isGis) { if (this.isGis) {
// console.log(this.map)
} else { } else {
this.canvasData.selectTemplateData = items this.canvasData.selectTemplateData = items
this.canvas.beginPaint() this.canvas.beginPaint()
@ -2254,32 +2294,31 @@ export class CollectionToolsPlanComponent implements OnInit {
'</div>'; '</div>';
// 将 icon 传入 marker // 将 icon 传入 marker
let startMarker = new AMap.Marker({ let startMarker: IMarker = MapFactory.MarkerInstance({
position: new AMap.LngLat(e.lnglat.lng, e.lnglat.lat), position: MapFactory.LngLatInstance(e.lnglat.lng, e.lnglat.lat),
// 将 html 传给 content // 将 html 传给 content
content: markerContent, content: markerContent,
// 以 icon 的 [center bottom] 为原点 // 以 icon 的 [center bottom] 为原点
offset: new AMap.Pixel(-13, -30), offset: MapFactory.PixelInstance(-13, -30),
draggable: true, draggable: true,
}); } as IMarkOptions);
startMarker.id = id startMarker.id = id
startMarker.on('click', (e) => { startMarker.on('click', (e) => {
this.clickId = e.target.id this.clickId = e.target.id
this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[e.target.id]) this.setAssetsProperty(this.canvasData.originaleveryStoreyData.data[e.target.id])
}); },this);
startMarker.on('dragend', (e) => { startMarker.on('dragend', (e) => {
// console.log('拖拽完成', e) // console.log('拖拽完成', e)
this.canvasData.isChange = true this.canvasData.isChange = true
this.clickId = e.target.id this.clickId = e.target.id
this.canvasData.originaleveryStoreyData.data[e.target.id].Point = { x: e.lnglat.lng, y: e.lnglat.lat } this.canvasData.originaleveryStoreyData.data[e.target.id].Point = { x: e.lnglat.lng, y: e.lnglat.lat }
}); },this);
//将图标数据添加 //将图标数据添加
let itemData = JSON.parse(JSON.stringify(this.selectImage)) let itemData = JSON.parse(JSON.stringify(this.selectImage))
itemData.id = id itemData.id = id
itemData.point = { x: e.lnglat.lng, y: e.lnglat.lat } itemData.point = { x: e.lnglat.lng, y: e.lnglat.lat }
itemData.floorId = this.selectingSitePlan.id
itemData = this.canvasData.deserialize(JSON.stringify(itemData))//反序列化为大写 itemData = this.canvasData.deserialize(JSON.stringify(itemData))//反序列化为大写
// 添加楼层数据 // 添加楼层数据
this.canvasData.originaleveryStoreyData.data[id] = itemData; this.canvasData.originaleveryStoreyData.data[id] = itemData;
@ -2295,11 +2334,264 @@ export class CollectionToolsPlanComponent implements OnInit {
} }
//处置预案
allFirePlan: any = []; //所有灾情
selectDisposalNode: string = ''; //当前点击tree节点 css选中样式
//获取所有灾情
getAllFirePlan() {
let params = { componentId: sessionStorage.getItem('planId') }
this.http.get('/api/Disasters', { params: params }).subscribe((data: any) => {
if (!data.length) { //该 单位没有灾情时
let msg = {
name: '灾情',
modifiedTime: new Date(),
planComponentId: sessionStorage.getItem('planId')
}
this.http.post('/api/Disasters', msg).subscribe(data => {
this.allFirePlan.push(data)
let params = { disasterId: this.allFirePlan[0].id || '' }
this.http.get('/api/DisposalNodes', { params: params }).subscribe(data => { //所有处置节点
this.canvasData.allDisposalNode = data
})
})
} else { //单位 有灾情时
this.allFirePlan = data
let params = { disasterId: this.allFirePlan[0].id || '' }
this.http.get('/api/DisposalNodes', { params: params }).subscribe(data => { //所有处置节点
this.canvasData.allDisposalNode = data
})
}
})
}
//获取所有处置节点
getDisposalNode() {
this.selectDisposalNode = ''
let params = { disasterId: this.allFirePlan[0].id || '' }
this.http.get('/api/DisasterData/Markers', { params: params }).subscribe(data => { //灾情标签信息
this.canvasData.allNodeMarkers = data
this.mateFireForce()
})
this.http.get('/api/DisposalNodes', { params: params }).subscribe(data => { //处置节点
this.canvasData.allDisposalNode = data
this.handleHybridTree()
})
}
treeData: any = []; //渲染tree处理完成数据
defaultExpandedKeys: any = []; //首次渲染 tree展开状态
//处理 节点 Tree数据
handleHybridTree() {
this.defaultExpandedKeys = []
let treeData = []
let data = JSON.parse(JSON.stringify(this.canvasData.allDisposalNode || []))
data.forEach(element => {
this.defaultExpandedKeys.push(element.id)
element.title = element.name //name
element.key = element.id //id
element.children = [] //children
if (element.sitePlanId || element.buildingAreaId) { //是数据节点
element.isLeaf = true
element.isDataNode = true
} else { //不是数据节点
element.isLeaf = false
element.isDataNode = false
}
data.forEach(item => {
item.parentId === element.id ? element.children.push(item) : null
})
});
data.forEach(element => {
!element.parentId ? treeData.push(element) : null
})
this.treeData = [...treeData]
this.defaultExpandedKeys = [...this.defaultExpandedKeys]
}
//刷新 treeData 保存已展开节点
refurbishTreeData() {
this.defaultExpandedKeys = []
let params = { disasterId: this.allFirePlan[0].id || '' }
this.http.get('/api/DisposalNodes', { params: params }).subscribe(nodeData => { //处置节点
this.canvasData.allDisposalNode = nodeData
let oldTreeData = this.nzTreeComponent.getExpandedNodeList()
oldTreeData.forEach(item => {
this.defaultExpandedKeys.push(item.key)
})
let treeData = []
let data = JSON.parse(JSON.stringify(this.canvasData.allDisposalNode || []))
data.forEach(element => {
element.title = element.name //name
element.key = element.id //id
element.children = [] //children
if (element.sitePlanId || element.buildingAreaId) { //是数据节点
element.isLeaf = true
element.isDataNode = true
} else { //不是数据节点
element.isLeaf = false
element.isDataNode = false
}
data.forEach(item => {
item.parentId === element.id ? element.children.push(item) : null
})
});
data.forEach(element => {
!element.parentId ? treeData.push(element) : null
})
this.treeData = [...treeData]
this.defaultExpandedKeys = [...this.defaultExpandedKeys]
})
}
sitePlanIcon = { fire: 0, force: 0 } // 总平面图 火源/力量 图标 是否展示
//刷新 建筑楼层 匹配 火源/力量 图标
mateFireForce() {
let data = this.canvasData.allNodeMarkers.markers || {}
for (let key in data) { //遍历 火/力量 图标
this.sitePlanData.forEach(element => { //楼层
if (element.id == key) { // 相匹配时
data[key].fireCount != 0 ? element.fire = 1 : element.fire = 0
data[key].forceCount != 0 ? element.force = 1 : element.force = 0
}
});
this.allBuildings.forEach(element => { //建筑
if (element.id == key) { // 相匹配时
data[key].fireCount != 0 ? element.fire = 1 : element.fire = 0
data[key].forceCount != 0 ? element.force = 1 : element.force = 0
}
});
if (this.params.companyId == key) { //总平面图时
data[key].fireCount != 0 ? this.sitePlanIcon.fire = 1 : this.sitePlanIcon.fire = 0
data[key].forceCount != 0 ? this.sitePlanIcon.force = 1 : this.sitePlanIcon.force = 0
}
}
let buildingMSG = this.canvasData.allNodeMarkers.highlightMarkers || {}
for (let key in buildingMSG) {
if (key === this.canvasData.selectPanelPoint.DisposalNodeId) {
for (let keys in buildingMSG[key]) {
this.sitePlanData.forEach(element => { //楼层
if (element.id === keys) {
buildingMSG[key][keys].fireCount != 0 ? element.fire = 2 : null
buildingMSG[key][keys].forceCount != 0 ? element.force = 2 : null
}
});
this.allBuildings.forEach(element => { //建筑
if (element.id === keys) { // 相匹配时
buildingMSG[key][keys].fireCount != 0 ? element.fire = 2 : null
buildingMSG[key][keys].forceCount != 0 ? element.force = 2 : null
}
});
if (this.params.companyId === keys) { //总平面图时
buildingMSG[key][keys].fireCount != 0 ? this.sitePlanIcon.fire = 2 : null
buildingMSG[key][keys].forceCount != 0 ? this.sitePlanIcon.force = 2 : null
}
}
}
}
}
// 切换 基本信息时 刷新 删除 建筑楼层 自定义属性
mateDeleteCustomize() {
this.canvasData.selectPanelPointBaseData = { description: '', notes: '', weather: '', airTemperature: '', windDirection: '', windScale: '' }
this.defaultExpandedKeys = []
this.sitePlanIcon = { fire: 0, force: 0 }
this.sitePlanData.forEach(element => { //楼层
delete element.fire
delete element.force
});
this.allBuildings.forEach(element => { //建筑
delete element.fire
delete element.force
});
}
//计算差异
countValue(e) {
e.stopPropagation()
let params = { disasterId: this.allFirePlan[0].id || '' }
this.http.get('/api/DisasterData/Diffs', { params: params }).subscribe(data => {
this.canvasData.allNodeMarkers = data
this.mateFireForce()
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('计算差异完成', '确定', config);
})
}
//复制 处置预案 节点
copyPanelPoint(e, item, treeData) {
e.stopPropagation()
if (confirm(`确定要复制 ${item.title} ?`)) {
let params = { id: item.origin.id }
let order
if (item.level == 0) {
treeData.length ? order = treeData[treeData.length - 1].order + 1 : order = 0
} else {
let parent = item.getParentNode() //获取父节点
parent.origin.children.length ? order = parent.origin.children[parent.origin.children.length - 1].order + 1 : order = 0
}
let data = {
name: item.title + '(副本)',
level: item.level,
order: order,
description: '',
disasterId: item.origin.disasterId || '',
parentId: item.origin.parentId || null,
planComponentId: item.origin.planComponentId || '',
}
this.http.post('/api/DisposalNodes/Clone', data, { params: params }).subscribe(data => {
this.refurbishTreeData()
})
} //isTrue
}
//删除 处置预案 节点
deletePanelPoint(e, item) {
e.stopPropagation()
if (confirm(`确定要删除 ${item.name} ?`)) {
this.http.delete(`/api/DisposalNodes/${item.id}`).subscribe(data => {
this.refurbishTreeData()
})
}
}
//点击 处置Tree节点
selectanelPoint(e) {
if (!e.buildingAreaId && !e.sitePlanId) { //当前节点 不是 数据节点 时
let msg = this.canvasData.findDisposalNode(e.id)
this.canvasData.selectPanelPointBaseData = msg
this.selectDisposalNode == msg.id ? this.selectDisposalNode = '' : this.selectDisposalNode = msg.id //选中 节点
} else if (e.buildingAreaId || e.sitePlanId) { //当前节点 是 数据节点 时
let msg = this.canvasData.findDisposalNode(e.parentId)
this.canvasData.selectPanelPointBaseData = msg
this.selectDisposalNode = e.parentId //选中 节点
if (this.canvasData.selectPanelPoint.DisposalNodeId != e.id) { //选择节点 不是当前节点时
let params = { nodeId: e.id }
let parameter = { //查询 节点 对应 建筑/楼层 index,id
buildingIndex: e.sitePlanId ? -1 : this.allBuildings.findIndex(item => { return item.id === e.buildingId }), //总平面图/建筑 index
storeyId: e.sitePlanId ? e.sitePlanId : e.buildingAreaId, //楼层id
}
this.http.get('/api/DisposalNodeData', { params: params }).subscribe(data => {
this.canvasData.selectPanelPoint = this.canvasData.deserialize(JSON.stringify(data || new DisposalNodeData())) //选择 当前 节点
this.canvasData.selectPanelPoint.Data = this.canvasData.deserialize(this.canvasData.selectPanelPoint.Data)
this.seekPanelPoint(parameter)
})
} //if
} //else if
}
//查找 数据节点 对应 建筑/楼层 //查找 数据节点 对应 建筑/楼层
seekPanelPoint(paramsData) { seekPanelPoint(paramsData) {
this.checkedBuildingIndex = paramsData.buildingIndex this.checkedBuildingIndex = paramsData.buildingIndex
if (paramsData.buildingIndex == -1) { //总平面图时 if (paramsData.buildingIndex == -1) { //总平面图时
// console.log('走了1')
this.beforeOneCheckedBuilding = { name: "总平面图" } this.beforeOneCheckedBuilding = { name: "总平面图" }
let fireData = this.getFireElements(sessionStorage.getItem('buildingTypeId')) //获取单位下 消防要素 let fireData = this.getFireElements(sessionStorage.getItem('buildingTypeId')) //获取单位下 消防要素
let planData = this.getSitePlanCompanyData() //获取 单位 数据 let planData = this.getSitePlanCompanyData() //获取 单位 数据
@ -2309,20 +2601,17 @@ export class CollectionToolsPlanComponent implements OnInit {
this.selectingSitePlan = this.sitePlanData[index] || {} this.selectingSitePlan = this.sitePlanData[index] || {}
this.canvasData.selectStorey = this.sitePlanData[index] || {} //服务中 存一份数据 this.canvasData.selectStorey = this.sitePlanData[index] || {} //服务中 存一份数据
this.selectSitePlanIndex = index this.selectSitePlanIndex = index
Promise.all([fireData, planData]).then((res) => { Promise.all([fireData, planData]).then((res) => {
this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据 this.getSitePlanStorey(this.selectingSitePlan) //获取 平面图 楼层数据
}) })
}) //get }) //get
} else { //建筑时 } else { //建筑时
// console.log('走了2')
// console.log('allBuildings', this.allBuildings)
// console.log('paramsData', paramsData)
this.beforeOneCheckedBuilding = this.allBuildings[paramsData.buildingIndex] this.beforeOneCheckedBuilding = this.allBuildings[paramsData.buildingIndex]
let params = { buildingId: this.beforeOneCheckedBuilding.id } let params = { buildingId: this.beforeOneCheckedBuilding.id }
let fireData = this.getFireElements(this.beforeOneCheckedBuilding.buildingTypes[0].id || '') //获取建筑下 消防要素 let fireData = this.getFireElements(this.beforeOneCheckedBuilding.buildingTypes[0].id || '') //获取建筑下 消防要素
let planData = this.getBuildingData(params) //获取 建筑 数据 let planData = this.getBuildingData(params) //获取 建筑 数据
this.http.get('/api/BuildingAreas', { params }).subscribe(data => { this.http.get('/api/BuildingAreas', { params }).subscribe(data => {
// console.log('BuildingAreas', data)
this.sitePlanData = data this.sitePlanData = data
let index = this.sitePlanData.findIndex(item => { return item.id === paramsData.storeyId }) let index = this.sitePlanData.findIndex(item => { return item.id === paramsData.storeyId })
this.selectingSitePlan = this.sitePlanData[index] || {} this.selectingSitePlan = this.sitePlanData[index] || {}

2
src/app/working-area/model/axImageShape.ts

@ -236,7 +236,7 @@ export class AxImageShape extends AxShape {
if (this.rightDrag) { if (this.rightDrag) {
this.rightDrag = false; this.rightDrag = false;
this.image.anchor.set(0.5); this.image.anchor.set(0.5);
this.image.position.set(this.image.position.x + (this.image.width / 2)); this.image.position.set(this.image.position.x + (this.image.width / 2), this.image.position.y);
} }
}); });
this.right.visible = false; this.right.visible = false;

23
src/app/working-area/model/axShape.ts

@ -42,7 +42,7 @@ export class AxShape extends Graphics {
} }
if (this.allowEdit) { if (this.allowEdit) {
this.mouseDragging = true; this.mouseDragging = true;
this.mousePosition = new PIXI.Point(event.data.global.x, event.data.global.y); this.mousePosition = event.data.getLocalPosition(this.workingArea.backgroundImage);
} }
}) })
.on('pointerup', event => { .on('pointerup', event => {
@ -53,15 +53,26 @@ export class AxShape extends Graphics {
}) })
.on('pointermove', event => { .on('pointermove', event => {
if (this.mouseDragging) { if (this.mouseDragging) {
// const newPosition = event.data.getLocalPosition(this.workingArea.backgroundImage);
// const x = newPosition.x - this.x;
// const y = newPosition.y - this.y;
// this.workingArea.selection.all().forEach(item => {
// item.x += x;
// item.y += y;
// item.assetData.Point = new PIXI.Point(item.x, item.y);
// this.workingArea.canvasData.isChange = true;
// });
const newPosition = event.data.getLocalPosition(this.workingArea.backgroundImage);
const offsetX = newPosition.x - this.mousePosition.x;
const offsetY = newPosition.y - this.mousePosition.y;
this.workingArea.selection.all().forEach(item => { this.workingArea.selection.all().forEach(item => {
const x = event.data.global.x - this.mousePosition.x; item.x += offsetX;
const y = event.data.global.y - this.mousePosition.y; item.y += offsetY;
item.x += x * (1 / this.workingArea.camera2D.scale.x);
item.y += y * (1 / this.workingArea.camera2D.scale.y);
item.assetData.Point = new PIXI.Point(item.x, item.y); item.assetData.Point = new PIXI.Point(item.x, item.y);
this.workingArea.canvasData.isChange = true; this.workingArea.canvasData.isChange = true;
}); });
this.mousePosition = new PIXI.Point(event.data.global.x, event.data.global.y); this.mousePosition = newPosition;
} }
}) })
.on('rightclick', event => { .on('rightclick', event => {

4
src/app/working-area/working-area.component.ts

@ -175,7 +175,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
* - * -
* - * -
*/ */
public VERSION = '1.5.0.20210507_rc'; public VERSION = '1.5.1.20210715';
/** /**
* *
*/ */
@ -641,7 +641,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
* *
*/ */
public resetCanvas() { public resetCanvas() {
if(!this.init.isGis){ if (!this.init.isGis) {
this.app.renderer.resize(this.content.nativeElement.clientWidth, this.content.nativeElement.clientHeight); this.app.renderer.resize(this.content.nativeElement.clientWidth, this.content.nativeElement.clientHeight);
} }
} }

13
src/assets/kmap/Kmap.config.json

@ -0,0 +1,13 @@
{
"DIST_URL": "./kmap-service-main-kd.js",
"TOKEN": "E203F172F1A54CD5B3CEDD107B8F4E43",
"CT_SERVER_URL": "https://10.14.183.81",
"USERMNG_SERVER": "",
"SEARCH_SERVER": "",
"WS_SERVER": "",
"ROUTING_SERVER": "",
"STORAGE_SERVER": "",
"COORDINATETYPE": "",
"INDOOR_MAP_MAX_ZOOM": 24
}

81
src/assets/kmap/kmap-service-main-kd.js

File diff suppressed because one or more lines are too long

14
src/index.html

@ -20,16 +20,16 @@
</head> </head>
<body> <body>
<app-root></app-root> <app-root></app-root>
</body> </body>
<script src="http://10.81.73.39:8000/webapi/maps?v=2.0&key=e4b359dc7b03f9418b7497f807131346&plugin=AMap.Driving,AMap.MouseTool,AMap.RangingTool"></script> <!-- <script type="text/javascript" src="./assets/kmap/kmap-service-main-kd.js"></script> -->
<script src="http://10.81.73.39:8000/webapi/ui/1.1/main.js"></script> <!-- <script src="http://10.81.73.39:8000/webapi/maps?v=2.0&key=e4b359dc7b03f9418b7497f807131346&plugin=AMap.Driving,AMap.MouseTool,AMap.RangingTool"></script>
<!-- <script src="https://webapi.amap.com/maps?v=2.0&key=e4b359dc7b03f9418b7497f807131346&plugin=AMap.Driving,AMap.MouseTool,AMap.RangingTool"></script> <script src="http://10.81.73.39:8000/webapi/ui/1.1/main.js"></script> -->
<script src="https://webapi.amap.com/ui/1.1/main.js"></script> --> <script src="https://webapi.amap.com/maps?v=2.0&key=e4b359dc7b03f9418b7497f807131346&plugin=AMap.Driving,AMap.MouseTool,AMap.RangingTool"></script>
<script src="https://webapi.amap.com/ui/1.1/main.js"></script>
<script src="/assets/html2canvas.js"></script> <script src="/assets/html2canvas.js"></script>
<!-- <script type="text/javascript" src="/assets/wordexport/jquery.js"></script> <script type="text/javascript" src="/assets/wordexport/jquery.js"></script>
<script type="text/javascript" src="/assets/wordexport/FileSaver.js"></script> <script type="text/javascript" src="/assets/wordexport/FileSaver.js"></script>
<script type="text/javascript" src="/assets/wordexport/jquery.wordexport.js"></script> --> <script type="text/javascript" src="/assets/wordexport/jquery.wordexport.js"></script>
</html> </html>

3
src/modules/map/declare/component/SearchDownListPlugins/SearchDownList.html

@ -0,0 +1,3 @@
<div class="content" [ngStyle]="{'left': leftCss,'top': topCss,'min-width': minWidthCss}" *ngIf="searchList.length">
<div *ngFor="let item of searchList" (click)="select(item)" class="item">{{item.name}}</div>
</div>

16
src/modules/map/declare/component/SearchDownListPlugins/SearchDownList.scss

@ -0,0 +1,16 @@
.content{
position: absolute;
z-index: 1024;
background-color: #fefefe;
border: 1px solid #d1d1d1;
bottom: auto;
}
.item {
white-space: nowrap;
font-size: 12px;
cursor: pointer;
padding: 4px;
}
.item:hover {
background-color: #7fb9f7;
}

53
src/modules/map/declare/component/SearchDownListPlugins/SearchDownList.ts

@ -0,0 +1,53 @@
import { Component, OnInit, Inject } from '@angular/core';
import { AutocompleteSelect, HtmlRender } from '../../map';
type ClickHandler = (data: AutocompleteSelect) => void;
@Component({
selector: 'SearchDownList',
templateUrl: './SearchDownList.html',
styleUrls: ['./SearchDownList.scss']
})
export class SearchDownList implements OnInit {
constructor() {}
public $input; //input
public searchList: AutocompleteSelect[] = []; //list
public leftCss: string = '0px';
public topCss: string = '0px';
public minWidthCss: string = '0px';
private clickHandler: ClickHandler;
ngOnInit(): void {
window.onresize = () => {
if (this.$input) {
let Dom = this.$input.getBoundingClientRect()
this.leftCss = `${Dom.left + 3}px`
this.topCss = `${Dom.top + Dom.height + 3}px`
this.minWidthCss = `${Dom.width}px`
}
}
}
setClickHander(handler: ClickHandler) {
this.clickHandler = handler;
}
clearClickHander() {
this.clearClickHander = null;
}
init(inputElement: HtmlRender): void {
this.$input = inputElement
let Dom = this.$input.getBoundingClientRect()
this.leftCss = `${Dom.left + 3}px`
this.topCss = `${Dom.top + Dom.height + 3}px`
this.minWidthCss = `${Dom.width}px`
}
// 触发 select
select(e) {
this.clearClickHander && this.clickHandler(e);
this.searchList = [];
}
}

135
src/modules/map/declare/factory.ts

@ -0,0 +1,135 @@
const mapSupplier: number = 1; // 1:高德, 2:科达
import { IMap, IMapOptions, IMarker, IPixel, IMarkOptions, ILngLat, ILayer, ICircle, IMarkerCluster, IRenderClusterMarker, IInfoWindow, IMouseTool, IIcon, ISize, IIconOptions, ITileLayer, IDriving, IDrivingOptions, IAutocomplete, IPlaceSearch } from './map'
import { GaodeCircle, GaodeIcon, GaodeInfoWindow, GaodeLayer, GaoDeLngLat, GaoDeMap, GaoDeMarker, GaoDeMarkerCluster, GaodeMouseTool, GaoDePixel, GaoDeRenderClusterMarker, GaodeTileLayer, GaodeSize, GaodeDriving, GaodeAutocomplete, GaodePlaceSearch } from './gaode-map'
import { KedaAutocomplete, KedaCircle, KedaDriving, KedaInfoWindow, KedaLayer, KeDaLngLat, KeDaMap, KeDaMarker, KedaMarkerCluster, KedaMouseTool, KeDaPixel, KedaPlaceSearch, KedaRenderClusterMarkerr, KedaTileLayer } from './keda-map';
import MapTools from './map-tools';
export class MapFactory {
public static MapInstance(container: string, options: IMapOptions | any,plugins?:string[]): IMap {
let config = MapTools.ExplicitConvert(options);
switch (mapSupplier) {
case 1: return new GaoDeMap(container, config,plugins);
case 2: return new KeDaMap(container, config);
default: return null;
}
}
public static PixelInstance(x: number, y: number): IPixel {
switch (mapSupplier) {
case 1: return new GaoDePixel(x, y);
case 2: return new KeDaPixel(x, y);
default: return null;
}
}
public static MarkerInstance(options: IMarkOptions): IMarker {
switch (mapSupplier) {
case 1: return new GaoDeMarker(options);
case 2: return new KeDaMarker(options);
default: return null;
}
}
public static MarkerClusterInstance(map: IMap, list: Object[], renderObj: { gridSize: number, render: IRenderClusterMarker }): IMarkerCluster {
switch (mapSupplier) {
case 1: return new GaoDeMarkerCluster(map, list, renderObj);
case 2: return new KedaMarkerCluster(map, list, renderObj);
default: return null;
}
}
public static LngLatInstance(x: number, y: number): ILngLat {
switch (mapSupplier) {
case 1: return new GaoDeLngLat(x, y);
case 2: return new KeDaLngLat(x, y);
default: return null;
}
}
public static IconInstance(options: IIconOptions): IIcon { //科达map 暂不需要
switch (mapSupplier) {
case 1: return new GaodeIcon(options);
default: return null;
}
}
public static SizeInstance(x: number, y: number): ISize { //科达map 暂不需要
switch (mapSupplier) {
case 1: return new GaodeSize(x, y);
default: return null;
}
}
public static TileLayerInstance(): ITileLayer {
switch (mapSupplier) {
case 1: return new GaodeTileLayer();
case 2: return new KedaTileLayer();
default: return null;
}
}
public static LayerInstance(options: any): ILayer {
switch (mapSupplier) {
case 1: return new GaodeLayer(options);
case 2: return new KedaLayer(options);
default: return null;
}
}
public static DrivingInstance(options: IDrivingOptions): IDriving {
switch (mapSupplier) {
case 1: return new GaodeDriving(options);
case 2: return new KedaDriving(options);
default: return null;
}
}
public static AutocompleteInstance(options: any,component: any): IAutocomplete {
switch (mapSupplier) {
case 1: return new GaodeAutocomplete(options,component);
case 2: return new KedaAutocomplete(options,component);
default: return null;
}
}
public static PlaceSearchInstance(component: any): IPlaceSearch {
switch (mapSupplier) {
case 1: return new GaodePlaceSearch(component);
case 2: return new KedaPlaceSearch(component);
default: return null;
}
}
public static MouseToolInstance(map: IMap): IMouseTool {
switch (mapSupplier) {
case 1: return new GaodeMouseTool(map);
case 2: return new KedaMouseTool(map);
default: return null;
}
}
public static InfoWindowInstance(options: any): IInfoWindow {
switch (mapSupplier) {
case 1: return new GaodeInfoWindow(options);
case 2: return new KedaInfoWindow(options);
default: return null;
}
}
public static CircleInstance(options: any): ICircle {
switch (mapSupplier) {
case 1: return new GaodeCircle(options);
case 2: return new KedaCircle(options);
default: return null;
}
}
public static RenderClusterMarkerInstance(): IRenderClusterMarker {
switch (mapSupplier) {
case 1: return new GaoDeRenderClusterMarker();
case 2: return new KedaRenderClusterMarkerr();
default: return null;
}
}
}

488
src/modules/map/declare/gaode-map.ts

@ -0,0 +1,488 @@
import { HtmlRender, ICircle, IIcon, IIconOptions, ILayer, ILngLat, IMap, IMapOptions, IMarker, IMarkerCluster, IMarkOptions, IMouseTool, IInfoWindow, IPixel, IRenderClusterMarker, ISelf, ISize, PixelRender, ITileLayer, IDriving, IDrivingOptions, IAutocomplete, IPlaceSearch, AutocompleteSearchCallback, AutocompleteSelectCallback, PlaceSearchCallback, AutocompleteSearch, DrivingSearchCallback } from './map'
import MapTools from './map-tools';
declare var AMap: any;
declare var AMapUI: any;
class GaodeBasic implements ISelf {
self: any;
discriminator: string = "ISelf";
}
export class GaoDeMap extends GaodeBasic implements IMap {
/// plugins:同步加载插件
constructor(container: string, options: IMapOptions, plugins?: string[]) {
super();
this.self = new AMap.Map(container, options);
if (!!plugins && plugins.length) {
for (var i in plugins) {
let name = plugins[i];
if (name.indexOf('AMap.') == -1) continue;
let pObj = eval(`new ${plugins[i]}()`);
this.self.plugin(pObj);
}
}
}
containerToLngLat(e: any) {
return this.self.containerToLngLat(e)
}
clearMap() {
return this.self.clearMap();
}
distance(a: number[], b: number[]) {
return AMap.GeometryUtil.distance(a, b);
}
getCity(callback: Function) {
return this.self.getCity(callback)
}
setZoomAndCenter(zoom: number, pos: number[]) {
return this.self.setZoomAndCenter(zoom, pos)
}
plugin(pluginNames: string[], callback: Function) {
let names = pluginNames.filter(s => s.indexOf("AMap.") == 0);
return this.self.plugin(names, callback)
}
getBounds() {
return this.self.getBounds()
}
add(obj: IMarker | any) {
return this.self.add(obj.self)
}
remove(obj: any) {
return this.self.remove(obj.self)
}
setCity(city: string) {
return this.self.setCity(city)
}
setZoom(zoom) {
return this.self.setZoom(zoom)
}
setCenter(pos: any) {
return this.self.setCenter(pos)
}
getCenter(): ILngLat {
let d = this.self.getCenter();
return new GaoDeLngLat(0, 0, d);
}
getZoom() {
return this.self.getZoom();
}
on(eventName: string, callback: Function): void {
return this.self.on(eventName, callback);
}
setAdministrativeAreaStyle(component: any, getData?: Function, setData?: Function) {//自定义 行政区划 样式
let that = this
let level = sessionStorage.getItem("level")
AMapUI.loadUI(['geo/DistrictExplorer'], (DistrictExplorer) => {
let colors = [
"#3366cc", "#dc3912", "#ff9900", "#109618", "#990099", "#0099c6", "#dd4477", "#66aa00",
"#b82e2e", "#316395", "#994499", "#22aa99", "#aaaa11", "#6633cc", "#e67300", "#8b0707",
"#651067", "#329262", "#5574a6", "#3b3eac"
];
//创建一个实例
let districtExplorer = new DistrictExplorer({
map: that.self,
eventSupport: true, //打开事件支持
});
let adcode = 310000 //上海行政编码
districtExplorer.loadAreaNode(adcode, (error, areaNode) => {
//更新地图视野
that.self.setBounds(areaNode.getBounds(), null, null, true);
//设置定位节点,支持鼠标位置识别
//注意节点的顺序,前面的高优先级
districtExplorer.setAreaNodesForLocating(areaNode);
//清除已有的绘制内容
districtExplorer.clearFeaturePolygons();
//绘制子区域
districtExplorer.renderSubFeatures(areaNode, (feature, i) => {
let fillColor = colors[i % colors.length];
let strokeColor = colors[colors.length - 1 - i % colors.length];
return {
cursor: 'default',
bubble: true,
strokeColor: strokeColor, //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线宽
fillColor: fillColor, //填充色
fillOpacity: 0.5, //填充透明度
};
});
//绘制父区域
districtExplorer.renderParentFeature(areaNode, {
cursor: 'default',
bubble: true,
strokeColor: 'black', //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线宽
fillColor: null, //填充色
fillOpacity: 0.5, //填充透明度
});
// 更新地图视野以适合区划面
that.self.setFitView(districtExplorer.getAllFeaturePolygons());
});
if (level == "0" || level == "1" || level == "2") {
//区域内点击
districtExplorer.on('featureClick', (e, feature) => {
getData && getData.call(component, feature);
let props = feature.properties;
adcode = props.adcode
let fillColor2
if (props.level == 'city') {
fillColor2 = null
} else {
fillColor2 = '#d0daee'
}
districtExplorer.loadAreaNode(adcode, (error, areaNode) => {
//设置定位节点,支持鼠标位置识别
//注意节点的顺序,前面的高优先级
districtExplorer.setAreaNodesForLocating(areaNode);
//清除已有的绘制内容
districtExplorer.clearFeaturePolygons();
//绘制子区域
districtExplorer.renderSubFeatures(areaNode, (feature, i) => {
let fillColor = colors[i % colors.length];
let strokeColor = colors[colors.length - 1 - i % colors.length];
return {
cursor: 'default',
bubble: true,
strokeColor: strokeColor, //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线宽
fillColor: fillColor, //填充色
fillOpacity: 0.5, //填充透明度
};
});
//绘制父区域
districtExplorer.renderParentFeature(areaNode, {
cursor: 'default',
bubble: true,
strokeColor: 'black', //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线宽
fillColor: fillColor2, //填充色
fillOpacity: 0.5, //填充透明度
});
// 更新地图视野以适合区划面
that.self.setFitView(districtExplorer.getAllFeaturePolygons());
});
});
districtExplorer.on('outsideClick', (e) => {
setData && setData.call(component);
let adcode = 310000
districtExplorer.loadAreaNode(adcode, (error, areaNode) => {
//设置定位节点,支持鼠标位置识别
//注意节点的顺序,前面的高优先级
districtExplorer.setAreaNodesForLocating(areaNode);
//清除已有的绘制内容
districtExplorer.clearFeaturePolygons();
//绘制子区域
districtExplorer.renderSubFeatures(areaNode, (feature, i) => {
let fillColor = colors[i % colors.length];
let strokeColor = colors[colors.length - 1 - i % colors.length];
return {
cursor: 'default',
bubble: true,
strokeColor: strokeColor, //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线宽
fillColor: fillColor, //填充色
fillOpacity: 0.5, //填充透明度
};
});
//绘制父区域
districtExplorer.renderParentFeature(areaNode, {
cursor: 'default',
bubble: true,
strokeColor: 'black', //线颜色
strokeOpacity: 1, //线透明度
strokeWeight: 1, //线宽
fillColor: null, //填充色
fillOpacity: 0.5, //填充透明度
});
// 更新地图视野以适合区划面
that.self.setFitView(districtExplorer.getAllFeaturePolygons());
});
})
}
}); //end
}
}
export class GaoDePixel extends GaodeBasic implements IPixel {
constructor(x: number, y: number) {
super();
this.x = x;
this.y = y;
this.self = new AMap.Pixel(x, y);
}
getArray(): number[] {
return [this.x, this.y];
}
x: number;
y: number;
}
export class GaoDeMarker extends GaodeBasic implements IMarker {
constructor(options: IMarkOptions) {
super();
let conf = MapTools.ExplicitConvert(options);
this.self = new AMap.Marker(conf);
this._position = this.self._position;
}
getLngLatByMarkerEvent(map: IMap, e: any): ILngLat {
return map.containerToLngLat(e.pixel);
}
setContent(html: string) {
return this.self.setContent(html)
}
setPosition(x: ILngLat | number[]) {
x = (x as ILngLat).getArray == undefined ? x : (x as ILngLat).getArray();
return this.self.setPosition(x)
}
_position: number[]
setMap() {
return this.self.setMap(null)
}
get id(): string {
return this.self.id;
}
set id(str: string) {
this.self.id = str;
}
on(eventName: string, callback: Function): void {
return this.self.on(eventName, callback);
}
}
export class GaoDeMarkerCluster extends GaodeBasic implements IMarkerCluster {
constructor(map: IMap, list: Object[], options: any) {
super();
let conf = MapTools.ExplicitConvert(options);
AMap.plugin('AMap.MarkerClusterer', () => {
this.self = new AMap.MarkerCluster(map.self, list, conf)
});
}
on(eventName: string, callback: Function): void {
this.self.on(eventName, callback);
}
setData(list: any[]) {
this.self.setData(list)
}
}
export class GaoDeLngLat extends GaodeBasic implements ILngLat {
constructor(x: number, y: number, me?: any) {
super();
if (me == undefined)
this.self = new AMap.LngLat(x, y);
else
this.self = me;
}
typeName = "LngLat";
get KL(): number {
return this.lng;
}
get kT(): number {
return this.lat;
}
getArray(): number[] {
return [this.lng, this.lat];
}
get lng(): number {
return this.self.lng;
}
get lat(): number {
return this.self.lat;
}
offset(x: number, y: number): ILngLat {
return this.self.offset(x, y)
}
}
export class GaodeLayer extends GaodeBasic implements ILayer {
constructor(options: any) {
super();
this.self = new AMap.createDefaultLayer(options);
}
}
export class GaodeIcon extends GaodeBasic implements IIcon {
constructor(options: IIconOptions) {
super();
options.size = options.size.self
options.imageSize = options.imageSize.self
this.self = new AMap.Icon(options);
}
}
export class GaodeSize extends GaodeBasic implements ISize {
constructor(x: number, y: number) {
super();
this.self = new AMap.Size(x, y);
}
}
export class GaodeTileLayer extends GaodeBasic implements ITileLayer {
constructor() {
super();
}
Satellite() {
this.self = new AMap.TileLayer.Satellite()
return this
}
RoadNet() {
this.self = new AMap.TileLayer.RoadNet()
return this
}
}
export class GaodeDriving extends GaodeBasic implements IDriving {
constructor(options: IDrivingOptions) {
super();
options.map = options.map.self
AMap.plugin('AMap.Driving', () => {
this.self = new AMap.Driving(options)
})
}
search(component: any, posStart: ILngLat, posEnd: ILngLat, callback: DrivingSearchCallback) {
return this.self.search(posStart.getArray(), posEnd.getArray(), (status, result)=>{
callback.call(component,status,result)
})
}
clear() {
return this.self.clear()
}
}
export class GaodeAutocomplete extends GaodeBasic implements IAutocomplete {
private component: any
constructor(options: any, component: any) {
super();
this.component = component
AMap.plugin('AMap.AutoComplete', () => {
this.self = new AMap.Autocomplete(options)
})
}
on(eventName: string, callback: AutocompleteSelectCallback) {
this.self.on(eventName, (event) => {
callback.call(this.component, event)
})
}
search(address: string, callback: AutocompleteSearchCallback) {
this.self.search(address, (status, result) => {
callback.call(this.component, status, result)
})
}
}
export class GaodePlaceSearch extends GaodeBasic implements IPlaceSearch {
private component: any
constructor(component: any) {
super();
this.component = component
AMap.plugin('AMap.PlaceSearch', () => {
this.self = new AMap.PlaceSearch()
})
}
search(text: string, callback: PlaceSearchCallback) {
return this.self.search(text, (status, result) => {
callback.call(this.component, status, result)
})
}
}
export class GaodeMouseTool extends GaodeBasic implements IMouseTool {
constructor(map: IMap) {
super();
AMap.plugin(["AMap.RangingTool", "AMap.MouseTool"], () => {
this.self = new AMap.MouseTool(map.self);
})
}
rule(options: any) {
let conf = MapTools.ExplicitConvert(options);
return this.self.rule(conf)
}
measureArea(options: any) {
return this.self.measureArea(options)
}
close(isTrue: boolean) {
return this.self.close(isTrue)
}
}
export class GaodeInfoWindow extends GaodeBasic implements IInfoWindow {
constructor(options: any) {
super();
options.offset = options.offset.self
this.self = new AMap.InfoWindow(options);
}
open(map: IMap) {
return this.self.open(map.self)
}
listen(html: any, event: string, callback: Function) {
return this.self.listen(html, event, callback)
}
}
export class GaodeCircle extends GaodeBasic implements ICircle {
constructor(options: Object) {
super();
this.self = new AMap.Circle(options);
}
setMap(map: IMap) {
return this.self.setMap(map.self)
}
setCenter(pos: number[]) {
return this.self.setCenter(pos)
}
setRadius(num: number) {
return this.self.setRadius(num)
}
}
export class GaoDeRenderClusterMarker implements IRenderClusterMarker, ISelf {
discriminator: string = "ISelfCombine";
getFirstImages(context: any): string {
return context.data[0].image;
}
contentRender: HtmlRender;
contentNonRender: HtmlRender;
pixelRender: PixelRender;
pixelNonRender: PixelRender;
get self(): any {
return {
renderClusterMarker: (context) => {
context.marker.setContent(this.contentRender(context.count));
context.marker.setOffset(this.pixelRender(context.count).self);
},
renderMarker: (context) => {
context.marker.setContent(this.contentNonRender(this.getFirstImages(context)));
context.marker.setOffset(this.pixelNonRender(context.count).self);
}
};
}
}

910
src/modules/map/declare/keda-map.ts

@ -0,0 +1,910 @@
import { AutocompleteSearch, AutocompleteSearchCallback, AutocompleteSelect, AutocompleteSelectCallback, ClickOptions, DrivingSearchCallback, EventCallback, HtmlRender, IAutocomplete, ICircle, IDriving, IInfoWindow, ILayer, ILngLat, IMap, IMapOptions, IMarker, IMarkerCluster, IMarkOptions, IMouseTool, IPixel, IPlaceSearch, IRenderClusterMarker, ISelf, ITileLayer, MarkerClusterCallback, PixelRender, PlaceSearchCallback } from './map'
import { SearchDownList } from './component/SearchDownListPlugins/SearchDownList';
import { SearchService } from '@src/app/searchComponent.service';
import { HttpClient } from '@angular/common/http';
import * as ObjectID from 'bson-objectid';
import * as global from 'globals';
declare var KMap: any;
class KedaBasic implements ISelf {
self: any;
discriminator: string = "ISelf";
}
const cityPosition: number[] = [121.469167918, 31.232262275]; //上海市 坐标
const beforCity: string = "上海市"; //当前城市
const cityCode: string = "310000"; //当前城市 行政编码
export class KeDaMap extends KedaBasic implements IMap {
public isLoadEnd:boolean = false
public LoadedCallback:Function[] = [];
constructor(container: string, options: IMapOptions) { //地图初始化
super();
let that = this
let opt = Object.assign({}, { containerId: container }, options) as any;
opt.configUrl = "/assets/kmap/Kmap.config.json";
opt.targetCoordinateType = "WGS84";
opt.center = cityPosition;
opt.zoom === undefined ? opt.zoom = 9 : opt.zoom = opt.zoom - 2
if (opt.mapStyle && opt.mapStyle == 'amap://styles/grey') {
opt.solution = '8888'
}
let mapLayer = function () {
if (opt.viewMode && opt.viewMode == "3D") {
let data = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: cityPosition
},
properties: { height: 30 }
}
]
};
that.self.add3DLayer({ data: data });
}
that.isLoadEnd = true
that.LoadedCallback.forEach(i=>{
try{
i();
}catch(e) {
console.log(e,'错误')
}
});
that.LoadedCallback = []
}
opt.onLoadMap = mapLayer
this.self = new KMap(opt);
}
containerToLngLat(e: IPixel): ILngLat {
let d = null;
this.self.getGeoPointByPixel({
ePoint: e.self,
callback: (e) => {
d = new KeDaLngLat(e.data.lng, e.data.lat);
}
})
return d;
}
setAdministrativeAreaStyle(component: any, getData?: Function, setData?: Function) { //自定义 行政区划 样式
let _this =this;
if(!this.isLoadEnd){
this.LoadedCallback.push(
()=>_this.setAdministrativeAreaStyle(component,getData,setData)
);
return;
}
let beforeCode:string = cityCode //当前 城市行政编码
let setTime //延时器
let initMap = ()=>{ //绘制地图
this.self.getGeometryByAdminCode({
code: beforeCode,
callback: (res)=> {
this.self.highlightPolygon({
color: 'rgba(0,102,255,0.5)',
area: res.data
});
}
});
} //function
let clickMap = (e)=>{ //点击地图
_this.self.getAdminInfoByPoint({
point: [e.lnglat.lng, e.lnglat.lat],
callback: (res)=>{
if (res.status === 10) {
console.log(res.data,'当前点击行政区域')
if (res.data.adminId != beforeCode && res.data.parentId == cityCode) { //当前点击位置已改动
_this.self.clear()
window.clearTimeout(setTime)
beforeCode = (res.data.adminId).toString()
setTime = window.setTimeout(()=>{ initMap() },100)
let name = { properties:{name: res.data.nameZh } }
getData && getData.call(component,name);
return
} else if (res.data.parentId != cityCode) {
_this.self.clear()
window.clearTimeout(setTime)
beforeCode = cityCode
setTime = window.setTimeout(()=>{ initMap() },100)
setData && setData.call(component);
}
} else {
if (beforeCode != cityCode) {
_this.self.clear()
window.clearTimeout(setTime)
beforeCode = cityCode
setTime = window.setTimeout(()=>{ initMap() },100)
setData && setData.call(component);
}
}
}
});
}
initMap()
let level = Number(sessionStorage.getItem("level"))
if (level < 3) {
this.on("click",clickMap,this);
}
}
clearMap() {
this.self.clear()
}
distance(a: number[], b: number[]) {
let num
this.self.distancePoints({
startPoint: a,
endPoint: b,
units: "meters",
callback: (res) => { num = res.data }
})
return num
}
setZoomAndCenter(zoom: number, pos: number[]) {
this.self.flyTo({
zoom: zoom,
point: pos,
});
}
getBounds() {
let bounds = {
northEast: null,
southWest: null
}
this.self.getBounds({
callback: (res) => {
bounds.northEast = new KeDaLngLat(res.data[0][0],res.data[0][1])
bounds.southWest = new KeDaLngLat(res.data[1][0],res.data[1][1])
}
})
return bounds
}
add(obj: any) {
let _this =this;
if(!this.isLoadEnd){
this.LoadedCallback.push(
()=>_this.add(obj)
);
return;
}
if (obj && obj.typeName === "KeDaMarker") {
let _marker = (obj as KeDaMarker);
_marker.map = this;
this.self.addCustomOverlay(_marker.self)
} else if (obj == "卫星图层") {
this.self.setImageLayer({ display: true })
} else if (obj == "路网图层") {
this.self.setMapStyle({ solution: '8888' });
}
}
remove(obj: any) {
if (obj && obj.typeName === "KeDaMarker") {
obj.KedaMarkerID && this.self.removeCustomOverlayById({ id: obj.KedaMarkerID })
} else if (obj && obj.typeName === "KeDaInfoWindow") {
this.self.removeAllPopups()
} else if (obj && obj.typeName === "KeDaCircle") {
obj.id && this.self.removeLayer({ layerId: obj.id })
} else if (obj == "卫星图层") {
this.self.setImageLayer({ display: false })
} else if (obj == "路网图层") {
this.self.setMapStyle({ solution: '9999' });
}
}
setCity(city: string) {
let that = this
if (city.includes("上海") && this.isLoadEnd) {
that.self.flyTo({
zoom: 9,
point: cityPosition
});
}
}
getCity(callback: Function) {
let autoOptions = { city: "上海" }
return callback(autoOptions)
}
setZoom(zoom: number) {
this.self.zoomTo({
zoom: zoom
});
}
getZoom(): number {
let num
this.self.getZoom({
callback: (e) => {
num = e.data;
}
})
return num
}
setCenter(pos: number[] | ILngLat) {
let _this =this;
if(!this.isLoadEnd){
this.LoadedCallback.push(
()=>_this.setCenter(pos)
);
return;
}
let position = []
if (pos instanceof Array) {
position = pos
} else {
position = pos.getArray();
}
this.self.flyTo({ point: position })
}
getCenter() {
let center
this.self.getCenter({
callback: function (res) {
center = res.data
}
});
return center
}
on(eventName: string, callback: EventCallback, component?: any) {
let _this =this;
if(!this.isLoadEnd){
this.LoadedCallback.push(
()=>_this.on(eventName,callback,component)
);
return;
}
let eventMapProfile = {
complete: "load",
click: "click",
rightclick: "contextmenu"
};
if (eventName == "click") {
this.self.addEventOnMap({event: "click",
handler: (res)=>{
let event = {
lnglat: new KeDaLngLat(res.lngLat.lng,res.lngLat.lat),
pixel: new KeDaPixel(res.point.x,res.point.y),
type: res.type,
target: { id:null } //TODO
}
callback.call(component,event);
}
});
} else if (eventName == "complete") {
callback.call(component,null);
} else {
this.self.addEventOnMap({
event: eventMapProfile[eventName],
handler: callback
});
}
}
}
export class KeDaPixel extends KedaBasic implements IPixel {
constructor(x: number, y: number) {
super();
this.x = x;
this.y = y;
this.self = [x, y];
}
getArray(): number[] {
return this.self;
}
x: number;
y: number;
}
export class KeDaMarker extends KedaBasic implements IMarker {
public map: KeDaMap;
public KedaMarkerID:String;
public typeName: string = "KeDaMarker";
private html:string = '<img class="KedaPosImg" src="/assets/images/dingwei.png">'
constructor(options: IMarkOptions) {
super();
let pos = []
if (options.position instanceof Array) {
pos = options.position
} else {
pos = options.position.getArray()
}
let elementHtml = document.createElement('div')
elementHtml.innerHTML = options.content? options.content : this.html
let marker = {
point: pos,
//anchor: 'bottom', //TODO
//offset: options.offset? options.offset.self : [0,0], //TODO
element: elementHtml.firstElementChild,
ended: (res) => {
this.KedaMarkerID = res.data;
if (options.draggable) { //启用拖拽功能
this.map.self.setCustomOverlayDraggable({
id: this.KedaMarkerID,
draggable: true,
})
this.map.self.addEventOnCustomOverlays({
selector: `#${this.KedaMarkerID}`,
event: 'dragend',
});
}
this.startBindEvent();
}
};
this.self = marker;
this._position = pos
if (options.map) {
this.map = options.map as KeDaMap
this.map.self.addCustomOverlay(this.self);
}
}
getLngLatByMarkerEvent(map:IMap,e: any): ILngLat {
return e.lnglat;
}
_position: number[];
setContent(html: string) { //marker 添加 DOM元素
this.map.self.setCustomOverlayProperty({
type: 'id',
id: this.KedaMarkerID,
element: html,
})
}
setPosition(x: ILngLat | number[]) {
x = (x as ILngLat).getArray == undefined ? x : (x as ILngLat).getArray();
this.map.self.setCustomOverlayProperty({
type: 'id',
id: this.KedaMarkerID,
point: x
})
}
setMap() {
this.map.self.removeCustomOverlayById({ id: this.KedaMarkerID })
}
get id(): string {
return this.self.id
}
set id(str: string) {
this.self.id = str
}
public bindObj = []; // event
on(eventName: string, callback: EventCallback, component?: any) {
this.bindObj.push({
eventName: eventName,
callback: callback,
component: component,
});
this.startBindEvent();
}
startBindEvent() {
let _this =this;
if (this.map !== undefined) {
this.bindObj.forEach((item, index) => {
if (item.eventName.includes('drag')) {
this.map.self.setCustomOverlayDraggable({
id: this.KedaMarkerID,
draggable: true,
})
}
this.map.self.addEventOnCustomOverlays({
selector: `#${this.KedaMarkerID}`,
event: item.eventName,
handler: (res) =>{
this.map.self.getOverlayById({
id: this.KedaMarkerID,
callback: (p)=>{
let point = p.data.point;
let event
if (res.lngLat!=undefined && res.point!=undefined) {
event = {
lnglat: new KeDaLngLat(point.lng,point.lat),
pixel: [0,0],//科达覆盖物所用的div坐标为center,儿我们的div正好近似正方形,所以不用偏移
type: res.type,
target: { id:this.self.id || null },
_target:res.target
}
} else {
event = {
lnglat: new KeDaLngLat(point.lng,point.lat),
target: { id:this.self.id || null }
}
}
item.callback.call(item.component,event)
}
})
}
});
})
this.bindObj = [];
}
}
}
export class KeDaLngLat extends KedaBasic implements ILngLat {
constructor(lng: number, lat: number) {
super();
this.lng = lng
this.lat = lat
this.self = this;
}
offset(x: number, y: number): ILngLat {
return x = 2 * Math.asin(Math.sin(Math.round(x) / 12756274) / Math.cos(this.kT * Math.PI / 180)),
x = this.KL + 180 * x / Math.PI,
y = 2 * Math.asin(Math.round(y) / 12756274),
new KeDaLngLat(x, y);
}
typeName = "LngLat";
lng: number;
lat: number;
get KL(): number {
return this.lng;
}
get kT(): number {
return this.lat;
}
getArray(): number[] {
return [this.lng, this.lat];
}
}
export class KedaDriving extends KedaBasic implements IDriving { //路线导航
public map: KeDaMap;
public policy: number = 0; // 0:快捷模式, 4:躲避拥堵
public id: string;
constructor(options: any) {
super();
this.map = options.map as KeDaMap
options.policy === undefined ? this.policy = 0 : this.policy = options.policy
}
search(component: any, posStart: ILngLat, posEnd: ILngLat, callback: DrivingSearchCallback) {
let params = {
startPoint: posStart.getArray(),
endPoint: posEnd.getArray(),
error: () => { alert('路线规划失败!') },
ended: (res) => {
console.log(res.data,'路径规划')
this.id = res.data
let router = { routes:[] }
callback.call(component,'complete',router)
}
}
if (this.map.isLoadEnd) { //map加载完毕
if (this.policy === 0) { //快捷模式
this.map.self.createMinDistanceRoutePlanning(params)
} else { //躲避拥堵
this.map.self.createMinTimeRoutePlanning(params)
}
} else {
let _this =this;
this.map.LoadedCallback.push(
()=>_this.search(component,posStart,posEnd,callback)
);
}
}
clear() {
this.id? this.map.self.removeRoutePlanning({ id: this.id }) : null
}
}
export class KedaAutocomplete extends KedaBasic implements IAutocomplete { //Autocomplete 关键字搜索
private component: any;
private searchDownList: SearchDownList;
private $input: any;
constructor(options: any, component: any) {
super();
this.component = component
if (options && options.input != undefined) { //绑定input框 搜索事件
this.searchDownList = global.injector.get<SearchService>(SearchService).appendComponentToBody(SearchDownList).instance;
this.$input = document.getElementById(options.input);
this.searchDownList.init(this.$input)
this.$input.oninput = (e) =>{ //监听 input事件
(this.component.map as KeDaMap).self.queryInfoByType({
code: cityCode,
keyword: this.$input.value,
maxCount: 10,
searchType: [],
callback: (res) => {
let list = res.data
this.searchDownList.searchList = list || []
}
}) // search
}
}
}
on(eventName: string, callback: AutocompleteSelectCallback) {
this.searchDownList.setClickHander((e:any) => {
let a = {
id : e.id,
name : e.name,
adcode : e.adminId,
district : e.address,
location : new KeDaLngLat(e.locationpoint[0],e.locationpoint[1]),
type : 'point',
poi: { location : new KeDaLngLat(e.locationpoint[0],e.locationpoint[1]) }
}
callback.call(this.component,a);
});
}
search(address: string, callback: AutocompleteSearchCallback) {
(this.component.map as KeDaMap).self.queryInfoByType({
code: cityCode,
keyword: address,
maxCount: 10,
searchType: [],
callback: (res:any) => {
let list = { tips:[] };
res.data.forEach(item => {
let a = {
id : item.id,
name : item.name,
adcode : item.adminId,
district : item.address,
location : new KeDaLngLat(item.locationpoint[0],item.locationpoint[1]),
type : 'point',
poi: { location : new KeDaLngLat(item.locationpoint[0],item.locationpoint[1]) }
}
list.tips.push(a);
});
callback.call(this.component,'complete',list);
}
})
}
}
export class KedaPlaceSearch extends KedaBasic implements IPlaceSearch { //PlaceSearch 关键字搜索
private component: any
constructor(component: any) {
super();
this.component = component
}
search(address: string, callback: PlaceSearchCallback) {
(this.component.map as KeDaMap).self.queryInfoByType({
code: cityCode,
keyword: address,
maxCount: 10,
searchType: [],
callback: (res:any) => {
let list = { info:'OK', poiList:{ posi:[] } };
res.data.forEach(item => {
let a = {
id : item.id,
name : item.name,
adcode : item.adminId,
district : item.address,
location : new KeDaLngLat(item.locationpoint[0],item.locationpoint[1]),
type : 'point',
poi: { location : new KeDaLngLat(item.locationpoint[0],item.locationpoint[1]) }
}
list.poiList.posi.push(a);
});
callback.call(this.component,'complete',list);
}
})
}
}
export class KedaCircle extends KedaBasic implements ICircle { //圆形 图层
public typeName: string = "KeDaCircle";
public id: string;
constructor(options: any) {
super();
let circle = {
data: {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: cityPosition
},
properties: { id: ObjectID.default.generate() }
}
]
},
defaultStyles: {
"line-dasharray": options.strokeDasharray,
"line-opacity": options.strokeOpacity,
"fill-color": options.fillColor,
"fill-opacity": options.fillOpacity,
},
radius: 0,
draggable: false,
updateHandler: (res) => { },
end: (res) => { this.id = res }
}
this.self = circle
}
setRadius(num: number) { //设置圆的半径
this.self.radius = num / 1000
}
setCenter(pos: number[]) {//设置圆的中心
this.self.center = pos
}
setMap(map: KeDaMap) {//把圆添加到 map
if (map.isLoadEnd) {
this.self.radius != 0 && map.self.addGeometryCircleLayer(this.self)
} else {
let _this =this;
map.LoadedCallback.push(
()=>_this.setMap(map)
);
}
}
}
export class KedaMarkerCluster extends KedaBasic implements IMarkerCluster { //Marker 聚合物
public map:KeDaMap
public id:string
private LoadedCallback:Function[] = []
public markerList:any[] = []
constructor(map: IMap, list: Object[], options: any) {
super();
this.map = map as KeDaMap;
list.forEach((item:any)=>{
let elementHtml = document.createElement('div')
elementHtml.innerHTML = `<img class="KedaPosIcon" src="${item.image}">`
let marker = {
point: item.lnglat,
element: elementHtml.firstElementChild,
customProps: item.data,
}
this.markerList.push(marker)
})
if (this.markerList.length) { //有聚合物时
}
// let http:HttpClient = global.injector.get<HttpClient>(HttpClient)
// http.get(`http://10.14.183.81/kiop-web/static/autoGroup/2.19.0.kd/assets/json/buildData.json`).subscribe(data=>{
// console.log(data)
// })
//覆盖物聚合
// this.map.self.addOverlayLayer({
// serviceName: 'service_tzn_test3', //业务图层类型
// clustered: true, //是否聚合
// defaultIcon: 'icon-policeman-1',//雪碧图名称
// clusteredMarkerTemplate: `'<div style="background-color: lightgrey;padding: 4px;border-radius: 3px">' +
// '{{IMGTAG}}' +</div>`,
// singleMarkerTemplate: {
// default: '<div style="background-color: red;padding: 2px;border-radius: 3px">' +
// '{{IMGTAG}}' + '</div>',
// filters: [
// {
// template: '<div style="background-color: red;padding: 2px;border-radius: 3px">' +
// '{{IMGTAG}}' +
// '</div>',
// icon: 'icon-policeman-1',
// //status === 1 的数据,将显示为markerHtml的marker样式
// match: [{
// key: 'status',
// value: 1
// }]
// },
// ]
// },
// ended: function (res) {
// console.log(res,'覆盖物聚合·')
// this.id = res.data
// this.LoadedCallback.forEach(i=>{
// try{
// i();
// }catch(e) {
// console.log(e,'错误')
// }
// });
// this.LoadedCallback = []
// }
// })
}
on(eventName: string, callback: MarkerClusterCallback, component?: any): void {
let _this =this;
if(!this.id){
this.LoadedCallback.push(
()=>_this.on(eventName,callback,component)
);
return;
}
}
setData(list: any[]) {
if (!list.length && this.id) {
}
}
}
export class KedaRenderClusterMarkerr extends KedaBasic implements IRenderClusterMarker { //Marker 聚合物 配置项
discriminator: string = "ISelfCombine";
constructor() {
super();
}
getFirstImages(context: any): string {
return context.data[0].image;
}
contentRender: HtmlRender;
contentNonRender: HtmlRender;
pixelRender: PixelRender;
pixelNonRender: PixelRender;
}
export class KedaInfoWindow extends KedaBasic implements IInfoWindow { //信息窗体
public typeName: string = "KeDaInfoWindow";
constructor(options) {
super();
let opt = {
htmlText: options.content,
// offset: options.offset.self,
anchor: 'bottom',
point: options.position,
closeButton: true,
}
this.self = opt
}
open(map: IMap) {
map.self.addPopup(this.self);
}
listen(html: any, event: string, callback: Function) {
html.addEventListener(event, callback)
}
}
export class KedaLayer extends KedaBasic implements ILayer { //mapInit 配置项
constructor(options: any) {
super();
}
}
export class KedaTileLayer extends KedaBasic implements ITileLayer { //图层切换
constructor() {
super();
}
Satellite() { //卫星图层
return "卫星图层"
}
RoadNet() { //路网图层
return "路网图层"
}
}
export class KedaMouseTool extends KedaBasic implements IMouseTool { //地图工具
constructor(map: IMap) {
super();
this.self = map.self
}
layerIds = [];
layerIdAreas = [];
rule(options: any) {
let that = this
this.self.measureDistance({
units: 'kilometers',
callback: (result) => {
var startText, sClass = that.self.mapType === 'AG' ? 'ag-popup-tools' : 'mm-popup-tools';
var result = result.data;
if (!result.isEnd) {
if (result.isStart) {
that.self.addTexts({
points: [{
point: result.point,
htmlText: '起点',
class: sClass
}],
anchor: 'left',
ended: function (res) {
that.layerIds.push(res.data);
startText = res.data;
}
});
} else {
that.self.addTexts({
points: [{
point: result.point,
htmlText: result.distance.toFixed(4) + 'km',
class: sClass
}],
anchor: 'left',
ended: function (res) {
that.layerIds.push(res.data);
}
});
}
} else {
if (result.index >= 1) {
if (result.isFailure) {
that.layerIds.forEach((layerId) => {
that.self.removeTextsByType({
textType: layerId
});
});
return;
}
that.layerIds.push(result.layerId);
if (that.self.mapType === 'BM') {
that.self.addTexts({
points: [{
point: result.point,
htmlText: '总距离:' + result.distance.toFixed(4) +
'km',
class: sClass
}],
anchor: 'left',
ended: function (res) {
that.layerIds.push(res.data);
}
});
}
} else {
that.layerIds.forEach((layerId) => {
that.self.removeTextsByType({
textType: layerId
});
});
}
}
}
});
}
measureArea(options: any) {
let that = this
this.self.measureArea({
units: 'meters',
callback: (result) => {
var sClass = that.self.mapType === 'AG' ? 'ag-popup-tools' : 'mm-popup-tools';
var result = result.data;
if (!result.isEnd) {
if (result.index >= 2) {
that.self.addTexts({
points: [{
point: result.point,
htmlText: result.area + '平方米',
class: sClass
}],
anchor: 'left',
ended: function (res) {
that.layerIdAreas.push(res.data);
}
});
}
} else {
if (result.index >= 2) {
if (result.isFailure) {
that.layerIdAreas.forEach((layerId) => {
that.self.removeTextsByType({
textType: layerId
});
});
return;
}
that.layerIdAreas.push(result.layerId);
if (that.self.mapType === 'BM') {
that.self.addTexts({
points: [{
point: result.point,
htmlText: '总面积:' + result.area + '平方米',
class: sClass
}],
anchor: 'left',
ended: function (res) {
that.layerIdAreas.push(res.data);
}
});
}
}
}
}
});
}
close(isTrue: boolean) {
if (isTrue) {
this.self.clear();
for (var i in this.layerIds) {
this.self.removeTextsByType({
textType: this.layerIds[i]
});
}
for (var i in this.layerIdAreas) {
this.self.removeTextsByType({
textType: this.layerIdAreas[i]
});
}
this.layerIdAreas = [];
this.layerIds = [];
}
}
}

43
src/modules/map/declare/map-tools.ts

@ -0,0 +1,43 @@
export default class MapTools {
//显式转换
public static ExplicitConvert(data: any): any {
if (data == null) {
return
}
let obj = Object.assign({}, data);
let convert = (obj: any, data: string) => {
if (!obj[data]) return;
if (obj[data].discriminator === "ISelf") {
obj[data] = obj[data].self;
} else if (obj[data].discriminator === "ISelfCombine") {
Object.assign(obj, obj[data].self);
}
}
let process = (obj: any, deep: number = 0) => {
try {
deep++;
if (deep >= 4) return;
if (obj == undefined) return;
if (!(obj instanceof Object)) return;
for (var name in obj) {
if (obj[name] instanceof Array) {
for (var j in obj[name]) {
convert(obj[name], j);
process(obj[name][j], deep);
}
continue;
}
convert(obj, name);
process(obj[name], deep);
}
} catch (e) {
console.log(e);
debugger
}
}
process(obj);
return obj;
}
}

200
src/modules/map/declare/map.d.ts vendored

@ -0,0 +1,200 @@
export interface ISelf {
self: any;
discriminator: string;
}
export class ClickOptions {
lnglat: ILngLat
pixel: IPixel
type: string
target: { id:string }
}
type EventCallback = (event?:ClickOptions)=>void;
export interface IMap extends ISelf {
on(eventName: string, callback: EventCallback, component?: any);
add(obj: IMarker|ITileLayer|any);
remove(obj: IMarker|ITileLayer|any);
clearMap();
containerToLngLat(e:IPixel): ILngLat; //地图容器像素坐标转经纬度
setCity(city: string);
getCity(callback: Function): any;
setZoom(zoom: number);
setZoomAndCenter(zoom: number, pos: number[]);
getZoom(): number;
setCenter(pos: number[]|ILngLat);
getCenter(): ILngLat;
getBounds(): any;
distance(a:number[],b:number[]): any;
setAdministrativeAreaStyle(component:any,getData?:Function,setData?:Function): any; //自定义 行政区划 样式
}
export interface IMapOptions {
zoom?: number;
zooms?: number[];
}
export interface IMarker extends ISelf {
id: string;
_position:number[];
on(eventName: string, callback: EventCallback, component?: any);
setPosition(x:ILngLat|number[])
setContent(html:string)
setMap();
getLngLatByMarkerEvent(map:IMap,e:any):ILngLat;
}
export class MarkerClusterOptions { //聚合物 click 数据类型
cluster:any[]
clusterData:any[]
lnglat:ILngLat
target:any
markers:IMarker[]
}
type MarkerClusterCallback = (event:MarkerClusterOptions)=>void;
export interface IMarkerCluster extends ISelf {
on(eventName: string, callback: MarkerClusterCallback, component?: any): void;
setData(list: any[]);
}
type HtmlRender = (...args) => string | HTMLElement;
type PixelRender = (...args) => IPixel;
export interface IRenderClusterMarker {
getFirstImages(context: any): string;
contentRender: HtmlRender;
contentNonRender: HtmlRender;
pixelRender: PixelRender;
pixelNonRender: PixelRender;
}
export class IMarkOptions {
position?: ILngLat | number[];
content?: string;
offset?: IPixel;
map?: IMap;
draggable?: boolean
}
export interface IPixel extends ISelf {
x:number
y:number
getArray():number[]
}
export interface ILngLat extends ISelf {
typeName:string
lng: number
lat: number
KL:number
kT:number
offset(x: number, y: number):ILngLat
getArray():number[]
}
export interface ILayer extends ISelf {
}
export interface IIconOptions {
size?: ISize;
imageSize?: ISize;
image?: string;
}
export interface IIcon extends ISelf {
}
export interface ISize extends ISelf {
}
export interface ITileLayer extends ISelf {
Satellite();
RoadNet();
}
export interface IDrivingOptions {
map?: IMap;
policy?: string
showTraffic?: boolean
isOutline?: boolean
}
export class DrivingSearch { //Driving Search() 数据类型
distance: number
time: number
tolls_distance: number
steps: DrivingSearchSteps[]
routes:any[] //伪代码
}
export class DrivingSearchSteps { //Driving Search() Steps 数据类型
instruction:string
orientation:string
road: string
distance: number
time: number
tolls_distance: number
}
type DrivingSearchCallback = (status:string,searchData:DrivingSearch)=>void;
export interface IDriving extends ISelf {
clear();
search(component: any,posStart: ILngLat, posEnd: ILngLat, callback:DrivingSearchCallback);
}
export class AutocompleteSearch { //Autocomplete Search() 数据类型
info: string
count: number
tips: AutocompleteSelect[]
}
export class AutocompleteSelect { //GaoDe POI 数据类型
id: string
name: string
adcode: string
district: string
location: ILngLat
type: string
poi:{ location: ILngLat }
}
type AutocompleteSearchCallback = (status:string,searchData:AutocompleteSearch)=>void;
type AutocompleteSelectCallback = (event:AutocompleteSelect)=>void;
export interface IAutocomplete extends ISelf {
search(address: string,callback: AutocompleteSearchCallback)
on(eventName: string, callback: AutocompleteSelectCallback)
}
export class PlaceSearchSearch { //PlaceSearch Search() 数据类型
info: string
poiList: PlaceSearchSearchTips
}
export class PlaceSearchSearchTips { //PlaceSearch Search() 数据类型
pois:AutocompleteSelect[]
pageIndex:number
pageSize:number
count:number
}
type PlaceSearchCallback = (status:string,searchData:PlaceSearchSearch)=>void;
export interface IPlaceSearch extends ISelf {
search(text:string, callback: PlaceSearchCallback);
}
export interface IMouseTool extends ISelf {
rule(options:any)
measureArea(options:any)
close(isTrue:boolean)
}
export interface IInfoWindow extends ISelf {
open(map:IMap);
listen(html:any, event:string, callback: Function)
}
export interface ICircle extends ISelf {
setRadius(num: number);
setCenter(pos: number[])
setMap(map: IMap)
}

12
src/styles.scss

@ -207,6 +207,18 @@ table td.mat-footer-cell:last-of-type{
--swiper-navigation-size: 26px;/* 设置按钮大小 */ --swiper-navigation-size: 26px;/* 设置按钮大小 */
} }
} }
.KedaPosImg {
width: 30px;
height: 36px;
background-size: 100%;
background: no-repeat center;
}
.KedaPosIcon {
width: 30px;
height: 30px;
background-size: 100%;
background: no-repeat center;
}
//点聚合自定义图片大小 //点聚合自定义图片大小
.clusterImg{ .clusterImg{
width: 30px; width: 30px;

5
tsconfig.json

@ -18,7 +18,10 @@
"lib": [ "lib": [
"es2018", "es2018",
"dom" "dom"
] ],
"paths": {
"@src/*":["src/*"]
}
}, },
"angularCompilerOptions": { "angularCompilerOptions": {
"fullTemplateTypeCheck": true, "fullTemplateTypeCheck": true,

Loading…
Cancel
Save