diff --git a/src/app/home/nav/nav.component.ts b/src/app/home/nav/nav.component.ts index e1a930e..ef35c8c 100644 --- a/src/app/home/nav/nav.component.ts +++ b/src/app/home/nav/nav.component.ts @@ -16,7 +16,6 @@ export class NavComponent implements OnInit { constructor(private modal: NzModalService, private http: HttpClient, private message: NzMessageService, private viewContainerRef: ViewContainerRef, private router: Router, public token: CacheTokenService) { } user = null - isSuperAdmin ngOnInit(): void { //调用服务中的function刷新token @@ -27,12 +26,14 @@ export class NavComponent implements OnInit { return item.name == '超级管理员' }) isTrue ? this.isSuperAdmin = true : this.isSuperAdmin = false - // signalR.initSR(); - // // 接收来自中心的消息 - // (signalR.SR as any).on('receiveNotification', (message: string, senderName: string) => { - // // 接收后要做的事 - // console.log('收到消息---', message) - // }) + + + signalR.initSR(); + // 接收来自中心的消息 + (signalR.SR as any).on('receiveNotification', (message: string, senderName: string) => { + // 接收后要做的事 + console.log('收到消息---', message) + }) @@ -41,10 +42,9 @@ export class NavComponent implements OnInit { this.router.navigate(['/login']) } ngOnDestroy(): void { - this.token.delete() - // console.log('断开SR') - // signalR.stopSR(); + (signalR.SR as any).receiveNotification = [] + signalR.stopSR() } changePassword() { diff --git a/src/app/home/system-management/user/adduser/adduser.component.html b/src/app/home/system-management/user/adduser/adduser.component.html index a3ff138..06c82f8 100644 --- a/src/app/home/system-management/user/adduser/adduser.component.html +++ b/src/app/home/system-management/user/adduser/adduser.component.html @@ -9,7 +9,7 @@ - 真实姓名 + 真实姓名 @@ -17,7 +17,7 @@ - 电子邮箱 + 电子邮箱 @@ -43,7 +43,7 @@ - 角色 + 角色 @@ -51,5 +51,14 @@ + + 职位 + + + + + + + \ No newline at end of file diff --git a/src/app/home/system-management/user/adduser/adduser.component.ts b/src/app/home/system-management/user/adduser/adduser.component.ts index 6469be4..cf0c5dd 100644 --- a/src/app/home/system-management/user/adduser/adduser.component.ts +++ b/src/app/home/system-management/user/adduser/adduser.component.ts @@ -19,10 +19,11 @@ export class AdduserComponent implements OnInit { ngOnInit(): void { this.validateForm = this.fb.group({ account: [null, [Validators.required]], - name: [null, [Validators.required]], - email: [null, [Validators.required]], + name: [null], + email: [null], organization: [null, [Validators.required]], - role: [[], [Validators.required]] + role: [[]], + posts: [[]] }); if (this.roleList.length == 0) { diff --git a/src/app/home/system-management/user/edituser/edituser.component.html b/src/app/home/system-management/user/edituser/edituser.component.html index a3ff138..06c82f8 100644 --- a/src/app/home/system-management/user/edituser/edituser.component.html +++ b/src/app/home/system-management/user/edituser/edituser.component.html @@ -9,7 +9,7 @@ - 真实姓名 + 真实姓名 @@ -17,7 +17,7 @@ - 电子邮箱 + 电子邮箱 @@ -43,7 +43,7 @@ - 角色 + 角色 @@ -51,5 +51,14 @@ + + 职位 + + + + + + + \ No newline at end of file diff --git a/src/app/home/system-management/user/edituser/edituser.component.ts b/src/app/home/system-management/user/edituser/edituser.component.ts index 085e1a8..33f9c30 100644 --- a/src/app/home/system-management/user/edituser/edituser.component.ts +++ b/src/app/home/system-management/user/edituser/edituser.component.ts @@ -23,10 +23,11 @@ export class EdituserComponent implements OnInit { }); this.validateForm = this.fb.group({ account: [this.data.username, [Validators.required]], - name: [this.data.name, [Validators.required]], - email: [this.data.email, [Validators.required]], + name: [this.data.name], + email: [this.data.email], organization: [this.data.organizationId, [Validators.required]], - role: [rolesId, [Validators.required]] + role: [rolesId], + posts: [this.data.posts] }); if (this.roleList.length == 0) { this.getAllRoles() diff --git a/src/app/home/system-management/user/user.component.html b/src/app/home/system-management/user/user.component.html index d687c08..a6fbd54 100644 --- a/src/app/home/system-management/user/user.component.html +++ b/src/app/home/system-management/user/user.component.html @@ -38,6 +38,7 @@ 真实姓名 所属机构 角色 + 职位 创建时间 操作 @@ -58,6 +59,11 @@ {{i.name}} + + + {{i}} + + {{item.creationTime | date:"yyyy-MM-dd"}} diff --git a/src/app/home/system-management/user/user.component.ts b/src/app/home/system-management/user/user.component.ts index f506a2a..9e1230a 100644 --- a/src/app/home/system-management/user/user.component.ts +++ b/src/app/home/system-management/user/user.component.ts @@ -139,6 +139,7 @@ export class UserComponent implements OnInit { email: instance.validateForm.value.email, organizationId: instance.validateForm.value.organization, roleIds: instance.validateForm.value.role, + posts: instance.validateForm.value.posts, } this.http.post('/api/Users', body).subscribe({ next: async (data) => { @@ -192,6 +193,7 @@ export class UserComponent implements OnInit { email: instance.validateForm.value.email, organizationId: instance.validateForm.value.organization, roleIds: instance.validateForm.value.role, + posts: instance.validateForm.value.posts, } this.http.patch(`/api/Users/${item.id}`, body).subscribe({ next: async (data) => { diff --git a/src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.ts b/src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.ts index 2ffbd38..40f0a6d 100644 --- a/src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.ts +++ b/src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.ts @@ -3,6 +3,7 @@ import { Component, NgZone, OnInit, ViewContainerRef } from '@angular/core'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalService } from 'ng-zorro-antd/modal'; import { AllotPersonComponent } from '../da-subordinate-audit/allot-person/allot-person.component'; +import signalR from '../../../../signalR' @Component({ selector: 'app-da-monthly-task-overview', templateUrl: './da-monthly-task-overview.component.html', @@ -62,6 +63,15 @@ export class DaMonthlyTaskOverviewComponent implements OnInit { OrganizationId ngOnInit(): void { + + + + // 接收来自中心的消息 + (signalR.SR as any).on('receiveNotification', (message: string, senderName: string) => { + // 接收后要做的事 + console.log('收到消息---', message) + }) + this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId this.selectedMonth = new Date().getMonth() + 1 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 256d8a1..e6069c4 100644 --- a/src/app/home/task/zhi-indicators/zhi-indicators.component.html +++ b/src/app/home/task/zhi-indicators/zhi-indicators.component.html @@ -448,19 +448,19 @@
- - - + + {{o.name}} - - - + + {{o.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 2d810de..2308eb2 100644 --- a/src/app/home/task/zhi-indicators/zhi-indicators.component.ts +++ b/src/app/home/task/zhi-indicators/zhi-indicators.component.ts @@ -9,6 +9,8 @@ import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalService } from 'ng-zorro-antd/modal'; import { EditOrComponent } from './edit-or/edit-or.component'; import { AllotPersonComponent } from '../da-subordinate-audit/allot-person/allot-person.component'; + +import signalR from '../../../../signalR' @Component({ selector: 'app-zhi-indicators', templateUrl: './zhi-indicators.component.html', @@ -401,6 +403,9 @@ export class ZhiIndicatorsComponent implements OnInit { OrganizationId ngOnInit(): void { + + + this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId this.selectedMonth = new Date().getMonth() + 1 //说明保存防抖 diff --git a/src/signalR.ts b/src/signalR.ts index 191dba1..9e5fe4b 100644 --- a/src/signalR.ts +++ b/src/signalR.ts @@ -40,15 +40,15 @@ export default { }, // 停止连接,因为调用that.SR.stop(),同时会触发5操作,所以用了flag stopSR: function () { - // const that = this - // (this.SR as any).flag = false - // async function stop() { - // try { - // await (this.SR as any).stop(); - // } catch (err) { - // console.log(err) - // } - // } - this.signalR.stop(); + let that = this; + (that.SR as any).flag = false + async function stop() { + try { + await that.SR.stop(); + console.log("signaR退出成功"); + } catch (err) { } + } + stop(); } + }; \ No newline at end of file