Browse Source

[新增]新增消息通知功能

非煤矿山灾害智能感知和预警系统
邵佳豪 3 years ago
parent
commit
1df2c007c1
  1. 9
      src/app/app.module.ts
  2. 5
      src/app/auth.guard.ts
  3. 8
      src/app/home/home.module.ts
  4. 41
      src/app/home/nav/nav.component.html
  5. 44
      src/app/home/nav/nav.component.scss
  6. 45
      src/app/home/nav/nav.component.ts
  7. 1
      src/app/home/system-management/user/user.component.ts
  8. 2
      src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.ts
  9. 2
      src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.html
  10. 5
      src/app/home/task/station-task-apply/apply/apply.component.ts
  11. 6
      src/app/home/task/station-task-apply/station-task-apply.component.html
  12. 20
      src/app/home/task/station-task-apply/station-task-apply.component.ts
  13. 2
      src/app/home/task/station-task-execution/station-task-execution.component.html
  14. 14
      src/app/home/task/station-task-execution/station-task-execution.component.ts
  15. 13
      src/app/home/task/station-weekly-plan/station-weekly-plan.component.html
  16. 7
      src/app/home/task/station-weekly-plan/station-weekly-plan.component.scss
  17. 61
      src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts
  18. 4
      src/app/home/task/zhi-indicators/zhi-indicators.component.html
  19. 8
      src/app/home/task/zhi-indicators/zhi-indicators.component.ts
  20. 1
      src/app/http-interceptors/base-interceptor.ts
  21. 10
      src/app/service/configFormData.service.ts
  22. 27
      src/app/service/method.service.ts
  23. 28
      src/app/service/new-task-message.service.ts
  24. 11
      src/theme.less

9
src/app/app.module.ts

@ -11,13 +11,10 @@ import { CacheTokenService } from './service/cache-token.service'
import { NzNotificationModule } from 'ng-zorro-antd/notification';
import { NzMessageModule } from 'ng-zorro-antd/message';
import { TreeService } from './service/tree.service';
import { RouteReuseStrategy } from '@angular/router';
import { CustomReuseStrategy } from './CustomReuseStrategy';
import { ConfigFormDataService } from './service/configFormData.service';
import { registerLocaleData } from '@angular/common';
import { NzModalModule } from 'ng-zorro-antd/modal';
import zh from '@angular/common/locales/zh';
import { MethodService } from './method.service';
import { MethodService } from './service/method.service';
import { SelectUnitComponent } from './commonComponents/select-unit/select-unit.component';
import { TestComponent } from './commonComponents/test/test.component';
registerLocaleData(zh);
@ -38,9 +35,9 @@ registerLocaleData(zh);
NzMessageModule,
NzModalModule
],
// providers: [httpInterceptorProviders, CacheTokenService, TreeService, ConfigFormDataService,
// providers: [httpInterceptorProviders, CacheTokenService, TreeService,
// { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }],
providers: [httpInterceptorProviders, CacheTokenService, TreeService, ConfigFormDataService, MethodService],
providers: [httpInterceptorProviders, CacheTokenService, TreeService, MethodService],
bootstrap: [AppComponent]
})
export class AppModule { }

5
src/app/auth.guard.ts

