Browse Source

Merge branch 'master' of http://121.36.37.70:3000/shaojiahao/Jinan_project

非煤矿山灾害智能感知和预警系统
jingbowen 3 years ago
parent
commit
b7f5cd9cac
  1. 9
      src/app/app.module.ts
  2. 0
      src/app/commonComponents/select-unit/select-unit.component.html
  3. 53
      src/app/commonComponents/select-unit/select-unit.component.scss
  4. 17
      src/app/commonComponents/select-unit/select-unit.component.ts
  5. 1
      src/app/commonComponents/test/test.component.html
  6. 0
      src/app/commonComponents/test/test.component.scss
  7. 25
      src/app/commonComponents/test/test.component.spec.ts
  8. 15
      src/app/commonComponents/test/test.component.ts
  9. 20
      src/app/home/nav/nav.component.ts
  10. 15
      src/app/home/system-management/user/adduser/adduser.component.html
  11. 7
      src/app/home/system-management/user/adduser/adduser.component.ts
  12. 15
      src/app/home/system-management/user/edituser/edituser.component.html
  13. 7
      src/app/home/system-management/user/edituser/edituser.component.ts
  14. 6
      src/app/home/system-management/user/user.component.html
  15. 2
      src/app/home/system-management/user/user.component.ts
  16. 10
      src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.ts
  17. 6
      src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.html
  18. 3
      src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.ts
  19. 62
      src/app/home/task/station-task-apply/apply/apply.component.html
  20. 15
      src/app/home/task/station-task-apply/apply/apply.component.scss
  21. 222
      src/app/home/task/station-task-apply/apply/apply.component.ts
  22. 30
      src/app/home/task/station-task-apply/station-task-apply.component.html
  23. 58
      src/app/home/task/station-task-apply/station-task-apply.component.ts
  24. 11
      src/app/home/task/station-task-execution/station-task-execution.component.html
  25. 19
      src/app/home/task/station-task-execution/station-task-execution.component.ts
  26. 203
      src/app/home/task/zhi-indicators/zhi-indicators.component.html
  27. 195
      src/app/home/task/zhi-indicators/zhi-indicators.component.ts
  28. 47
      src/app/method.service.ts
  29. 20
      src/signalR.ts
  30. 2
      src/theme.less

9
src/app/app.module.ts

@ -17,10 +17,15 @@ 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 { TestComponent } from './commonComponents/test/test.component';
registerLocaleData(zh);
@NgModule({
declarations: [
AppComponent
AppComponent,
SelectUnitComponent,
TestComponent
],
imports: [
BrowserModule,
@ -35,7 +40,7 @@ registerLocaleData(zh);
],
// providers: [httpInterceptorProviders, CacheTokenService, TreeService, ConfigFormDataService,
// { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }],
providers: [httpInterceptorProviders, CacheTokenService, TreeService, ConfigFormDataService],
providers: [httpInterceptorProviders, CacheTokenService, TreeService, ConfigFormDataService, MethodService],
bootstrap: [AppComponent]
})
export class AppModule { }

0
src/app/commonComponents/select-unit/select-unit.component.html

53
src/app/commonComponents/select-unit/select-unit.component.scss

@ -0,0 +1,53 @@
.selectUnitPopover {
width: 550px;
height: 492px;
nz-form-item {
margin: 12px 0;
}
display: flex;
flex-direction: column;
.popoverTitle {
display: flex;
align-items: center;
span {
color: #C7CAD0;
cursor: pointer;
}
.selectedspan {
color: #2C4DC0;
}
}
.popoverContent {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
.popoverContentitem {
flex: 1;
overflow-y: auto;
display: flex;
flex-direction: column;
p {
text-align: center;
}
}
}
.popoverBtn {
display: flex;
justify-content: flex-end;
margin-top: 16px;
button {
margin-left: 18px;
}
}
}

17
src/app/commonComponents/select-unit/select-unit.component.ts

@ -0,0 +1,17 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-select-unit',
templateUrl: './select-unit.component.html',
styleUrls: ['./select-unit.component.scss']
})
export class SelectUnitComponent implements OnInit {
constructor() { }
complaint
ngOnInit(): void {
}
}

1
src/app/commonComponents/test/test.component.html

@ -0,0 +1 @@
<p>test works!</p>

0
src/app/commonComponents/test/test.component.scss

25
src/app/commonComponents/test/test.component.spec.ts

