From 180ef35a5271f8e0c725ae9fa7194435f51a87a2 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Thu, 11 Aug 2022 20:45:04 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E6=95=91=E6=8F=B4=E7=AB=99?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E4=BB=BB=E5=8A=A1=E5=AF=B9=E6=8E=A5=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/app/CustomReuseStrategy.ts | 2 +- src/app/home/home.module.ts | 10 +- .../allot-person/allot-person.component.html | 1 + .../allot-person/allot-person.component.scss | 0 .../allot-person/allot-person.component.ts | 15 +++ .../da-subordinate-audit.component.html | 50 +++---- .../da-subordinate-audit.component.ts | 68 +++++++++- .../apply-look/apply-look.component.html | 6 +- .../apply-look/apply-look.component.ts | 32 +---- .../apply/apply.component.html | 12 +- .../apply/apply.component.ts | 77 +++++++---- .../station-task-apply.component.html | 57 +++++--- .../station-task-apply.component.scss | 10 +- .../station-task-apply.component.ts | 123 +++++++++++++----- .../station-task-execution.component.html | 34 ++++- .../station-task-execution.component.scss | 9 +- .../station-task-execution.component.ts | 27 +++- .../zhi-indicators.component.html | 16 ++- .../zhi-indicators.component.scss | 5 + .../zhi-indicators.component.ts | 100 +++++++++++++- src/app/service/cache-token.service.ts | 5 +- src/theme.less | 7 + 23 files changed, 500 insertions(+), 168 deletions(-) create mode 100644 src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.html create mode 100644 src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.scss create mode 100644 src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.ts diff --git a/package.json b/package.json index 1ea62e3..306c82a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.0.0", "scripts": { "ng": "ng", - "start": "ng serve --proxy-config proxy.config.json --open --port 4000 ", + "start": "ng serve --proxy-config proxy.config.json --open --port 8888 ", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test" diff --git a/src/app/CustomReuseStrategy.ts b/src/app/CustomReuseStrategy.ts index 5385fce..340c598 100644 --- a/src/app/CustomReuseStrategy.ts +++ b/src/app/CustomReuseStrategy.ts @@ -15,7 +15,7 @@ export class CustomReuseStrategy implements RouteReuseStrategy { /** 表示对所有路由允许复用 如果你有路由不想利用可以在这加一些业务逻辑判断 */ shouldDetach(route: ActivatedRouteSnapshot): boolean { // console.log('shouldDetach======>', route); - if (route.routeConfig.path == 'basicInfo' || route.routeConfig.path == '') { + if (route.routeConfig.path == 'basicInfo' || route.routeConfig.path == '' || route.routeConfig.path == 'indicators') { return false; } else { return true; diff --git a/src/app/home/home.module.ts b/src/app/home/home.module.ts index 8ddc6ac..00f3520 100644 --- a/src/app/home/home.module.ts +++ b/src/app/home/home.module.ts @@ -53,6 +53,8 @@ import { ApplyLookComponent } from './task/station-task-apply/apply-look/apply-l import { NzDatePickerModule } from 'ng-zorro-antd/date-picker'; import { LookTaskComponent } from './task/zhi-audit/look-task/look-task.component'; import { UnitEditComponent } from './basic-info/unit-edit/unit-edit.component'; +import { NzSpinModule } from 'ng-zorro-antd/spin'; +import { AllotPersonComponent } from './task/da-subordinate-audit/allot-person/allot-person.component'; @NgModule({ declarations: [ NavComponent, @@ -83,7 +85,8 @@ import { UnitEditComponent } from './basic-info/unit-edit/unit-edit.component'; ApplyComponent, ApplyLookComponent, LookTaskComponent, - UnitEditComponent + UnitEditComponent, + AllotPersonComponent ], imports: [ CommonModule, @@ -111,8 +114,9 @@ import { UnitEditComponent } from './basic-info/unit-edit/unit-edit.component'; ScrollingModule, NzGridModule, NzRadioModule, - NzDatePickerModule + NzDatePickerModule, + NzSpinModule ], - entryComponents: [AddroleComponent, EditroleComponent, AdduserComponent, EdituserComponent, AddorComponent, EditorComponent, ApplyComponent, ApplyLookComponent, LookTaskComponent] + entryComponents: [AddroleComponent, EditroleComponent, AdduserComponent, EdituserComponent, AddorComponent, EditorComponent, ApplyComponent, ApplyLookComponent, LookTaskComponent, AllotPersonComponent] }) export class HomeModule { } 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 new file mode 100644 index 0000000..412c1d0 --- /dev/null +++ b/src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.html @@ -0,0 +1 @@ +

allot-person works!

diff --git a/src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.scss b/src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.scss new file mode 100644 index 0000000..e69de29 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 new file mode 100644 index 0000000..c130e97 --- /dev/null +++ b/src/app/home/task/da-subordinate-audit/allot-person/allot-person.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-allot-person', + templateUrl: './allot-person.component.html', + styleUrls: ['./allot-person.component.scss'] +}) +export class AllotPersonComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.html b/src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.html index 8fa5aeb..2924de9 100644 --- a/src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.html +++ b/src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.html @@ -12,26 +12,21 @@
-
-
- 熟悉演练任务 +
+
+ {{item.name}} - 已审批: 6/8 -
-
-
-
- 联络指导任务 - - 已审批: 6/8 + 已审批: {{item.finished}}/{{item.totalCount}}
-
-
+
+
- 上海雅特酒店管理有限公司济南泺文路分公司 + {{item.company.companyName}}
@@ -44,22 +39,25 @@ 分配 | - 申请人: 历下区A消防救援站 - 修改 + 申请人: {{item.assitantOrganization.name}} +
- - + +
-
-
+
+
- 上海雅特酒店管理有限公司济南泺文路分公司 + {{item.company.companyName}}
@@ -72,15 +70,17 @@ 分配 | - 申请人: 历下区A消防救援站 - 修改 + 申请人: {{item.assitantOrganization.name}} +
- - + +
diff --git a/src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.ts b/src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.ts index aa8aa9e..5c5e526 100644 --- a/src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.ts +++ b/src/app/home/task/da-subordinate-audit/da-subordinate-audit.component.ts @@ -1,3 +1,4 @@ +import { HttpClient } from '@angular/common/http'; import { Component, OnInit } from '@angular/core'; @Component({ @@ -7,9 +8,20 @@ import { Component, OnInit } from '@angular/core'; }) export class DaSubordinateAuditComponent implements OnInit { - constructor() { } + constructor(private http: HttpClient) { } + OrganizationId + selectedTab = 0 + selectTab(item) { + this.selectedTab = item + } ngOnInit(): void { + this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId + let month = new Date().getMonth() + 1 + this.selectedMonth = month + '月' + + this.getTaskList() + } months = [ { name: '1月', isable: true }, @@ -31,8 +43,56 @@ export class DaSubordinateAuditComponent implements OnInit { } - selectedTab = 1 - selectTab(item) { - this.selectedTab = item + nzLoading = false + PageNumber = 1 + PageSize = 9999 + + data = [ + { id: 0, name: '熟悉演练任务', finished: 0, totalCount: 0, list: [] }, + { id: 1, name: '联络指导任务', finished: 0, totalCount: 0, list: [] } + ] + + + getTaskList() { + this.nzLoading = true + let params = { + + OrganizationId: this.OrganizationId, + PageNumber: this.PageNumber, + PageSize: this.PageSize + } + this.http.get('/api/PlanTasks', { + params: params + }).subscribe((data: any) => { + this.nzLoading = false + + let arr1 = [] + let arr2 = [] + data.items.forEach(element => { + if (element.taskName == '熟悉演练') { + arr1.push(element) + } + if (element.taskName == '联络指导') { + arr2.push(element) + } + }); + arr1.forEach(item => { + if (!!item.approvalStatus) { + this.data[0].finished += 1 + } + }); + arr2.forEach(item => { + if (!!item.approvalStatus) { + this.data[1].finished += 1 + } + }); + this.data[0].totalCount = arr1.length + this.data[0].list = [...arr1] + this.data[1].totalCount = arr2.length + this.data[1].list = [...arr2] + + }) } + + } diff --git a/src/app/home/task/station-task-apply/apply-look/apply-look.component.html b/src/app/home/task/station-task-apply/apply-look/apply-look.component.html index f42a839..690b770 100644 --- a/src/app/home/task/station-task-apply/apply-look/apply-look.component.html +++ b/src/app/home/task/station-task-apply/apply-look/apply-look.component.html @@ -1,6 +1,6 @@
-

任务名称: 熟悉演练

-

单位名称: 上海雅特酒店管理有限公司济南泺文路分公司

-

协助机构: 历下区A消防救援站

+

任务名称: {{data.taskName}}

+

单位名称: {{data.company.companyName}}

+

协助机构: {{data.assitantOrganization.name}}

\ No newline at end of file diff --git a/src/app/home/task/station-task-apply/apply-look/apply-look.component.ts b/src/app/home/task/station-task-apply/apply-look/apply-look.component.ts index a4fab8e..198f964 100644 --- a/src/app/home/task/station-task-apply/apply-look/apply-look.component.ts +++ b/src/app/home/task/station-task-apply/apply-look/apply-look.component.ts @@ -11,44 +11,16 @@ import { TreeService } from 'src/app/service/tree.service'; }) export class ApplyLookComponent implements OnInit { - @Input() title?: string; - @Input() subtitle?: string; + @Input() data?: any; validateForm!: FormGroup; constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { } ngOnInit(): void { - this.validateForm = this.fb.group({ - taskname: [true, [Validators.required]], - unitname: [null, [Validators.required]], - organization: [null, [Validators.required]] - }); - - this.getAllOrganization() + console.log(this.data) } destroyModal(): void { this.modal.destroy({ data: 'this the result data' }); } - //获取所有组织机构 - nodes: any = [] - getAllOrganization() { - // let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id - // let params = { - // OrganizationUnitId: OrganizationUnitId, - // IsContainsChildren: "true" - // } - // this.http.get('/api/services/app/Organization/GetAll', { - // params: params - // }).subscribe((data: any) => { - // data.result.items.forEach(element => { - // if (element.id == OrganizationUnitId) { - // element.parentId = null - // } - // element.key = element.id - // element.title = element.displayName - // }); - // this.nodes = [...this.toTree.toTree(data.result.items)] - // }) - } } 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 a4428b7..63b53a3 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,15 +3,19 @@ 任务名称 - + 单位名称 - - - + + + + + + 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 b094675..42dafa8 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 @@ -3,16 +3,16 @@ import { NzModalRef } from 'ng-zorro-antd/modal'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { HttpClient } from '@angular/common/http'; import { TreeService } from 'src/app/service/tree.service'; - +import { Observable, of } from 'rxjs'; +import { catchError, map } from 'rxjs/operators'; @Component({ selector: 'app-apply', templateUrl: './apply.component.html', styleUrls: ['./apply.component.scss'] }) export class ApplyComponent implements OnInit { - @Input() title?: string; - @Input() subtitle?: string; + @Input() nodes?: any; validateForm!: FormGroup; constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient, private toTree: TreeService) { } @@ -23,31 +23,60 @@ export class ApplyComponent implements OnInit { organization: [null, [Validators.required]] }); - this.getAllOrganization() } + destroyModal(): void { this.modal.destroy({ data: 'this the result data' }); } - //获取所有组织机构 - nodes: any = [] - getAllOrganization() { - // let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id - // let params = { - // OrganizationUnitId: OrganizationUnitId, - // IsContainsChildren: "true" - // } - // this.http.get('/api/services/app/Organization/GetAll', { - // params: params - // }).subscribe((data: any) => { - // data.result.items.forEach(element => { - // if (element.id == OrganizationUnitId) { - // element.parentId = null - // } - // element.key = element.id - // element.title = element.displayName - // }); - // this.nodes = [...this.toTree.toTree(data.result.items)] - // }) + optionList = []; + selectedUser = null; + isLoading = false; + + PageNumber = 0 + PageSize = 50 + totalCount + loadMore(): Promise { + if (this.optionList.length >= this.totalCount) { + return + } + this.PageNumber += 1 + this.isLoading = true; + this.getCompanies() + } + + search(value: string) { + this.optionList = [] + this.PageNumber = 1 + this.isLoading = true; + this.getCompanies(value) + } + + async getCompanies(CompanyName?: string) { + let params = { + CompanyName: CompanyName, + OrganizationId: JSON.parse(sessionStorage.getItem('userData')).organizationId, + PageNumber: this.PageNumber, + PageSize: this.PageSize + } + await new Promise((resolve, reject) => { + this.http.get('/api/Companies', { + params: params + }).subscribe((data: any) => { + this.totalCount = data.totalCount + this.isLoading = false; + this.optionList = [...this.optionList, ...data.items]; + let map = new Map(); + for (let item of this.optionList) { + if (!map.has(item.id)) { + map.set(item.id, item); + }; + }; + this.optionList = [...map.values()]; + resolve(data) + }) + }) } + } + 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 1d51153..9201a2e 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 @@ -13,45 +13,70 @@
- +
- + 任务名称 单位名称 - 单位级别 + 协助机构 结果 + 时间 操作 - 监督检查 + + {{item.taskName}} + - 上海雅特酒店管理有限公司济南泺文路分公司 + {{item.company.companyName}} - + + + {{item.assitantOrganization.name}} - 历下区A消防救援站 + / - 未发现违法违规情况 + {{item.creationTime | date:"yyyy-MM-dd hh:mm:ss"}} 查看 @@ -61,10 +86,10 @@
diff --git a/src/app/home/task/station-task-apply/station-task-apply.component.scss b/src/app/home/task/station-task-apply/station-task-apply.component.scss index 955fecb..09c8e58 100644 --- a/src/app/home/task/station-task-apply/station-task-apply.component.scss +++ b/src/app/home/task/station-task-apply/station-task-apply.component.scss @@ -43,12 +43,18 @@ padding: 0 20px; align-items: center; border-bottom: 1px solid #E4E7EC; + .search { - width: 80%; + width: 100%; display: flex; + justify-content: flex-start; - input { + input, + nz-select, + nz-tree-select { + width: 220px; margin-right: 16px; + text-align: left; } button { diff --git a/src/app/home/task/station-task-apply/station-task-apply.component.ts b/src/app/home/task/station-task-apply/station-task-apply.component.ts index 8187a91..8e23092 100644 --- a/src/app/home/task/station-task-apply/station-task-apply.component.ts +++ b/src/app/home/task/station-task-apply/station-task-apply.component.ts @@ -23,14 +23,13 @@ export class StationTaskApplyComponent implements OnInit { unitlevel: '', or: '' } - usersNum - loading - usersLIst = [1] + OrganizationId ngOnInit(): void { + this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId + this.getAllOrganization() + this.getTaskList() } - pageChange($event) { - } cancel(item, type) { @@ -39,7 +38,75 @@ export class StationTaskApplyComponent implements OnInit { } + nzLoading = false + totalCount + PageNumber = 1 + PageSize = 10 + taskLIst = [] + getTaskList() { + this.nzLoading = true + let params = { + OrganizationId: this.OrganizationId, + TaskName: this.searchForm.taskname, + CompanyName: this.searchForm.unitname, + AssitantOrganizationId: this.searchForm.or, + PageNumber: this.PageNumber, + PageSize: this.PageSize + } + this.http.get('/api/PlanTasks', { + params: params + }).subscribe((data: any) => { + this.nzLoading = false + console.log('任务申请列表', data); + this.totalCount = data.totalCount + this.taskLIst = [...data.items] + }) + } + pageChange($event) { + this.PageNumber = $event + this.getTaskList() + } + search() { + this.PageNumber = 1 + this.getTaskList() + } + reset() { + this.PageNumber = 1 + this.searchForm = { + taskname: '', + unitname: '', + unitlevel: '', + or: '' + } + this.getTaskList() + } + + + expandKeys + defaultOrId: string + //获取所有组织机构 + nodes: any = [] + getAllOrganization() { + let params = { + PageNumber: 1, + PageSize: 9999 + } + this.http.get('/api/Organizations', { + params: params + }).subscribe((data: any) => { + data.items.forEach(element => { + element.key = element.id + element.title = element.name + }); + this.nodes = [...this.toTree.toTree(data.items)] + }) + } + apply() { + if (this.nodes.length == 0) { + this.message.create('warning', '组织机构初始化中,请稍后重试'); + return + } const modal = this.modal.create({ nzTitle: '申请', nzContent: ApplyComponent, @@ -47,32 +114,31 @@ export class StationTaskApplyComponent implements OnInit { nzWidth: 660, nzMaskClosable: false, nzComponentParams: { - title: '', - subtitle: '' + title: "熟悉演练", + nodes: this.nodes, }, nzOnOk: async () => { if (instance.validateForm.valid) { - await new Promise(resolve => { - let roleNames = [...instance.validateForm.value.role, ...instance.validateForm.value.role2] + await new Promise((resolve, reject) => { let body = { - userName: instance.validateForm.value.account, - name: instance.validateForm.value.name, - organizationUnitId: Number(instance.validateForm.value.organization), - roleNames: roleNames, - phoneNumber: instance.validateForm.value.phonenum, - isActive: true + organizationId: this.OrganizationId, + taskName: "熟悉演练", + companyId: instance.validateForm.value.unitname, + assitantOrganizationId: instance.validateForm.value.organization, } - // this.http.post(this.addUrl, body).subscribe(data => { - // resolve(data) - // this.message.create('success', '创建成功!'); - // this.SkipCount = 0 - // this.getAllUsers() - // return true - // }, err => { - // resolve(err) - // this.message.create('warning', err.error.error.message); - // return false - // }) + this.http.post('/api/PlanTasks', body).subscribe({ + next: (data) => { + this.message.create('success', '创建成功'); + resolve(data) + this.getTaskList() + return true + }, + error: (err) => { + this.message.create('warning', '创建失败'); + reject(err) + return false + } + }) }) } else { this.message.create('warning', '请填写完整!'); @@ -92,10 +158,9 @@ export class StationTaskApplyComponent implements OnInit { nzWidth: 660, nzMaskClosable: false, nzComponentParams: { - title: '', - subtitle: '' + data: item, }, - nzFooter:null, + nzFooter: null, nzOnOk: async () => { if (instance.validateForm.valid) { await new Promise(resolve => { diff --git a/src/app/home/task/station-task-execution/station-task-execution.component.html b/src/app/home/task/station-task-execution/station-task-execution.component.html index d756c1d..ac499a4 100644 --- a/src/app/home/task/station-task-execution/station-task-execution.component.html +++ b/src/app/home/task/station-task-execution/station-task-execution.component.html @@ -12,13 +12,33 @@
diff --git a/src/app/home/task/station-task-execution/station-task-execution.component.scss b/src/app/home/task/station-task-execution/station-task-execution.component.scss index 40365e1..b069319 100644 --- a/src/app/home/task/station-task-execution/station-task-execution.component.scss +++ b/src/app/home/task/station-task-execution/station-task-execution.component.scss @@ -1,7 +1,7 @@ .box { width: 100%; height: 100%; - + color: #303133; box-sizing: border-box; padding: 20px; @@ -47,8 +47,13 @@ width: 100%; display: flex; - input { + input, + nz-select, + nz-tree-select, + nz-date-picker { + width: 220px; margin-right: 16px; + text-align: left; } button { diff --git a/src/app/home/task/station-task-execution/station-task-execution.component.ts b/src/app/home/task/station-task-execution/station-task-execution.component.ts index eb6d271..e2579cc 100644 --- a/src/app/home/task/station-task-execution/station-task-execution.component.ts +++ b/src/app/home/task/station-task-execution/station-task-execution.component.ts @@ -19,7 +19,7 @@ export class StationTaskExecutionComponent implements OnInit { tasktime: '', unitname: '', unitlevel: '', - or:'' + or: '' } usersNum loading @@ -36,4 +36,29 @@ export class StationTaskExecutionComponent implements OnInit { delete(item) { } + expandKeys + defaultOrId: string + //获取所有组织机构 + nodes: any = [] + getAllOrganization() { + let organizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId + let params = { + OrganizationId: organizationId || '', + ContainsChildren: "true", + PageNumber: 1, + PageSize: 9999 + } + this.http.get('/api/Organizations', { + params: params + }).subscribe((data: any) => { + data.items.forEach(element => { + if (element.id == organizationId) { + element.parentId = null + } + element.key = element.id + element.title = element.name + }); + this.nodes = [...this.toTree.toTree(data.items)] + }) + } } diff --git a/src/app/home/task/zhi-indicators/zhi-indicators.component.html b/src/app/home/task/zhi-indicators/zhi-indicators.component.html index 7c124ae..ad5073c 100644 --- a/src/app/home/task/zhi-indicators/zhi-indicators.component.html +++ b/src/app/home/task/zhi-indicators/zhi-indicators.component.html @@ -33,7 +33,7 @@
-
+ @@ -46,6 +46,10 @@
+ +

更多

@@ -64,13 +68,14 @@
+ nzBlockNode (nzClick)="nzEvent($event)" + (nzExpandChange)="nzEvent($event)" [nzExpandedIcon]="multiExpandedIconTpl">
- {{ node.title }} @@ -78,7 +83,7 @@
- + @@ -130,8 +135,7 @@ + placeholder="一段简短的说明文字..." (ngModelChange)="saveItem()"> diff --git a/src/app/home/task/zhi-indicators/zhi-indicators.component.scss b/src/app/home/task/zhi-indicators/zhi-indicators.component.scss index aca7a11..324ab8e 100644 --- a/src/app/home/task/zhi-indicators/zhi-indicators.component.scss +++ b/src/app/home/task/zhi-indicators/zhi-indicators.component.scss @@ -130,6 +130,11 @@ .popoverContentitem{ flex: 1; overflow-y: auto; + display: flex; + flex-direction: column; + p{ + text-align: center; + } } } 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 a9c4809..65e9ee3 100644 --- a/src/app/home/task/zhi-indicators/zhi-indicators.component.ts +++ b/src/app/home/task/zhi-indicators/zhi-indicators.component.ts @@ -4,6 +4,7 @@ import { FormBuilder, FormGroup } from '@angular/forms'; import { TreeService } from 'src/app/service/tree.service'; import { fromEvent, Subject } from 'rxjs'; import { debounceTime } from 'rxjs/operators'; // 引入debounceTime、Subject +import { NzFormatEmitEvent, NzTreeNodeOptions } from 'ng-zorro-antd/tree'; @Component({ selector: 'app-zhi-indicators', templateUrl: './zhi-indicators.component.html', @@ -18,6 +19,7 @@ export class ZhiIndicatorsComponent implements OnInit { ngOnInit(): void { this.getAllOrganization() + this.getCompanies() //保存防抖 this.valueChange.pipe(debounceTime(1000)).subscribe(data => { console.log(data); @@ -59,7 +61,8 @@ export class ZhiIndicatorsComponent implements OnInit { data: [ { explain: '' } ],//表格数据 - nodes: [] + nodes: [], + unitList: [] } // 熟悉演练 @@ -72,18 +75,55 @@ export class ZhiIndicatorsComponent implements OnInit { search2Value: [], selectedMenu: 1,//选择单位气泡卡片 data: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],//表格数据 - nodes: [] + nodes: [], + unitList: [] } + PageNumber = 1 + PageSize = 50 + totalCount: number + getCompanies(CompanyName?: string) { + let params = { + CompanyName: CompanyName, + PageNumber: this.PageNumber, + PageSize: this.PageSize + } + this.http.get('/api/Companies', { + params: params + }).subscribe((data: any) => { + console.log(data); + this.totalCount = data.totalCount + data.items.forEach(element => { + element.label = element.companyName + element.value = element.id + }); + this.doubleRandom.unitList = this.doubleRandom.unitList.concat(data.items); + this.doubleRandom.unitList = [...this.doubleRandom.unitList] + }) + } + moreData() { + this.PageNumber += 1 + this.getCompanies() + } + log(data) { + let arr = [] + data.unitList.forEach(item => { + item.checked ? arr.push(item.id) : null + }); + data.search1Value = arr + } + isPopover(data) { data.isPopover = !data.isPopover } //搜索框提交 - submitForm(value): void { - // console.log(value) + submitForm(data): void { + data.unitList = [] + this.PageNumber = 1 + this.getCompanies(data.search1) } // 弹出 tab popoverMenuSelect(data, type) { @@ -96,7 +136,7 @@ export class ZhiIndicatorsComponent implements OnInit { nzExpandAll = false; - totalCount: string + allOrList: any nodes @@ -108,7 +148,6 @@ export class ZhiIndicatorsComponent implements OnInit { this.http.get('/api/Organizations', { params: params }).subscribe((data: any) => { - this.totalCount = data.totalCount data.items.forEach(element => { element.key = element.id element.title = element.name @@ -134,4 +173,53 @@ export class ZhiIndicatorsComponent implements OnInit { } console.log(data.search2Value) } + + ngOnDestroy(): void { + //Called once, before the instance is destroyed. + //Add 'implements OnDestroy' to the class. + console.log('毁灭了') + this.doubleRandom.isPopover = false + } + + nzEvent(event: NzFormatEmitEvent): any { + console.log(event); + // load child async + if(event.node.origin.companyName){ + return new Promise((resolve, reject) => { + reject() + }) + } + if (event.node.origin.level === 3 && !event.node.origin.companyName) { + const node = event.node; + console.log(node?.getChildren()) + if (node?.getChildren().length === 0) { + this.loadNode(event.node.origin.id).then(data => { + node.addChildren(data); + }); + } + } + } + + 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 + }); + resolve(data.items) + }) + }); + } + + } diff --git a/src/app/service/cache-token.service.ts b/src/app/service/cache-token.service.ts index 7c2c9c4..13466d6 100644 --- a/src/app/service/cache-token.service.ts +++ b/src/app/service/cache-token.service.ts @@ -24,7 +24,7 @@ export class CacheTokenService { sessionStorage.setItem("token", data.token); sessionStorage.setItem("refreshToken", data.refreshToken); }) - }, 18 * 60 * 1000) + }, 10 * 60 * 1000) console.log('启动定时刷新token') } @@ -38,8 +38,5 @@ export class CacheTokenService { window.clearInterval(this.timer) } - createTime = (time: string) => { - var newtime = time.substr(0, 4) + '年' + time.substr(5, 2) + '月' + time.substr(8, 2) + '日' + time.substr(11, 8) - } } diff --git a/src/theme.less b/src/theme.less index d9f8e38..2f5141a 100644 --- a/src/theme.less +++ b/src/theme.less @@ -84,3 +84,10 @@ .maxHeightTreeSelect { max-height: 280px; } +.ant-checkbox-group{ + display: flex; + flex-direction: column; + label{ + margin-bottom: 6px; + } +} \ No newline at end of file