Browse Source

[修改]修改用户界面

非煤矿山灾害智能感知和预警系统
邵佳豪 3 years ago
parent
commit
105dca6691
  1. 20
      src/app/home/nav/nav.component.ts
  2. 15
      src/app/home/system-management/user/adduser/adduser.component.html
  3. 7
      src/app/home/system-management/user/adduser/adduser.component.ts
  4. 15
      src/app/home/system-management/user/edituser/edituser.component.html
  5. 7
      src/app/home/system-management/user/edituser/edituser.component.ts
  6. 6
      src/app/home/system-management/user/user.component.html
  7. 2
      src/app/home/system-management/user/user.component.ts
  8. 10
      src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.ts
  9. 16
      src/app/home/task/zhi-indicators/zhi-indicators.component.html
  10. 5
      src/app/home/task/zhi-indicators/zhi-indicators.component.ts
  11. 20
      src/signalR.ts

20
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() {

15
src/app/home/system-management/user/adduser/adduser.component.html

@ -9,7 +9,7 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="真实姓名">真实姓名</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="真实姓名">真实姓名</nz-form-label>
<nz-form-control>
<nz-input-group>
<input nz-input type="text" formControlName="name" placeholder="请输入真实姓名" />
@ -17,7 +17,7 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="电子邮箱">电子邮箱</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="电子邮箱">电子邮箱</nz-form-label>
<nz-form-control>
<nz-input-group>
<input nz-input type="text" formControlName="email" placeholder="请输入电子邮箱" />
@ -43,7 +43,7 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="角色">角色</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="角色">角色</nz-form-label>
<nz-form-control>
<nz-select formControlName="role" nzPlaceHolder="请选择角色" nzMode="multiple">
<nz-option *ngFor="let item of listOfData" [nzValue]="item.id" [nzLabel]="item.name">
@ -51,5 +51,14 @@
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="职位">职位</nz-form-label>
<nz-form-control>
<nz-select formControlName="posts" nzPlaceHolder="请选择职位" nzMode="multiple">
<nz-option [nzValue]="'主查'" [nzLabel]="'主查'"></nz-option>
<nz-option [nzValue]="'协查'" [nzLabel]="'协查'"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</form>
</div>

7
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) {

15
src/app/home/system-management/user/edituser/edituser.component.html

@ -9,7 +9,7 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="真实姓名">真实姓名</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="真实姓名">真实姓名</nz-form-label>
<nz-form-control>
<nz-input-group>
<input nz-input type="text" formControlName="name" placeholder="请输入真实姓名" />
@ -17,7 +17,7 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="电子邮箱">电子邮箱</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="电子邮箱">电子邮箱</nz-form-label>
<nz-form-control>
<nz-input-group>
<input nz-input type="text" formControlName="email" placeholder="请输入电子邮箱" />
@ -43,7 +43,7 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="角色">角色</nz-form-label>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="角色">角色</nz-form-label>
<nz-form-control>
<nz-select formControlName="role" nzPlaceHolder="请选择角色" nzMode="multiple">
<nz-option *ngFor="let item of listOfData" [nzValue]="item.id" [nzLabel]="item.name">
@ -51,5 +51,14 @@
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="职位">职位</nz-form-label>
<nz-form-control>
<nz-select formControlName="posts" nzPlaceHolder="请选择职位" nzMode="multiple">
<nz-option [nzValue]="'主查'" [nzLabel]="'主查'"></nz-option>
<nz-option [nzValue]="'协查'" [nzLabel]="'协查'"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</form>
</div>

7
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()

6
src/app/home/system-management/user/user.component.html

@ -38,6 +38,7 @@
<th>真实姓名</th>
<th>所属机构</th>
<th>角色</th>
<th>职位</th>
<th>创建时间</th>
<th [width]="'20%'">操作</th>
</tr>
@ -58,6 +59,11 @@
{{i.name}}
</span>
</td>
<td>
<span *ngFor="let i of item.posts">
{{i}}
</span>
</td>
<td>
{{item.creationTime | date:"yyyy-MM-dd"}}
</td>

2
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) => {

10
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

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

@ -448,19 +448,19 @@
<ng-container *ngIf="i.supervisors.length != 0; else elseTemplate">
<div class="ellipsis">
<span class="assistant" nz-tooltip [nzTooltipTitle]="titleTemplate">
<span *ngFor="let o of i.supervisors">
<img *ngIf="o.posts && o.posts[0] == '主查人员'"
src="../../../../assets/images/icon/main.png" alt="">
<img *ngIf="o.posts && o.posts[0] == '协查人员'"
<span *ngFor="let o of i.supervisors;let key = index">
<img *ngIf="key == 0" src="../../../../assets/images/icon/main.png"
alt="">
<img *ngIf="key == 1"
src="../../../../assets/images/icon/assist.png" alt="">
{{o.name}}
</span>
</span>
<ng-template #titleTemplate let-thing>
<span style="margin-right: 6px;" *ngFor="let o of i.supervisors">
<img *ngIf="o.posts && o.posts[0] == '主查人员'"
src="../../../../assets/images/icon/main.png" alt="">
<img *ngIf="o.posts && o.posts[0] == '协查人员'"
<span style="margin-right: 6px;" *ngFor="let o of i.supervisors;let key = index">
<img *ngIf="key == 0" src="../../../../assets/images/icon/main.png"
alt="">
<img *ngIf="key == 2"
src="../../../../assets/images/icon/assist.png" alt="">
{{o.name}}
</span>

5
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
//说明保存防抖

20
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();
}
};
Loading…
Cancel
Save