@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TestComponent } from './test.component';
describe('TestComponent', () => {
let component: TestComponent;
let fixture: ComponentFixture<TestComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ TestComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(TestComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

15
src/app/commonComponents/test/test.component.ts

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-test',
templateUrl: './test.component.html',
styleUrls: ['./test.component.scss']
})
export class TestComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

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

6
src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.html

@ -3,7 +3,8 @@
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="检查员(主)">检查员(主)</nz-form-label>
<nz-form-control>
<nz-select nzMode="multiple" formControlName="main" nzPlaceHolder="请选择消防监督检查员(主)">
<nz-select nzShowSearch [nzDropdownClassName]="'maxHeightTreeSelect'" formControlName="main"
nzPlaceHolder="请选择消防监督检查员(主)">
<nz-option *ngFor="let item of mainsupervisorList" [nzValue]="item.id" [nzLabel]="item.name">
</nz-option>
</nz-select>
@ -12,7 +13,8 @@
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="检查员(协)">检查员(协)</nz-form-label>
<nz-form-control>
<nz-select nzMode="multiple" formControlName="assitant" nzPlaceHolder="请选择消防监督检查员(协)">
<nz-select nzShowSearch [nzDropdownClassName]="'maxHeightTreeSelect'" formControlName="assitant"
nzPlaceHolder="请选择消防监督检查员(协)">
<nz-option *ngFor="let item of assitantsupervisorList" [nzValue]="item.id" [nzLabel]="item.name">
</nz-option>
</nz-select>

3
src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.ts

@ -21,7 +21,8 @@ export class AllotPersonComponent implements OnInit {
assitant: [null, [Validators.required]]
});
// console.log(this.mainsupervisorList)
// console.log(this.assitantsupervisorList)
}
destroyModal(): void {
this.modal.destroy({ data: 'this the result data' });

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

@ -3,7 +3,7 @@
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="账号">任务名称</nz-form-label>
<nz-form-control>
<nz-radio-group formControlName="taskname">
<nz-radio-group formControlName="taskname" [(ngModel)]="taskType">
<label nz-radio [nzValue]="item" *ngFor="let item of title">{{item}}</label>
</nz-radio-group>
</nz-form-control>
@ -53,11 +53,19 @@
<nz-checkbox-group [(ngModel)]="unitPopover.unitList" (ngModelChange)="log(unitPopover)"
[ngModelOptions]="{standalone: true}">
</nz-checkbox-group>
<p class="blue" *ngIf="unitPopover.unitList.length < totalCount" (click)="moreData()">
<ng-container *ngIf="moreDataLoading; else moreDatatemplate">
<span nz-icon nzType="loading" nzTheme="outline"></span>
</ng-container>
<ng-template #moreDatatemplate>
更多
</ng-template>
</p>
</div>
</div>
<div class="popoverContent" *ngIf="unitPopover.selectedMenu == 2">
<div>
<form nz-form>
<form nz-form (ngSubmit)="getCompaniesByName(unitPopover)">
<nz-form-item>
<nz-form-control>
<nz-input-group nzPrefixIcon="search">
@ -65,32 +73,41 @@
placeholder="请输入单位名称" [ngModelOptions]="{standalone: true}" />
</nz-input-group>
</nz-form-control>
<button style="display: none;" type="submit"></button>
</nz-form-item>
</form>
</div>
<div class="popoverContentitem">
<nz-tree [nzHideUnMatched]='true' [nzSearchValue]="unitPopover.search2" #nzTreeComponent
[nzData]="unitPopover.nodes" [nzTreeTemplate]="nzTreeTemplate" nzBlockNode
[nzExpandedIcon]="multiExpandedIconTpl2">
<nz-tree *ngIf="unitPopover.isnodes" [nzHideUnMatched]='true' [nzData]="unitPopover.nodes"
[nzTreeTemplate]="nzTreeTemplateunitPopover1" nzBlockNode [nzAsyncData]="true"
(nzExpandChange)="onExpandChange($event)">
</nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<ng-template #nzTreeTemplateunitPopover1 let-node let-origin="origin">
<div class="nodebox">
<span class="name">
<label *ngIf="node.origin.companyName" [(ngModel)]="node.origin.isChecked"
nz-checkbox (ngModelChange)="orcheckbox(unitPopover,$event,node)"
<label *ngIf="node.origin.companyName" nz-checkbox
[(ngModel)]="node.origin.isChecked"
(ngModelChange)="orcheckbox(unitPopover,$event,node)"
[ngModelOptions]="{standalone: true}"></label>
{{ node.title }}
</span>
</div>
</ng-template>
<ng-template #multiExpandedIconTpl2 let-node let-origin="origin">
<ng-container *ngIf="node.origin.companyName; else elseTemplate">
</ng-container>
<ng-template #elseTemplate>
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'"
class="ant-tree-switcher-line-icon"></i>
</ng-template>
<nz-tree *ngIf="!unitPopover.isnodes" [nzHideUnMatched]='true' [nzData]="unitPopover.nodes2"
[nzTreeTemplate]="nzTreeTemplateunitPopover2" nzBlockNode>
</nz-tree>
<ng-template #nzTreeTemplateunitPopover2 let-node let-origin="origin">
<div class="nodebox">
<span class="name">
<label *ngIf="node.origin.companyName" nz-checkbox
[(ngModel)]="node.origin.isChecked"
(ngModelChange)="orcheckbox(unitPopover,$event,node)"
[ngModelOptions]="{standalone: true}"></label>
{{ node.title }}
</span>
</div>
</ng-template>
</div>
</div>
@ -122,5 +139,20 @@
</ng-template>
</nz-form-control>
</nz-form-item>
<nz-form-item class="itembox" *ngIf="taskType == '双随机'">
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired nzFor="检查人员">检查人员</nz-form-label>
<nz-form-control>
<img class="img1" src="../../../../../assets/images/icon/main.png" alt="">
<nz-select nzPlaceHolder="请选择主查" class="select" formControlName="main">
<nz-option *ngFor="let item of mainsupervisorList" [nzValue]="item.id" [nzLabel]="item.name">
</nz-option>
</nz-select>
<img class="img2" src="../../../../../assets/images/icon/assist.png" alt="">
<nz-select nzPlaceHolder="请选择协查" class="select" formControlName="assist">
<nz-option *ngFor="let item of assitantsupervisorList" [nzValue]="item.id" [nzLabel]="item.name">
</nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</form>
</div>

15
src/app/home/task/station-task-apply/apply/apply.component.scss

@ -26,6 +26,7 @@
border: 1px solid #d9d9d9;
box-sizing: border-box;
padding: 10px;
nz-form-item {
margin: 12px 0;
}
@ -76,3 +77,17 @@
}
}
}
.itembox {
.img1 {
margin-right: 8px;
}
.img2 {
margin: 0 8px;
}
.select{
width: 44.6%;
}
}

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

