From 1df2c007c16c1b8eaffa420a6875c786b18ecfe3 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Fri, 2 Sep 2022 17:22:08 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E6=96=B0=E5=A2=9E=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E9=80=9A=E7=9F=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.module.ts | 11 ++-- src/app/auth.guard.ts | 5 +- src/app/home/home.module.ts | 8 ++- src/app/home/nav/nav.component.html | 41 ++++++++++--- src/app/home/nav/nav.component.scss | 44 +++++++++---- src/app/home/nav/nav.component.ts | 45 ++++++++++++-- .../system-management/user/user.component.ts | 1 - .../plan-adjustment.component.ts | 2 +- .../da-subordinate-audit.component.html | 2 +- .../apply/apply.component.ts | 5 +- .../station-task-apply.component.html | 6 +- .../station-task-apply.component.ts | 20 +++--- .../station-task-execution.component.html | 2 +- .../station-task-execution.component.ts | 14 ++--- .../station-weekly-plan.component.html | 13 ++-- .../station-weekly-plan.component.scss | 7 ++- .../station-weekly-plan.component.ts | 61 ++++++++++++------- .../zhi-indicators.component.html | 4 +- .../zhi-indicators.component.ts | 8 +-- src/app/http-interceptors/base-interceptor.ts | 1 - src/app/service/configFormData.service.ts | 10 --- src/app/{ => service}/method.service.ts | 27 ++++++-- src/app/service/new-task-message.service.ts | 28 +++++++++ src/theme.less | 11 ++++ 24 files changed, 255 insertions(+), 121 deletions(-) delete mode 100644 src/app/service/configFormData.service.ts rename src/app/{ => service}/method.service.ts (79%) create mode 100644 src/app/service/new-task-message.service.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 4919b50..fdd822e 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -11,14 +11,11 @@ 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 { SelectUnitComponent } from './commonComponents/select-unit/select-unit.component'; +import { MethodService } from './service/method.service'; +import { SelectUnitComponent } from './commonComponents/select-unit/select-unit.component'; import { TestComponent } from './commonComponents/test/test.component'; registerLocaleData(zh); @NgModule({ @@ -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 { } diff --git a/src/app/auth.guard.ts b/src/app/auth.guard.ts index 10df7d8..25b154a 100644 --- a/src/app/auth.guard.ts +++ b/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'); diff --git a/src/app/home/home.module.ts b/src/app/home/home.module.ts index 08f291f..db7db92 100644 --- a/src/app/home/home.module.ts +++ b/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] }) diff --git a/src/app/home/nav/nav.component.html b/src/app/home/nav/nav.component.html index 2404a09..30cb638 100644 --- a/src/app/home/nav/nav.component.html +++ b/src/app/home/nav/nav.component.html @@ -19,16 +19,37 @@
-
欢迎 , {{user}}
- - - - - - +
欢迎 , {{user}}
+
+ +
+ +
+ + + + + {{ item.content }} + + + + +
+
+
+ + + + +
    +
  • 修改密码
  • +
  • 退出
  • +
+
+
+
diff --git a/src/app/home/nav/nav.component.scss b/src/app/home/nav/nav.component.scss index 50f7f45..06ea1f7 100644 --- a/src/app/home/nav/nav.component.scss +++ b/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; +} \ No newline at end of file diff --git a/src/app/home/nav/nav.component.ts b/src/app/home/nav/nav.component.ts index 29cff3d..789e07f 100644 --- a/src/app/home/nav/nav.component.ts +++ b/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); + } + } diff --git a/src/app/home/system-management/user/user.component.ts b/src/app/home/system-management/user/user.component.ts index 9e1230a..1d201a1 100644 --- a/src/app/home/system-management/user/user.component.ts +++ b/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 diff --git a/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.ts b/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.ts index 301274a..ef35294 100644 --- a/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.ts +++ b/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 diff --git a/src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.html b/src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.html index 895f0d9..7d453b4 100644 --- a/src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.html +++ b/src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.html @@ -42,7 +42,7 @@ 分配 | - 申请人: {{item.assitantOrganization.name}} + 申请人: {{item.assistantOrganization.name}}
diff --git a/src/app/home/task/station-task-apply/apply/apply.component.ts b/src/app/home/task/station-task-apply/apply/apply.component.ts index 2c6131d..fe878bf 100644 --- a/src/app/home/task/station-task-apply/apply/apply.component.ts +++ b/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 diff --git a/src/app/home/task/station-task-apply/station-task-apply.component.html b/src/app/home/task/station-task-apply/station-task-apply.component.html index f29ae54..2bf153c 100644 --- a/src/app/home/task/station-task-apply/station-task-apply.component.html +++ b/src/app/home/task/station-task-apply/station-task-apply.component.html @@ -9,7 +9,7 @@
    -
  • +
  • {{item.content}}
    @@ -119,7 +119,7 @@
    - + {{i.name}} @@ -136,7 +136,7 @@ - + {{i.name}} diff --git a/src/app/home/task/station-task-apply/station-task-apply.component.ts b/src/app/home/task/station-task-apply/station-task-apply.component.ts index 0ab3679..c0243dc 100644 --- a/src/app/home/task/station-task-apply/station-task-apply.component.ts +++ b/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: '待处理' } diff --git a/src/app/home/task/station-task-execution/station-task-execution.component.html b/src/app/home/task/station-task-execution/station-task-execution.component.html index 6808698..c9b10fd 100644 --- a/src/app/home/task/station-task-execution/station-task-execution.component.html +++ b/src/app/home/task/station-task-execution/station-task-execution.component.html @@ -9,7 +9,7 @@
      -
    • +
    • {{item.content}}
      diff --git a/src/app/home/task/station-task-execution/station-task-execution.component.ts b/src/app/home/task/station-task-execution/station-task-execution.component.ts index 5d2307e..44a6918 100644 --- a/src/app/home/task/station-task-execution/station-task-execution.component.ts +++ b/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 diff --git a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.html b/src/app/home/task/station-weekly-plan/station-weekly-plan.component.html index 12f5846..ad8cd36 100644 --- a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.html +++ b/src/app/home/task/station-weekly-plan/station-weekly-plan.component.html @@ -9,7 +9,7 @@
        -
      • +
      • {{item.content}}
        @@ -53,10 +53,13 @@
      -
      - - {{item.name}} -
      + +
      + + {{item.name}} +
      +
      +

      任务分配 diff --git a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.scss b/src/app/home/task/station-weekly-plan/station-weekly-plan.component.scss index 3882aa4..19c1c37 100644 --- a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.scss +++ b/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; diff --git a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts b/src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts index 39d3a31..d1ee327 100644 --- a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts +++ b/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 diff --git a/src/app/home/task/zhi-indicators/zhi-indicators.component.html b/src/app/home/task/zhi-indicators/zhi-indicators.component.html index 75e0558..3664e72 100644 --- a/src/app/home/task/zhi-indicators/zhi-indicators.component.html +++ b/src/app/home/task/zhi-indicators/zhi-indicators.component.html @@ -148,7 +148,7 @@ /{{i.name}} - + /{{i.name}} @@ -314,7 +314,7 @@ /{{i.name}} - + /{{i.name}} diff --git a/src/app/home/task/zhi-indicators/zhi-indicators.component.ts b/src/app/home/task/zhi-indicators/zhi-indicators.component.ts index 5d7263e..cb84d07 100644 --- a/src/app/home/task/zhi-indicators/zhi-indicators.component.ts +++ b/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) => { diff --git a/src/app/http-interceptors/base-interceptor.ts b/src/app/http-interceptors/base-interceptor.ts index 02bc6ca..8163235 100644 --- a/src/app/http-interceptors/base-interceptor.ts +++ b/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}`, }); diff --git a/src/app/service/configFormData.service.ts b/src/app/service/configFormData.service.ts deleted file mode 100644 index 3f02089..0000000 --- a/src/app/service/configFormData.service.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable() -export class ConfigFormDataService { - tableData: any//摄像头列表数据 - config1: any//配置文件 - config2: any//配置文件 - config3: any//配置文件 - config4: any//配置文件 -} \ No newline at end of file diff --git a/src/app/method.service.ts b/src/app/service/method.service.ts similarity index 79% rename from src/app/method.service.ts rename to src/app/service/method.service.ts index 2a1329c..d5b5fd5 100644 --- a/src/app/method.service.ts +++ b/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((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((resolve, reject) => { + this.http.get(`/api/PlanTasks/${id}`).subscribe((data: any) => { resolve(data) }) }) } - diff --git a/src/app/service/new-task-message.service.ts b/src/app/service/new-task-message.service.ts new file mode 100644 index 0000000..33f947e --- /dev/null +++ b/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 = new ReplaySubject; + + /** * 向其他组件发送信息 * @param message 需要发送的信息 * + * @returns {Observavle} */ + + public sendMessage(message: any) { + + this._sendMessage.next(message); + + } + + /** *订阅其他组件发送来的消息 * + * @returns {Observalue} */ + + public getMessage() { + + return this._sendMessage.asObservable(); + + } +} diff --git a/src/theme.less b/src/theme.less index b39bbd5..a0ca125 100644 --- a/src/theme.less +++ b/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; +} \ No newline at end of file