@ -14,14 +14,11 @@ 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();
}
checkLogin(): boolean {
// console.log('xxxxxxxxxxxx')
// 判断本地有没有token
const token = sessionStorage.getItem('token');

8
src/app/home/home.module.ts

@ -64,6 +64,9 @@ import { TaskDetailsComponent } from './task/station-weekly-plan/task-details/ta
import { EditOrComponent } from './task/zhi-indicators/edit-or/edit-or.component';
import { NzInputNumberModule } from 'ng-zorro-antd/input-number';
import { CreateTaskComponent } from './task/station-weekly-plan/create-task/create-task.component';
import { NzNotificationModule } from 'ng-zorro-antd/notification';
import { NzBadgeModule } from 'ng-zorro-antd/badge';
import { NzListModule } from 'ng-zorro-antd/list';
@NgModule({
declarations: [
NavComponent,
@ -133,7 +136,10 @@ import { CreateTaskComponent } from './task/station-weekly-plan/create-task/crea
NzCardModule,
NzUploadModule,
NzToolTipModule,
NzInputNumberModule
NzInputNumberModule,
NzNotificationModule,
NzBadgeModule,
NzListModule
],
entryComponents: [AddroleComponent, EditroleComponent, AdduserComponent, EdituserComponent, AddorComponent, EditorComponent, ApplyComponent, ApplyLookComponent, LookTaskComponent, AllotPersonComponent, EditOrComponent, CreateTaskComponent]
})

41
src/app/home/nav/nav.component.html

@ -19,16 +19,37 @@
</li>
</ul>
<div class="headerbtn">
<div>欢迎 , {{user}}</div>
<a nz-dropdown [nzDropdownMenu]="menu" [nzTrigger]="'click'" [nzBackdrop]='false'>
<i nz-icon nzType="setting"></i>
</a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li nz-menu-item (click)="changePassword()">修改密码</li>
<li nz-menu-item (click)="signOut()">退出</li>
</ul>
</nz-dropdown-menu>
<div class="username">欢迎 , {{user}}</div>
<div class="iconbox" nz-popover nzPopoverTitle="消息列表" [(nzPopoverVisible)]="visible" [nzPopoverTrigger]=null
[nzPopoverContent]="contentTemplateMess" nzPopoverPlacement="bottomRight" (click)="clickMe()"
[nzPopoverOverlayStyle]="{'padding': '0'}">
<span nz-icon nzType="bell" nzTheme="outline"></span>
</div>
<ng-template #contentTemplateMess>
<div class="messageBox">
<nz-list nzBordered [nzBordered]="false">
<nz-list-item *ngFor="let item of methodService.notificationsList">
<nz-list-item-meta [nzDescription]="item.creationTime | date:'yyyy-MM-dd hh:mm:ss'">
<nz-list-item-meta-title>
{{ item.content }}
</nz-list-item-meta-title>
</nz-list-item-meta>
</nz-list-item>
</nz-list>
</div>
</ng-template>
<div class="iconbox">
<a nz-dropdown [nzDropdownMenu]="menu" [nzTrigger]="'click'" [nzBackdrop]='false'>
<i nz-icon nzType="setting"></i>
</a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li nz-menu-item (click)="changePassword()">修改密码</li>
<li nz-menu-item (click)="signOut()">退出</li>
</ul>
</nz-dropdown-menu>
</div>
</div>
</nz-header>
<nz-layout>

44
src/app/home/nav/nav.component.scss

@ -11,26 +11,43 @@ nz-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 20px;
.logobox{
width: 220px;
img{
padding: 0;
.logobox {
width: 250px;
img {
margin-right: 8px;
}
font-size: 16px;
}
.headerbtn{
text-align: right;
width: 220px;
.headerbtn {
width: 250px;
display: flex;
div{
align-items: center;
justify-content: flex-end;
.username {
flex: 1;
padding-right: 20px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: right;
margin-right: 8px;
}
a{
color: #fff;
.iconbox{
width: 30px;
cursor: pointer;
span,a{
text-align: center;
color: #fff;
}
}
}
ul {
display: flex;
justify-content: center;
@ -88,3 +105,8 @@ nz-layout:last-child {
.router-link-active {
color: black;
}
.messageBox{
width: 300px;
height: 530px;
overflow-y: auto;
}

45
src/app/home/nav/nav.component.ts

@ -7,6 +7,9 @@ import { NzModalService } from 'ng-zorro-antd/modal';
import { NzMessageService } from 'ng-zorro-antd/message';
import signalR from '../../../signalR'
import { NzNotificationPlacement, NzNotificationService } from 'ng-zorro-antd/notification';
import { MethodService } from 'src/app/service/method.service';
import { NewTaskMessageService } from 'src/app/service/new-task-message.service';
@Component({
selector: 'app-nav',
templateUrl: './nav.component.html',
@ -14,7 +17,7 @@ import signalR from '../../../signalR'
})
export class NavComponent implements OnInit {
constructor(private modal: NzModalService, private http: HttpClient, private message: NzMessageService, private viewContainerRef: ViewContainerRef, private router: Router, public token: CacheTokenService) { }
constructor(private modal: NzModalService, private http: HttpClient, private message: NzMessageService, private viewContainerRef: ViewContainerRef, private router: Router, public token: CacheTokenService, private notification: NzNotificationService, public methodService: MethodService, private newTaskMessage: NewTaskMessageService) { }
user = null
isSuperAdmin
@ -31,22 +34,43 @@ export class NavComponent implements OnInit {
let organizationLevel = JSON.parse(sessionStorage.getItem('userData')).organizationLevel
organizationLevel == 'brigade' ? this.isZhidui = true : this.isZhidui = false
this.methodService.getNotifications()
signalR.initSR();
// 接收来自中心的消息
(signalR.SR as any).on('receiveNotification', (message: string, senderName: string) => {
// 接收后要做的事
(signalR.SR as any).on('receiveNotification', (message: any, senderName: string) => {
console.log('收到消息---', message)
//1.右下角弹窗(新增任务提示)
if (message.planTaskState == 'added') {
this.createBasicNotification(message)
}
//2.右上角消息栏目(全部消息)
//3.生成周计划新增徽章(新增任务提示)
if (this.router.url.indexOf('weeklyplan') != -1) {
this.methodService.getTaskDetails(message.planTaskId).then((data: any) => {
this.newTaskMessage.sendMessage(data);//发布一条消息
})
}
})
}
createBasicNotification(data): void {
this.notification.blank(
'任务提示',
data.senderName + '向你发起一个任务,' + data.content,
{ nzPlacement: 'bottomRight' }
);
}
signOut() {
this.router.navigate(['/login'])
}
ngOnDestroy(): void {
(signalR.SR as any).receiveNotification = []
signalR.stopSR()
}
@ -92,4 +116,15 @@ export class NavComponent implements OnInit {
// Return a result when closed
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result));
}
visible: boolean = false;
clickMe(): void {
this.visible = !this.visible;
}
change(value: boolean): void {
console.log(value);
}
}

1
src/app/home/system-management/user/user.component.ts

@ -99,7 +99,6 @@ export class UserComponent implements OnInit {
this.http.get('/api/Organizations', {
params: params
}).subscribe((data: any) => {
console.log('xxx', data)
data.items.forEach(element => {
if (element.id == organizationId) {
element.parentId = null

2
src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.ts

@ -141,7 +141,7 @@ export class PlanAdjustmentComponent implements OnInit {
params = {
Month: this.time,
SupervisorId: this.isSupervisor ? this.userId : null,
AssitantOrganizationId: this.isSupervisor ? null : this.OrganizationId,
assistantOrganizationId: this.isSupervisor ? null : this.OrganizationId,
PageNumber: this.PageNumber,
approvalStatuses: statuses,
PageSize: this.PageSize

2
src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.html

@ -42,7 +42,7 @@
</span>
<span class="blue" (click)="allot(item)">分配</span>
<span>|</span>
<span>申请人: {{item.assitantOrganization.name}}</span>
<span>申请人: {{item.assistantOrganization.name}}</span>
<!-- <span class="blue">修改</span> -->
</div>
<div class="btn">

5
src/app/home/task/station-task-apply/apply/apply.component.ts

@ -26,8 +26,9 @@ export class ApplyComponent implements OnInit {
taskType
newTree
OrganizationId
ngOnInit(): void {
this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId
console.log('mainsupervisorList', this.mainsupervisorList)
console.log('assitantsupervisorList', this.assitantsupervisorList)
this.validateForm = this.fb.group({
@ -150,6 +151,7 @@ export class ApplyComponent implements OnInit {
PageNumber = 1
async getCompanies(incomingData?: any) {
let params = {
OrganizationId: this.OrganizationId,
CompanyName: incomingData ? incomingData.search1 : '',
PageNumber: this.PageNumber,
PageSize: 50
@ -223,6 +225,7 @@ export class ApplyComponent implements OnInit {
if (incomingData.search2) {
incomingData.isnodes = false
let params = {
OrganizationId: this.OrganizationId,
CompanyName: incomingData.search2,
PageNumber: this.PageNumber,
PageSize: 9999

6
src/app/home/task/station-task-apply/station-task-apply.component.html

@ -9,7 +9,7 @@
<div class="informright" id="container" (mouseenter)="mouseEnter()" (mouseleave)="mouseleave()">
<div id="list-wrapper" style="top: 0">
<ul class="notice-list" id="notice-list">
<li class="info" *ngFor="let item of messageList;let key = index">
<li class="info" *ngFor="let item of methodService.notificationsList;let key = index">
<div class="infoitem">
{{item.content}}
</div>
@ -119,7 +119,7 @@
<div class="flexcol flexcolassistant">
<span class="assistant" nz-tooltip [nzTooltipTitle]="titleTemplate">
<ng-container *ngIf="isSupervisor; else elseTemplate2">
<span *ngFor="let i of item.assitantOrganizations">
<span *ngFor="let i of item.assistantOrganizations">
{{i.name}}
</span>
<span *ngFor="let i of item.supervisors;let key = index">
@ -136,7 +136,7 @@
</span>
<ng-template #titleTemplate let-thing>
<ng-container *ngIf="isSupervisor; else elseTemplate3">
<span style="margin-right: 6px;" *ngFor="let i of item.assitantOrganizations">
<span style="margin-right: 6px;" *ngFor="let i of item.assistantOrganizations">
{{i.name}}
</span>
<span style="margin-right: 6px;" *ngFor="let i of item.supervisors;let key = index">

20
src/app/home/task/station-task-apply/station-task-apply.component.ts

@ -8,7 +8,7 @@ import { TreeService } from 'src/app/service/tree.service';
import { ApplyComponent } from './apply/apply.component';
import { ApplyLookComponent } from './apply-look/apply-look.component';
import { ThisReceiver } from '@angular/compiler';
import { MethodService } from 'src/app/method.service';
import { MethodService } from 'src/app/service/method.service';
@Component({
@ -19,7 +19,7 @@ import { MethodService } from 'src/app/method.service';
export class StationTaskApplyComponent implements OnInit {
validateForm!: FormGroup;
constructor(private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient, private toTree: TreeService, private methodService: MethodService) { }
constructor(private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient, private toTree: TreeService, public methodService: MethodService) { }
searchForm = {
taskname: '',
unitname: '',
@ -69,7 +69,7 @@ export class StationTaskApplyComponent implements OnInit {
Month: selectedTime,
TaskName: this.searchForm.taskname,
CompanyName: this.searchForm.unitname,
AssitantOrganizationId: this.searchForm.or,
assistantOrganizationId: this.searchForm.or,
CreatorId: this.isSupervisor ? this.userId : null,//如果是检查员需要传CreatorId只针对这个账户 如果是救援站就不需要
CreationTypes: ['申领任务'],
OrganizationId: this.OrganizationId,
@ -200,7 +200,6 @@ export class StationTaskApplyComponent implements OnInit {
return p
}
messageList = []
userId
ngOnInit(): void {
this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId
@ -232,11 +231,6 @@ export class StationTaskApplyComponent implements OnInit {
this.getSupervisortype('main')
this.getSupervisortype('assisted')
//滚动消息
this.methodService.getNotifications().then((data: any) => {
this.messageList = data
})
}
timer
@ -312,17 +306,17 @@ export class StationTaskApplyComponent implements OnInit {
let selectedMonth = this.selectedMonth < 10 ? "0" + this.selectedMonth : this.selectedMonth;
let selectedTime = this.selectedYear + '-' + selectedMonth + '-' + '01'
let supervisorIds
let assitantOrganizationIds
let assistantOrganizationIds
if (this.isSupervisor) {
if (instance.taskType == '双随机') {
supervisorIds = [instance.validateForm.value.main, instance.validateForm.value.assist]
} else {
supervisorIds = []
}
assitantOrganizationIds = instance.validateForm.value.organization
assistantOrganizationIds = instance.validateForm.value.organization
} else {
supervisorIds = instance.validateForm.value.organization
assitantOrganizationIds = []
assistantOrganizationIds = []
}
let body = {
@ -332,7 +326,7 @@ export class StationTaskApplyComponent implements OnInit {
companyId: instance.selectedUnitData.id,
organizationId: this.OrganizationId,
supervisorIds: supervisorIds,
assitantOrganizationIds: assitantOrganizationIds,
assistantOrganizationIds: assistantOrganizationIds,
creationType: '申领任务',
approvalStatus: '待处理'
}

2
src/app/home/task/station-task-execution/station-task-execution.component.html

@ -9,7 +9,7 @@
<div class="informright" id="container" (mouseenter)="mouseEnter()" (mouseleave)="mouseleave()">
<div id="list-wrapper" style="top: 0">
<ul class="notice-list" id="notice-list">
<li class="info" *ngFor="let item of messageList;let key = index">
<li class="info" *ngFor="let item of methodService.notificationsList;let key = index">
<div class="infoitem">
{{item.content}}
</div>

14
src/app/home/task/station-task-execution/station-task-execution.component.ts

@ -6,7 +6,7 @@ import { NzMessageService } from 'ng-zorro-antd/message';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { TreeService } from 'src/app/service/tree.service';
import { ThisReceiver } from '@angular/compiler';
import { MethodService } from 'src/app/method.service';
import { MethodService } from 'src/app/service/method.service';
@Component({
selector: 'app-station-task-execution',
templateUrl: './station-task-execution.component.html',
@ -15,7 +15,7 @@ import { MethodService } from 'src/app/method.service';
export class StationTaskExecutionComponent implements OnInit {
validateForm!: FormGroup;
constructor(private methodService: MethodService, private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient, private toTree: TreeService) { }
constructor(public methodService: MethodService, private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient, private toTree: TreeService) { }
searchForm = {
taskname: '',
unitname: '',
@ -72,7 +72,7 @@ export class StationTaskExecutionComponent implements OnInit {
// OrganizationId: this.OrganizationId,
TaskName: this.searchForm.taskname,
CompanyName: this.searchForm.unitname,
AssitantOrganizationId: this.searchForm.or,
assistantOrganizationId: this.searchForm.or,
approvalStatuses: ['已检查'],
SupervisorId: this.userId,
PageNumber: this.PageNumber,
@ -222,17 +222,11 @@ export class StationTaskExecutionComponent implements OnInit {
let date = '2022-9-10'
let t2 = Date.parse(date)
this.methodService.countdown(t1, t2, (res) => {
console.log(666, res)
// console.log(666, res)
this.time1 = res.day + '天' + res.hour + '小时'
})
//滚动消息
this.methodService.getNotifications().then((data: any) => {
this.messageList = data
})
}
messageList = []
timer
rollStart() {
var ROLL_SPEED = 100

13
src/app/home/task/station-weekly-plan/station-weekly-plan.component.html

@ -9,7 +9,7 @@
<div class="informright" id="container" (mouseenter)="mouseEnter()" (mouseleave)="mouseleave()">
<div id="list-wrapper" style="top: 0">
<ul class="notice-list" id="notice-list">
<li class="info" *ngFor="let item of messageList;let key = index">
<li class="info" *ngFor="let item of methodService.notificationsList;let key = index">
<div class="infoitem">
{{item.content}}
</div>
@ -53,10 +53,13 @@
</div>
<div class="itemone" *ngIf="!item.isDetails">
<div class="instrumentpanelitemleft">
<div class="panelheadername" [style]="'background:'+ item.background">
<img [src]="'../../../../assets/images/icon/'+ item.icon" alt="">
{{item.name}}
</div>
<nz-badge [nzCount]="item.badgeNum">
<div class="panelheadername" [style]="'background:'+ item.background">
<img [src]="'../../../../assets/images/icon/'+ item.icon" alt="">
{{item.name}}
</div>
</nz-badge>
<div class="tasknum">
<p>
<span style="margin-right: 6px;">任务分配</span>

7
src/app/home/task/station-weekly-plan/station-weekly-plan.component.scss

@ -115,10 +115,13 @@
align-items: flex-start;
flex: 1;
box-sizing: border-box;
nz-badge{
width: 80%;
color: #fff;
}
.panelheadername {
width: 80%;
width: 100%;
height: 46px;
line-height: 46px;
text-align: center;

61
src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts

@ -10,7 +10,8 @@ import { TaskDetailsComponent } from './task-details/task-details.component';
import { CreateTaskComponent } from './create-task/create-task.component';
import { differenceInCalendarDays, setHours } from 'date-fns'
import { PlanAdjustmentComponent } from '../da-oneself-plan/plan-adjustment/plan-adjustment.component';
import { MethodService } from 'src/app/method.service';
import { MethodService } from 'src/app/service/method.service';
import { NewTaskMessageService } from 'src/app/service/new-task-message.service';
@Component({
selector: 'app-station-weekly-plan',
templateUrl: './station-weekly-plan.component.html',
@ -18,7 +19,7 @@ import { MethodService } from 'src/app/method.service';
})
export class StationWeeklyPlanComponent implements OnInit {
constructor(private http: HttpClient, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef, private methodService: MethodService) { }
constructor(private http: HttpClient, private modal: NzModalService, private message: NzMessageService, private viewContainerRef: ViewContainerRef, public methodService: MethodService, private newTaskMessage: NewTaskMessageService) { }
OrganizationId
userId
isSupervisor
@ -79,6 +80,7 @@ export class StationWeeklyPlanComponent implements OnInit {
openDetails(data, type) {
data.isDetails = type
data.badgeNum = 0
}
radioChange(e, i, element) {
@ -146,24 +148,24 @@ export class StationWeeklyPlanComponent implements OnInit {
}
cardData = [
{ name: '双随机', isDetails: false, isLoading: false, background: '#1D9DFF', icon: 'suiji.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '行政许可', isDetails: false, isLoading: false, background: '#42B983', icon: 'xuke.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '熟悉演练', isDetails: false, isLoading: false, background: '#9D80FF', icon: 'yanlian.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '联络指导', isDetails: false, isLoading: false, background: '#5483EA', icon: 'zhidao.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '消防宣传', isDetails: false, isLoading: false, background: '#FF5D2A', icon: 'xuanchuan.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '投诉举报', isDetails: false, isLoading: false, background: '#5087FF', icon: 'tousu.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '火灾调查', isDetails: false, isLoading: false, background: '#FF404D', icon: 'huozai.png', passed: 0, inspected: 0, percentage: 0, data: [] }
{ name: '双随机', badgeNum: 0, isDetails: false, isLoading: false, background: '#1D9DFF', icon: 'suiji.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '行政许可', badgeNum: 0, isDetails: false, isLoading: false, background: '#42B983', icon: 'xuke.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '熟悉演练', badgeNum: 0, isDetails: false, isLoading: false, background: '#9D80FF', icon: 'yanlian.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '联络指导', badgeNum: 0, isDetails: false, isLoading: false, background: '#5483EA', icon: 'zhidao.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '消防宣传', badgeNum: 0, isDetails: false, isLoading: false, background: '#FF5D2A', icon: 'xuanchuan.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '投诉举报', badgeNum: 0, isDetails: false, isLoading: false, background: '#5087FF', icon: 'tousu.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '火灾调查', badgeNum: 0, isDetails: false, isLoading: false, background: '#FF404D', icon: 'huozai.png', passed: 0, inspected: 0, percentage: 0, data: [] }
]
//初始化数据
initializeData() {
this.cardData = [
{ name: '双随机', isDetails: false, isLoading: false, background: '#1D9DFF', icon: 'suiji.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '行政许可', isDetails: false, isLoading: false, background: '#42B983', icon: 'xuke.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '熟悉演练', isDetails: false, isLoading: false, background: '#9D80FF', icon: 'yanlian.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '联络指导', isDetails: false, isLoading: false, background: '#5483EA', icon: 'zhidao.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '消防宣传', isDetails: false, isLoading: false, background: '#FF5D2A', icon: 'xuanchuan.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '投诉举报', isDetails: false, isLoading: false, background: '#5087FF', icon: 'tousu.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '火灾调查', isDetails: false, isLoading: false, background: '#FF404D', icon: 'huozai.png', passed: 0, inspected: 0, percentage: 0, data: [] }
{ name: '双随机', badgeNum: 0, isDetails: false, isLoading: false, background: '#1D9DFF', icon: 'suiji.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '行政许可', badgeNum: 0, isDetails: false, isLoading: false, background: '#42B983', icon: 'xuke.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '熟悉演练', badgeNum: 0, isDetails: false, isLoading: false, background: '#9D80FF', icon: 'yanlian.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '联络指导', badgeNum: 0, isDetails: false, isLoading: false, background: '#5483EA', icon: 'zhidao.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '消防宣传', badgeNum: 0, isDetails: false, isLoading: false, background: '#FF5D2A', icon: 'xuanchuan.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '投诉举报', badgeNum: 0, isDetails: false, isLoading: false, background: '#5087FF', icon: 'tousu.png', passed: 0, inspected: 0, percentage: 0, data: [] },
{ name: '火灾调查', badgeNum: 0, isDetails: false, isLoading: false, background: '#FF404D', icon: 'huozai.png', passed: 0, inspected: 0, percentage: 0, data: [] }
]
this.stationData.forEach(element => {
@ -190,7 +192,7 @@ export class StationWeeklyPlanComponent implements OnInit {
let params = {
Month: selectedTime,
SupervisorId: this.isSupervisor ? this.userId : null,
AssitantOrganizationId: this.isSupervisor ? null : this.OrganizationId,
assistantOrganizationId: this.isSupervisor ? null : this.OrganizationId,
PageNumber: this.PageNumber,
PageSize: this.PageSize,
approvalStatuses: ['待处理', '通过', '驳回', '待检查', '已检查']
@ -232,7 +234,7 @@ export class StationWeeklyPlanComponent implements OnInit {
Month: selectedTime,
approvalStatuses: ['通过', '待检查', '已检查'],
SupervisorId: this.isSupervisor ? this.userId : null,
AssitantOrganizationId: this.isSupervisor ? null : this.OrganizationId,
assistantOrganizationId: this.isSupervisor ? null : this.OrganizationId,
PageNumber: this.PageNumber,
PageSize: this.PageSize
}
@ -382,13 +384,26 @@ export class StationWeeklyPlanComponent implements OnInit {
this.rollStart()
}, 0);
//滚动消息
this.methodService.getNotifications().then((data: any) => {
this.messageList = data
})
this.newTaskMessage.getMessage().subscribe((data: any) => {
console.log('具体任务信息', data);
this.cardData.forEach((item: any) => {
if (item.name == data.taskType) {
item.data.unshift(data)
if (!item.isDetails) {
item.badgeNum += 1
}
if (data.approvalStatus == '通过') {
item.passed += 1
this.getTaskListPass(this.stationData[0])
}
}
})
});
}
messageList = []
timer
rollStart() {
var ROLL_SPEED = 100

4
src/app/home/task/zhi-indicators/zhi-indicators.component.html

@ -148,7 +148,7 @@
<span *ngFor="let i of item.supervisors">
/{{i.name}}
</span>
<span *ngFor="let i of item.assitantOrganizations">
<span *ngFor="let i of item.assistantOrganizations">
/{{i.name}}
</span>
</span>
@ -314,7 +314,7 @@
<span *ngFor="let i of item.supervisors">
/{{i.name}}
</span>
<span *ngFor="let i of item.assitantOrganizations">
<span *ngFor="let i of item.assistantOrganizations">
/{{i.name}}
</span>
</span>

8
src/app/home/task/zhi-indicators/zhi-indicators.component.ts

@ -365,7 +365,7 @@ export class ZhiIndicatorsComponent implements OnInit {
nzWidth: 660,
nzMaskClosable: false,
nzComponentParams: {
selectedData: [...item.supervisorIds, ...item.assitantOrganizationIds],
selectedData: [...item.supervisorIds, ...item.assistantOrganizationIds],
organizationList: JSON.parse(JSON.stringify(this.allOrList)),
// users: JSON.parse(JSON.stringify(this.users)),
supervisorList: [...JSON.parse(JSON.stringify(this.assitantsupervisorList)), ...JSON.parse(JSON.stringify(this.mainsupervisorList))]
@ -375,13 +375,13 @@ export class ZhiIndicatorsComponent implements OnInit {
await new Promise((resolve, reject) => {
console.log(instance.nzTreeComponent.getCheckedNodeList())
let supervisorIds = []
let assitantOrganizationIds = []
let assistantOrganizationIds = []
instance.nzTreeComponent.getCheckedNodeList().forEach(item => {
item.origin.datatype == '机构' ? assitantOrganizationIds.push(item.key) : supervisorIds.push(item.key)
item.origin.datatype == '机构' ? assistantOrganizationIds.push(item.key) : supervisorIds.push(item.key)
})
let body = {
supervisorIds: supervisorIds,
assitantOrganizationIds: assitantOrganizationIds
assistantOrganizationIds: assistantOrganizationIds
}
this.http.patch(`/api/PlanTasks/${item.id}`, body).subscribe({
next: async (data: any) => {

1
src/app/http-interceptors/base-interceptor.ts

@ -26,7 +26,6 @@ export class BaseInterceptor implements HttpInterceptor {
}
req = req.clone({ params });
// debugger
// console.log('xxxxxx',req)
let newReq = req.clone({
url: req.hadBaseurl ? `${req.url}` : `${req.url}`,
});

10
src/app/service/configFormData.service.ts

@ -1,10 +0,0 @@
import { Injectable } from '@angular/core';
@Injectable()
export class ConfigFormDataService {
tableData: any//摄像头列表数据
config1: any//配置文件
config2: any//配置文件
config3: any//配置文件
config4: any//配置文件
}

27
src/app/method.service.ts → src/app/service/method.service.ts

@ -8,14 +8,12 @@ export class MethodService {
constructor(private http: HttpClient) { }
timer = null
/***
@param {number} nowtime
@param {number} endtime
@example: countdown('当前时间时间戳' '结束时间时间戳', callback);
*/
timer = null
countdown(nowtime, endtime, callback) {
var times = parseInt(String((endtime - nowtime) / 1000));
this.timer = setInterval(function () {
@ -44,15 +42,34 @@ export class MethodService {
clearTimeout(this.timer);
}
//获得播报消息
/**
* @params
*/
notificationsList
/**
* @returns
*/
async getNotifications() {
return new Promise<void>((resolve, reject) => {
this.http.get('/api/Notifications').subscribe((data: any) => {
console.log('消息列表',data)
this.notificationsList = data
resolve(data)
})
})
}
/**
* @param id id
* @returns
*/
async getTaskDetails(id) {
return new Promise<void>((resolve, reject) => {
this.http.get(`/api/PlanTasks/${id}`).subscribe((data: any) => {
resolve(data)
})
})
}

28
src/app/service/new-task-message.service.ts

@ -0,0 +1,28 @@
import { Injectable } from '@angular/core';
import { ReplaySubject } from "rxjs";
@Injectable({
providedIn: 'root'
})
export class NewTaskMessageService {
constructor() { }
private _sendMessage: ReplaySubject<any> = new ReplaySubject;
/** * * @param message *
* @returns {Observavle<any>} */
public sendMessage(message: any) {
this._sendMessage.next(message);
}
/** * *
* @returns {Observalue<any>} */
public getMessage() {
return this._sendMessage.asObservable();
}
}

11
src/theme.less

@ -94,6 +94,11 @@
}
}
.ant-badge {
p {
color: #fff;
}
}
.bigfontpattern {
.logobox {
@ -114,6 +119,9 @@
padding-bottom: 0;
}
.panelheadername {
width: 140px !important;
}
}
// 适配125%
@ -138,3 +146,6 @@
}
}
}
.xxx{
padding: 0;
}
Loading…
Cancel
Save