From 5fcba2084101b3f649ff428356c324459b329e47 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Mon, 29 Aug 2022 08:48:13 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E]=E4=BB=BB=E5=8A=A1=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../da-oneself-plan.component.ts | 12 +- .../plan-adjustment.component.html | 41 ++-- .../plan-adjustment.component.scss | 2 + .../plan-adjustment.component.ts | 228 ++++++++++++++---- .../station-weekly-plan.component.html | 2 +- .../station-weekly-plan.component.ts | 22 ++ 6 files changed, 230 insertions(+), 77 deletions(-) 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 e86125b..c834595 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 @@ -149,7 +149,7 @@ export class DaOneselfPlanComponent implements OnInit { Month: selectedTime, CompanyOrganizationId: item.id, PageNumber: this.PageNumber, - approvalStatuses: '通过', + approvalStatuses: ['通过', '待检查'], PageSize: this.PageSize } item.isLoading = true @@ -203,12 +203,8 @@ export class DaOneselfPlanComponent implements OnInit { }) } - - - - nodes: any = [] - BuildingTypes adjustment(item) { + let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01' const modal = this.modal.create({ nzTitle: "任务调整", nzContent: PlanAdjustmentComponent, @@ -216,7 +212,9 @@ export class DaOneselfPlanComponent implements OnInit { nzWidth: 900, nzFooter: null, nzComponentParams: { - data: item + data: JSON.parse(JSON.stringify(item)), + time: selectedTime, + level: '大队' } }); const instance = modal.getContentComponent(); diff --git a/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.html b/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.html index caf21ce..cbd2070 100644 --- a/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.html +++ b/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.html @@ -1,33 +1,38 @@
-
-
未接任务任务总数:{{taskNumber}}/8
+
+
+ +
+
未接任务
-
-    - {{item.tag}} -
- +
+    + {{item.name}} +
+
-
-
+
+
+ +
已接任务
-
+
-    - {{item2.tag}} +    + {{item.name}}
-
-
-
{{data.name}}
-
+
+
+
{{i.company.companyName}}
+
-
diff --git a/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.scss b/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.scss index 53bf912..168eb3f 100644 --- a/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.scss +++ b/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.scss @@ -1,5 +1,7 @@ .box { display: flex; + max-height: 800px; + overflow-y: auto; } .title{ span{ diff --git a/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.ts b/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.ts index 6d67bb6..431b430 100644 --- a/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.ts +++ b/src/app/home/task/da-oneself-plan/plan-adjustment/plan-adjustment.component.ts @@ -1,4 +1,6 @@ +import { HttpClient } from '@angular/common/http'; import { Component, Input, OnInit } from '@angular/core'; +import { NzMessageService } from 'ng-zorro-antd/message'; @Component({ selector: 'app-plan-adjustment', @@ -7,65 +9,189 @@ import { Component, Input, OnInit } from '@angular/core'; }) export class PlanAdjustmentComponent implements OnInit { @Input() data?: any; - constructor() { } - list = [ - { - tag: "行政许可", - class: "#42B983", - item: [ - { - name: "想啥吃啥餐饮有限公司", - checked: false - }, - { - name: "想啥吃啥餐饮有限公司", - checked: false - } - ] - }, - { - tag: "双随机", - class: "#1D9DFF", - item: [ - { - name: "想啥吃啥餐饮有限公司", - checked: false - } - ] - }, - ] - list2 = [ + @Input() time?: any; + @Input() level?: any; + + constructor(private http: HttpClient, private message: NzMessageService) { } - ] - taskNumber = 0 - task = false + spin1 = false + spin2 = false + userId ngOnInit(): void { - console.log(this.data) + this.userId = JSON.parse(sessionStorage.getItem('userData')).id + this.getTaskListOfStation(this.data, '未接任务') } - aaa(data) { - if (data.checked && !this.task) { - this.list2.push({ meu: this.list2.length, data }) - console.log(this.list2); - this.taskNumber = this.list2.length - if (this.taskNumber == 8) { - this.task = true - } - } else { - this.bbb(data) + push(i, item, e) { + let body = { + approvalStatus: e ? '通过' : '待处理' } + this.http.patch(`/api/PlanTasks/${i.id}`, body).subscribe({ + next: (data) => { + this.message.create('success', '处理成功'); + if (e) { + i.approvalStatus = '通过' + let isTrue = this.data.data.find((item) => { + return item.name == i.taskType + }) + if (isTrue) { + this.data.data.forEach(item => { + if (item.name == i.taskType) { + item.data.push(i) + } + }); + } else { + this.data.data.push({ + name: item.name, + background: item.background, + data: [i] + }) + } + } else { + this.data.data.forEach((item, key) => { + if (item.name == i.taskType) { + for (let index = 0; index < item.data.length; index++) { + const element = item.data[index]; + if (element.id == i.id) { + item.data.splice(index, 1) + index-- + } + } + } + }); + } + }, + error: (err) => { + this.message.create('warning', '处理失败'); + + } + }) } - bbb(e) { - console.log(e); - e.checked = false - for (let index = 0; index < this.list2.length; index++) { - if (e == this.list2[index].data) { - this.list2.splice(this.list2[index].meu, 1) - this.taskNumber = this.list2.length - if (this.taskNumber != 8) { - this.task = false + cancel(i, item) { + // console.log(i) + // console.log(item) + // console.log(this.allTasks) + let body = { + approvalStatus: '待处理' + } + this.http.patch(`/api/PlanTasks/${i.id}`, body).subscribe({ + next: (data) => { + this.message.create('success', '处理成功'); + this.allTasks.forEach(element => { + if (element.name == item.name) { + element.data.forEach(item => { + if (item.id == i.id) { + item.checked = false + item.approvalStatus = '待处理' + } + }); + } + }); + + for (let index = 0; index < item.data.length; index++) { + const element = item.data[index]; + if (element.id == i.id) { + item.data.splice(index, 1) + index-- + } } + }, + error: (err) => { + this.message.create('warning', '处理失败'); } + }) + + } + + //获得消防站下的所有任务 + PageNumber = 1 + PageSize = 9999 + allTasks + async getTaskListOfStation(item, type) { + let statuses = [] + if (type == '未接任务') { + statuses = ['待处理', '通过', '驳回', '待检查', '已检查'] + this.spin1 = true + } + if (type == '已接任务') { + statuses = ['通过', '待检查'] + this.spin2 = true + } + let params + if (this.level == '大队') { + params = { + Month: this.time, + CompanyOrganizationId: item.id, + PageNumber: this.PageNumber, + approvalStatuses: statuses, + PageSize: this.PageSize + } + } else { + params = { + Month: this.time, + SupervisorId: this.userId, + PageNumber: this.PageNumber, + approvalStatuses: statuses, + PageSize: this.PageSize + } } + return new Promise((resolve, reject) => { + this.http.get('/api/PlanTasks', { + params: params + }).subscribe({ + next: (data: any) => { + let checkedList = [] + this.data.data.forEach(element => { + element.data.forEach(item => { + checkedList.push(item) + }); + }); + data.items.forEach(element => { + element.checked = false + checkedList.forEach(item => { + if (item.id == element.id) { + element.checked = true + } + }); + }); + + let listData = [ + { 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) => { + element.taskType == item.name ? listData[key].data.push(element) : null + }); + }); + for (let index = 0; index < listData.length; index++) { + const element = listData[index]; + if (element.data.length == 0) { + listData.splice(index, 1) + index-- + } + } + this.allTasks = listData + if (type == '未接任务') { + this.spin1 = false + } + if (type == '已接任务') { + this.spin2 = false + } + resolve(data) + }, + error: (err) => { + reject(err) + } + }) + }) + } + + } 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 339edf8..bb6846f 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 @@ -135,7 +135,7 @@
- + 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 edf76e6..ddd0f36 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 @@ -9,6 +9,7 @@ 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' +import { PlanAdjustmentComponent } from '../da-oneself-plan/plan-adjustment/plan-adjustment.component'; @Component({ selector: 'app-station-weekly-plan', templateUrl: './station-weekly-plan.component.html', @@ -540,4 +541,25 @@ export class StationWeeklyPlanComponent implements OnInit { } }) } + + + adjustment(item) { + let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01' + const modal = this.modal.create({ + nzTitle: "任务调整", + nzContent: PlanAdjustmentComponent, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 900, + nzFooter: null, + nzComponentParams: { + data: JSON.parse(JSON.stringify(item)), + time: selectedTime, + level: '非大队' + } + }); + const instance = modal.getContentComponent(); + modal.afterClose.subscribe(result => { + this.getTaskListPass(this.stationData[0]) + }); + } }