@ -6,6 +6,7 @@ import { TreeService } from 'src/app/service/tree.service';
import { Observable, of } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { NzMessageService } from 'ng-zorro-antd/message';
import { NzFormatEmitEvent, NzTreeNodeOptions } from 'ng-zorro-antd/tree';
@Component({
selector: 'app-apply',
templateUrl: './apply.component.html',
@ -17,27 +18,34 @@ export class ApplyComponent implements OnInit {
@Input() supervisorList?: any;
@Input() organizationList?: any;
@Input() users?: any;
@Input() mainsupervisorList?: any;
@Input() assitantsupervisorList?: any;
validateForm!: FormGroup;
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService, private message: NzMessageService) { }
taskType
newTree
ngOnInit(): void {
console.log('mainsupervisorList', this.mainsupervisorList)
console.log('assitantsupervisorList', this.assitantsupervisorList)
this.validateForm = this.fb.group({
taskname: [null, [Validators.required]],
organization: [null, [Validators.required]]
organization: [null, [Validators.required]],
main: [null],
assist: [null]
});
this.newTree = this.nodes
this.getCompanies()
this.getAllOrganization()
Promise.all([this.getCompanies(), this.getAllOrganization()])
.then((results) => {
let arr = [...JSON.parse(JSON.stringify(this.allOrList)), ...JSON.parse(JSON.stringify(this.unitList))]
let nodes = [...this.toTree.toTree(arr)]
console.log('6666',nodes)
this.unitPopover.nodes = JSON.parse(JSON.stringify(nodes))
});
// Promise.all([this.getCompanies(), this.getAllOrganization()])
// .then((results) => {
// let arr = [...JSON.parse(JSON.stringify(this.allOrList)), ...JSON.parse(JSON.stringify(this.unitList))]
// let nodes = [...this.toTree.toTree(arr)]
// this.unitPopover.nodes = JSON.parse(JSON.stringify(nodes))
// });
}
@ -61,47 +69,24 @@ export class ApplyComponent implements OnInit {
element.title = element.name
element.selectable = false
element.disableCheckbox = true
element.datatype = '机构'
element.level == 'squadron' ? element.disableCheckbox = false : null
});
this.allOrList = JSON.parse(JSON.stringify(data.items))
console.log(111,this.allOrList)
this.allOrList.forEach(element => {
if(element.id == JSON.parse(sessionStorage.getItem('userData')).organizationId){
data.items.forEach(element => {
if (element.id == JSON.parse(sessionStorage.getItem('userData')).organizationId) {
element.parentId = null
}
});
this.allOrList = JSON.parse(JSON.stringify(data.items))
this.nodes = [...this.toTree.toTree(JSON.parse(JSON.stringify(data.items)))]
this.unitPopover.nodes = JSON.parse(JSON.stringify(this.nodes))
console.log(6666, data.items)
resolve(data)
})
})
}
unitList
async getCompanies(incomingData?: any) {
let params = {
CompanyName: incomingData ? incomingData.search1 : '',
OrganizationId: JSON.parse(sessionStorage.getItem('userData')).organizationId,
PageNumber: 1,
PageSize: 9999
}
return new Promise<void>((resolve, reject) => {
this.http.get('/api/Companies', {
params: params
}).subscribe((data: any) => {
data.items.forEach(element => {
element.label = element.companyName
element.value = element.id
element.parentId = element.organizationId
element.key = element.id
element.title = element.companyName
element.level = 4
});
this.unitList = data.items
this.unitPopover.unitList = JSON.parse(JSON.stringify(this.unitList))
resolve(data)
})
})
}
selectedUnitData = {
@ -112,19 +97,18 @@ export class ApplyComponent implements OnInit {
e ? e.stopPropagation() : null
let arr = [...data.search1Value, ...data.search2Value]
let arrSet = [...new Set(arr)]
console.log(arrSet)
console.log(this.unitPopover)
if (arrSet.length > 1) {
this.message.create('warning', '只能选择一个单位');
return
} else {
this.unitList.forEach(element => {
if (element.id == arrSet[0]) {
this.selectedUnitData.name = element.companyName
this.selectedUnitData.id = element.id
}
});
console.log(this.selectedUnitData)
console.log(this.unitPopover)
this.http.get(`/api/Companies/${arrSet[0]}`).subscribe((data: any) => {
console.log(data)
this.selectedUnitData.name = data.companyName
this.selectedUnitData.id = data.id
})
this.unitPopover.isPopover = false
}
}
@ -143,16 +127,13 @@ export class ApplyComponent implements OnInit {
data: [
],//表格数据
nodes: [],
nodes2: [],//查询后展示的tree
isnodes: true,
unitList: []
}
isPopover(data, e?: any) {
e ? e.stopPropagation() : null
console.log(data)
data.isPopover = !data.isPopover
// data.unitList.forEach(element => {
// element.checked = false
// });
}
// 弹出 tab
popoverMenuSelect(data, type) {
@ -160,10 +141,134 @@ export class ApplyComponent implements OnInit {
}
//搜索框提交
submitForm(data): void {
console.log(data)
data.unitList = []
this.PageNumber = 1
this.getCompanies(data)
}
totalCount: number
unitList = []
PageNumber = 1
async getCompanies(incomingData?: any) {
let params = {
CompanyName: incomingData ? incomingData.search1 : '',
PageNumber: this.PageNumber,
PageSize: 50
}
return new Promise<void>((resolve, reject) => {
this.http.get('/api/Companies', {
params: params
}).subscribe((data: any) => {
this.moreDataLoading = false
this.totalCount = data.totalCount
data.items.forEach(element => {
element.label = element.companyName
element.value = element.id
element.parentId = element.organizationId
element.key = element.id
element.title = element.companyName
element.level = 4
});
this.unitList = data.items
this.unitPopover.unitList = this.unitPopover.unitList.concat(JSON.parse(JSON.stringify(data.items)));
this.unitPopover.unitList = [...this.unitPopover.unitList]
resolve(data)
})
})
}
moreDataLoading = false
moreData() {
this.moreDataLoading = true
this.PageNumber += 1
this.getCompanies()
}
onExpandChange(e: NzFormatEmitEvent): void {
const node = e.node;
if (node && node.getChildren().length === 0 && node.isExpanded && node.origin.level == 'squadron') {
this.loadNode(node.origin.id).then(data => {
node.addChildren(data);
});
} else {
node.isLoading = false
}
}
loadNode(id): Promise<NzTreeNodeOptions[]> {
return new Promise(resolve => {
let params = {
OrganizationId: id,
PageNumber: 1,
PageSize: 9999
}
this.http.get('/api/Companies', {
params: params
}).subscribe((data: any) => {
console.log(data.items)
data.items.forEach(element => {
element.key = element.id
element.title = element.companyName
element.level = 4
element.isLeaf = true
});
resolve(data.items)
})
});
}
async getCompaniesByName(incomingData) {
console.log(incomingData.search2Value)
if (incomingData.search2) {
incomingData.isnodes = false
let params = {
CompanyName: incomingData.search2,
PageNumber: this.PageNumber,
PageSize: 9999
}
return new Promise<void>((resolve, reject) => {
this.http.get('/api/Companies', {
params: params
}).subscribe((data: any) => {
this.moreDataLoading = false
this.totalCount = data.totalCount
data.items.forEach(element => {
element.label = element.companyName
element.value = element.id
element.parentId = element.organizationId
element.key = element.id
element.title = element.companyName
element.level = 4
element.isLeaf = true
incomingData.search2Value.forEach(item => {
item == element.id ? element.isChecked = true : null
});
});
if (data.items.length == 0) {
this.message.create('warning', '没有查询到任何单位');
incomingData.isnodes = true
return
}
let allOrList = JSON.parse(JSON.stringify(this.allOrList))
allOrList.forEach(element => {
element.expanded = true
});
let arr = [...allOrList, ...data.items]
incomingData.nodes2 = [...this.toTree.toTree(arr)]
resolve(data)
})
})
} else {
// incomingData.search2Value = []
incomingData.isnodes = true
}
}
log(data) {
let arr = []
data.unitList.forEach(item => {
@ -172,6 +277,7 @@ export class ApplyComponent implements OnInit {
data.search1Value = arr
}
orcheckbox(data, $event, node) {
// search2NameValue
if ($event) {
data.search2Value.push(node.origin.id)
} else {
@ -182,8 +288,8 @@ export class ApplyComponent implements OnInit {
index--
}
}
}
console.log(data.search2Value)
}
}

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

@ -49,15 +49,16 @@
<div class="searchbox">
<div class="search">
<nz-select nzPlaceHolder="任务名称" [(ngModel)]="searchForm.taskname" nzAllowClear>
<nz-option nzValue="监督检查" nzLabel="监督检查"></nz-option>
<nz-option nzValue="熟悉演练" nzLabel="熟悉演练"></nz-option>
<nz-option *ngIf="isSupervisor" nzValue="双随机" nzLabel="双随机"></nz-option>
<nz-option *ngIf="isSupervisor" nzValue="联络指导" nzLabel="联络指导"></nz-option>
<nz-option *ngIf="!isSupervisor" nzValue="熟悉演练" nzLabel="熟悉演练"></nz-option>
</nz-select>
<input type="text" nz-input placeholder="单位名称" [(ngModel)]="searchForm.unitname" nzAllowClear />
<!-- <nz-select nzPlaceHolder="单位级别" [(ngModel)]="searchForm.unitlevel">
<nz-option nzValue="一般单位" nzLabel="一般单位"></nz-option>
<nz-option nzValue="重点单位" nzLabel="重点单位"></nz-option>
</nz-select> -->
<nz-tree-select [nzExpandedKeys]="expandKeys" [nzNodes]="nodes" nzShowSearch nzPlaceHolder="协助机构"
<!-- <nz-tree-select [nzExpandedKeys]="expandKeys" [nzNodes]="nodes" nzShowSearch nzPlaceHolder="协助机构"
[(ngModel)]="searchForm.or" [nzExpandedIcon]="multiExpandedIconTpl"
[nzDropdownClassName]="'maxHeightTreeSelect'" nzAllowClear>
</nz-tree-select>
@ -68,7 +69,7 @@
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'"
class="ant-tree-switcher-line-icon"></i>
</ng-template>
</ng-template>
</ng-template> -->
<button (click)="search()" nz-button nzType="primary"><i nz-icon nzType="search"
nzTheme="outline"></i>查询</button>
<button (click)="reset()" nz-button nzType="default"><i nz-icon nzType="reload"
@ -121,13 +122,14 @@
<span *ngFor="let i of item.assitantOrganizations">
{{i.name}}
</span>
<span *ngFor="let i of item.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="">
{{i.name}}
</span>
</ng-container>
<ng-template #elseTemplate2>
<span *ngFor="let i of item.supervisors">
<img *ngIf="i.posts && i.posts[0] == '主查人员'"
src="../../../../assets/images/icon/main.png" alt="">
<img *ngIf="i.posts && i.posts[0] == '协查人员'"
src="../../../../assets/images/icon/assist.png" alt="">
{{i.name}}
</span>
</ng-template>
@ -137,21 +139,21 @@
<span style="margin-right: 6px;" *ngFor="let i of item.assitantOrganizations">
{{i.name}}
</span>
<span style="margin-right: 6px;" *ngFor="let i of item.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="">
{{i.name}}
</span>
</ng-container>
<ng-template #elseTemplate3>
<span style="margin-right: 6px;" *ngFor="let i of item.supervisors">
<img *ngIf="i.posts && i.posts[0] == '主查人员'"
src="../../../../assets/images/icon/main.png" alt="">
<img *ngIf="i.posts && i.posts[0] == '协查人员'"
src="../../../../assets/images/icon/assist.png" alt="">
{{i.name}}
</span>
</ng-template>
</ng-template>
<span>
{{isSupervisor ? '协助机构' : '协助人员'}}
{{isSupervisor ? '协助机构/人员' : '协助人员'}}
</span>
</div>
<div class="flexcol">

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

@ -70,7 +70,7 @@ export class StationTaskApplyComponent implements OnInit {
CompanyName: this.searchForm.unitname,
AssitantOrganizationId: this.searchForm.or,
CreatorId: this.isSupervisor ? this.userId : null,//如果是检查员需要传CreatorId只针对这个账户 如果是救援站就不需要
CreationTypes:['申领任务'],
CreationTypes: ['申领任务'],
OrganizationId: this.OrganizationId,
PageNumber: this.PageNumber,
PageSize: this.PageSize
@ -139,10 +139,9 @@ export class StationTaskApplyComponent implements OnInit {
//获得所有检查员
supervisorList = []
mainsupervisorList = []
assitantsupervisorList = []
async getSupervisor() {
var p = new Promise<void>((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
this.http.get('/api/Users/Inspectors').subscribe((data: any) => {
console.log('检查员列表', data)
data.forEach(element => {
@ -154,7 +153,23 @@ export class StationTaskApplyComponent implements OnInit {
resolve(data)
})
})
return p
}
mainsupervisorList = []
assitantsupervisorList = []
getSupervisortype(type) {
let params = {
inspectorType: type
}
this.http.get('/api/Users/Inspectors', {
params: params
}).subscribe((data: any) => {
if (type == 'main') {
this.mainsupervisorList = data
} else {
this.assitantsupervisorList = data
}
})
}
//获得除了检查员的其他用户
@ -210,6 +225,10 @@ export class StationTaskApplyComponent implements OnInit {
setTimeout(() => {
this.rollStart()
}, 0);
//获得主协调查人员
this.getSupervisortype('main')
this.getSupervisortype('assisted')
}
messageList = [1, 1, 1, 1, 1]
@ -268,22 +287,45 @@ export class StationTaskApplyComponent implements OnInit {
supervisorList: JSON.parse(JSON.stringify(this.supervisorList)),
organizationList: JSON.parse(JSON.stringify(this.organizationList)),
users: JSON.parse(JSON.stringify(this.users)),
nodes: JSON.parse(JSON.stringify(this.nodes))
nodes: JSON.parse(JSON.stringify(this.nodes)),
mainsupervisorList: JSON.parse(JSON.stringify(this.mainsupervisorList)),
assitantsupervisorList: JSON.parse(JSON.stringify(this.assitantsupervisorList))
},
nzOnOk: async () => {
console.log(instance.validateForm.value)
if (instance.validateForm.valid && instance.selectedUnitData.id) {
if (instance.taskType == '双随机') {
if (!instance.validateForm.value.main || !instance.validateForm.value.assist) {
this.message.create('warning', '请填写检查人员!');
return false
}
}
await new Promise((resolve, reject) => {
let selectedMonth = this.selectedMonth < 10 ? "0" + this.selectedMonth : this.selectedMonth;
let selectedTime = this.selectedYear + '-' + selectedMonth + '-' + '01'
let supervisorIds
let assitantOrganizationIds
if (this.isSupervisor) {
if (instance.taskType == '双随机') {
supervisorIds = [instance.validateForm.value.main, instance.validateForm.value.assist]
} else {
supervisorIds = []
}
assitantOrganizationIds = instance.validateForm.value.organization
} else {
supervisorIds = instance.validateForm.value.organization
assitantOrganizationIds = []
}
let body = {
month: selectedTime,
taskName: instance.validateForm.value.taskname,
taskType: instance.validateForm.value.taskname,
companyId: instance.selectedUnitData.id,
organizationId: this.OrganizationId,
supervisorIds: this.isSupervisor ? [] : instance.validateForm.value.organization,
assitantOrganizationIds: this.isSupervisor ? instance.validateForm.value.organization : [],
supervisorIds: supervisorIds,
assitantOrganizationIds: assitantOrganizationIds,
creationType: '申领任务',
approvalStatus: '待处理'
}

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

@ -43,21 +43,22 @@
</span>
<span style="font-size: 14px; color: #42B983;">
<i nz-icon nzType="info-circle" nzTheme="outline"></i>
任务申请已开始!剩余时间 3天13小时 / 生成周计划已开始!剩余时间 23:54:03
任务申请已开始!剩余时间 {{time1}} / 生成周计划已开始!剩余时间 {{time1}}
</span>
</div>
<div class="searchbox">
<div class="search">
<nz-select nzPlaceHolder="任务名称" [(ngModel)]="searchForm.taskname" nzAllowClear>
<nz-option nzValue="监督检查" nzLabel="监督检查"></nz-option>
<nz-option nzValue="熟悉演练" nzLabel="熟悉演练"></nz-option>
<nz-option *ngIf="isSupervisor" nzValue="双随机" nzLabel="双随机"></nz-option>
<nz-option *ngIf="isSupervisor" nzValue="联络指导" nzLabel="联络指导"></nz-option>
<nz-option *ngIf="!isSupervisor" nzValue="熟悉演练" nzLabel="熟悉演练"></nz-option>
</nz-select>
<input type="text" nz-input placeholder="单位名称" [(ngModel)]="searchForm.unitname" nzAllowClear />
<!-- <nz-select nzPlaceHolder="单位级别" [(ngModel)]="searchForm.unitlevel">
<nz-option nzValue="一般单位" nzLabel="一般单位"></nz-option>
<nz-option nzValue="重点单位" nzLabel="重点单位"></nz-option>
</nz-select> -->
<nz-tree-select [nzExpandedKeys]="expandKeys" [nzNodes]="nodes" nzShowSearch nzPlaceHolder="协助机构"
<!-- <nz-tree-select [nzExpandedKeys]="expandKeys" [nzNodes]="nodes" nzShowSearch nzPlaceHolder="协助机构"
[(ngModel)]="searchForm.or" [nzExpandedIcon]="multiExpandedIconTpl"
[nzDropdownClassName]="'maxHeightTreeSelect'" nzAllowClear>
</nz-tree-select>
@ -68,7 +69,7 @@
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'"
class="ant-tree-switcher-line-icon"></i>
</ng-template>
</ng-template>
</ng-template> -->
<button (click)="search()" nz-button nzType="primary"><i nz-icon nzType="search"
nzTheme="outline"></i>查询</button>
<button (click)="reset()" nz-button nzType="default"><i nz-icon nzType="reload"

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

@ -6,6 +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';
@Component({
selector: 'app-station-task-execution',
templateUrl: './station-task-execution.component.html',
@ -14,7 +15,7 @@ import { ThisReceiver } from '@angular/compiler';
export class StationTaskExecutionComponent implements OnInit {
validateForm!: FormGroup;
constructor(private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient, private toTree: TreeService) { }
constructor(private methodService: MethodService, private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient, private toTree: TreeService) { }
searchForm = {
taskname: '',
unitname: '',
@ -186,6 +187,10 @@ export class StationTaskExecutionComponent implements OnInit {
}
userId
time1
time2
ngOnInit(): void {
this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId
this.userId = JSON.parse(sessionStorage.getItem('userData')).id
@ -210,6 +215,16 @@ export class StationTaskExecutionComponent implements OnInit {
setTimeout(() => {
this.rollStart()
}, 0);
let t1 = new Date().getTime()
let date = '2022-9-10'
let t2 = Date.parse(date)
this.methodService.countdown(t1, t2, (res) => {
console.log(666, res)
this.time1 = res.day + '天' + res.hour + '小时'
})
}
messageList = [1, 1, 1, 1, 1]
@ -250,6 +265,8 @@ export class StationTaskExecutionComponent implements OnInit {
ngOnDestroy(): void {
console.log('退出了')
this.mouseEnter()
this.methodService.cleartimer()
}
apply() {

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

@ -52,13 +52,19 @@
<div class="popoverContentitem">
<nz-checkbox-group [(ngModel)]="complaint.unitList"
(ngModelChange)="log(complaint)"></nz-checkbox-group>
<!-- <p class="blue" *ngIf="complaint.unitList.length < totalCount"
(click)="moreData()">更多</p> -->
<p class="blue" *ngIf="complaint.unitList.length < totalCount" (click)="moreData()">
<ng-container *ngIf="moreDataLoading; else moreDatatemplate">
<span nz-icon nzType="loading" nzTheme="outline"></span>
</ng-container>
<ng-template #moreDatatemplate>
更多
</ng-template>
</p>
</div>
</div>
<div class="popoverContent" *ngIf="complaint.selectedMenu == 2">
<div>
<form nz-form>
<form nz-form (ngSubmit)="getCompaniesByName(complaint)">
<nz-form-item>
<nz-form-control>
<nz-input-group nzPrefixIcon="search">
@ -66,32 +72,40 @@
placeholder="请输入单位名称" [ngModelOptions]="{standalone: true}" />
</nz-input-group>
</nz-form-control>
<button style="display: none;" type="submit"></button>
</nz-form-item>
</form>
</div>
<div class="popoverContentitem">
<nz-tree [nzHideUnMatched]='true' [nzSearchValue]="complaint.search2"
#nzTreeComponent [nzData]="complaint.nodes" [nzTreeTemplate]="nzTreeTemplate"
nzBlockNode [nzExpandedIcon]="multiExpandedIconTpl">
<nz-tree *ngIf="complaint.isnodes" [nzHideUnMatched]='true'
[nzData]="complaint.nodes" [nzTreeTemplate]="nzTreeTemplatecomplaint1"
nzBlockNode [nzAsyncData]="true" (nzExpandChange)="onExpandChange($event)">
</nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<ng-template #nzTreeTemplatecomplaint1 let-node let-origin="origin">
<div class="nodebox">
<span class="name">
<label *ngIf="node.origin.companyName"
[(ngModel)]="node.origin.isChecked" nz-checkbox
<label *ngIf="node.origin.companyName" nz-checkbox
[(ngModel)]="node.origin.isChecked"
(ngModelChange)="orcheckbox(complaint,$event,node)"></label>
{{ node.title }}
</span>
</div>
</ng-template>
<ng-template #multiExpandedIconTpl let-node let-origin="origin">
<ng-container *ngIf="node.origin.companyName; else elseTemplate">
</ng-container>
<ng-template #elseTemplate>
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'"
class="ant-tree-switcher-line-icon"></i>
</ng-template>
<nz-tree *ngIf="!complaint.isnodes" [nzHideUnMatched]='true'
[nzData]="complaint.nodes2" [nzTreeTemplate]="nzTreeTemplatecomplaint2"
nzBlockNode>
</nz-tree>
<ng-template #nzTreeTemplatecomplaint2 let-node let-origin="origin">
<div class="nodebox">
<span class="name">
<label *ngIf="node.origin.companyName" nz-checkbox
[(ngModel)]="node.origin.isChecked"
(ngModelChange)="orcheckbox(complaint,$event,node)"></label>
{{ node.title }}
</span>
</div>
</ng-template>
</div>
</div>
@ -203,13 +217,20 @@
<div class="popoverContentitem">
<nz-checkbox-group [(ngModel)]="permission.unitList"
(ngModelChange)="log(permission)"></nz-checkbox-group>
<!-- <p class="blue" *ngIf="permission.unitList.length < totalCount"
(click)="moreData()">更多</p> -->
<p class="blue" *ngIf="permission.unitList.length < totalCount"
(click)="moreData()">
<ng-container *ngIf="moreDataLoading; else moreDatatemplate">
<span nz-icon nzType="loading" nzTheme="outline"></span>
</ng-container>
<ng-template #moreDatatemplate>
更多
</ng-template>
</p>
</div>
</div>
<div class="popoverContent" *ngIf="permission.selectedMenu == 2">
<div>
<form nz-form>
<form nz-form (ngSubmit)="getCompaniesByName(permission)">
<nz-form-item>
<nz-form-control>
<nz-input-group nzPrefixIcon="search">
@ -217,32 +238,40 @@
placeholder="请输入单位名称" [ngModelOptions]="{standalone: true}" />
</nz-input-group>
</nz-form-control>
<button style="display: none;" type="submit"></button>
</nz-form-item>
</form>
</div>
<div class="popoverContentitem">
<nz-tree [nzHideUnMatched]='true' [nzSearchValue]="permission.search2"
#nzTreeComponent [nzData]="permission.nodes" [nzTreeTemplate]="nzTreeTemplate"
nzBlockNode [nzExpandedIcon]="multiExpandedIconTpl">
<nz-tree *ngIf="permission.isnodes" [nzHideUnMatched]='true'
[nzData]="permission.nodes" [nzTreeTemplate]="nzTreeTemplatepermission1"
nzBlockNode [nzAsyncData]="true" (nzExpandChange)="onExpandChange($event)">
</nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<ng-template #nzTreeTemplatepermission1 let-node let-origin="origin">
<div class="nodebox">
<span class="name">
<label *ngIf="node.origin.companyName"
[(ngModel)]="node.origin.isChecked" nz-checkbox
<label *ngIf="node.origin.companyName" nz-checkbox
[(ngModel)]="node.origin.isChecked"
(ngModelChange)="orcheckbox(permission,$event,node)"></label>
{{ node.title }}
</span>
</div>
</ng-template>
<ng-template #multiExpandedIconTpl let-node let-origin="origin">
<ng-container *ngIf="node.origin.companyName; else elseTemplate">
</ng-container>
<ng-template #elseTemplate>
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'"
class="ant-tree-switcher-line-icon"></i>
</ng-template>
<nz-tree *ngIf="!permission.isnodes" [nzHideUnMatched]='true'
[nzData]="permission.nodes2" [nzTreeTemplate]="nzTreeTemplatepermission2"
nzBlockNode>
</nz-tree>
<ng-template #nzTreeTemplatepermission2 let-node let-origin="origin">
<div class="nodebox">
<span class="name">
<label *ngIf="node.origin.companyName" nz-checkbox
[(ngModel)]="node.origin.isChecked"
(ngModelChange)="orcheckbox(permission,$event,node)"></label>
{{ node.title }}
</span>
</div>
</ng-template>
</div>
</div>
@ -354,13 +383,20 @@
<div class="popoverContentitem">
<nz-checkbox-group [(ngModel)]="doubleRandom.unitList"
(ngModelChange)="log(doubleRandom)"></nz-checkbox-group>
<!-- <p class="blue" *ngIf="doubleRandom.unitList.length < totalCount"
(click)="moreData()">更多</p> -->
<p class="blue" *ngIf="doubleRandom.unitList.length < totalCount"
(click)="moreData()">
<ng-container *ngIf="moreDataLoading; else moreDatatemplate">
<span nz-icon nzType="loading" nzTheme="outline"></span>
</ng-container>
<ng-template #moreDatatemplate>
更多
</ng-template>
</p>
</div>
</div>
<div class="popoverContent" *ngIf="doubleRandom.selectedMenu == 2">
<div>
<form nz-form>
<form nz-form (ngSubmit)="getCompaniesByName(doubleRandom)">
<nz-form-item>
<nz-form-control>
<nz-input-group nzPrefixIcon="search">
@ -368,32 +404,40 @@
placeholder="请输入单位名称" [ngModelOptions]="{standalone: true}" />
</nz-input-group>
</nz-form-control>
<button style="display: none;" type="submit"></button>
</nz-form-item>
</form>
</div>
<div class="popoverContentitem">
<nz-tree [nzHideUnMatched]='true' [nzSearchValue]="doubleRandom.search2"
#nzTreeComponent [nzData]="doubleRandom.nodes" [nzTreeTemplate]="nzTreeTemplate"
nzBlockNode [nzExpandedIcon]="multiExpandedIconTpl">
<nz-tree *ngIf="doubleRandom.isnodes" [nzHideUnMatched]='true'
[nzData]="doubleRandom.nodes" [nzTreeTemplate]="nzTreeTemplatedoubleRandom1"
nzBlockNode [nzAsyncData]="true" (nzExpandChange)="onExpandChange($event)">
</nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<ng-template #nzTreeTemplatedoubleRandom1 let-node let-origin="origin">
<div class="nodebox">
<span class="name">
<label *ngIf="node.origin.companyName"
[(ngModel)]="node.origin.isChecked" nz-checkbox
<label *ngIf="node.origin.companyName" nz-checkbox
[(ngModel)]="node.origin.isChecked"
(ngModelChange)="orcheckbox(doubleRandom,$event,node)"></label>
{{ node.title }}
</span>
</div>
</ng-template>
<ng-template #multiExpandedIconTpl let-node let-origin="origin">
<ng-container *ngIf="node.origin.companyName; else elseTemplate">
</ng-container>
<ng-template #elseTemplate>
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'"
class="ant-tree-switcher-line-icon"></i>
</ng-template>
<nz-tree *ngIf="!doubleRandom.isnodes" [nzHideUnMatched]='true'
[nzData]="doubleRandom.nodes2" [nzTreeTemplate]="nzTreeTemplatedoubleRandom2"
nzBlockNode>
</nz-tree>
<ng-template #nzTreeTemplatedoubleRandom2 let-node let-origin="origin">
<div class="nodebox">
<span class="name">
<label *ngIf="node.origin.companyName" nz-checkbox
[(ngModel)]="node.origin.isChecked"
(ngModelChange)="orcheckbox(doubleRandom,$event,node)"></label>
{{ node.title }}
</span>
</div>
</ng-template>
</div>
</div>
@ -448,19 +492,20 @@
<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 == 1"
src="../../../../assets/images/icon/assist.png" alt="">
{{o.name}}
</span>
@ -543,13 +588,19 @@
<div class="popoverContentitem">
<nz-checkbox-group [(ngModel)]="rehearsal.unitList"
(ngModelChange)="log(rehearsal)"></nz-checkbox-group>
<!-- <p class="blue" *ngIf="rehearsal.unitList.length < totalCount"
(click)="moreData()">更多</p> -->
<p class="blue" *ngIf="rehearsal.unitList.length < totalCount" (click)="moreData()">
<ng-container *ngIf="moreDataLoading; else moreDatatemplate">
<span nz-icon nzType="loading" nzTheme="outline"></span>
</ng-container>
<ng-template #moreDatatemplate>
更多
</ng-template>
</p>
</div>
</div>
<div class="popoverContent" *ngIf="rehearsal.selectedMenu == 2">
<div>
<form nz-form>
<form nz-form (ngSubmit)="getCompaniesByName(rehearsal)">
<nz-form-item>
<nz-form-control>
<nz-input-group nzPrefixIcon="search">
@ -557,32 +608,40 @@
placeholder="请输入单位名称" [ngModelOptions]="{standalone: true}" />
</nz-input-group>
</nz-form-control>
<button style="display: none;" type="submit"></button>
</nz-form-item>
</form>
</div>
<div class="popoverContentitem">
<nz-tree [nzHideUnMatched]='true' [nzSearchValue]="rehearsal.search2"
#nzTreeComponent [nzData]="rehearsal.nodes" [nzTreeTemplate]="nzTreeTemplate"
nzBlockNode [nzExpandedIcon]="multiExpandedIconTpl">
<nz-tree *ngIf="rehearsal.isnodes" [nzHideUnMatched]='true'
[nzData]="rehearsal.nodes" [nzTreeTemplate]="nzTreeTemplaterehearsal1"
nzBlockNode [nzAsyncData]="true" (nzExpandChange)="onExpandChange($event)">
</nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<ng-template #nzTreeTemplaterehearsal1 let-node let-origin="origin">
<div class="nodebox">
<span class="name">
<label *ngIf="node.origin.companyName"
[(ngModel)]="node.origin.isChecked" nz-checkbox
<label *ngIf="node.origin.companyName" nz-checkbox
[(ngModel)]="node.origin.isChecked"
(ngModelChange)="orcheckbox(rehearsal,$event,node)"></label>
{{ node.title }}
</span>
</div>
</ng-template>
<ng-template #multiExpandedIconTpl let-node let-origin="origin">
<ng-container *ngIf="node.origin.companyName; else elseTemplate">
</ng-container>
<ng-template #elseTemplate>
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'"
class="ant-tree-switcher-line-icon"></i>
</ng-template>
<nz-tree *ngIf="!rehearsal.isnodes" [nzHideUnMatched]='true'
[nzData]="rehearsal.nodes2" [nzTreeTemplate]="nzTreeTemplaterehearsal2"
nzBlockNode>
</nz-tree>
<ng-template #nzTreeTemplaterehearsal2 let-node let-origin="origin">
<div class="nodebox">
<span class="name">
<label *ngIf="node.origin.companyName" nz-checkbox
[(ngModel)]="node.origin.isChecked"
(ngModelChange)="orcheckbox(rehearsal,$event,node)"></label>
{{ node.title }}
</span>
</div>
</ng-template>
</div>
</div>

195
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',
@ -103,6 +105,7 @@ export class ZhiIndicatorsComponent implements OnInit {
this.rehearsal.data = []
}
//投诉举报
complaint = {
name: '投诉举报',
@ -119,6 +122,8 @@ export class ZhiIndicatorsComponent implements OnInit {
data: [
],//表格数据
nodes: [],
nodes2: [],//查询后展示的tree
isnodes: true,
unitList: []
}
@ -137,6 +142,8 @@ export class ZhiIndicatorsComponent implements OnInit {
selectedMenu: 1,//选择单位气泡卡片
data: [],//表格数据
nodes: [],
nodes2: [],//查询后展示的tree
isnodes: true,
unitList: []
}
@ -156,6 +163,8 @@ export class ZhiIndicatorsComponent implements OnInit {
selectedMenu: 1,//选择单位气泡卡片
data: [],//表格数据
nodes: [],
nodes2: [],//查询后展示的tree
isnodes: true,
unitList: []
}
@ -175,16 +184,14 @@ export class ZhiIndicatorsComponent implements OnInit {
selectedMenu: 1,//选择单位气泡卡片
data: [],//表格数据
nodes: [],
nodes2: [],//查询后展示的tree
isnodes: true,
unitList: []
}
PageNumber
moreData() {
this.PageNumber += 1
this.getCompanies()
}
log(data) {
@ -213,12 +220,6 @@ export class ZhiIndicatorsComponent implements OnInit {
}
//搜索框提交
submitForm(data): void {
data.unitList = []
this.PageNumber = 1
this.getCompanies(data)
}
// 弹出 tab
popoverMenuSelect(data, type) {
@ -229,18 +230,26 @@ export class ZhiIndicatorsComponent implements OnInit {
}
//搜索框提交
submitForm(data): void {
data.unitList = []
this.PageNumber = 1
this.getCompanies(data)
}
totalCount: number
unitList = []
PageNumber = 1
async getCompanies(incomingData?: any) {
let params = {
CompanyName: incomingData ? incomingData.search1 : '',
PageNumber: 1,
PageSize: 99999
PageNumber: this.PageNumber,
PageSize: 50
}
return new Promise<void>((resolve, reject) => {
this.http.get('/api/Companies', {
params: params
}).subscribe((data: any) => {
this.moreDataLoading = false
this.totalCount = data.totalCount
data.items.forEach(element => {
element.label = element.companyName
@ -252,35 +261,42 @@ export class ZhiIndicatorsComponent implements OnInit {
});
this.unitList = data.items
if (incomingData && incomingData.name == '投诉举报') {
this.complaint.unitList = JSON.parse(JSON.stringify(this.unitList))
} else if (incomingData && incomingData.name == '行政许可') {
this.permission.unitList = JSON.parse(JSON.stringify(this.unitList))
} else if (incomingData && incomingData.name == '双随机') {
this.doubleRandom.unitList = JSON.parse(JSON.stringify(this.unitList))
} else if (incomingData && incomingData.name == '熟悉演练') {
this.rehearsal.unitList = JSON.parse(JSON.stringify(this.unitList))
} else {
this.complaint.unitList = JSON.parse(JSON.stringify(this.unitList))
this.permission.unitList = JSON.parse(JSON.stringify(this.unitList))
this.doubleRandom.unitList = JSON.parse(JSON.stringify(this.unitList))
this.rehearsal.unitList = JSON.parse(JSON.stringify(this.unitList))
}
// this.complaint.unitList = this.complaint.unitList.concat(JSON.parse(JSON.stringify(data.items)));
// this.complaint.unitList = [...this.complaint.unitList]
// this.permission.unitList = this.permission.unitList.concat(JSON.parse(JSON.stringify(data.items)));
// this.permission.unitList = [...this.permission.unitList]
// this.doubleRandom.unitList = this.doubleRandom.unitList.concat(JSON.parse(JSON.stringify(data.items)));
// this.doubleRandom.unitList = [...this.doubleRandom.unitList]
// this.rehearsal.unitList = this.rehearsal.unitList.concat(JSON.parse(JSON.stringify(data.items)));
// this.rehearsal.unitList = [...this.rehearsal.unitList]
// if (incomingData && incomingData.name == '投诉举报') {
// this.complaint.unitList = JSON.parse(JSON.stringify(this.unitList))
// } else if (incomingData && incomingData.name == '行政许可') {
// this.permission.unitList = JSON.parse(JSON.stringify(this.unitList))
// } else if (incomingData && incomingData.name == '双随机') {
// this.doubleRandom.unitList = JSON.parse(JSON.stringify(this.unitList))
// } else if (incomingData && incomingData.name == '熟悉演练') {
// this.rehearsal.unitList = JSON.parse(JSON.stringify(this.unitList))
// } else {
// this.complaint.unitList = JSON.parse(JSON.stringify(this.unitList))
// this.permission.unitList = JSON.parse(JSON.stringify(this.unitList))
// this.doubleRandom.unitList = JSON.parse(JSON.stringify(this.unitList))
// this.rehearsal.unitList = JSON.parse(JSON.stringify(this.unitList))
// }
this.complaint.unitList = this.complaint.unitList.concat(JSON.parse(JSON.stringify(data.items)));
this.complaint.unitList = [...this.complaint.unitList]
this.permission.unitList = this.permission.unitList.concat(JSON.parse(JSON.stringify(data.items)));
this.permission.unitList = [...this.permission.unitList]
this.doubleRandom.unitList = this.doubleRandom.unitList.concat(JSON.parse(JSON.stringify(data.items)));
this.doubleRandom.unitList = [...this.doubleRandom.unitList]
this.rehearsal.unitList = this.rehearsal.unitList.concat(JSON.parse(JSON.stringify(data.items)));
this.rehearsal.unitList = [...this.rehearsal.unitList]
resolve(data)
})
})
}
moreDataLoading = false
moreData() {
this.moreDataLoading = true
this.PageNumber += 1
this.getCompanies()
}
allOrList: any
nodes
@ -300,12 +316,20 @@ export class ZhiIndicatorsComponent implements OnInit {
element.disableCheckbox = true
element.datatype = '机构'
element.level == 'squadron' ? element.disableCheckbox = false : null
});
this.allOrList = JSON.parse(JSON.stringify(data.items))
this.nodes = [...this.toTree.toTree(JSON.parse(JSON.stringify(data.items)))]
this.complaint.nodes = JSON.parse(JSON.stringify(this.nodes))
this.permission.nodes = JSON.parse(JSON.stringify(this.nodes))
this.doubleRandom.nodes = JSON.parse(JSON.stringify(this.nodes))
this.rehearsal.nodes = JSON.parse(JSON.stringify(this.nodes))
resolve(data)
})
})
}
//获得除了检查员的其他用户
users
async getUsers() {
@ -401,6 +425,9 @@ export class ZhiIndicatorsComponent implements OnInit {
OrganizationId
ngOnInit(): void {
this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId
this.selectedMonth = new Date().getMonth() + 1
//说明保存防抖
@ -443,17 +470,17 @@ export class ZhiIndicatorsComponent implements OnInit {
});
// this.getUsers()
Promise.all([this.getCompanies(), this.getAllOrganization()])
.then((results) => {
let arr = [...JSON.parse(JSON.stringify(this.allOrList)), ...JSON.parse(JSON.stringify(this.unitList))]
this.nodes = [...this.toTree.toTree(arr)]
this.complaint.nodes = JSON.parse(JSON.stringify(this.nodes))
this.permission.nodes = JSON.parse(JSON.stringify(this.nodes))
this.doubleRandom.nodes = JSON.parse(JSON.stringify(this.nodes))
this.rehearsal.nodes = JSON.parse(JSON.stringify(this.nodes))
});
this.getCompanies()
this.getAllOrganization()
// Promise.all([this.getCompanies(), this.getAllOrganization()])
// .then((results) => {
// let arr = [...JSON.parse(JSON.stringify(this.allOrList)), ...JSON.parse(JSON.stringify(this.unitList))]
// this.nodes = [...this.toTree.toTree(arr)]
// this.complaint.nodes = JSON.parse(JSON.stringify(this.nodes))
// this.permission.nodes = JSON.parse(JSON.stringify(this.nodes))
// this.doubleRandom.nodes = JSON.parse(JSON.stringify(this.nodes))
// this.rehearsal.nodes = JSON.parse(JSON.stringify(this.nodes))
// });
this.getTaskList('投诉举报')
@ -562,7 +589,6 @@ export class ZhiIndicatorsComponent implements OnInit {
})
}
async getTaskList(TaskType, carddata?: any) {
TaskType == '投诉举报' ? this.complaint.isLoading = true : this.permission.isLoading = true
// carddata ? carddata.isLoading = true : null
@ -615,22 +641,14 @@ export class ZhiIndicatorsComponent implements OnInit {
// console.log('毁灭了')
// this.doubleRandom.isPopover = false
}
nzEvent(event: NzFormatEmitEvent): any {
if (event.node.origin.companyName) {
return new Promise<void>((resolve, reject) => {
resolve()
})
}
if (event.node.origin.level === 'squadron' && !event.node.origin.companyName) {
const node = event.node;
console.log(node?.getChildren())
console.log(888)
if (node?.getChildren().length === 0) {
this.loadNode(event.node.origin.id).then(data => {
node.addChildren(data);
});
}
onExpandChange(e: NzFormatEmitEvent): void {
const node = e.node;
if (node && node.getChildren().length === 0 && node.isExpanded && node.origin.level == 'squadron') {
this.loadNode(node.origin.id).then(data => {
node.addChildren(data);
});
} else {
node.isLoading = false
}
}
@ -649,12 +667,61 @@ export class ZhiIndicatorsComponent implements OnInit {
element.key = element.id
element.title = element.companyName
element.level = 4
element.isLeaf = true
});
resolve(data.items)
})
});
}
async getCompaniesByName(incomingData) {
// incomingData.search2Value
console.log(incomingData.search2Value)
if (incomingData.search2) {
incomingData.isnodes = false
let params = {
CompanyName: incomingData.search2,
PageNumber: this.PageNumber,
PageSize: 9999
}
return new Promise<void>((resolve, reject) => {
this.http.get('/api/Companies', {
params: params
}).subscribe((data: any) => {
this.moreDataLoading = false
this.totalCount = data.totalCount
data.items.forEach(element => {
element.label = element.companyName
element.value = element.id
element.parentId = element.organizationId
element.key = element.id
element.title = element.companyName
element.level = 4
element.isLeaf = true
incomingData.search2Value.forEach(item => {
item == element.id ? element.isChecked = true : null
});
});
if (data.items.length == 0) {
this.message.create('warning', '没有查询到任何单位');
incomingData.isnodes = true
return
}
let allOrList = JSON.parse(JSON.stringify(this.allOrList))
allOrList.forEach(element => {
element.expanded = true
});
let arr = [...allOrList, ...data.items]
incomingData.nodes2 = [...this.toTree.toTree(arr)]
resolve(data)
})
})
} else {
incomingData.isnodes = true
}
}
assitantsupervisorList
mainsupervisorList

47
src/app/method.service.ts

@ -0,0 +1,47 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class MethodService {
constructor() { }
/***
@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 () {
var day: any = 0, hour: any = 0, minute: any = 0, second: any = 0;//时间默认值
if (times > 0) {
day = Math.floor(times / (60 * 60 * 24));
hour = Math.floor(times / (60 * 60)) - (day * 24);
minute = Math.floor(times / 60) - (day * 24 * 60) - (hour * 60);
second = Math.floor(times) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
}
// if (day <= 9) day = '0' + day;
// if (hour <= 9) hour = '0' + hour;
// if (minute <= 9) minute = '0' + minute;
// if (second <= 9) second = '0' + second;
//console.log(minute+"分钟:"+second+"秒");
// var new_time = day + '天' + hour + '小时' + minute + '分' + second + '秒';
typeof callback == "function" ? callback({ day: day, hour: hour, minute: minute, second: second }) : '';
times--;
}, 1000);
if (times <= 0) {
clearInterval(this.timer);
}
}
cleartimer() {
clearTimeout(this.timer);
}
}

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

2
src/theme.less

@ -90,4 +90,4 @@
label{
margin-bottom: 6px;
}
}
}

Loading…
Cancel
Save