diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 62ab6f4..a8272e8 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -15,12 +15,12 @@ const routes: Routes = [ { path: 'login', component: LoginComponent }, //登录页 { path: 'register', component: RegisterComponent }, //注册页 { - path: '', component: HomeComponent, children: [ + path: '', component: HomeComponent, canActivate: [AuthGuard], children: [ { path: '', loadChildren: () => import('./pages/pages.module').then(m => m.PagesModule) } ] }, //首页 { - path: '', component: NavigationComponent, children: [ + path: '', component: NavigationComponent, canActivate: [AuthGuard], children: [ { path: 'system', loadChildren: () => import('./system-management/system-management.module').then(m => m.SystemManagementModule) } ] }//系统管理 diff --git a/src/app/app.component.html b/src/app/app.component.html index 0dbe5df..90c6b64 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,19 +1 @@ - - - - - -
-
- -
-
- 您有一条新的预警提醒! - 这是详细描述这是详细描述这是详细描述... -
-
-
- - -
-
+ \ No newline at end of file diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 6104104..2edc3c9 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,13 +1,10 @@ import { Component, TemplateRef, ViewChild } from '@angular/core'; import { HttpClient } from '@angular/common/http' -import { Data } from './interface' import { Router, ActivatedRoute } from '@angular/router' import { CacheTokenService } from './service/cache-token.service'//引入服务 import { CookieService } from 'ngx-cookie-service'; import "reflect-metadata"; import { NzNotificationService } from 'ng-zorro-antd/notification'; - - @Component({ selector: 'app-root', templateUrl: './app.component.html', @@ -17,7 +14,7 @@ export class AppComponent { @ViewChild(TemplateRef, { static: false }) template?: TemplateRef<{}>; - constructor(private http: HttpClient, private router: Router, public token: CacheTokenService, private cookieService: CookieService,private notificationService: NzNotificationService) { } + constructor(private http: HttpClient, private router: Router, public token: CacheTokenService, private cookieService: CookieService, private notificationService: NzNotificationService) { } ngOnInit(): void { // var token = this.cookieService.get("token") @@ -30,11 +27,7 @@ export class AppComponent { // this.token.startUp() // }) // } - } - receiptOfNotification() { - this.notificationService.template(this.template!, { nzPlacement: 'bottomRight', nzClass: 'receiptOfNotification',nzDuration: 0 }); - } - + } diff --git a/src/app/auth.guard.ts b/src/app/auth.guard.ts index ac887e4..af4d216 100644 --- a/src/app/auth.guard.ts +++ b/src/app/auth.guard.ts @@ -14,17 +14,17 @@ export class AuthGuard implements CanActivate { // 路由守卫 canActivate(next: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean { - console.log('路由守卫',next.data) - if(next.data.permission == 'xxxx'){ - return true; - } - // return this.checkLogin(); + // console.log('路由守卫',next.data) + // if(next.data.permission == 'xxxx'){ + // return true; + // } + return this.checkLogin(); } checkLogin(): boolean { - + console.log('xxxxxxxxxxxx') // 判断本地有没有token - const token = this.cookieService.get("token"); + const token = this.cookieService.get("token") || sessionStorage.getItem('token'); // 如果有token,允许访问 if (token) { return true; } diff --git a/src/app/babylon/view/mark-window/mark-window.ts b/src/app/babylon/view/mark-window/mark-window.ts index c449522..6fcedc9 100644 --- a/src/app/babylon/view/mark-window/mark-window.ts +++ b/src/app/babylon/view/mark-window/mark-window.ts @@ -524,7 +524,7 @@ export class MarkWindow extends UIBase { */ openProperty(markInfo: ModelInfo_mark) { if (markInfo != null) { - //ThreeDimensionalHomeComponent.instance.getSandTableNature(markInfo.markData); + PlanComponent.instance.getSandTableNature(markInfo.markData); } } diff --git a/src/app/pages/criminal-records-admin/criminal-records-admin.component.html b/src/app/pages/criminal-records-admin/criminal-records-admin.component.html index 4783137..03256b2 100644 --- a/src/app/pages/criminal-records-admin/criminal-records-admin.component.html +++ b/src/app/pages/criminal-records-admin/criminal-records-admin.component.html @@ -1,64 +1,65 @@
-
+
@@ -68,7 +69,7 @@
预警事件总数
-
206
+
{{num}}
diff --git a/src/app/pages/criminal-records-admin/criminal-records-admin.component.scss b/src/app/pages/criminal-records-admin/criminal-records-admin.component.scss index 4f9b0d3..2d24701 100644 --- a/src/app/pages/criminal-records-admin/criminal-records-admin.component.scss +++ b/src/app/pages/criminal-records-admin/criminal-records-admin.component.scss @@ -10,7 +10,7 @@ padding: 0 36px; width: 100%; height: 32px; - margin-top: 14px; + margin-bottom: 16px; form { width: 100%; @@ -65,20 +65,21 @@ width: 100%; display: flex; justify-content: center; - + .chartname{ + position: absolute; + left: 20px; + top: 12px; + } .chart { width: 97%; - height: 360px; - border: 0px; - box-shadow: 0 0 26px 0px #1a7fd7 inset; + height: 350px; box-sizing: border-box; - padding: 18px 26px; + padding: 0 10px; display: flex; div { display: flex; flex-direction: column; - span { font-family: titlefont; display: flex; @@ -91,22 +92,18 @@ div { flex: 1; } - - .piechart {} - - .barchart { - // border: 1px solid rgba(145, 204, 255, 0.95); - } + } - .leftbox { width: 360px; position: relative; - + border: 0px; + box-shadow: 0 0 26px 0px #1a7fd7 inset; + margin-right: 16px; .centerContent { position: absolute; top: 42%; - left: 11%; + left: 26%; width: 170px; div { @@ -132,11 +129,12 @@ .rightbox { flex: 1; position: relative; - + border: 0px; + box-shadow: 0 0 26px 0px #1a7fd7 inset; .btnbox { position: absolute; - right: 5px; - top: 5px; + right: 28px; + top: 12px; display: flex; flex-direction: row; z-index: 999; diff --git a/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts b/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts index 63587fa..d76adf5 100644 --- a/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts +++ b/src/app/pages/criminal-records-admin/criminal-records-admin.component.ts @@ -30,8 +30,9 @@ export class CriminalRecordsAdminComponent implements OnInit { { // name: 'Access From', type: 'pie', - radius: [85, 112],//内半径外,外半径 - left: '-30%', + radius: [88, 116],//内半径外,外半径 + left: '0', + top:'8%', avoidLabelOverlap: false,//防止标签重叠策略 label: {//每一个标签外网延伸的引导说明 show: false, @@ -49,26 +50,7 @@ export class CriminalRecordsAdminComponent implements OnInit { } }, data: [ - { value: 26, name: '工作人员倚靠加油机或者立柱1' }, - { value: 86, name: '工作人员倚靠加油机或者立柱2' }, - { value: 34, name: '工作人员倚靠加油机或者立柱3' }, - { value: 55, name: '工作人员倚靠加油机或者立柱4' }, - { value: 60, name: '工作人员倚靠加油机或者立柱5' }, - { value: 26, name: '工作人员倚靠加油机或者立柱6' }, - { value: 86, name: '工作人员倚靠加油机或者立柱7' }, - { value: 34, name: '工作人员倚靠加油机或者立柱8' }, - { value: 55, name: '工作人员倚靠加油机或者立柱9' }, - { value: 60, name: '工作人员倚靠加油机或者立柱10' }, - { value: 26, name: '工作人员倚靠加油机或者立柱11' }, - { value: 86, name: '工作人员倚靠加油机或者立柱12' }, - { value: 34, name: '工作人员倚靠加油机或者立柱13' }, - { value: 55, name: '工作人员倚靠加油机或者立柱14' }, - { value: 60, name: '工作人员倚靠加油机或者立柱15' }, - { value: 26, name: '工作人员倚靠加油机或者立柱16' }, - { value: 86, name: '工作人员倚靠加油机或者立柱17' }, - { value: 34, name: '工作人员倚靠加油机或者立柱18' }, - { value: 55, name: '工作人员倚靠加油机或者立柱19' }, - { value: 60, name: '工作人员倚靠加油机或者立柱20' } + ], tooltip: {//鼠标移入提示 position: 'right', @@ -87,7 +69,7 @@ export class CriminalRecordsAdminComponent implements OnInit { baroption = { xAxis: { type: 'category', - data: this.getThirtyDays(), + data: [], axisLine: { show: false, lineStyle: { @@ -96,7 +78,8 @@ export class CriminalRecordsAdminComponent implements OnInit { }, axisTick: {//刻度线 show: false - } + }, + inverse: true }, yAxis: { type: 'value', @@ -121,7 +104,7 @@ export class CriminalRecordsAdminComponent implements OnInit { }, series: [ { - data: [120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130, 100, 101], + data: [], type: 'bar', itemStyle: { color: { @@ -141,7 +124,7 @@ export class CriminalRecordsAdminComponent implements OnInit { barWidth: '25%' }, { - data: [120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130, 100, 101], + data: [], type: 'line', symbol: 'circle', symbolSize: 8, @@ -160,10 +143,10 @@ export class CriminalRecordsAdminComponent implements OnInit { } ], grid: { - left: '36px', + left: '42px', right: '30px', - bottom: '50px', - top: '45px' + bottom: '38px', + top: '60px' } }; baroption2 = { @@ -173,7 +156,7 @@ export class CriminalRecordsAdminComponent implements OnInit { }, yAxis: { type: 'category', - data: ['北京市第十九加油站1', '北京市第十九加油站2', '北京市第十九加油站3', '北京市第十九加油站4', '北京市第十九加油站5', '北京市第十九加油站6', '北京市第十九加油站7', '北京市第十九加油站8', '北京市第十九加油站9', '北京市第十九加油站10', '北京市第十九加油站11', '北京市第十九加油站12', '北京市第十九加油站', '北京市第十九加油站', '北京市第十九加油站', '北京市第十九加油站', '北京市第十九加油站', '北京市第十九加油站', '北京市第十九加油站', '北京市第十九加油站20', '北京市第十九加油站21', '北京市第十九加油站22', '北京市第十九加油站23'], + data: [], axisLine: { show: false, lineStyle: { @@ -185,8 +168,27 @@ export class CriminalRecordsAdminComponent implements OnInit { }, axisLabel: { formatter: function (value, index) { + let newParamsName = ''; + const paramsNameNumber = value.length; + const provideNumber = 10; + const rowNumber = Math.ceil(paramsNameNumber / provideNumber); + if (paramsNameNumber > provideNumber) { + for (let p = 0; p < rowNumber; p++) { + let tempStr = ''; + const start = p * provideNumber; + const end = start + provideNumber; + if (p == rowNumber - 1) { + tempStr = value.substring(start, paramsNameNumber); + } else { + tempStr = value.substring(start, end) + '\n'; + } + newParamsName += tempStr; + } + } else { + newParamsName = value; + } // 格式化成月/日,只在第一个刻度显示年份 - return '{s|·}' + `{a|${value}}`; + return '{s|·}' + `{a|${newParamsName}}`; }, rich: { a: { @@ -219,7 +221,7 @@ export class CriminalRecordsAdminComponent implements OnInit { formatter: '{c}', offset: [6, 0] }, - data: [40, 36, 30, 25, 19, 15, 14, 11, 10, 8, 40, 36, 30, 25, 19, 15, 14, 11, 10, 8, 1, 2, 3].reverse(), + data: [], type: 'bar', itemStyle: { color: { @@ -244,7 +246,7 @@ export class CriminalRecordsAdminComponent implements OnInit { left: '150px', right: '80px', bottom: '3px', - top: '20px' + top: '36px' }, // dataZoom: [ //Y轴滑动条 // { @@ -278,7 +280,6 @@ export class CriminalRecordsAdminComponent implements OnInit { startdate enddate ngOnInit(): void { - //当前日期 let myDate: any = new Date(); let nowY = myDate.getFullYear(); @@ -309,7 +310,85 @@ export class CriminalRecordsAdminComponent implements OnInit { this.warningType() this.getViolateRecordList() } + //刷新饼图图表数据 + num + echartsData: any + refreshPieData(data) { + //饼图 + let option = this.myChart.getOption(); + var num = 0 + data.pieTop.forEach(element => { + num += element.count + element.name = element.key + element.value = element.count + }); + this.num = num + option.series[0].data = data.pieTop; + this.myChart.setOption(option); + } + //刷新柱状折线图表数据 + refreshBarLineData(data, type) { + console.log('统计图表数据', data) + //柱状图 + let option = this.mybarChart.getOption(); + console.log('柱图option', option) + if (type == 'month') {//近一个月柱状折线图 + option = this.baroption + let monthArr = [] + let valuedata = [] + data.timeTop.forEach(element => { + monthArr.push(moment(element.key).format('MM.DD')) + valuedata.push(element.count) + }); + option.xAxis.data = monthArr + option.series[0].data = valuedata + option.series[1].data = valuedata + } else if (type == 'eventTop') { + option = this.baroption2 + let ydata = [] + let valuedata = [] + data.eventTop.forEach(element => { + ydata.push(element.key) + valuedata.push(element.count) + }); + option.yAxis.data = ydata + option.series.data = valuedata + } else if (type == 'siteTop') { + option = this.baroption2 + let ydata = [] + let valuedata = [] + data.siteTop.forEach(element => { + ydata.push(element.key) + valuedata.push(element.count) + }); + option.yAxis.data = ydata + option.series.data = valuedata + } + this.mybarChart.setOption(option); + } + //获取统计信息 + getAggregations() { + let ViolationIds = [] + if (this.validateForm.value.type) { + this.warningTypesDetails.forEach(item => { + item.id ? ViolationIds.push(item.id) : null + }); + } + let body: any = { + organizationUnitId: JSON.parse(sessionStorage.getItem('userdata')).organization.id, + isContainsChildren: true, + ViolateTime: this.validateForm.value.datePicker ? [moment(this.validateForm.value.datePicker[0]).format('yyyy-MM-DD'), moment(this.validateForm.value.datePicker[1]).format('yyyy-MM-DD')] : null + } + this.validateForm.value.level ? body.level = this.validateForm.value.level : null + this.validateForm.value.site ? body.violateArea = this.validateForm.value.site : null + ViolationIds.length != 0 ? body.violationType = ViolationIds : null + this.http.post('/api/services/app/ViolateRecord/Aggregations', body).subscribe((data: any) => { + this.echartsData = data.result + this.refreshPieData(data.result) + this.refreshBarLineData(this.echartsData, 'month') + }) + } //获得违规记录列表 SkipCount: string = '0' MaxResultCount: string = '50' @@ -340,6 +419,7 @@ export class CriminalRecordsAdminComponent implements OnInit { // this.list = data.result.items this.totalCount = data.result.totalCount console.log('违规记录列表', data) + this.getAggregations() }) } @@ -466,13 +546,25 @@ export class CriminalRecordsAdminComponent implements OnInit { this.mybarChart.dispose() this.mybarChart = echarts.init(document.getElementById('barchart')); if (type == '排名') { - this.mybarChart.setOption(this.baroption2); + console.log(this.selectedRankingType) + if (this.selectedRankingType == '站点排名') { + this.refreshBarLineData(this.echartsData, 'siteTop') + } + if (this.selectedRankingType == '事件排名') { + this.refreshBarLineData(this.echartsData, 'eventTop') + } } else { - this.mybarChart.setOption(this.baroption); + this.refreshBarLineData(this.echartsData, 'month') } } echartClick2(type) { this.selectedRankingType = type + if (this.selectedRankingType == '站点排名') { + this.refreshBarLineData(this.echartsData, 'siteTop') + } + if (this.selectedRankingType == '事件排名') { + this.refreshBarLineData(this.echartsData, 'eventTop') + } } } diff --git a/src/app/pages/criminal-records/criminal-records.component.html b/src/app/pages/criminal-records/criminal-records.component.html index 299ac75..a10f121 100644 --- a/src/app/pages/criminal-records/criminal-records.component.html +++ b/src/app/pages/criminal-records/criminal-records.component.html @@ -1,64 +1,65 @@
-
+
@@ -68,7 +69,7 @@
预警事件总数
-
206
+
{{num}}
diff --git a/src/app/pages/criminal-records/criminal-records.component.scss b/src/app/pages/criminal-records/criminal-records.component.scss index 13599ab..3c005b1 100644 --- a/src/app/pages/criminal-records/criminal-records.component.scss +++ b/src/app/pages/criminal-records/criminal-records.component.scss @@ -10,7 +10,7 @@ padding: 0 36px; width: 100%; height: 32px; - margin-top: 14px; + margin-bottom: 16px; form { width: 100%; @@ -66,14 +66,16 @@ width: 100%; display: flex; justify-content: center; - + .chartname{ + position: absolute; + left: 20px; + top: 12px; + } .chart { width: 97%; - height: 360px; - border: 0px; - box-shadow: 0 0 26px 0px #1a7fd7 inset; + height: 350px; box-sizing: border-box; - padding: 18px 26px; + padding: 0 10px; display: flex; div { @@ -92,22 +94,18 @@ div { flex: 1; } - - .piechart {} - - .barchart { - // border: 1px solid rgba(145, 204, 255, 0.95); - } } .leftbox { width: 360px; position: relative; - + border: 0px; + box-shadow: 0 0 26px 0px #1a7fd7 inset; + margin-right: 16px; .centerContent { position: absolute; top: 42%; - left: 11%; + left: 26%; width: 170px; div { @@ -133,11 +131,12 @@ .rightbox { flex: 1; position: relative; - + border: 0px; + box-shadow: 0 0 26px 0px #1a7fd7 inset; .btnbox { position: absolute; - right: 5px; - top: 5px; + right: 28px; + top: 12px; display: flex; flex-direction: row; z-index: 999; diff --git a/src/app/pages/criminal-records/criminal-records.component.ts b/src/app/pages/criminal-records/criminal-records.component.ts index 5972b59..b9c18f2 100644 --- a/src/app/pages/criminal-records/criminal-records.component.ts +++ b/src/app/pages/criminal-records/criminal-records.component.ts @@ -26,8 +26,9 @@ export class CriminalRecordsComponent implements OnInit { { // name: 'Access From', type: 'pie', - radius: [85, 112],//内半径外,外半径 - left: '-30%', + radius: [88, 116],//内半径外,外半径 + left: '0', + top:'8%', avoidLabelOverlap: false,//防止标签重叠策略 label: {//每一个标签外网延伸的引导说明 show: false, @@ -45,26 +46,6 @@ export class CriminalRecordsComponent implements OnInit { } }, data: [ - { value: 26, name: '工作人员倚靠加油机或者立柱1' }, - { value: 86, name: '工作人员倚靠加油机或者立柱2' }, - { value: 34, name: '工作人员倚靠加油机或者立柱3' }, - { value: 55, name: '工作人员倚靠加油机或者立柱4' }, - { value: 60, name: '工作人员倚靠加油机或者立柱5' }, - { value: 26, name: '工作人员倚靠加油机或者立柱6' }, - { value: 86, name: '工作人员倚靠加油机或者立柱7' }, - { value: 34, name: '工作人员倚靠加油机或者立柱8' }, - { value: 55, name: '工作人员倚靠加油机或者立柱9' }, - { value: 60, name: '工作人员倚靠加油机或者立柱10' }, - { value: 26, name: '工作人员倚靠加油机或者立柱11' }, - { value: 86, name: '工作人员倚靠加油机或者立柱12' }, - { value: 34, name: '工作人员倚靠加油机或者立柱13' }, - { value: 55, name: '工作人员倚靠加油机或者立柱14' }, - { value: 60, name: '工作人员倚靠加油机或者立柱15' }, - { value: 26, name: '工作人员倚靠加油机或者立柱16' }, - { value: 86, name: '工作人员倚靠加油机或者立柱17' }, - { value: 34, name: '工作人员倚靠加油机或者立柱18' }, - { value: 55, name: '工作人员倚靠加油机或者立柱19' }, - { value: 60, name: '工作人员倚靠加油机或者立柱20' } ], tooltip: {//鼠标移入提示 position: 'right', @@ -84,7 +65,7 @@ export class CriminalRecordsComponent implements OnInit { baroption = { xAxis: { type: 'category', - data: this.getThirtyDays(), + data: [], axisLine: { show: false, lineStyle: { @@ -93,7 +74,9 @@ export class CriminalRecordsComponent implements OnInit { }, axisTick: {//刻度线 show: false - } + }, + inverse: true + }, yAxis: { type: 'value', @@ -118,7 +101,7 @@ export class CriminalRecordsComponent implements OnInit { }, series: [ { - data: [120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130, 100, 101], + data: [], type: 'bar', itemStyle: { color: { @@ -138,7 +121,7 @@ export class CriminalRecordsComponent implements OnInit { barWidth: '25%' }, { - data: [120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130, 120, 200, 150, 80, 70, 110, 130, 100, 101], + data: [], type: 'line', symbol: 'circle', symbolSize: 8, @@ -157,10 +140,10 @@ export class CriminalRecordsComponent implements OnInit { } ], grid: { - left: '36px', + left: '42px', right: '30px', - bottom: '50px', - top: '45px' + bottom: '38px', + top: '60px' } }; baroption2 = { @@ -170,7 +153,7 @@ export class CriminalRecordsComponent implements OnInit { }, yAxis: { type: 'category', - data: ['预警事件名', '预警事件名', '预警事件名', '预警事件名', '预警事件名', '预警事件名', '预警事件名', '预警事件名', '预警事件名', '预警事件名'], + data: [], axisLine: { show: false, lineStyle: { @@ -182,8 +165,27 @@ export class CriminalRecordsComponent implements OnInit { }, axisLabel: { formatter: function (value, index) { + let newParamsName = ''; + const paramsNameNumber = value.length; + const provideNumber = 10; + const rowNumber = Math.ceil(paramsNameNumber / provideNumber); + if (paramsNameNumber > provideNumber) { + for (let p = 0; p < rowNumber; p++) { + let tempStr = ''; + const start = p * provideNumber; + const end = start + provideNumber; + if (p == rowNumber - 1) { + tempStr = value.substring(start, paramsNameNumber); + } else { + tempStr = value.substring(start, end) + '\n'; + } + newParamsName += tempStr; + } + } else { + newParamsName = value; + } // 格式化成月/日,只在第一个刻度显示年份 - return '{s|·}' + `{a|${value}}`; + return '{s|·}' + `{a|${newParamsName}}`; }, rich: { a: { @@ -201,8 +203,8 @@ export class CriminalRecordsComponent implements OnInit { shadowColor: "#fff" } } - } - + }, + inverse: true }, series: { @@ -215,7 +217,7 @@ export class CriminalRecordsComponent implements OnInit { formatter: '{c}', offset: [6, 0] }, - data: [40, 36, 30, 25, 19, 15, 14, 11, 10, 8].reverse(), + data: [], type: 'bar', itemStyle: { color: { @@ -237,10 +239,10 @@ export class CriminalRecordsComponent implements OnInit { } , grid: { - left: '100px', - right: '60px', + left: '150px', + right: '80px', bottom: '3px', - top: '20px' + top: '36px' } } getThirtyDays() { @@ -312,6 +314,87 @@ export class CriminalRecordsComponent implements OnInit { this.warningType() this.getViolateRecordList() + + + + } + //刷新饼图图表数据 + num + echartsData: any + refreshPieData(data) { + //饼图 + let option = this.myChart.getOption(); + var num = 0 + data.pieTop.forEach(element => { + num += element.count + element.name = element.key + element.value = element.count + }); + this.num = num + option.series[0].data = data.pieTop; + this.myChart.setOption(option); + } + //刷新柱状折线图表数据 + refreshBarLineData(data, type) { + console.log('统计图表数据', data) + //柱状图 + let option = this.mybarChart.getOption(); + console.log('柱图option', option) + if (type == 'month') {//近一个月柱状折线图 + option = this.baroption + let monthArr = [] + let valuedata = [] + data.timeTop.forEach(element => { + monthArr.push(moment(element.key).format('MM.DD')) + valuedata.push(element.count) + }); + option.xAxis.data = monthArr + option.series[0].data = valuedata + option.series[1].data = valuedata + } else if (type == 'eventTop') { + option = this.baroption2 + let ydata = [] + let valuedata = [] + data.eventTop.forEach(element => { + ydata.push(element.key) + valuedata.push(element.count) + }); + option.yAxis.data = ydata + option.series.data = valuedata + } else if (type == 'siteTop') { + option = this.baroption2 + let ydata = [] + let valuedata = [] + data.siteTop.forEach(element => { + ydata.push(element.key) + valuedata.push(element.count) + }); + option.yAxis.data = ydata + option.series.data = valuedata + } + this.mybarChart.setOption(option); + } + //获取统计信息 + getAggregations() { + let ViolationIds = [] + if (this.validateForm.value.type) { + this.warningTypesDetails.forEach(item => { + item.id ? ViolationIds.push(item.id) : null + }); + } + let body: any = { + organizationUnitId: JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id, + isContainsChildren: true, + ViolateTime: this.validateForm.value.datePicker ? [moment(this.validateForm.value.datePicker[0]).format('yyyy-MM-DD'), moment(this.validateForm.value.datePicker[1]).format('yyyy-MM-DD')] : null + } + this.validateForm.value.level ? body.level = this.validateForm.value.level : null + this.validateForm.value.site ? body.violateArea = this.validateForm.value.site : null + ViolationIds.length != 0 ? body.violationType = ViolationIds : null + this.http.post('/api/services/app/ViolateRecord/Aggregations', body).subscribe((data: any) => { + this.echartsData = data.result + this.refreshPieData(data.result) + this.refreshBarLineData(this.echartsData, 'month') + }) } //获得违规记录列表 @@ -344,6 +427,7 @@ export class CriminalRecordsComponent implements OnInit { // this.list = data.result.items this.totalCount = data.result.totalCount console.log('违规记录列表', data) + this.getAggregations() }) } ngAfterViewInit(): void { @@ -405,9 +489,10 @@ export class CriminalRecordsComponent implements OnInit { this.mybarChart.dispose() this.mybarChart = echarts.init(document.getElementById('barchart')); if (type == '排名') { - this.mybarChart.setOption(this.baroption2); + console.log(this.selectedRankingType) + this.refreshBarLineData(this.echartsData, 'eventTop') } else { - this.mybarChart.setOption(this.baroption); + this.refreshBarLineData(this.echartsData, 'month') } } diff --git a/src/app/pages/home/home.component.html b/src/app/pages/home/home.component.html index 6702563..5594d54 100644 --- a/src/app/pages/home/home.component.html +++ b/src/app/pages/home/home.component.html @@ -1,8 +1,11 @@
-
+
@@ -205,6 +204,35 @@ + + +
+ + 名称 + + + + + + 任务 + + + +
    +
  • {{item.taskName}}
  • +
+
+
+
+ + 备注 + + + + +
+
+
\ No newline at end of file diff --git a/src/app/pages/plan/plan.component.scss b/src/app/pages/plan/plan.component.scss index de97d92..12e7da1 100644 --- a/src/app/pages/plan/plan.component.scss +++ b/src/app/pages/plan/plan.component.scss @@ -362,9 +362,13 @@ } label:nth-child(2){ flex: 1; + display: flex; overflow: hidden; - //.anticon{ font-size: 16px; color: #23D9FF; } - img{ height: 35px; width: auto; vertical-align: top; } + .progress{ + display: flex; + div { flex: 1; line-height: 30px; } + img{ width: 27px; height: 35px; display: block; cursor: pointer; } + } } label:last-child{ width: 15%; diff --git a/src/app/pages/plan/plan.component.ts b/src/app/pages/plan/plan.component.ts index 73877d9..5633852 100644 --- a/src/app/pages/plan/plan.component.ts +++ b/src/app/pages/plan/plan.component.ts @@ -20,7 +20,7 @@ import { NzMessageService } from 'ng-zorro-antd/message'; import { LeftDomainComponent } from '../left-domain/left-domain.component'; import { JYZInfoMoudleType } from 'src/app/babylon/model/data/institution/jyz-show-data'; import { AllMarkData } from 'src/app/babylon/model/data/mark/all-mark-data'; -import { MarkData } from 'src/app/babylon/model/data/mark/mark-data'; +import { MarkData, MarkTask } from 'src/app/babylon/model/data/mark/mark-data'; import { MarkWindow } from 'src/app/babylon/view/mark-window/mark-window'; import { AllMarkPlanData, MarkNodeData, MarkPlanData } from 'src/app/babylon/model/data/mark/mark-plan-data'; @@ -339,6 +339,8 @@ export class PlanComponent implements OnInit { nzCurrent: number = -1; //当前选择 预案节点Index isSuspend: boolean = false; //是否暂停 自动切换节点 timer: any; //定时器 + progressList: number[] = []; //进度条 条/值 + updateTimer: any; //更新进度条定时器 //初始化 应急预案模块 initializePlan() { @@ -346,14 +348,21 @@ export class PlanComponent implements OnInit { this.beforePlanNode = new MarkNodeData(-99, "请选择节点") this.isSuspend = false //初始化暂停状态 window.clearTimeout(this.timer) //清除定时器 + this.progressList = [] + window.clearTimeout(this.updateTimer) //清除定时器 } //公用 切换选中节点 publicToggleNode() { - this.beforePlanNode = this.beforeEmergencyPlan.nodes[this.nzCurrent] - this.leftDomain.selectPlanId = this.beforeEmergencyPlan.id - this.leftDomain.selectNodeId = this.beforePlanNode.id - MarkWindow.instance.selectMarkNode(this.beforeEmergencyPlan.id, this.beforePlanNode.id, false, true) + return new Promise((resolve, reject) => { + this.beforePlanNode = this.beforeEmergencyPlan.nodes[this.nzCurrent] + this.leftDomain.selectPlanId = this.beforeEmergencyPlan.id + this.leftDomain.selectNodeId = this.beforePlanNode.id + MarkWindow.instance.selectMarkNode(this.beforeEmergencyPlan.id, this.beforePlanNode.id, false, true) + this.beforePlanNode = MarkWindow.instance.currentMarkNodeInfo.nodeData + this.updateProgress() //更新进度条 + resolve(true) + }) } //选中 底部一级节点 开启自动播放 @@ -363,10 +372,14 @@ export class PlanComponent implements OnInit { let isTrue = confirm("即将开始播放节点") if (isTrue) { this.timer? window.clearTimeout(this.timer) : null //清除定时器 + this.updateTimer? window.clearTimeout(this.updateTimer) : null //清除定时器 this.nzCurrent = 0 this.beforeEmergencyPlan = item - this.publicToggleNode() - !this.isSuspend? this.autoPlay() : null + this.updateProgressList().then(res=>{ + this.publicToggleNode().then(data=>{ + !this.isSuspend? this.autoPlay() : null + }) + }) } } else { this.message.info('暂无数据节点'); @@ -374,31 +387,55 @@ export class PlanComponent implements OnInit { } } - //自动播放-切换接点 - autoPlay() { - if (this.nzCurrent >= this.beforeEmergencyPlan.nodes.length - 1) { - this.nzCurrent = this.nzCurrent + 1 - this.isSuspend = false //初始化暂停状态 - window.clearTimeout(this.timer) //清除定时器 - this.message.info('已播放至最后一节点'); + //更新进度条 值 + updateProgress() { + if (this.progressList[this.nzCurrent] >= 100) { + this.progressList[this.nzCurrent] = 100 + window.clearTimeout(this.updateTimer) //清除定时器 return } - let time: number = this.beforePlanNode.getShowTime() - console.log(`所需${time}s`) + let time: number = this.beforePlanNode.getShowTime() || 1 + this.updateTimer = window.setTimeout(()=>{ + this.progressList[this.nzCurrent] = this.progressList[this.nzCurrent] + Math.ceil(100 / time) + this.updateProgress() + },1000) + } + + //更新进度条 条数 + updateProgressList() { + return new Promise((resolve, reject) => { + this.progressList = [] + this.beforeEmergencyPlan.nodes.forEach(item=>{ this.progressList.push(0) }) + resolve(true) + }) + } + + //自动播放-切换接点 + autoPlay() { + let time: number = this.beforePlanNode.getShowTime() || 1 this.timer = window.setTimeout(()=>{ + if (this.nzCurrent >= this.beforeEmergencyPlan.nodes.length - 1) { + this.isSuspend = false //初始化暂停状态 + window.clearTimeout(this.timer) //清除定时器 + this.message.info('已播放至最后一节点'); + return + } this.nzCurrent = this.nzCurrent + 1 - this.publicToggleNode() - !this.isSuspend? this.autoPlay() : null + this.publicToggleNode().then(data=>{ + !this.isSuspend? this.autoPlay() : null + }) },time * 1000) } //切换预案节点 changePlanNode(event){ - if (event === this.beforeEmergencyPlan.nodes.length) { - return + if (this.progressList.length != this.beforeEmergencyPlan.nodes.length) { + this.updateProgressList() } this.timer? window.clearTimeout(this.timer) : null //清除定时器 + this.updateTimer? window.clearTimeout(this.updateTimer) : null //清除定时器 this.nzCurrent = event + this.progressList[this.nzCurrent] = 0 this.publicToggleNode() } @@ -412,10 +449,16 @@ export class PlanComponent implements OnInit { this.message.info('目前已经是第一节点'); return } + if (this.progressList.length != this.beforeEmergencyPlan.nodes.length) { + this.updateProgressList() + } this.timer? window.clearTimeout(this.timer) : null //清除定时器 + this.updateTimer? window.clearTimeout(this.updateTimer) : null //清除定时器 this.nzCurrent = this.nzCurrent - 1 - this.publicToggleNode() - !this.isSuspend? this.autoPlay() : null + this.progressList[this.nzCurrent] = 0 + this.publicToggleNode().then(data=>{ + //!this.isSuspend? this.autoPlay() : null + }) } //切换预案节点 暂停 @@ -424,13 +467,21 @@ export class PlanComponent implements OnInit { this.message.info('请选择节点'); return } + if (this.progressList.length != this.beforeEmergencyPlan.nodes.length) { + this.updateProgressList() + } this.isSuspend = isSuspend let msg: string = this.isSuspend? "目前已暂停" : "目前已开始播放" this.message.info(msg); if (this.isSuspend) { //暂停 window.clearTimeout(this.timer) //清除定时器 + window.clearTimeout(this.updateTimer) //清除定时器 } else { //开启 + this.timer? window.clearTimeout(this.timer) : null //清除定时器 + this.updateTimer? window.clearTimeout(this.updateTimer) : null //清除定时器 + this.progressList.forEach((item,index)=>{ index >= this.nzCurrent? this.progressList[index] = 0 : null }) MarkWindow.instance.selectMarkNode(this.beforeEmergencyPlan.id, this.beforePlanNode.id, false, true) + this.updateProgress() this.autoPlay() } } @@ -442,9 +493,13 @@ export class PlanComponent implements OnInit { return } this.timer? window.clearTimeout(this.timer) : null //清除定时器 - this.nzCurrent = 0 - this.publicToggleNode() - !this.isSuspend? this.autoPlay() : null + this.updateTimer? window.clearTimeout(this.updateTimer) : null //清除定时器 + this.updateProgressList().then(res=>{ + this.nzCurrent = 0 + this.publicToggleNode().then(data=>{ + !this.isSuspend? this.autoPlay() : null + }) + }) } //切换预案节点 下一个 @@ -457,17 +512,63 @@ export class PlanComponent implements OnInit { this.message.info('目前已经是最后一个节点'); return } + if (this.progressList.length != this.beforeEmergencyPlan.nodes.length) { + this.updateProgressList() + } this.timer? window.clearTimeout(this.timer) : null //清除定时器 + this.updateTimer? window.clearTimeout(this.updateTimer) : null //清除定时器 this.nzCurrent = this.nzCurrent + 1 - this.publicToggleNode() - !this.isSuspend? this.autoPlay() : null + this.progressList[this.nzCurrent] = 0 + this.publicToggleNode().then(data=>{ + //!this.isSuspend? this.autoPlay() : null + }) } + //获取进度条 flex分布 + getProgressFlex(e: MarkNodeData):string { + let length: number = 0 + this.beforeEmergencyPlan.nodes.forEach(item=>{ + length = length + (item.getShowTime() || 1) + }) + let percentage: number = (e.getShowTime() || 1) / length + return `${percentage * 100}%` + } + + contingencyPlanTask: MarkData = null; //应急预案选中 设备 + taskDialog: taskDialog = new taskDialog("", "", ""); //设备任务 深拷贝数据 + allTaskList: any[] = []; //所有任务 List + //选中应急预案 设备 selectSandTableMark(markData: MarkData, select: boolean) { MarkWindow.instance.selectMarkData(markData, select) } + //选中应急预案 设备任务窗口 + getSandTableNature(markData: MarkData) { + if (markData.property.taskType != MarkTask.None) { + this.contingencyPlanTask = markData + this.taskDialog.institution = JSON.parse(JSON.stringify(markData.property.institution || "")) + this.taskDialog.description = JSON.parse(JSON.stringify(markData.property.description || "")) + this.taskDialog.task = JSON.parse(JSON.stringify(markData.property.task || "")) + if (markData.property.taskType === MarkTask.Person) { + this.allTaskList = (new taskList()).character + } else if (markData.property.taskType === MarkTask.Car) { + this.allTaskList = (new taskList()).car + } else { + this.allTaskList = [] + } + } + } + + //提交 设备任务窗口表单 + submitTaskForm(e) { + this.contingencyPlanTask.property.institution = e.companyName + this.contingencyPlanTask.property.description = e.description + this.contingencyPlanTask.property.task = e.taskName + MarkWindow.instance.updateProperty() + this.contingencyPlanTask = null //关闭弹窗 + } + selectRightTopFast: number = 0; //当前选择功能 快捷栏 selectAdsorb: boolean = false; //吸附状态 topLevelView: boolean = false; //顶视图状态 @@ -543,6 +644,64 @@ export class PlanComponent implements OnInit { } +//设备任务窗口 数据类型 +export class taskDialog { + institution: string; //单位 + task: string; //任务 + description: string; //备注 + constructor(institution: string, task: string, description: string) { + this.institution = institution + this.task = task + this.description = description + } +} +//设备任务list +export class taskList { + character: any[] = [ + { taskName: "外部控火" }, + { taskName: "内部控火" }, + { taskName: "外部侦察" }, + { taskName: "内部侦察" }, + { taskName: "外部观察" }, + { taskName: "外部疏散救生" }, + { taskName: "询问知情人" }, + { taskName: "占领消控室" }, + { taskName: "水源引导" }, + { taskName: "断电气" }, + { taskName: "灭火" }, + { taskName: "掩护" }, + { taskName: "警戒" }, + { taskName: "破拆" }, + { taskName: "排烟" }, + { taskName: "照明" }, + { taskName: "通信" }, + { taskName: "待命" }, + ]; + car: any[] = [ + { taskName: "内攻" }, + { taskName: "出枪掩护" }, + { taskName: "出枪冷却" }, + { taskName: "出枪灭火" }, + { taskName: "供水" }, + { taskName: "供泡沫" }, + { taskName: "连接消火栓" }, + { taskName: "遥控水炮冷却" }, + { taskName: "遥控水炮灭火" }, + { taskName: "抢险救援" }, + { taskName: "救人" }, + { taskName: "指挥" }, + { taskName: "排烟" }, + { taskName: "提供器材" }, + { taskName: "照明" }, + { taskName: "供电" }, + { taskName: "待命" }, + ] + firemonitor: any[] = [ + { taskName: "遥控水炮冷却" }, + { taskName: "遥控水炮灭火" }, + { taskName: "待命" }, + ] +} //属性栏 定位 export class naturePosition { top: string = "1%" diff --git a/src/app/pages/today-warning-admin/today-warning-admin.component.html b/src/app/pages/today-warning-admin/today-warning-admin.component.html index 521910f..28baa97 100644 --- a/src/app/pages/today-warning-admin/today-warning-admin.component.html +++ b/src/app/pages/today-warning-admin/today-warning-admin.component.html @@ -1,6 +1,11 @@
+
+ + 今日预警 + {{totalCount}} +