diff --git a/src/app/home/home-routing.module.ts b/src/app/home/home-routing.module.ts index df6c515..f98e4ba 100644 --- a/src/app/home/home-routing.module.ts +++ b/src/app/home/home-routing.module.ts @@ -42,7 +42,7 @@ const routes: Routes = [ }, { path: 'audit', - component: ZhiAuditComponent, + component: ZhiAuditComponent }, { path: 'monthlytaskoverview', diff --git a/src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.html b/src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.html index 173595b..fc2ec10 100644 --- a/src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.html +++ b/src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.html @@ -32,14 +32,15 @@ style="vertical-align: text-top;cursor: pointer;" nz-icon nzType="right-circle" nzTheme="outline">

-

5/9

+

+ {{item.passed}}/{{item.data.length}}

完成率 - 60% + {{item.percentage}}%

-
@@ -51,13 +52,12 @@ nzTheme="outline">返回

-
+

- 济南历下森豪室内娱乐场 + {{i.company.companyName}}

- 已分配 - 已检查 + {{i.approvalStatus}}

@@ -81,7 +81,14 @@
- {{item.name}} +
+ {{item.name}} + + 已审批: {{item.finished}}/{{item.list.length}} + +
+ + {{item.isExpand ? '收起' :'展开'}} @@ -89,39 +96,38 @@
+ [ngClass]="{'redcard': i.approvalStatus == '驳回'}">
{{i.company.companyName}}
-
- - - {{i.mainSupervisor ? i.mainSupervisor.name : '未分配'}} + + + + + {{o.name}} - - - {{i.assitantSupervisor ? i.assitantSupervisor.name : '未分配'}} + + + + + + {{o.name}} - 分配 - | - 申请人: {{i.organization.name}} - -
+ + + | + 申请人: {{i.organization.name}} +
+
+ +
- -
- - -
@@ -157,27 +163,30 @@ 75% - - + +
- +
- +
- +
-
-
上级指派46%
+
+
上级指派46%
-
自主任务46%
+
自主任务46%
-
申领任务46%
+
申领任务46%
@@ -185,7 +194,7 @@
- 任务总数 + 消防救援任务总数
@@ -195,28 +204,31 @@ + [nzPercent]="75" nzStrokeColor="#42B983" [nzShowInfo]="false" [nzStrokeWidth]="18"> 75% - -
-
- +
- +
-
-
自主任务46%
+
+
上级指派46%
+
+
+
+
自主任务46%
-
-
申领任务46%
+
申领任务46%
@@ -224,7 +236,7 @@
- 任务总数 + 检查员任务总数
@@ -238,26 +250,29 @@ 75% - -
-
- +
- -
-
-
-
自主任务46%
-
- -
-
-
申领任务46%
-
+ +
+
+
+
上级指派46%
+
+
+
自主任务46%
+
+
+
+
申领任务46%
+
+
@@ -276,14 +291,18 @@ {{element.name}} - 单位总数: 7/8 -
+ + + 单位总数:{{element.awaitInspect}}/{{element.allUnitsNum}} + + +
完成进度 - +
- + {{element.isExpand ? '收起' :'展开'}} @@ -298,12 +317,12 @@
已分配 - 0 + {{item.inspected}}
已完成 - 0 + {{item.finished}}
@@ -366,7 +385,7 @@
- 未发现违法违规情况 + {{i.inspectionResult}} 检查结果 diff --git a/src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.scss b/src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.scss index 350fe09..1d880b9 100644 --- a/src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.scss +++ b/src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.scss @@ -261,22 +261,19 @@ border-radius: 4px 4px 4px 4px; opacity: 1; display: flex; + margin-bottom: 18px; + align-items: center; box-sizing: border-box; padding: 0 20px; position: relative; - margin-bottom: 18px; div { display: flex; align-items: center; - - img { - margin-top: -3px; - } } .unitname { - width: 30%; + flex: 1; } .info { @@ -285,33 +282,38 @@ justify-content: center; align-items: center; - span { - margin-right: 20px; - } - } + .assistant { + width: 50%; - .btn { - flex: 1; + span { + color: #303133; + margin-right: 6px; + } + + img { + width: 16px; + height: 16px; + vertical-align: text-bottom; + } - button:nth-child(1) { - background: #42B983; - color: white; + display: inline-block; + text-align: left; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } - button:nth-child(2) { - background: #FF0000; - color: white; - margin-left: 20px; + span { + margin-right: 20px; } } + .img { - width: 30%; + flex: 1; - .auditimg { - position: absolute; - right: 18%; - top: 9%; + img { + margin-left: 40%; } } @@ -329,9 +331,8 @@ } } - .taskauditbox:nth-child(2) { + .taskauditbox:nth-child(3) { margin-bottom: 0px; - } } @@ -433,7 +434,7 @@ .tips { width: 10px; height: 10px; - + border-radius: 10px; margin-right: 5px; } @@ -646,4 +647,4 @@ .cutoffrule { width: 100%; border-top: 1px dashed #C7CAD0; -} \ No newline at end of file +} 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 6dd7709..a5ff8bd 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 @@ -1,5 +1,5 @@ import { HttpClient } from '@angular/common/http'; -import { Component, OnInit, ViewContainerRef } from '@angular/core'; +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'; @@ -10,19 +10,23 @@ import { AllotPersonComponent } from '../da-subordinate-audit/allot-person/allot }) export class DaMonthlyTaskOverviewComponent implements OnInit { - constructor(private http: HttpClient, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService) { } + constructor(private ngZone: NgZone, private http: HttpClient, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService) { } selectedMonth selectedYear = 2022 selectedTime selectMonth(item) { this.selectedMonth = item.id + this.getHigherTasks() this.getTaskList() + this.getAllStation() } selectYear(e) { this.selectedYear = e console.log('年', e) + this.getHigherTasks() this.getTaskList() + this.getAllStation() } months = [ { id: 1, name: '1月', isable: true }, @@ -39,47 +43,123 @@ export class DaMonthlyTaskOverviewComponent implements OnInit { { id: 12, name: '12月', isable: true } ] - //下级任务申请打开关闭 - istaskauditExpanded = true - istaskauditexpand() { - this.istaskauditExpanded = !this.istaskauditExpanded + + + OrganizationId + ngOnInit(): void { + this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId + this.selectedMonth = new Date().getMonth() + 1 + + //上级任务指标 + this.getHigherTasks() + + + // 下级任务申请 + this.getTaskList() + this.getSupervisor('main') + this.getSupervisor('assisted') + + //本级部署 + this.getAllStation() } - //本级部署打开关闭 - isdeployboxExpanded = true - isdeployboxexpand() { - this.isdeployboxExpanded = !this.isdeployboxExpanded + //上级任务指标 + cardData = [ + { name: '双随机', isDetails: false, isLoading: false, background: '#1D9DFF', icon: 'suiji.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '行政许可', isDetails: false, isLoading: false, background: '#42B983', icon: 'xuke.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '熟悉演练', isDetails: false, isLoading: false, background: '#9D80FF', icon: 'yanlian.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '消防宣传', isDetails: false, isLoading: false, background: '#FF5D2A', icon: 'xuanchuan.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '投诉举报', isDetails: false, isLoading: false, background: '#5087FF', icon: 'tousu.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '火灾调查', isDetails: false, isLoading: false, background: '#FF404D', icon: 'huozai.png', passed: 0, inspected: 0, percentage: 0, data: [] } + ] + + getHigherTasks() { + this.cardData.forEach((item, key) => { + item.data = [] + item.passed = 0 + item.inspected = 0 + }); + let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01' + let params = { + Month: selectedTime, + OrganizationId: this.OrganizationId, + PageNumber: 1, + CreationTypes: ['上级指派'], + PageSize: 9999 + } + + this.http.get('/api/PlanTasks', { + params: params + }).subscribe((data: any) => { + + data.items.forEach(element => { + this.cardData.forEach((item, key) => { + element.taskType == item.name ? this.cardData[key].data.push(element) : null + }); + }); + + this.cardData.forEach(element => { + element.data.forEach(item => { + item.approvalStatus == '通过' ? element.passed += 1 : null + item.approvalStatus == '已检查 ' ? element.inspected += 1 : null + }) + }) + this.cardData.forEach(element => { + element.percentage = Math.round(element.inspected / element.data.length) * 100 || 0 + }) + this.cardData = [...this.cardData] + + }) } - PageNumber = 1 - PageSize = 9999 + openDetails(data, type) { + this.ngZone.run(() => { + //这里写需要立即渲染的代码 + data.isDetails = type + }); + } + + //下级任务申请打开关闭 + expand(data) { + this.ngZone.run(() => { + //这里写需要立即渲染的代码 + data.isExpand = !data.isExpand + }); + + } + istaskauditExpanded = true + istaskauditexpand() { + this.istaskauditExpanded = !this.istaskauditExpanded + } taskData = [ { id: 0, name: '熟悉演练任务', finished: 0, totalCount: 0, list: [], isExpand: true }, - { id: 1, name: '联络指导任务', finished: 0, totalCount: 0, list: [], isExpand: true } + { id: 1, name: '联络指导任务', finished: 0, totalCount: 0, list: [], isExpand: true }, + { id: 2, name: '双随机任务', finished: 0, totalCount: 0, list: [], isExpand: true } ] - isloading = false getTaskList() { - this.isloading = true this.taskData = [ { id: 0, name: '熟悉演练任务', finished: 0, totalCount: 0, list: [], isExpand: true }, - { id: 1, name: '联络指导任务', finished: 0, totalCount: 0, list: [], isExpand: true } + { id: 1, name: '联络指导任务', finished: 0, totalCount: 0, list: [], isExpand: true }, + { id: 2, name: '双随机任务', finished: 0, totalCount: 0, list: [], isExpand: true } + ] let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01' - console.log('查询时间', selectedTime) let params = { Month: selectedTime, OrganizationId: this.OrganizationId, - PageNumber: this.PageNumber, - PageSize: this.PageSize + CreationTypes: ['申领任务'], + PageNumber: 1, + PageSize: 9999 } this.http.get('/api/PlanTasks', { params: params }).subscribe((data: any) => { let arr1 = [] let arr2 = [] + let arr3 = [] data.items.forEach(element => { if (element.taskName == '熟悉演练') { arr1.push(element) @@ -87,27 +167,33 @@ export class DaMonthlyTaskOverviewComponent implements OnInit { if (element.taskName == '联络指导') { arr2.push(element) } + if (element.taskName == '双随机') { + arr3.push(element) + } }); arr1.forEach(item => { - if (!!item.approvalStatus) { + if (item.approvalStatus == '通过') { this.taskData[0].finished += 1 } }); arr2.forEach(item => { - if (!!item.approvalStatus) { + if (item.approvalStatus == '通过') { this.taskData[1].finished += 1 } }); - this.taskData[0].totalCount = arr1.length + arr3.forEach(item => { + if (item.approvalStatus == '通过') { + this.taskData[2].finished += 1 + } + }); this.taskData[0].list = [...arr1] - this.taskData[1].totalCount = arr2.length this.taskData[1].list = [...arr2] - - this.isloading = false - + this.taskData[2].list = [...arr3] console.log('下级任务申请', this.taskData) + }) } + assitantsupervisorList mainsupervisorList getSupervisor(type) { @@ -125,7 +211,6 @@ export class DaMonthlyTaskOverviewComponent implements OnInit { } }) } - allot(item) { console.log(item) if (this.mainsupervisorList.length == 0 || this.assitantsupervisorList.length == 0) { @@ -154,7 +239,7 @@ export class DaMonthlyTaskOverviewComponent implements OnInit { this.message.create('success', '分配成功'); resolve(data) console.log(data); - + this.getTaskList() return true }, @@ -180,43 +265,15 @@ export class DaMonthlyTaskOverviewComponent implements OnInit { - expand(data) { - data.isExpand = !data.isExpand + //本级部署打开关闭 + isdeployboxExpanded = true + isdeployboxexpand() { + this.isdeployboxExpanded = !this.isdeployboxExpanded } formatOne = (percent: number): string => `${percent}%\n完成率`; - cardData = [ - { name: '双随机', isDetails: false, background: '#1D9DFF', icon: 'suiji.png' }, - { name: '熟悉演练', isDetails: false, background: '#9D80FF', icon: 'yanlian.png' }, - { name: '投诉举报', isDetails: false, background: '#5087FF', icon: 'tousu.png' }, - { name: '行政许可', isDetails: false, background: '#42B983', icon: 'xuke.png' }, - { name: '消防宣传', isDetails: false, background: '#FF5D2A', icon: 'xuanchuan.png' }, - { name: '火灾调查', isDetails: false, background: '#FF404D', icon: 'huozai.png' } - ] - - openDetails(data, type) { - data.isDetails = type - } - - - - OrganizationId - ngOnInit(): void { - this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId - this.selectedMonth = new Date().getMonth() + 1 - - this.getTaskList() - //获得主协调查人员 - this.getSupervisor('main') - this.getSupervisor('assisted') - - - this.getAllStation() - } - - //获得辖区下所有救援站 stationData = [] getAllStation() { @@ -227,23 +284,26 @@ export class DaMonthlyTaskOverviewComponent implements OnInit { this.http.get('/api/Organizations', { params: params }).subscribe((data: any) => { - data.items = data.items.filter(element => { - return element.level == 'squadron' - }); - data.items.forEach(element => { - element.isExpand = false - element.isLoading = false - }); - this.stationData = data.items + this.ngZone.run(() => { + data.items = data.items.filter(element => { + return element.level == 'squadron' + }); + data.items.forEach(element => { + element.isExpand = false + element.isLoading = false + }); + this.stationData = data.items + this.stationData[0].isExpand = true + this.stationData.forEach(item => { + this.getTaskListOfStation(item) + }) + }) + }) } expandcarditem(item) { item.isExpand = !item.isExpand - console.log(item) - if (item.isExpand) { - this.getTaskListOfStation(item) - } } //获得消防站下的所有任务 @@ -252,9 +312,9 @@ export class DaMonthlyTaskOverviewComponent implements OnInit { let params = { Month: selectedTime, CompanyOrganizationId: item.id, - PageNumber: this.PageNumber, + PageNumber: 1, approvalStatuses: '通过', - PageSize: this.PageSize + PageSize: 9999 } item.isLoading = true this.http.get('/api/PlanTasks', { @@ -263,13 +323,13 @@ export class DaMonthlyTaskOverviewComponent implements OnInit { next: (data: any) => { item.isLoading = false let listData = [ - { name: '双随机', background: '#1D9DFF', icon: 'suiji.png', scale: '0/0', data: [] }, - { name: '行政许可', background: '#42B983', icon: 'xuke.png', scale: '0/0', data: [] }, - { name: '熟悉演练', background: '#9D80FF', icon: 'yanlian.png', scale: '0/0', data: [] }, - { name: '联络指导', background: '#5483EA', icon: 'zhidao.png', scale: '0/0', data: [] }, - { name: '消防宣传', background: '#FF5D2A', icon: 'xuanchuan.png', scale: '0/0', data: [] }, - { name: '投诉举报', background: '#5087FF', icon: 'tousu.png', scale: '0/0', data: [] }, - { name: '火灾调查', background: '#FF404D', icon: 'huozai.png', scale: '0/0', data: [] } + { name: '双随机', background: '#1D9DFF', icon: 'suiji.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '行政许可', background: '#42B983', icon: 'xuke.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '熟悉演练', background: '#9D80FF', icon: 'yanlian.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '联络指导', background: '#5483EA', icon: 'zhidao.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '消防宣传', background: '#FF5D2A', icon: 'xuanchuan.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '投诉举报', background: '#5087FF', icon: 'tousu.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '火灾调查', background: '#FF404D', icon: 'huozai.png', scale: '0/0', data: [], inspected: 0, finished: 0 } ] data.items.forEach(element => { listData.forEach((item, key) => { @@ -284,7 +344,22 @@ export class DaMonthlyTaskOverviewComponent implements OnInit { } } item.data = listData - // console.log('点击的救援站通过数据', item) + console.log('当前登录用户所有通过的任务', item); + item.allUnitsNum = 0 + item.awaitInspect = 0 + item.inspected = 0 + item.finished = 0 + item.data.forEach(element => { + item.allUnitsNum += element.data.length + element.data.forEach(i => { + i.approvalStatus == '待检查' ? item.awaitInspect += 1 : null + i.approvalStatus == '已检查' ? item.inspected += 1 : null + i.approvalStatus == '待检查' ? element.inspected += 1 : null + i.approvalStatus == '已检查' ? element.finished += 1 : null + }); + }); + item.percentage = Math.round(item.inspected / item.allUnitsNum) * 100 + }, error: (err) => { this.message.create('warning', '获取数据失败'); diff --git a/src/app/home/task/da-oneself-plan/da-oneself-plan.component.html b/src/app/home/task/da-oneself-plan/da-oneself-plan.component.html index ce726a1..b5c662c 100644 --- a/src/app/home/task/da-oneself-plan/da-oneself-plan.component.html +++ b/src/app/home/task/da-oneself-plan/da-oneself-plan.component.html @@ -12,6 +12,7 @@
+
@@ -24,6 +25,9 @@
+
+ +
@@ -37,12 +41,13 @@ style="vertical-align: text-top;cursor: pointer;" nz-icon nzType="right-circle" nzTheme="outline">

-

5/9

+

+ {{item.passed}}/{{item.data.length}}

- +
-
@@ -50,19 +55,25 @@

{{item.name}} - 返回 + + + + 返回 + +

-
+

- 济南历下森豪室内娱乐场 - - 派发 + {{i.company.companyName}} + + {{i.approvalStatus}}

-

A消防救援站

-

派发

+

{{i.company.organization.name}}

+

+ {{i.approvalStatus}} +

@@ -82,14 +93,18 @@ {{element.name}} - 单位总数: 7/8 + + + 单位总数:{{element.awaitInspect}}/{{element.allUnitsNum}} + +
完成进度 - +
- - + + {{element.isExpand ? '收起' :'展开'}} @@ -104,12 +119,12 @@
已分配 - 0 + {{item.inspected}}
已完成 - 0 + {{item.finished}}
@@ -172,7 +187,7 @@
- 未发现违法违规情况 + {{i.inspectionResult}} 检查结果 diff --git a/src/app/home/task/da-oneself-plan/da-oneself-plan.component.ts b/src/app/home/task/da-oneself-plan/da-oneself-plan.component.ts index 9e70bad..03edaf1 100644 --- a/src/app/home/task/da-oneself-plan/da-oneself-plan.component.ts +++ b/src/app/home/task/da-oneself-plan/da-oneself-plan.component.ts @@ -17,6 +17,7 @@ export class DaOneselfPlanComponent implements OnInit { ngOnInit(): void { this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId this.selectedMonth = new Date().getMonth() + 1 + this.getTasks() this.getAllStation() } selectedMonth @@ -54,32 +55,67 @@ export class DaOneselfPlanComponent implements OnInit { formatOne = (percent: number): string => `${percent}%\n完成率`; + //上级任务指标 cardData = [ - { name: '双随机', isDetails: false, background: '#1D9DFF', icon: 'suiji.png' }, - { name: '行政许可', isDetails: false, background: '#42B983', icon: 'xuke.png' }, - { name: '熟悉演练', isDetails: false, background: '#9D80FF', icon: 'yanlian.png' }, - { name: '联络指导', isDetails: false, background: '#5483EA', icon: 'zhidao.png' }, - { name: '消防宣传', isDetails: false, background: '#FF5D2A', icon: 'xuanchuan.png' }, - { name: '投诉举报', isDetails: false, background: '#5087FF', icon: 'tousu.png' }, - { name: '火灾调查', isDetails: false, background: '#FF404D', icon: 'huozai.png' } + { name: '双随机', isDetails: false, isLoading: false, background: '#1D9DFF', icon: 'suiji.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '行政许可', isDetails: false, isLoading: false, background: '#42B983', icon: 'xuke.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '熟悉演练', isDetails: false, isLoading: false, background: '#9D80FF', icon: 'yanlian.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '联络指导', isDetails: false, isLoading: false, background: '#5483EA', icon: 'zhidao.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '消防宣传', isDetails: false, isLoading: false, background: '#FF5D2A', icon: 'xuanchuan.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '投诉举报', isDetails: false, isLoading: false, background: '#5087FF', icon: 'tousu.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '火灾调查', isDetails: false, isLoading: false, background: '#FF404D', icon: 'huozai.png', passed: 0, inspected: 0, percentage: 0, data: [] } ] + async getTasks() { + let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01' + let params = { + Month: selectedTime, + OrganizationId: this.OrganizationId, + PageNumber: 1, + PageSize: 9999 + } + return await new Promise((resolve, reject) => { + this.http.get('/api/PlanTasks', { + params: params + }).subscribe((data: any) => { + // console.log('任务申请列表', data.items); + data.items.forEach(element => { + this.cardData.forEach((item, key) => { + element.taskType == item.name ? this.cardData[key].data.push(element) : null + }); + }); + + this.cardData.forEach(element => { + element.data.forEach(item => { + item.approvalStatus == '通过' ? element.passed += 1 : null + item.approvalStatus == '已检查 ' ? element.inspected += 1 : null + }) + }) + this.cardData.forEach(element => { + element.percentage = Math.round(element.inspected / element.data.length) * 100 || 0 + }) + + resolve(data) + console.log('并入卡片数据', this.cardData) + }) + }) + } openDetails(data, type) { data.isDetails = type } - xxx = false - radioChange(e) { - setTimeout(() => { - this.xxx = !this.xxx - }, 0); + + radioChange(e) { } + + nodes: any = [] BuildingTypes - adjustment() { + adjustment(item) { + console.log(item) const modal = this.modal.create({ nzTitle: "任务调整", nzContent: PlanAdjustmentComponent, @@ -117,14 +153,15 @@ export class DaOneselfPlanComponent implements OnInit { element.isLoading = false }); this.stationData = data.items + this.stationData[0].isExpand = true + this.stationData.forEach(item => { + this.getTaskListOfStation(item) + }) }) } expandcarditem(item) { item.isExpand = !item.isExpand - console.log(item) - if (item.isExpand) { - this.getTaskListOfStation(item) - } + } //获得消防站下的所有任务 PageNumber = 1 @@ -145,13 +182,13 @@ export class DaOneselfPlanComponent implements OnInit { next: (data: any) => { item.isLoading = false let listData = [ - { name: '双随机', background: '#1D9DFF', icon: 'suiji.png', scale: '0/0', data: [] }, - { name: '行政许可', background: '#42B983', icon: 'xuke.png', scale: '0/0', data: [] }, - { name: '熟悉演练', background: '#9D80FF', icon: 'yanlian.png', scale: '0/0', data: [] }, - { name: '联络指导', background: '#5483EA', icon: 'zhidao.png', scale: '0/0', data: [] }, - { name: '消防宣传', background: '#FF5D2A', icon: 'xuanchuan.png', scale: '0/0', data: [] }, - { name: '投诉举报', background: '#5087FF', icon: 'tousu.png', scale: '0/0', data: [] }, - { name: '火灾调查', background: '#FF404D', icon: 'huozai.png', scale: '0/0', data: [] } + { name: '双随机', background: '#1D9DFF', icon: 'suiji.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '行政许可', background: '#42B983', icon: 'xuke.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '熟悉演练', background: '#9D80FF', icon: 'yanlian.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '联络指导', background: '#5483EA', icon: 'zhidao.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '消防宣传', background: '#FF5D2A', icon: 'xuanchuan.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '投诉举报', background: '#5087FF', icon: 'tousu.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '火灾调查', background: '#FF404D', icon: 'huozai.png', scale: '0/0', data: [], inspected: 0, finished: 0 } ] data.items.forEach(element => { listData.forEach((item, key) => { @@ -166,7 +203,21 @@ export class DaOneselfPlanComponent implements OnInit { } } item.data = listData - // console.log('点击的救援站通过数据', item) + console.log('当前登录用户所有通过的任务', item); + item.allUnitsNum = 0 + item.awaitInspect = 0 + item.inspected = 0 + item.finished = 0 + item.data.forEach(element => { + item.allUnitsNum += element.data.length + element.data.forEach(i => { + i.approvalStatus == '待检查' ? item.awaitInspect += 1 : null + i.approvalStatus == '已检查' ? item.inspected += 1 : null + i.approvalStatus == '待检查' ? element.inspected += 1 : null + i.approvalStatus == '已检查' ? element.finished += 1 : null + }); + }); + item.percentage = Math.round(item.inspected / item.allUnitsNum) * 100 }, error: (err) => { this.message.create('warning', '获取数据失败'); 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 c70daeb..c78fa9a 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 @@ -286,6 +286,7 @@ export class StationTaskApplyComponent implements OnInit { companyId: instance.validateForm.value.unitname, organizationId: this.OrganizationId, supervisorIds: instance.validateForm.value.organization, + creationType: '申领任务', approvalStatus: '待处理' } this.http.post('/api/PlanTasks', body).subscribe({ diff --git a/src/app/home/task/station-weekly-plan/create-task/create-task.component.html b/src/app/home/task/station-weekly-plan/create-task/create-task.component.html index dae8ace..237d5cd 100644 --- a/src/app/home/task/station-weekly-plan/create-task/create-task.component.html +++ b/src/app/home/task/station-weekly-plan/create-task/create-task.component.html @@ -13,7 +13,7 @@ - + diff --git a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.html b/src/app/home/task/station-weekly-plan/station-weekly-plan.component.html index 2195fff..441e5f7 100644 --- a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.html +++ b/src/app/home/task/station-weekly-plan/station-weekly-plan.component.html @@ -33,7 +33,7 @@
-
+
@@ -48,7 +48,7 @@
-
+
@@ -152,12 +152,12 @@
已分配 - 0 + {{item.inspected}}
已完成 - 0 + {{item.finished}}
@@ -220,8 +220,9 @@
- + diff --git a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts b/src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts index 4cf2ab6..28ee8ba 100644 --- a/src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts +++ b/src/app/home/task/station-weekly-plan/station-weekly-plan.component.ts @@ -8,6 +8,7 @@ import { TreeService } from 'src/app/service/tree.service'; import * as moment from 'moment'; import { TaskDetailsComponent } from './task-details/task-details.component'; import { CreateTaskComponent } from './create-task/create-task.component'; +import { differenceInCalendarDays, setHours } from 'date-fns' @Component({ selector: 'app-station-weekly-plan', templateUrl: './station-weekly-plan.component.html', @@ -20,6 +21,8 @@ export class StationWeeklyPlanComponent implements OnInit { userId isSupervisor + today = new Date(); + disabledDate = (current: Date): boolean => differenceInCalendarDays(current, this.today) <= 0; months = [ { id: 1, name: '1月', isable: true }, { id: 2, name: '2月', isable: true }, @@ -127,24 +130,24 @@ export class StationWeeklyPlanComponent implements OnInit { } cardData = [ - { name: '双随机', isDetails: false, isloading: false, background: '#1D9DFF', icon: 'suiji.png', passed: 0, inspected: 0, percentage: 0, data: [] }, - { name: '行政许可', isDetails: false, isloading: false, background: '#42B983', icon: 'xuke.png', passed: 0, inspected: 0, percentage: 0, data: [] }, - { name: '熟悉演练', isDetails: false, isloading: false, background: '#9D80FF', icon: 'yanlian.png', passed: 0, inspected: 0, percentage: 0, data: [] }, - { name: '联络指导', isDetails: false, isloading: false, background: '#5483EA', icon: 'zhidao.png', passed: 0, inspected: 0, percentage: 0, data: [] }, - { name: '消防宣传', isDetails: false, isloading: false, background: '#FF5D2A', icon: 'xuanchuan.png', passed: 0, inspected: 0, percentage: 0, data: [] }, - { name: '投诉举报', isDetails: false, isloading: false, background: '#5087FF', icon: 'tousu.png', passed: 0, inspected: 0, percentage: 0, data: [] }, - { name: '火灾调查', isDetails: false, isloading: false, background: '#FF404D', icon: 'huozai.png', passed: 0, inspected: 0, percentage: 0, data: [] } + { name: '双随机', isDetails: false, isLoading: false, background: '#1D9DFF', icon: 'suiji.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '行政许可', isDetails: false, isLoading: false, background: '#42B983', icon: 'xuke.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '熟悉演练', isDetails: false, isLoading: false, background: '#9D80FF', icon: 'yanlian.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '联络指导', isDetails: false, isLoading: false, background: '#5483EA', icon: 'zhidao.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '消防宣传', isDetails: false, isLoading: false, background: '#FF5D2A', icon: 'xuanchuan.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '投诉举报', isDetails: false, isLoading: false, background: '#5087FF', icon: 'tousu.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '火灾调查', isDetails: false, isLoading: false, background: '#FF404D', icon: 'huozai.png', passed: 0, inspected: 0, percentage: 0, data: [] } ] //初始化数据 initializeData() { this.cardData = [ - { name: '双随机', isDetails: false, isloading: false, background: '#1D9DFF', icon: 'suiji.png', passed: 0, inspected: 0, percentage: 0, data: [] }, - { name: '行政许可', isDetails: false, isloading: false, background: '#42B983', icon: 'xuke.png', passed: 0, inspected: 0, percentage: 0, data: [] }, - { name: '熟悉演练', isDetails: false, isloading: false, background: '#9D80FF', icon: 'yanlian.png', passed: 0, inspected: 0, percentage: 0, data: [] }, - { name: '联络指导', isDetails: false, isloading: false, background: '#5483EA', icon: 'zhidao.png', passed: 0, inspected: 0, percentage: 0, data: [] }, - { name: '消防宣传', isDetails: false, isloading: false, background: '#FF5D2A', icon: 'xuanchuan.png', passed: 0, inspected: 0, percentage: 0, data: [] }, - { name: '投诉举报', isDetails: false, isloading: false, background: '#5087FF', icon: 'tousu.png', passed: 0, inspected: 0, percentage: 0, data: [] }, - { name: '火灾调查', isDetails: false, isloading: false, background: '#FF404D', icon: 'huozai.png', passed: 0, inspected: 0, percentage: 0, data: [] } + { name: '双随机', isDetails: false, isLoading: false, background: '#1D9DFF', icon: 'suiji.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '行政许可', isDetails: false, isLoading: false, background: '#42B983', icon: 'xuke.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '熟悉演练', isDetails: false, isLoading: false, background: '#9D80FF', icon: 'yanlian.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '联络指导', isDetails: false, isLoading: false, background: '#5483EA', icon: 'zhidao.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '消防宣传', isDetails: false, isLoading: false, background: '#FF5D2A', icon: 'xuanchuan.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '投诉举报', isDetails: false, isLoading: false, background: '#5087FF', icon: 'tousu.png', passed: 0, inspected: 0, percentage: 0, data: [] }, + { name: '火灾调查', isDetails: false, isLoading: false, background: '#FF404D', icon: 'huozai.png', passed: 0, inspected: 0, percentage: 0, data: [] } ] this.stationData.forEach(element => { @@ -156,24 +159,26 @@ export class StationWeeklyPlanComponent implements OnInit { - isloading = false + isLoading = false PageNumber = 1 PageSize = 9999 async getTaskList() { - this.isloading = true + this.cardData.forEach(item => { + item.data = [] + }) + this.isLoading = true let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01' let params = { Month: selectedTime, - // OrganizationId: this.isSupervisor ? this.OrganizationId : "", SupervisorId: this.userId, PageNumber: this.PageNumber, PageSize: this.PageSize } - var p = await new Promise((resolve, reject) => { + return await new Promise((resolve, reject) => { this.http.get('/api/PlanTasks', { params: params }).subscribe((data: any) => { - this.isloading = false + this.isLoading = false // console.log('任务申请列表', data.items); data.items.forEach(element => { this.cardData.forEach((item, key) => { @@ -181,7 +186,6 @@ export class StationWeeklyPlanComponent implements OnInit { }); }); - this.cardData.forEach(element => { element.data.forEach(item => { item.approvalStatus == '通过' ? element.passed += 1 : null @@ -196,8 +200,6 @@ export class StationWeeklyPlanComponent implements OnInit { console.log('并入卡片数据', this.cardData) }) }) - return p - } stationData = [ @@ -220,13 +222,13 @@ export class StationWeeklyPlanComponent implements OnInit { item.isLoading = false let listData = [ - { name: '双随机', background: '#1D9DFF', icon: 'suiji.png', scale: '0/0', data: [] }, - { name: '行政许可', background: '#42B983', icon: 'xuke.png', scale: '0/0', data: [] }, - { name: '熟悉演练', background: '#9D80FF', icon: 'yanlian.png', scale: '0/0', data: [] }, - { name: '联络指导', background: '#5483EA', icon: 'zhidao.png', scale: '0/0', data: [] }, - { name: '消防宣传', background: '#FF5D2A', icon: 'xuanchuan.png', scale: '0/0', data: [] }, - { name: '投诉举报', background: '#5087FF', icon: 'tousu.png', scale: '0/0', data: [] }, - { name: '火灾调查', background: '#FF404D', icon: 'huozai.png', scale: '0/0', data: [] } + { name: '双随机', background: '#1D9DFF', icon: 'suiji.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '行政许可', background: '#42B983', icon: 'xuke.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '熟悉演练', background: '#9D80FF', icon: 'yanlian.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '联络指导', background: '#5483EA', icon: 'zhidao.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '消防宣传', background: '#FF5D2A', icon: 'xuanchuan.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '投诉举报', background: '#5087FF', icon: 'tousu.png', scale: '0/0', data: [], inspected: 0, finished: 0 }, + { name: '火灾调查', background: '#FF404D', icon: 'huozai.png', scale: '0/0', data: [], inspected: 0, finished: 0 } ] data.items.forEach(element => { listData.forEach((item, key) => { @@ -242,11 +244,17 @@ export class StationWeeklyPlanComponent implements OnInit { } item.data = listData console.log('当前登录用户所有通过的任务', item); + item.allUnitsNum = 0 + item.awaitInspect = 0 + item.inspected = 0 + item.finished = 0 item.data.forEach(element => { item.allUnitsNum += element.data.length - element.data.forEach(item => { - item.approvalStatus == '待检查' ? element.awaitInspect += 1 : null - item.approvalStatus == '已检查' ? element.inspected += 1 : null + element.data.forEach(i => { + i.approvalStatus == '待检查' ? item.awaitInspect += 1 : null + i.approvalStatus == '已检查' ? item.inspected += 1 : null + i.approvalStatus == '待检查' ? element.inspected += 1 : null + i.approvalStatus == '已检查' ? element.finished += 1 : null }); }); item.percentage = Math.round(item.inspected / item.allUnitsNum) * 100 @@ -266,7 +274,7 @@ export class StationWeeklyPlanComponent implements OnInit { nzOkText: '确定', nzOkType: 'default', nzOnOk: () => { - item.isloading = true + item.isLoading = true this.http.post(`/api/PlanTasks/Approval/${i.id}`, null, { params: { approvalStatus: '通过' @@ -275,14 +283,14 @@ export class StationWeeklyPlanComponent implements OnInit { next: (data) => { this.message.create('success', '已接受'); i.approvalStatus = '通过' - item.isloading = false + item.isLoading = false item.passed += 1 this.getTaskListPass(this.stationData[0]) }, error: (err) => { this.message.create('warning', '接受失败'); - item.isloading = false + item.isLoading = false } }) }, @@ -296,7 +304,7 @@ export class StationWeeklyPlanComponent implements OnInit { nzOkText: '确定', nzOkType: 'default', nzOnOk: () => { - item.isloading = true + item.isLoading = true this.http.post(`/api/PlanTasks/Approval/${i.id}`, null, { params: { approvalStatus: '驳回' @@ -305,13 +313,13 @@ export class StationWeeklyPlanComponent implements OnInit { next: (data) => { this.message.create('success', '已拒绝'); i.approvalStatus = '驳回' - item.isloading = false + item.isLoading = false item.passed -= 1 this.getTaskListPass(this.stationData[0]) }, error: (err) => { this.message.create('warning', '拒绝失败'); - item.isloading = false + item.isLoading = false } }) }, @@ -471,15 +479,19 @@ export class StationWeeklyPlanComponent implements OnInit { let body = { taskName: instance.validateForm.value.taskname, taskType: instance.validateForm.value.taskname, - companyId: instance.validateForm.value.unitname, - // organizationId: this.OrganizationId, - // supervisorIds: instance.validateForm.value.organization, + companyId: instance.validateForm.value.unitname.id, + organizationId: this.OrganizationId, + supervisorIds: [this.userId], + creationType: '自主任务', approvalStatus: '通过' } this.http.post('/api/PlanTasks', body).subscribe({ - next: (data) => { - console.log(data) - // item.data.push(data) + next: (data: any) => { + console.log(item) + data.company = instance.validateForm.value.unitname + item.data.push(data) + item.passed += 1 + // this.getTaskList() this.getTaskListPass(this.stationData[0]) this.message.create('success', '创建成功'); resolve(data) 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 2825964..a68e703 100644 --- a/src/app/home/task/zhi-indicators/zhi-indicators.component.html +++ b/src/app/home/task/zhi-indicators/zhi-indicators.component.html @@ -120,8 +120,9 @@ 单位名称 - 配合机构 + 配合机构 说明 + 操作 @@ -134,13 +135,23 @@ /{{i.name}} - 修改机构 + 修改机构 - + + + 派发 + + + 已派发 + + @@ -255,8 +266,9 @@ 单位名称 - 配合机构 + 配合机构 说明 + 操作 @@ -269,13 +281,23 @@ /{{i.name}} - 修改机构 + 修改机构 - + + + 派发 + + + 已派发 + + @@ -395,6 +417,7 @@ 单位名称 监督员 说明 + 操作 @@ -434,11 +457,13 @@
- 更改 + 更改
-
+
检查员
@@ -446,11 +471,20 @@
-
- + + +
+ + 派发 + + + 已派发 + +
@@ -569,6 +603,7 @@ 任务额 单位名称 说明 + 操作 @@ -590,12 +625,22 @@
-
+ +
+ + 派发 + + + 已派发 + +
+ 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 29f30ae..2e674fd 100644 --- a/src/app/home/task/zhi-indicators/zhi-indicators.component.ts +++ b/src/app/home/task/zhi-indicators/zhi-indicators.component.ts @@ -416,7 +416,7 @@ export class ZhiIndicatorsComponent implements OnInit { targetCount: item.targetCount, } return new Promise((resolve, reject) => { - this.http.patch(`/api/TaskTarget/${item.id}`, body).subscribe({ + this.http.patch(`/api/TaskTargets/${item.id}`, body).subscribe({ next: async (data: any) => { this.message.create('success', '修改任务额成功'); resolve(data) @@ -461,15 +461,15 @@ export class ZhiIndicatorsComponent implements OnInit { taskType: type } }).subscribe({ - next: (item) => { + next: (item: Array) => { data.isLoading = false data.isPopover = false - this.message.create('success', '派发成功'); + this.message.create('success', '共创建' + arrSet.length + '条任务' + ',成功创建' + item.length + '条,剩余' + (arrSet.length - item.length) + '个单位已被创建'); type == '投诉举报' ? this.getTaskList('投诉举报', data) : null type == '行政许可' ? this.getTaskList('行政许可', data) : null }, error: (err) => { - this.message.create('warning', '派发失败'); + this.message.create('warning', '创建失败'); } }) } @@ -480,20 +480,21 @@ export class ZhiIndicatorsComponent implements OnInit { let arr = [...data.search1Value, ...data.search2Value] let body = [...new Set(arr)] data.isLoading = true - this.http.post(`/api/TaskTarget/${selectedTime}`, body, { + this.http.post(`/api/TaskTargets/${selectedTime}`, body, { params: { taskType: type } }).subscribe({ - next: (item) => { + next: (item: Array) => { data.isLoading = false data.isPopover = false - this.message.create('success', '派发成功'); + this.message.create('success', '共创建' + body.length + '条任务' + ',成功创建' + item.length + '条,剩余' + (body.length - item.length) + '个单位已被创建'); type == '双随机' ? this.getTaskTarget('双随机', data) : null type == '熟悉演练' ? this.getTaskTarget('熟悉演练', data) : null + }, error: (err) => { - this.message.create('warning', '派发失败'); + this.message.create('warning', '创建失败'); } }) } @@ -504,7 +505,7 @@ export class ZhiIndicatorsComponent implements OnInit { taskType: TaskType } return await new Promise((resolve, reject) => { - this.http.get(`/api/TaskTarget/${selectedTime}`, { + this.http.get(`/api/TaskTargets/${selectedTime}`, { params: params }).subscribe((data: any) => { this.ngZone.run(() => { @@ -528,7 +529,7 @@ export class ZhiIndicatorsComponent implements OnInit { this.rehearsal.allPlanTasks += element.planTasks.length } element.planTasks.forEach(item => { - if (item.supervisorIds.length != 0) { + if (item.approvalStatus == '通过') { TaskType == '双随机' ? this.doubleRandom.allocated += 1 : null TaskType == '熟悉演练' ? this.rehearsal.allocated += 1 : null } @@ -572,7 +573,7 @@ export class ZhiIndicatorsComponent implements OnInit { TaskType == '行政许可' ? this.permission.data = data.items : null data.items.forEach(item => { - if (item.supervisorIds.length != 0) { + if (item.approvalStatus == '通过') { TaskType == '投诉举报' ? this.complaint.allocated += 1 : null TaskType == '行政许可' ? this.permission.allocated += 1 : null } @@ -702,4 +703,37 @@ export class ZhiIndicatorsComponent implements OnInit { modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!')); modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result)); } + + distribute(item, type) { + this.modal.confirm({ + nzTitle: `确定要派发该任务吗?`, + nzOkText: '确定', + nzOkType: 'default', + nzOnOk: () => { + item.isLoading = true + this.http.post(`/api/PlanTasks/Approval/${item.id}`, null, { + params: { + approvalStatus: '通过' + } + }).subscribe({ + next: (data) => { + this.message.create('success', '已派发'); + item.approvalStatus = '通过' + item.isLoading = false + item.passed += 1 + type == '投诉举报' ? this.complaint.allocated += 1 : null + type == '行政许可' ? this.permission.allocated += 1 : null + type == '双随机' ? this.doubleRandom.allocated += 1 : null + type == '熟悉演练' ? this.rehearsal.allocated += 1 : null + + }, + error: (err) => { + this.message.create('warning', '派发失败'); + item.isLoading = false + } + }) + }, + nzCancelText: '取消' + }); + } } diff --git a/src/app/http-interceptors/base-interceptor.ts b/src/app/http-interceptors/base-interceptor.ts index 9c706b0..02bc6ca 100644 --- a/src/app/http-interceptors/base-interceptor.ts +++ b/src/app/http-interceptors/base-interceptor.ts @@ -70,10 +70,11 @@ export class BaseInterceptor implements HttpInterceptor { } else { // 服务端返回http状态码 // 服务端返回错误信息 + console.error( `状态码${error.status}, ` + `错误内容:${error.error}`); - this.message.create('error', error.error.title); + this.message.create('error', error.error.detail); } // 返回带有面向用户的错误信息 return throwError(() => { diff --git a/src/styles.scss b/src/styles.scss index 616e28f..e67a4f8 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -130,13 +130,13 @@ app-root { .forbid { - color: gray; - pointer-events: none + color: gray !important; + pointer-events: none !important; } .forbidbtn { background: gray !important; - pointer-events: none + pointer-events: none !important; } .box {