diff --git a/src/app/app.module.ts b/src/app/app.module.ts index af1315e..4919b50 100644 --- a/src/app/app.module.ts +++ b/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 { } diff --git a/src/app/commonComponents/select-unit/select-unit.component.html b/src/app/commonComponents/select-unit/select-unit.component.html new file mode 100644 index 0000000..e69de29 diff --git a/src/app/commonComponents/select-unit/select-unit.component.scss b/src/app/commonComponents/select-unit/select-unit.component.scss new file mode 100644 index 0000000..7d1c75b --- /dev/null +++ b/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; + } + } +} diff --git a/src/app/commonComponents/select-unit/select-unit.component.ts b/src/app/commonComponents/select-unit/select-unit.component.ts new file mode 100644 index 0000000..83b4486 --- /dev/null +++ b/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 { + } + +} diff --git a/src/app/commonComponents/test/test.component.html b/src/app/commonComponents/test/test.component.html new file mode 100644 index 0000000..941f267 --- /dev/null +++ b/src/app/commonComponents/test/test.component.html @@ -0,0 +1 @@ +

test works!

diff --git a/src/app/commonComponents/test/test.component.scss b/src/app/commonComponents/test/test.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/commonComponents/test/test.component.spec.ts b/src/app/commonComponents/test/test.component.spec.ts new file mode 100644 index 0000000..e0f9bcc --- /dev/null +++ b/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; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ TestComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(TestComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/commonComponents/test/test.component.ts b/src/app/commonComponents/test/test.component.ts new file mode 100644 index 0000000..db9004b --- /dev/null +++ b/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 { + } + +} 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/da-subordinate-audit/allot-person/allot-person.component.html b/src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.html index f43ee10..cb169d0 100644 --- a/src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.html +++ b/src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.html @@ -3,7 +3,8 @@ 检查员(主) - + @@ -12,7 +13,8 @@ 检查员(协) - + diff --git a/src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.ts b/src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.ts index 5b6b9f3..801017a 100644 --- a/src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.ts +++ b/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' }); diff --git a/src/app/home/task/station-task-apply/apply/apply.component.html b/src/app/home/task/station-task-apply/apply/apply.component.html index 7b568fa..5311375 100644 --- a/src/app/home/task/station-task-apply/apply/apply.component.html +++ b/src/app/home/task/station-task-apply/apply/apply.component.html @@ -3,7 +3,7 @@ 任务名称 - + @@ -53,11 +53,19 @@ +

+ + + + + 更多 + +

-
+ @@ -65,32 +73,41 @@ placeholder="请输入单位名称" [ngModelOptions]="{standalone: true}" /> +
- + - +
- {{ node.title }}
- - - - - - + + + + +
+ + + {{ node.title }} + +
@@ -122,5 +139,20 @@
+ + 检查人员 + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/app/home/task/station-task-apply/apply/apply.component.scss b/src/app/home/task/station-task-apply/apply/apply.component.scss index 6ccbeba..36b1abf 100644 --- a/src/app/home/task/station-task-apply/apply/apply.component.scss +++ b/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%; + } +} 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 33d9f4a..2c6131d 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 @@ -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((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((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 { + 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((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) } } 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 9dd6671..002d85f 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 @@ -49,15 +49,16 @@
-
+ @@ -368,32 +404,40 @@ placeholder="请输入单位名称" [ngModelOptions]="{standalone: true}" /> +
- + - +
- {{ node.title }}
- - - - - - + + + + +
+ + + {{ node.title }} + +
@@ -448,19 +492,20 @@
- - - + + {{o.name}} - - - + + {{o.name}} @@ -543,13 +588,19 @@
- +

+ + + + + 更多 + +

-
+ @@ -557,32 +608,40 @@ placeholder="请输入单位名称" [ngModelOptions]="{standalone: true}" /> +
- + - +
- {{ node.title }}
- - - - - - + + + + +
+ + + {{ node.title }} + +
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..5d7263e 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', @@ -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((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((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((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 diff --git a/src/app/method.service.ts b/src/app/method.service.ts new file mode 100644 index 0000000..b807d2c --- /dev/null +++ b/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); + } + + +} 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 diff --git a/src/theme.less b/src/theme.less index 2f5141a..cbc3dad 100644 --- a/src/theme.less +++ b/src/theme.less @@ -90,4 +90,4 @@ label{ margin-bottom: 6px; } -} \ No newline at end of file +}