diff --git a/package-lock.json b/package-lock.json index 9f9c12a..1b64b40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10828,6 +10828,11 @@ "resolved": "https://registry.npm.taobao.org/lineclip/download/lineclip-1.1.5.tgz", "integrity": "sha1-K/JgZ9lDVP6r+R5CdoI221YW/RM=" }, + "linqjs": { + "version": "1.0.2", + "resolved": "https://registry.npmmirror.com/linqjs/download/linqjs-1.0.2.tgz", + "integrity": "sha1-u6n9aUvvP7DmTLfAvNlfzbxHD+w=" + }, "loader-runner": { "version": "2.4.0", "resolved": "https://registry.npm.taobao.org/loader-runner/download/loader-runner-2.4.0.tgz?cache=0&sync_timestamp=1574712695617&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Floader-runner%2Fdownload%2Floader-runner-2.4.0.tgz", diff --git a/package.json b/package.json index fc9157d..3c370ef 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "echarts": "^4.9.0", "firebase": "^7.6.2", "install": "^0.13.0", + "linqjs": "^1.0.2", "moment": "^2.29.1", "ng-zorro-antd": "^9.3.0", "ngx-cookie-service": "^3.0.2", diff --git a/src/app/app.component.html b/src/app/app.component.html index d838fa8..0dbe5df 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -8,7 +8,7 @@
- 您有一条新的违规事件! + 您有一条新的预警提醒! 这是详细描述这是详细描述这是详细描述...
diff --git a/src/app/http-interceptors/base-interceptor.ts b/src/app/http-interceptors/base-interceptor.ts index 778beae..16de0ab 100644 --- a/src/app/http-interceptors/base-interceptor.ts +++ b/src/app/http-interceptors/base-interceptor.ts @@ -18,7 +18,16 @@ export class BaseInterceptor implements HttpInterceptor { constructor(private router: Router, public token: CacheTokenService, private cookieService: CookieService, private message: NzMessageService) { } intercept(req, next: HttpHandler) { - + + let params = req.params; + for (const key of req.params.keys()) { + if (params.get(key) === undefined || params.get(key) === null) { + params = params.delete(key, undefined); + } + } + req = req.clone({ params }); +// debugger +// console.log('xxxxxx',req) let newReq = req.clone({ url: req.hadBaseurl ? `${req.url}` : `${req.url}`, }); 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 9169916..7311c5f 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 @@ -54,17 +54,17 @@
- +
- 违规事件统计 + 预警事件统计
-
违规事件总数
+
预警事件总数
206
@@ -74,14 +74,14 @@
- 违规趋势 + 预警趋势
+ [ngClass]="{'selectedbtn': selectedRankingType == '站点排名'}">油站 - + [ngClass]="{'selectedbtn': selectedRankingType == '事件排名'}">事件 +
@@ -92,7 +92,7 @@
- +
@@ -119,7 +119,7 @@ 摄像头
- 违规时间 + 预警时间
操作 @@ -131,7 +131,7 @@ Ⅰ级
- 日常违规行为 + 日常预警行为
中化某某省公司 diff --git a/src/app/pages/criminal-records/criminal-records.component.html b/src/app/pages/criminal-records/criminal-records.component.html index aa55342..815a2fb 100644 --- a/src/app/pages/criminal-records/criminal-records.component.html +++ b/src/app/pages/criminal-records/criminal-records.component.html @@ -54,17 +54,17 @@
- +
- 违规事件统计 + 预警事件统计
-
违规事件总数
+
预警事件总数
206
@@ -74,8 +74,16 @@
- 违规趋势 + 预警趋势 +
+ + + +
@@ -84,7 +92,7 @@
- +
@@ -96,13 +104,13 @@ 预警类型
- 违规信息 + 预警信息
摄像头
- 违规时间 + 预警时间
操作 @@ -114,7 +122,7 @@ Ⅰ级
- 日常违规行为 + 日常预警行为
工作人员倚靠加油机或立柱 diff --git a/src/app/pages/criminal-records/criminal-records.component.ts b/src/app/pages/criminal-records/criminal-records.component.ts index 727604e..a20a60a 100644 --- a/src/app/pages/criminal-records/criminal-records.component.ts +++ b/src/app/pages/criminal-records/criminal-records.component.ts @@ -89,6 +89,86 @@ export class CriminalRecordsComponent implements OnInit { top: '45px' } }; + baroption2 = { + xAxis: { + type: 'value', + show: false + }, + yAxis: { + type: 'category', + data: ['预警事件名', '预警事件名', '预警事件名', '预警事件名', '预警事件名', '预警事件名', '预警事件名', '预警事件名', '预警事件名', '预警事件名'], + axisLine: { + show: false, + lineStyle: { + color: '#91CCFF', + } + }, + axisTick: {//刻度线 + show: false + }, + axisLabel: { + formatter: function (value, index) { + // 格式化成月/日,只在第一个刻度显示年份 + return '{s|·}' + `{a|${value}}`; + }, + rich: { + a: { + color: '#C4E2FC', + padding: [0, 0, 0, 8], + }, + s: { + color: '#fff', + borderWidth: 1, + borderColor: '#23D9FF', + backgroundColor: '#fff', + width: 4, + height: 4, + shadowBlur: 3, + shadowColor: "#fff" + } + } + } + + }, + series: + { + label: { + // 柱图头部显示值 + show: true, + position: "right", + color: "#fff", + fontSize: 12, + formatter: '{c}', + offset: [6, 0] + }, + data: [40, 36, 30, 25, 19, 15, 14, 11, 10, 8].reverse(), + type: 'bar', + itemStyle: { + color: { + type: 'linear', + x: 0, + y: 0, + x2: 1, + y2: 0, + colorStops: [{ + offset: 0, color: '#063d72' // 0% 处的颜色 + }, { + offset: 1, color: '#FF9963' // 100% 处的颜色 + }], + global: false // 缺省为 false + } + }, + barWidth: '36%', + + } + , + grid: { + left: '100px', + right: '60px', + bottom: '3px', + top: '20px' + } + } getThirtyDays() { //获取当前日期 let myDate = new Date(); @@ -219,4 +299,21 @@ export class CriminalRecordsComponent implements OnInit { list: any = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] + + selectedType = '分布' + selectedRankingType = '站点排名' + echartClick(type) { + this.selectedType = type + this.mybarChart.dispose() + this.mybarChart = echarts.init(document.getElementById('barchart')); + if (type == '排名') { + this.mybarChart.setOption(this.baroption2); + } else { + this.mybarChart.setOption(this.baroption); + } + + } + // echartClick2(type) { + // this.selectedRankingType = type + // } } diff --git a/src/app/pages/equipment-info/equipment-info.component.ts b/src/app/pages/equipment-info/equipment-info.component.ts index cc09f12..c62f119 100644 --- a/src/app/pages/equipment-info/equipment-info.component.ts +++ b/src/app/pages/equipment-info/equipment-info.component.ts @@ -29,7 +29,7 @@ export class EquipmentInfoComponent implements OnInit { this.http.get('/api/services/app/FireEquipment/GetAll', { params: { Name:this.validateForm.value.search ? this.validateForm.value.search : '', - OrganizationId: JSON.parse(sessionStorage.getItem('userdata')).organization.id, + organizationUnitId: JSON.parse(sessionStorage.getItem('userdata')).organization.id, SkipCount: String(this.SkipCount), MaxResultCount: String(this.MaxResultCount) } @@ -75,7 +75,7 @@ export class EquipmentInfoComponent implements OnInit { productionDate: instance.validateForm.value.prodtime, purchaseDate: instance.validateForm.value.buytime, validityEndTime: instance.validateForm.value.validitytime, - organizationId: JSON.parse(sessionStorage.getItem('userdata')).organization.id + organizationUnitId: JSON.parse(sessionStorage.getItem('userdata')).organization.id } this.http.post('/api/services/app/FireEquipment/Create', body).subscribe(data => { resolve(data) @@ -121,7 +121,7 @@ export class EquipmentInfoComponent implements OnInit { productionDate: instance.validateForm.value.prodtime, purchaseDate: instance.validateForm.value.buytime, validityEndTime: instance.validateForm.value.validitytime, - organizationId: item.organizationId + organizationUnitId: item.organizationUnitId } this.http.put('/api/services/app/FireEquipment/Update', body).subscribe(data => { resolve(data) diff --git a/src/app/pages/home/home.component.html b/src/app/pages/home/home.component.html index 49d7d83..4c4d150 100644 --- a/src/app/pages/home/home.component.html +++ b/src/app/pages/home/home.component.html @@ -4,13 +4,13 @@
diff --git a/src/app/pages/home/home.component.ts b/src/app/pages/home/home.component.ts index d120480..625431d 100644 --- a/src/app/pages/home/home.component.ts +++ b/src/app/pages/home/home.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { Router, NavigationEnd, ActivatedRoute } from '@angular/router'; import { Title } from '@angular/platform-browser' import { filter } from 'rxjs/operators'; +import { NavChangeService } from 'src/app/service/navChange.service'; @Component({ selector: 'app-home', templateUrl: './home.component.html', @@ -9,15 +10,33 @@ import { filter } from 'rxjs/operators'; }) export class HomeComponent implements OnInit { - constructor(private router: Router) { } + constructor(private router: Router, private navChangeService: NavChangeService) { } isGasStationNav: boolean isGasStation: boolean isWarning: boolean = false//是否是今日预警页面 + num ngOnInit(): void { - if(sessionStorage.getItem('isGasStation') == 'true'){ + this.navChangeService.getMessage().subscribe((message: any) => { + console.log(message);//send a message + if(message.name == 'oilstation'){ + this.isGasStationNav = true + } + if(message.name == '改变数量'){ + this.isWarning = true + this.num = message.num + } + }); + + if (this.router.url.indexOf('petrolStation') != -1 && sessionStorage.getItem('isGasStation') == 'false') {//控制返回按钮显示 + this.isGasStation = true + } else { + this.isGasStation = false + } + + if (sessionStorage.getItem('isGasStation') == 'true') { this.isGasStationNav = true - }else{ + } else { this.isGasStationNav = false } @@ -31,15 +50,16 @@ export class HomeComponent implements OnInit { } if (event.url.indexOf('petrolStation') != -1 && sessionStorage.getItem('isGasStation') == 'false') {//控制返回按钮显示 this.isGasStation = true - }else{ + } else { this.isGasStation = false } }); } - goback(){ - history.go(-1) + goback() { + this.router.navigate(['/plan']) + this.isGasStationNav = false } } diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts index 6d85972..61dd9c4 100644 --- a/src/app/pages/login/login.component.ts +++ b/src/app/pages/login/login.component.ts @@ -43,37 +43,40 @@ export class LoginComponent implements OnInit { this.message.create('error', `请输入账号密码`); return } - // if (!this.selectedRole) { - // this.message.create('error', `请选择登录角色`); - // return - // } this.isLoading = true; this.http.post('/api/TokenAuth/Authenticate', { userNameOrEmailAddress: this.validateForm.value.userName, password: this.validateForm.value.password }).subscribe( (data: any) => { - sessionStorage.setItem("token", data.result.accessToken); this.cookieService.set("token", data.result.accessToken, null, '/'); this.cookieService.set("refreshToken", data.result.encryptedAccessToken, null, '/'); this.http.get('/api/services/app/Session/GetCurrentLoginInformations').subscribe((data: any) => { sessionStorage.setItem('userdata', JSON.stringify(data.result.user)) + sessionStorage.setItem('userdataOfgasstation', JSON.stringify(data.result.user)) this.isLoading = false; - if (data.result.user.organization.isGasStation) { - sessionStorage.setItem("isGasStation", 'true'); - this.router.navigate(['/plan/petrolStation']) + if (data.result.user.userName == 'admin') { + this.router.navigate(['/system/organization']) } else { - sessionStorage.setItem("isGasStation", 'false'); - this.router.navigate(['/plan']) + if (data.result.user.organization.isGasStation) { + sessionStorage.setItem("isGasStation", 'true'); + this.router.navigate(['/plan/petrolStation']) + } else { + sessionStorage.setItem("isGasStation", 'false'); + this.router.navigate(['/plan']) + } } this.message.create('success', `登陆成功`); + }, err => { + this.isLoading = false; }) //调用服务中的function刷新token // this.token.startUp() }, (err) => { + this.isLoading = false; this.message.create('error', err.error.error.details); } ) diff --git a/src/app/pages/oil-station-info/oil-station-info.component.ts b/src/app/pages/oil-station-info/oil-station-info.component.ts index 677f626..0b917eb 100644 --- a/src/app/pages/oil-station-info/oil-station-info.component.ts +++ b/src/app/pages/oil-station-info/oil-station-info.component.ts @@ -62,7 +62,7 @@ export class OilStationInfoComponent implements OnInit { getInfo() { this.http.get('/api/services/app/GasStation/Get', { params: { - organizationId: this.userdata.organization.id + organizationUnitId: this.userdata.organization.id } }).subscribe((data: any) => { console.log('油站信息', data) @@ -112,7 +112,7 @@ export class OilStationInfoComponent implements OnInit { httpBody = { id: null, stationName: JSON.parse(sessionStorage.getItem('userdata')).organization.displayName, - organizationId: JSON.parse(sessionStorage.getItem('userdata')).organization.id, + organizationUnitId: JSON.parse(sessionStorage.getItem('userdata')).organization.id, validityStartTime: '', validityEndTime: '', openTime: '', diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index 19af134..bd1ba89 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -11,8 +11,8 @@ import { EquipmentInfoComponent } from './equipment-info/equipment-info.componen import { PlanAdminComponent } from './plan-admin/plan-admin.component'; const routes: Routes = [ - { path: 'plan', component: PlanAdminComponent , data: { permission: 'xxxx' },canActivate: [AuthGuard]}, - { path: 'plan/petrolStation', component: PlanComponent , data: { permission: 'xxxx' },canActivate: [AuthGuard]}, + { path: 'plan', component: PlanAdminComponent }, + { path: 'plan/petrolStation', component: PlanComponent }, { path: 'warning', component: TodayWarningAdminComponent }, { path: 'warning/petrolStation', component: TodayWarningComponent }, { path: 'records', component: CriminalRecordsAdminComponent }, diff --git a/src/app/pages/pages.module.ts b/src/app/pages/pages.module.ts index 17142f1..73d4f96 100644 --- a/src/app/pages/pages.module.ts +++ b/src/app/pages/pages.module.ts @@ -41,13 +41,14 @@ import { EditequipmentComponent } from './equipment-info/editequipment/editequip import { NzTreeSelectModule } from 'ng-zorro-antd/tree-select'; import { PlanAdminComponent } from './plan-admin/plan-admin.component'; import { GetOutOfLineDetailsComponent } from './today-warning/get-out-of-line-details/get-out-of-line-details.component'; +import { WarningDetailsComponent } from './today-warning-admin/warning-details/warning-details.component'; @NgModule({ declarations: [LoginComponent, RegisterComponent, HomeComponent, PlanComponent, TodayWarningComponent, CriminalRecordsComponent, TodayWarningAdminComponent, CriminalRecordsAdminComponent, LeftDomainComponent, EquipmentInfoComponent, OilStationInfoComponent, - AddequipmentComponent, EditequipmentComponent,PlanAdminComponent, GetOutOfLineDetailsComponent], + AddequipmentComponent, EditequipmentComponent,PlanAdminComponent, GetOutOfLineDetailsComponent, WarningDetailsComponent], imports: [ diff --git a/src/app/pages/plan-admin/plan-admin.component.html b/src/app/pages/plan-admin/plan-admin.component.html index ab4456a..c5ce805 100644 --- a/src/app/pages/plan-admin/plan-admin.component.html +++ b/src/app/pages/plan-admin/plan-admin.component.html @@ -37,7 +37,7 @@ - + @@ -70,13 +70,13 @@
-
+
加油站名称
-
+
区域
@@ -94,13 +94,13 @@
-
- 自营 +
+
中化山东省淄博市第6加油站
-
+
山东-淄博
diff --git a/src/app/pages/plan-admin/plan-admin.component.scss b/src/app/pages/plan-admin/plan-admin.component.scss index 00604e8..8d23276 100644 --- a/src/app/pages/plan-admin/plan-admin.component.scss +++ b/src/app/pages/plan-admin/plan-admin.component.scss @@ -53,7 +53,7 @@ width: 100%; height: 32px; display: flex; - justify-content: space-around; + justify-content: flex-end; input { background: none; @@ -62,11 +62,12 @@ } .searchParams { - width: 28%; + width: 22%; } .btn { width: 5%; + margin-left: 16px; } } diff --git a/src/app/pages/plan-admin/plan-admin.component.ts b/src/app/pages/plan-admin/plan-admin.component.ts index 73538f4..8ecf84e 100644 --- a/src/app/pages/plan-admin/plan-admin.component.ts +++ b/src/app/pages/plan-admin/plan-admin.component.ts @@ -5,6 +5,7 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { NzContextMenuService, NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown'; import { NzFormatEmitEvent, NzTreeComponent, NzTreeNode } from 'ng-zorro-antd/tree'; import { Router } from '@angular/router'; +import { NavChangeService } from 'src/app/service/navChange.service'; @Component({ selector: 'app-plan-admin', templateUrl: './plan-admin.component.html', @@ -13,7 +14,7 @@ import { Router } from '@angular/router'; export class PlanAdminComponent implements OnInit { validateForm!: FormGroup; @ViewChild('nzTreeComponent', { static: false }) nzTreeComponent!: NzTreeComponent; - constructor(private http: HttpClient, private toTree: TreeService, private fb: FormBuilder, private nzContextMenuService: NzContextMenuService, private router: Router) { } + constructor(private navChangeService: NavChangeService, private http: HttpClient, private toTree: TreeService, private fb: FormBuilder, private nzContextMenuService: NzContextMenuService, private router: Router) { } list: any = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] ngOnInit(): void { this.validateForm = this.fb.group({ @@ -41,11 +42,22 @@ export class PlanAdminComponent implements OnInit { nodes: any = [] nzExpandAll = false getAllOrganization() { - this.http.get('/api/services/app/Organization/GetAll').subscribe((data: any) => { - data.result.items.forEach(element => { + this.http.get('/api/services/app/Organization/GetAll', { + params: { + SkipCount: '0', + MaxResultCount: '9999' + } + }).subscribe((data: any) => { + + data.result.items = data.result.items.filter((item, i) => { + return !item.isGasStation + }) + for (let index = 0; index < data.result.items.length; index++) { + const element = data.result.items[index]; element.key = element.id element.title = element.displayName - }); + } + this.nodes = [...this.toTree.toTree(data.result.items)] this.nzExpandAll = true }) @@ -53,6 +65,11 @@ export class PlanAdminComponent implements OnInit { look() { this.router.navigate(['/plan/petrolStation']) + + let obj = { + name: 'oilstation' + } + this.navChangeService.sendMessage(obj);//发布一条消息 } nzExpandedKeys: any = [] activatedNode?: NzTreeNode; 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 5bead1f..117dfd3 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,6 @@
- +
- -
-
+
预警级别
-
- 预警类型 -
-
- 违规信息 -
- 所属公司 + 预警类型
-
- 区域 +
+ 预警事件
- 站点 + 油站名称
- 摄像头 + 区域
-
- 违规时间 +
+ 预警时间
操作
-
- - +
+ + Ⅰ级 - - + + Ⅱ级 - - + + Ⅲ级 -
-
- 加油站违规 -
-
- 工作人员倚靠加油机或立柱 + + + Ⅳ级 +
- 中化北京分公司 + {{item.violation.violationType}}
-
- 北京-朝阳 +
+ {{item.violation.violationName}}
- 北京市第十九加油站 - 自营 - 加盟 + {{item.gasStation.stationName}}
- 加油区2号摄像头 + {{item.violateArea}}
-
- 2021-10-12 09:28:13 +
+ {{item.violateTime | date:"yyyy-MM-dd HH:mm:ss"}}
- +
- -
+ +
\ No newline at end of file diff --git a/src/app/pages/today-warning-admin/today-warning-admin.component.scss b/src/app/pages/today-warning-admin/today-warning-admin.component.scss index ac58c65..2d1bdf1 100644 --- a/src/app/pages/today-warning-admin/today-warning-admin.component.scss +++ b/src/app/pages/today-warning-admin/today-warning-admin.component.scss @@ -27,7 +27,7 @@ justify-content: space-around; .searchParams { - width: 22%; + width: 14.6%; } .btn { @@ -46,7 +46,10 @@ background-color: rgba(0, 0, 0, 0); width: 145%; } - + nz-range-picker { + background-color: rgba(0, 0, 0, 0); + width: 100%; + } } } diff --git a/src/app/pages/today-warning-admin/today-warning-admin.component.ts b/src/app/pages/today-warning-admin/today-warning-admin.component.ts index 230fa7d..51e5ec4 100644 --- a/src/app/pages/today-warning-admin/today-warning-admin.component.ts +++ b/src/app/pages/today-warning-admin/today-warning-admin.component.ts @@ -1,8 +1,17 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, ViewContainerRef } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Router } from '@angular/router'; import { HttpClient } from '@angular/common/http'; import { TreeService } from 'src/app/service/tree.service'; +import { NzModalService } from 'ng-zorro-antd/modal'; +import { GetOutOfLineDetailsComponent } from '../today-warning/get-out-of-line-details/get-out-of-line-details.component'; + +import * as moment from 'moment'; +import { NavChangeService } from 'src/app/service/navChange.service'; + +import 'linqjs'; + + @Component({ selector: 'app-today-warning-admin', templateUrl: './today-warning-admin.component.html', @@ -11,49 +20,110 @@ import { TreeService } from 'src/app/service/tree.service'; export class TodayWarningAdminComponent implements OnInit { validateForm!: FormGroup; - constructor(private http: HttpClient,private fb: FormBuilder, private router: Router, private toTree: TreeService) { } + constructor(private http: HttpClient, private fb: FormBuilder, private router: Router, private toTree: TreeService, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private navChangeService: NavChangeService) { } ngOnInit(): void { this.validateForm = this.fb.group({ level: [null], type: [null], - company: [null], + event: [null], + organization: [null], area: [null], - site: [null], datePicker: [null] }); - this.yujingType() + this.warningType() this.getAllOrganization() } + //预警类型接口 - yujingTypes:any //预警接口数据 - yujingType(){ + warningTypes: any //预警接口数据 + warningTypesDetails:any + warningType() { this.http.get('/api/services/app/Violation/GetAllList').subscribe((data: any) => { - this.yujingTypes=data.result + this.warningTypesDetails = data.result + this.warningTypes = (data.result as any).groupBy((t) => { return t.violationType }); + }) + } + typeChange(e){ + this.warningTypes.forEach(element => { + if(element.key == e){ + this.warningTypesDetails = element } - ) + }); + this.validateForm.patchValue({ + event: null, + }); } + + defaultOrId: string //获取所有组织机构 - nodes:any = [] + nodes: any = [] getAllOrganization() { this.http.get('/api/services/app/Organization/GetAll').subscribe((data: any) => { data.result.items.forEach(element => { - element.key = element.code + element.key = element.id element.title = element.displayName }); this.nodes = [...this.toTree.toTree(data.result.items)] - console.log(this.nodes) + this.defaultOrId = JSON.parse(sessionStorage.getItem('userdata')).organization.id + this.validateForm.value.organization = this.defaultOrId + this.getEarlyWarningList() + }) + } + + + //获得预警列表 + list: any = [ + ] + totalCount: string //预警总数 + getEarlyWarningList() { + let ViolationIds = [] + if(this.validateForm.value.event){ + ViolationIds.push(this.validateForm.value.event) + } + if(this.validateForm.value.type && !this.validateForm.value.event){ + this.warningTypesDetails.forEach(item => { + item.id ? ViolationIds.push(item.id) : null + }); + } + let params = { + Level: this.validateForm.value.level, + ViolationIds: ViolationIds, + ViolateArea: this.validateForm.value.area, + organizationUnitId: this.validateForm.value.organization, + 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, + SkipCount: '0', + MaxResultCount: '9999' + } + this.http.get('/api/services/app/ViolateRecord/GetAll', { + params: params + }).subscribe((data: any) => { + this.list = data.result.items + this.totalCount = data.result.totalCount + console.log('预警列表', this.list) + + let obj = { + name: '改变数量', + num: this.totalCount + } + setTimeout(() => { + console.log('走这里了') + this.navChangeService.sendMessage(obj);//发布一条消息 + }, 0); + }) } + + submitForm(): void { for (const i in this.validateForm.controls) { this.validateForm.controls[i].markAsDirty(); this.validateForm.controls[i].updateValueAndValidity(); } - - console.log(this.validateForm) + this.getEarlyWarningList() } + resetForm(e: MouseEvent): void { e.preventDefault(); this.validateForm.reset(); @@ -61,37 +131,33 @@ export class TodayWarningAdminComponent implements OnInit { this.validateForm.controls[key].markAsPristine(); this.validateForm.controls[key].updateValueAndValidity(); } + this.defaultOrId = JSON.parse(sessionStorage.getItem('userdata')).organization.id + this.validateForm.value.organization = this.defaultOrId + this.getEarlyWarningList() } - list: any = [ - { level: 1, name: '北京市第十九加油站', prop: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 2, name: '北京市第十九加油站', prop: 2, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 3, name: '北京市第十九加油站', prop: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, name: '北京市第十九加油站', prop: 2, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, name: '北京市第十九加油站', prop: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, name: '北京市第十九加油站', prop: 2, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, name: '北京市第十九加油站', prop: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, name: '北京市第十九加油站', prop: 2, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, name: '北京市第十九加油站', prop: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, name: '北京市第十九加油站', prop: 2, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, name: '北京市第十九加油站', prop: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, name: '北京市第十九加油站', prop: 2, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', company: '中化北京分公司', area: '北京-朝阳', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' } - ] - isVisible = false; - showModal(): void { - this.isVisible = true; - } - handleOk(): void { - console.log('Button ok clicked!'); - this.isVisible = false; - } - handleCancel(): void { - console.log('Button cancel clicked!'); - this.isVisible = false; - } - look() { - this.router.navigate(['warning/petrolStation']) + look(item) { + const modal = this.modal.create({ + nzContent: GetOutOfLineDetailsComponent, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 1200, + nzBodyStyle: { + 'border': '1px solid #6d9cc7', + 'border-radius': '0px', + 'padding': '0px', + 'box-shadow': '0 0 8px 0 #fff', + 'background': '#000D21', + }, + nzComponentParams: { + data: item + }, + nzFooter: null, + nzOnOk: async () => { + + } + }); + const instance = modal.getContentComponent(); } } diff --git a/src/app/pages/today-warning-admin/warning-details/warning-details.component.html b/src/app/pages/today-warning-admin/warning-details/warning-details.component.html new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/today-warning-admin/warning-details/warning-details.component.scss b/src/app/pages/today-warning-admin/warning-details/warning-details.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/today-warning-admin/warning-details/warning-details.component.spec.ts b/src/app/pages/today-warning-admin/warning-details/warning-details.component.spec.ts new file mode 100644 index 0000000..3e13d28 --- /dev/null +++ b/src/app/pages/today-warning-admin/warning-details/warning-details.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { WarningDetailsComponent } from './warning-details.component'; + +describe('WarningDetailsComponent', () => { + let component: WarningDetailsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ WarningDetailsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(WarningDetailsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/today-warning-admin/warning-details/warning-details.component.ts b/src/app/pages/today-warning-admin/warning-details/warning-details.component.ts new file mode 100644 index 0000000..bcb568b --- /dev/null +++ b/src/app/pages/today-warning-admin/warning-details/warning-details.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-warning-details', + templateUrl: './warning-details.component.html', + styleUrls: ['./warning-details.component.scss'] +}) +export class WarningDetailsComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html b/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html index 993acf0..4227ace 100644 --- a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html +++ b/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.html @@ -3,21 +3,128 @@
- 违规截图 + 预警截图
- 违规视频 + 预警视频
+
-
- 违规截图 +
+ +
+ +
-
- 违规视频 +
+
+
\ No newline at end of file diff --git a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.scss b/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.scss index 78ae625..7b55b3b 100644 --- a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.scss +++ b/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.scss @@ -28,8 +28,9 @@ font-family: sybold; font-size: 16px; position: relative; - cursor: pointer; - margin: 0 18px; + cursor: pointer; + margin: 0 18px; + .border { position: absolute; bottom: -7px; @@ -58,4 +59,164 @@ flex: 1; box-sizing: border-box; padding: 18px; + overflow: hidden; + .imgbox { + display: flex; + width: 100%; + height: 100%; + + .imglist { + display: flex; + flex-direction: column; + width: 196px; + height: 100%; + overflow-y: auto; + box-sizing: border-box; + padding-right: 12px; + border-right: 1px solid rgba(145, 204, 255, 0.3); + + .imglisttitle { + font-size: 16px; + font-family: sybold; + margin-bottom: 16px; + } + + .img { + width: 178px; + height: 108px; + margin-bottom: 8px; + + img { + width: 100%; + height: 100%; + cursor: pointer; + } + } + } + + .bigimg { + flex: 1; + box-sizing: border-box; + padding-left: 13px; + + img { + width: 100%; + height: 100%; + } + } + } + + + .oilbox { + display: flex; + width: 100%; + height: 100%; + + .imgDetailsbox { + width: 280px; + height: 100%; + box-sizing: border-box; + padding-right: 12px; + border-right: 1px solid rgba(145, 204, 255, 0.3); + display: flex; + flex-direction: column; + // justify-content: center; + align-items: center; + + .bigimage { + width: 264px; + height: 264px; + border: 1px solid #FF4B65; + box-shadow: 0px 0px 12px #FF4B65; + opacity: 1; + border-radius: 0px; + // margin-top: 40px; + margin-bottom: 24px; + + img { + width: 100%; + height: 100%; + } + } + + h1 { + font-weight: bold; + font-size: 24px; + color: #FF4B65; + margin-bottom: 32px; + margin-top: 36%; + } + + h3 { + font-size: 18px; + font-weight: 400; + color: #FFFFFF; + } + } + + .flowpathbox { + flex: 1; + box-sizing: border-box; + padding-left: 73px; + position: relative; + + // border: 1px solid red; + .name { + color: rgba(145, 204, 255, 1); + font-size: 15px; + margin-bottom: 12px; + } + + .flowpathlist { + display: flex; + flex-wrap: wrap; + + .flowpathimgbox { + width: 160px; + height: 200px; + display: flex; + flex-direction: column; + + img { + width: 158px; + height: 158px; + border: 1px solid rgba(0,0,0,0); + cursor: pointer; + } + + span { + text-align: center; + margin-top: 6px; + } + } + + .arrowsbox { + width: 40px; + height: 200px; + display: flex; + justify-content: center; + + img { + width: 38px; + height: 38px; + margin-top: 65px; + } + } + } + + .leftimg { + display: block; + position: absolute; + left: 20px; + bottom: 76px + } + + .rightimg { + display: block; + position: absolute; + right: -3px; + top: 99px; + } + } + } } diff --git a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts b/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts index 9b914cf..60540bf 100644 --- a/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts +++ b/src/app/pages/today-warning/get-out-of-line-details/get-out-of-line-details.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit,Input } from '@angular/core'; @Component({ selector: 'app-get-out-of-line-details', @@ -7,9 +7,16 @@ import { Component, OnInit } from '@angular/core'; }) export class GetOutOfLineDetailsComponent implements OnInit { + @Input() data:any + constructor() { } + + imgUrl:string + vedioUrl:string ngOnInit(): void { + this.imgUrl = this.data.violateImage + this.vedioUrl = this.data.violateVideo } diff --git a/src/app/pages/today-warning/today-warning.component.html b/src/app/pages/today-warning/today-warning.component.html index 6285804..cc6ecf4 100644 --- a/src/app/pages/today-warning/today-warning.component.html +++ b/src/app/pages/today-warning/today-warning.component.html @@ -1,6 +1,6 @@
- +
- 违规信息: {{item.content}} + 预警信息: {{item.content}}
摄像头: {{item.site}}
- 违规时间: {{item.time}} + 预警时间: {{item.time}}
diff --git a/src/app/pages/today-warning/today-warning.component.ts b/src/app/pages/today-warning/today-warning.component.ts index 08d17e0..5ca8c93 100644 --- a/src/app/pages/today-warning/today-warning.component.ts +++ b/src/app/pages/today-warning/today-warning.component.ts @@ -1,9 +1,9 @@ import { Component, OnInit, ViewContainerRef } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { HttpClient } from '@angular/common/http'; -import { TreeService } from 'src/app/service/tree.service'; import { NzModalService } from 'ng-zorro-antd/modal'; import { GetOutOfLineDetailsComponent } from './get-out-of-line-details/get-out-of-line-details.component'; +import { TreeService } from 'src/app/service/tree.service'; @Component({ selector: 'app-today-warning', templateUrl: './today-warning.component.html', @@ -52,18 +52,18 @@ export class TodayWarningComponent implements OnInit { } list: any = [ - { level: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 2, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 3, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, - { level: 1, type: '加油区违规', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' } + { level: 1, type: '加油区预警', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, + { level: 2, type: '加油区预警', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, + { level: 3, type: '加油区预警', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, + { level: 1, type: '加油区预警', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, + { level: 1, type: '加油区预警', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, + { level: 1, type: '加油区预警', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, + { level: 1, type: '加油区预警', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, + { level: 1, type: '加油区预警', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, + { level: 1, type: '加油区预警', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, + { level: 1, type: '加油区预警', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, + { level: 1, type: '加油区预警', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' }, + { level: 1, type: '加油区预警', content: '工作人员倚靠加油机或者立柱', site: '加油区2号摄像头', time: '2021-10-12 09:28:13' } ] @@ -83,7 +83,11 @@ export class TodayWarningComponent implements OnInit { 'box-shadow': '0 0 8px 0 #fff', 'background': '#000D21', }, - nzComponentParams: {}, + nzComponentParams: { + data: { + type: 1 + } + }, nzFooter: null, nzOnOk: async () => { diff --git a/src/app/service/navChange.service.ts b/src/app/service/navChange.service.ts new file mode 100644 index 0000000..b96032f --- /dev/null +++ b/src/app/service/navChange.service.ts @@ -0,0 +1,22 @@ +import { Injectable } from '@angular/core'; +import { Observable, ReplaySubject } from 'rxjs'; + +@Injectable({ + providedIn: 'root' +}) +export class NavChangeService { + + constructor() { } + private _sendMessage: ReplaySubject = new ReplaySubject(1); + /** * 向其他组件发送信息 ** + * @param message 需要发送的信息 * + * @returns {Observavle} */ + + public sendMessage(message: any) { + this._sendMessage.next(message); + } + + public getMessage(): Observable { + return this._sendMessage.asObservable(); + } +} diff --git a/src/app/system-management/analysis-of-the-host/addcamera/addcamera.component.html b/src/app/system-management/analysis-of-the-host/addcamera/addcamera.component.html new file mode 100644 index 0000000..b1d07c8 --- /dev/null +++ b/src/app/system-management/analysis-of-the-host/addcamera/addcamera.component.html @@ -0,0 +1,18 @@ +
+ + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/src/app/system-management/analysis-of-the-host/addcamera/addcamera.component.scss b/src/app/system-management/analysis-of-the-host/addcamera/addcamera.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/system-management/analysis-of-the-host/addcamera/addcamera.component.ts b/src/app/system-management/analysis-of-the-host/addcamera/addcamera.component.ts new file mode 100644 index 0000000..a8b97d8 --- /dev/null +++ b/src/app/system-management/analysis-of-the-host/addcamera/addcamera.component.ts @@ -0,0 +1,22 @@ +import { Component, OnInit, Input } from '@angular/core'; +import { NzModalRef } from 'ng-zorro-antd/modal'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { HttpClient } from '@angular/common/http'; +@Component({ + selector: 'app-addcamera', + templateUrl: './addcamera.component.html', + styleUrls: ['./addcamera.component.scss'] +}) +export class AddcameraComponent implements OnInit { + + validateForm!: FormGroup; + constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { } + + ngOnInit(): void { + this.validateForm = this.fb.group({ + name: [null, [Validators.required]], + code: [null, [Validators.required]] + }); + } + +} diff --git a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html index 776d383..637c86d 100644 --- a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html +++ b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.html @@ -15,8 +15,8 @@
+ [nzExpandedKeys]="defaultExpandedKeys" [nzSelectedKeys]='nzSelectedKeys' (nzClick)="nzClick($event)" + [nzTreeTemplate]="nzTreeTemplate" [nzExpandedIcon]="multiExpandedIconTpl">
@@ -38,13 +38,13 @@
- 加油站分析主机列表 + {{selectedOilStation ? selectedOilStation.displayName : '加油站'}} 分析主机列表 (请从左侧选择加油站)
+ nzTheme="outline">新增分析主机
@@ -57,14 +57,45 @@ - {{data.ip}} + {{data.hostIPAddress}} - 编辑 + 编辑 删除
+
\ No newline at end of file diff --git a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.scss b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.scss index bc0564a..b6dee8d 100644 --- a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.scss +++ b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.scss @@ -85,6 +85,7 @@ .hostListbox { flex: 1; margin-left: 26px; + overflow-y: auto; } .tablebox { diff --git a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts index a10f11b..724ab45 100644 --- a/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts +++ b/src/app/system-management/analysis-of-the-host/analysis-of-the-host.component.ts @@ -6,6 +6,8 @@ import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { NzModalService } from 'ng-zorro-antd/modal'; import { NzMessageService } from 'ng-zorro-antd/message'; import { AddhostComponent } from './addhost/addhost.component'; +import { AddcameraComponent } from './addcamera/addcamera.component'; +import { EdithostComponent } from './edithost/edithost.component'; @Component({ selector: 'app-analysis-of-the-host', templateUrl: './analysis-of-the-host.component.html', @@ -24,7 +26,12 @@ export class AnalysisOfTheHostComponent implements OnInit { nzExpandAll = false; totalCount: string getAllOrganization() { - this.http.get('/api/services/app/Organization/GetAll').subscribe((data: any) => { + this.http.get('/api/services/app/Organization/GetAll', { + params: { + SkipCount: '0', + MaxResultCount: '9999' + } + }).subscribe((data: any) => { this.totalCount = data.result.totalCount data.result.items.forEach(element => { element.key = element.id @@ -43,30 +50,54 @@ export class AnalysisOfTheHostComponent implements OnInit { nodes: any[] = [] nzSelectedKeys: any[] = [] - selectedOilStation:any + selectedOilStation: any nzClick(event: NzFormatEmitEvent): void { console.log(event.node.origin); - if(event.node.origin.isGasStation){//如果点击的是加油站才生效 + if (event.node.origin.isGasStation) {//如果点击的是加油站才生效 this.nzSelectedKeys[0] = event.node.origin.id this.nzSelectedKeys = [...this.nzSelectedKeys] this.selectedOilStation = event.node.origin this.getHost() - }else{ + } else { this.message.info('只有加油站才可以增加主机'); } } //获得加油站的主机 - getHost(){ - + listOfData: any[] = []; + getHost() { + this.http.get('/api/services/app/EdgeDevice/GetAll', { + params: { + organizationUnitId: this.selectedOilStation.id + } + }).subscribe((data: any) => { + console.log('主机列表', data.result.items) + this.listOfData = data.result.items + }) } + + //获得加油站摄像头 + listOfDataCamera: any[] = []; + getCamera() { + this.http.get('/api/services/app/Camera/GetAll', { + params: { + organizationUnitId: this.selectedOilStation.id + } + }).subscribe((data: any) => { + console.log('摄像头列表', data) + this.listOfDataCamera = data + }) + } + + ngAfterViewInit(): void { } //新增分析主机 addHost() { + console.log(this.selectedOilStation) const modal = this.modal.create({ nzTitle: '新增加油站主机', nzContent: AddhostComponent, @@ -77,16 +108,14 @@ export class AnalysisOfTheHostComponent implements OnInit { if (instance.validateForm.valid) { await new Promise(resolve => { console.log('表单信息', instance.validateForm) - let body = { - // name: instance.validateForm.value.name, - // DisplayName: instance.validateForm.value.name, - // grantedPermissions: arr + hostIPAddress: instance.validateForm.value.ip, + organizationUnitId: this.selectedOilStation.id } - this.http.post('/api/services/app/Role/Create', body).subscribe(data => { + this.http.post('/api/services/app/EdgeDevice/Create', body).subscribe(data => { resolve(data) this.message.create('success', '创建成功!'); - // this.getAllRoles() + this.getHost() return true }) }) @@ -99,10 +128,96 @@ export class AnalysisOfTheHostComponent implements OnInit { const instance = modal.getContentComponent(); } edit(data) { + console.log(data) + const modal = this.modal.create({ + nzTitle: '编辑加油站主机', + nzContent: EdithostComponent, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 288, + nzComponentParams: { + ip: data.hostIPAddress + }, + nzOnOk: async () => { + if (instance.validateForm.valid) { + await new Promise(resolve => { + console.log('表单信息', instance.validateForm) + data.hostIPAddress = instance.validateForm.value.ip, + this.http.put('/api/services/app/EdgeDevice/Update', data).subscribe(data => { + resolve(data) + this.message.create('success', '修改成功!'); + this.getHost() + return true + }) + }) + } else { + this.message.create('warning', '请填写完整!'); + return false + } + } + }); + const instance = modal.getContentComponent(); + } + delete(item) { + console.log(item) + this.modal.confirm({ + nzTitle: `确定要删除${item.name}这个主机吗?`, + nzOkText: '确定', + nzOkType: 'danger', + nzOnOk: () => { + this.http.delete('/api/services/app/EdgeDevice/Delete', { + params: { + Id: item.id + } + }).subscribe(data => { + this.message.create('success', '删除成功!'); + this.getHost() + }) + }, + nzCancelText: '取消' + }); + } + + //摄像头 + addCamera() { + console.log(this.selectedOilStation) + const modal = this.modal.create({ + nzTitle: '新增加油站摄像头', + nzContent: AddcameraComponent, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 288, + nzComponentParams: {}, + nzOnOk: async () => { + if (instance.validateForm.valid) { + await new Promise(resolve => { + console.log('表单信息', instance.validateForm) + let body = { + organizationUnitId: this.selectedOilStation.id, + code: instance.validateForm.value.code, + name: instance.validateForm.value.name, + description: "", + } + this.http.post('/api/services/app/Camera/Create', body).subscribe(data => { + resolve(data) + this.message.create('success', '创建成功!'); + this.getCamera() + return true + }, err => { + return false + }) + }) + } else { + this.message.create('warning', '请填写完整!'); + return false + } + } + }); + const instance = modal.getContentComponent(); } - delete(data) { + editCamera(data) { + + } + deleteCamera(data) { } - listOfData: any[] = []; } diff --git a/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.html b/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.html new file mode 100644 index 0000000..b2ee9c5 --- /dev/null +++ b/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.html @@ -0,0 +1 @@ +

editcamera works!

diff --git a/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.scss b/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.ts b/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.ts new file mode 100644 index 0000000..b57a77c --- /dev/null +++ b/src/app/system-management/analysis-of-the-host/editcamera/editcamera.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-editcamera', + templateUrl: './editcamera.component.html', + styleUrls: ['./editcamera.component.scss'] +}) +export class EditcameraComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/system-management/analysis-of-the-host/edithost/edithost.component.html b/src/app/system-management/analysis-of-the-host/edithost/edithost.component.html index 25287ae..4e62039 100644 --- a/src/app/system-management/analysis-of-the-host/edithost/edithost.component.html +++ b/src/app/system-management/analysis-of-the-host/edithost/edithost.component.html @@ -1 +1,11 @@ -

edithost works!

+
+
+ + + + + + + +
+
\ No newline at end of file diff --git a/src/app/system-management/analysis-of-the-host/edithost/edithost.component.ts b/src/app/system-management/analysis-of-the-host/edithost/edithost.component.ts index 83c9af2..22fc01b 100644 --- a/src/app/system-management/analysis-of-the-host/edithost/edithost.component.ts +++ b/src/app/system-management/analysis-of-the-host/edithost/edithost.component.ts @@ -1,4 +1,7 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Input } from '@angular/core'; +import { NzModalRef } from 'ng-zorro-antd/modal'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { HttpClient } from '@angular/common/http'; @Component({ selector: 'app-edithost', @@ -7,9 +10,14 @@ import { Component, OnInit } from '@angular/core'; }) export class EdithostComponent implements OnInit { - constructor() { } + @Input() ip: any + + validateForm!: FormGroup; + constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { } ngOnInit(): void { + this.validateForm = this.fb.group({ + ip: [null, [Validators.required]] + }); } - } diff --git a/src/app/system-management/navigation/navigation.component.html b/src/app/system-management/navigation/navigation.component.html index c32cf4d..43a4f69 100644 --- a/src/app/system-management/navigation/navigation.component.html +++ b/src/app/system-management/navigation/navigation.component.html @@ -22,7 +22,7 @@ - Hey,欢迎登录中化油站可视化智能安全管理系统 + Hey,欢迎登陆加油站可视化智能安全管理系统 diff --git a/src/app/system-management/navigation/navigation.component.ts b/src/app/system-management/navigation/navigation.component.ts index 6604860..d5ca598 100644 --- a/src/app/system-management/navigation/navigation.component.ts +++ b/src/app/system-management/navigation/navigation.component.ts @@ -13,6 +13,6 @@ export class NavigationComponent implements OnInit { ngOnInit(): void { } signOut() { - this.router.navigate(['/plan']) + this.router.navigate(['/login']) } } diff --git a/src/app/system-management/organization/addor/addor.component.html b/src/app/system-management/organization/addor/addor.component.html index b8a3678..a56e67b 100644 --- a/src/app/system-management/organization/addor/addor.component.html +++ b/src/app/system-management/organization/addor/addor.component.html @@ -7,13 +7,13 @@ - + diff --git a/src/app/system-management/organization/addor/addor.component.ts b/src/app/system-management/organization/addor/addor.component.ts index c853619..177ff23 100644 --- a/src/app/system-management/organization/addor/addor.component.ts +++ b/src/app/system-management/organization/addor/addor.component.ts @@ -15,7 +15,7 @@ export class AddorComponent implements OnInit { ngOnInit(): void { this.validateForm = this.fb.group({ name: [null, [Validators.required]], - code: [null, [Validators.required]], + // code: [null, [Validators.required]], isGasStation: [false] }); } diff --git a/src/app/system-management/organization/editor/editor.component.html b/src/app/system-management/organization/editor/editor.component.html index ef277b3..d2a5386 100644 --- a/src/app/system-management/organization/editor/editor.component.html +++ b/src/app/system-management/organization/editor/editor.component.html @@ -7,13 +7,13 @@ - + diff --git a/src/app/system-management/organization/editor/editor.component.ts b/src/app/system-management/organization/editor/editor.component.ts index 6069106..a154f55 100644 --- a/src/app/system-management/organization/editor/editor.component.ts +++ b/src/app/system-management/organization/editor/editor.component.ts @@ -17,7 +17,7 @@ export class EditorComponent implements OnInit { ngOnInit(): void { this.validateForm = this.fb.group({ name: [null, [Validators.required]], - code: [null, [Validators.required]], + // code: [null, [Validators.required]], isGasStation: [] }); this.datacopy = JSON.parse(JSON.stringify(this.data)) diff --git a/src/app/system-management/organization/organization.component.ts b/src/app/system-management/organization/organization.component.ts index 15b2533..e071506 100644 --- a/src/app/system-management/organization/organization.component.ts +++ b/src/app/system-management/organization/organization.component.ts @@ -36,7 +36,12 @@ export class OrganizationComponent implements OnInit { nzExpandAll = false; totalCount: string getAllOrganization() { - this.http.get('/api/services/app/Organization/GetAll').subscribe((data: any) => { + this.http.get('/api/services/app/Organization/GetAll',{ + params:{ + SkipCount:'0', + MaxResultCount:'9999' + } + }).subscribe((data: any) => { this.totalCount = data.result.totalCount // console.log('组织机构',data.result.totalCount) data.result.items.forEach(element => { @@ -98,7 +103,7 @@ export class OrganizationComponent implements OnInit { await new Promise(resolve => { let body = { parentId: node ? Number(node.key) : null, - code: instance.validateForm.value.code, + // code: instance.validateForm.value.code, displayName: instance.validateForm.value.name, isGasStation: instance.validateForm.value.isGasStation } @@ -142,7 +147,7 @@ export class OrganizationComponent implements OnInit { let body = { id: node.origin.id, parentId: node.origin.parentId, - code: instance.validateForm.value.code, + // code: instance.validateForm.value.code, displayName: instance.validateForm.value.name, isGasStation: instance.validateForm.value.isGasStation } diff --git a/src/app/system-management/system-management.module.ts b/src/app/system-management/system-management.module.ts index d0fc6ae..77f63bb 100644 --- a/src/app/system-management/system-management.module.ts +++ b/src/app/system-management/system-management.module.ts @@ -30,8 +30,10 @@ import { NzCheckboxModule } from 'ng-zorro-antd/checkbox'; import { AnalysisOfTheHostComponent } from './analysis-of-the-host/analysis-of-the-host.component'; import { AddhostComponent } from './analysis-of-the-host/addhost/addhost.component'; import { EdithostComponent } from './analysis-of-the-host/edithost/edithost.component'; +import { AddcameraComponent } from './analysis-of-the-host/addcamera/addcamera.component'; +import { EditcameraComponent } from './analysis-of-the-host/editcamera/editcamera.component'; @NgModule({ - declarations: [OrganizationComponent, UserComponent, RoleComponent, NavigationComponent, AdduserComponent, EdituserComponent, AddroleComponent, EditroleComponent, AddorComponent, EditorComponent, AnalysisOfTheHostComponent, AddhostComponent, EdithostComponent], + declarations: [OrganizationComponent, UserComponent, RoleComponent, NavigationComponent, AdduserComponent, EdituserComponent, AddroleComponent, EditroleComponent, AddorComponent, EditorComponent, AnalysisOfTheHostComponent, AddhostComponent, EdithostComponent, AddcameraComponent, EditcameraComponent], imports: [ CommonModule, SystemRoutingModule, @@ -53,7 +55,7 @@ import { EdithostComponent } from './analysis-of-the-host/edithost/edithost.comp NzTreeSelectModule, NzCheckboxModule ], - entryComponents :[AdduserComponent,EdituserComponent,AddroleComponent,EditroleComponent,AddorComponent,EditorComponent,AddhostComponent,EdithostComponent] + entryComponents :[AdduserComponent,EdituserComponent,AddroleComponent,EditroleComponent,AddorComponent,EditorComponent,AddhostComponent,EdithostComponent,AddcameraComponent,EditcameraComponent] }) export class SystemManagementModule { } diff --git a/src/app/system-management/user/adduser/adduser.component.ts b/src/app/system-management/user/adduser/adduser.component.ts index 290dbbc..4320adf 100644 --- a/src/app/system-management/user/adduser/adduser.component.ts +++ b/src/app/system-management/user/adduser/adduser.component.ts @@ -45,7 +45,7 @@ export class AdduserComponent implements OnInit { getAllOrganization() { this.http.get('/api/services/app/Organization/GetAll').subscribe((data: any) => { data.result.items.forEach(element => { - element.key = element.code + element.key = element.id element.title = element.displayName }); this.nodes = [...this.toTree.toTree(data.result.items)] diff --git a/src/app/system-management/user/edituser/edituser.component.html b/src/app/system-management/user/edituser/edituser.component.html index dc1a983..f7084b7 100644 --- a/src/app/system-management/user/edituser/edituser.component.html +++ b/src/app/system-management/user/edituser/edituser.component.html @@ -16,7 +16,7 @@ - + diff --git a/src/app/system-management/user/user.component.ts b/src/app/system-management/user/user.component.ts index eabc922..18ac3df 100644 --- a/src/app/system-management/user/user.component.ts +++ b/src/app/system-management/user/user.component.ts @@ -76,7 +76,7 @@ export class UserComponent implements OnInit { let body = { userName: instance.validateForm.value.account, name: instance.validateForm.value.name, - organizationId: Number(instance.validateForm.value.organization), + organizationUnitId: Number(instance.validateForm.value.organization), roleNames: instance.validateForm.value.role, phoneNumber: instance.validateForm.value.phonenum, isActive: true @@ -108,6 +108,7 @@ export class UserComponent implements OnInit { //编辑用户 editUser(data): void { + console.log(data) const modal = this.modal.create({ nzTitle: '编辑用户', nzContent: EdituserComponent, @@ -121,14 +122,15 @@ export class UserComponent implements OnInit { if (instance.validateForm.valid) { await new Promise(resolve => { let body = { + id:data.id, userName: instance.validateForm.value.account, name: instance.validateForm.value.name, - organizationId: instance.validateForm.value.organization, + organizationUnitId: instance.validateForm.value.organization, roleNames: instance.validateForm.value.role, phoneNumber: instance.validateForm.value.phonenum, isActive: true } - this.http.post('/api/services/app/User/Create', body).subscribe(data => { + this.http.put('/api/services/app/User/Update', body).subscribe(data => { resolve(data) this.message.create('success', '创建成功!'); this.getAllUsers() diff --git a/src/app/ui/tabbar/tabbar.component.html b/src/app/ui/tabbar/tabbar.component.html index cb138f4..267f8da 100644 --- a/src/app/ui/tabbar/tabbar.component.html +++ b/src/app/ui/tabbar/tabbar.component.html @@ -18,7 +18,7 @@
  • 基本信息
  • 器材信息
  • -
  • 系统管理
  • +
  • 退出系统
diff --git a/src/app/ui/tabbar/tabbar.component.ts b/src/app/ui/tabbar/tabbar.component.ts index 87f7986..9b62cba 100644 --- a/src/app/ui/tabbar/tabbar.component.ts +++ b/src/app/ui/tabbar/tabbar.component.ts @@ -21,10 +21,7 @@ export class TabbarComponent implements OnInit { setInterval(() => { this.getTime() }, 1000); - this.surname = JSON.parse(sessionStorage.getItem('userdata')).surname - // this.http.get('/api/services/app/Session/GetCurrentLoginInformations').subscribe((data: any) => { - // this.surname = data.result.user.surname - // }) + this.surname = JSON.parse(sessionStorage.getItem('userdata')).name } //获得时间 diff --git a/src/assets/images/left.png b/src/assets/images/left.png new file mode 100644 index 0000000..1fb4fc0 Binary files /dev/null and b/src/assets/images/left.png differ diff --git a/src/assets/images/left2.png b/src/assets/images/left2.png new file mode 100644 index 0000000..7c59007 Binary files /dev/null and b/src/assets/images/left2.png differ diff --git a/src/assets/images/right.png b/src/assets/images/right.png new file mode 100644 index 0000000..0342bf4 Binary files /dev/null and b/src/assets/images/right.png differ diff --git a/src/assets/images/right2.png b/src/assets/images/right2.png new file mode 100644 index 0000000..67be955 Binary files /dev/null and b/src/assets/images/right2.png differ diff --git a/src/assets/images/warning1.png b/src/assets/images/warning1.png new file mode 100644 index 0000000..cd769fe Binary files /dev/null and b/src/assets/images/warning1.png differ diff --git a/src/assets/images/warning2.png b/src/assets/images/warning2.png new file mode 100644 index 0000000..c1c2373 Binary files /dev/null and b/src/assets/images/warning2.png differ diff --git a/src/assets/images/warning3.png b/src/assets/images/warning3.png new file mode 100644 index 0000000..68604a1 Binary files /dev/null and b/src/assets/images/warning3.png differ diff --git a/src/assets/images/warning4.png b/src/assets/images/warning4.png new file mode 100644 index 0000000..8c092d6 Binary files /dev/null and b/src/assets/images/warning4.png differ