Browse Source

[新增]大队自由调整任务检查时间

master
邵佳豪 2 months ago
parent
commit
88ba6c9f88
  1. 2
      package.json
  2. 12
      src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.html
  3. 817
      src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.ts

2
package.json

@ -3,7 +3,7 @@
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.config.json --open --port 8888 ",
"start": "ng serve --proxy-config proxy.config.json --open --port 8888 --host 192.168.1.46",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"

12
src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.html

@ -451,6 +451,18 @@
检查结果
</span>
</div>
<div class="flexcol" style="flex: 2;">
<span class="ellipsi">
<nz-date-picker nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss"
[(ngModel)]="i.planTime" nzPlaceHolder="请选择检查日期" nzBorderless
(ngModelChange)="checkTime($event,i,element)">
</nz-date-picker>
</span>
<span>
检查时间
</span>
</div>
</div>
</div>

817
src/app/home/task/da-monthly-task-overview/da-monthly-task-overview.component.ts

@ -3,45 +3,53 @@ 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'
import signalR from '../../../../signalR';
import * as moment from 'moment';
@Component({
selector: 'app-da-monthly-task-overview',
templateUrl: './da-monthly-task-overview.component.html',
styleUrls: ['./da-monthly-task-overview.component.scss']
styleUrls: ['./da-monthly-task-overview.component.scss'],
})
export class DaMonthlyTaskOverviewComponent implements OnInit {
constructor(private ngZone: NgZone, private http: HttpClient, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService) { }
selectedMonth
selectedYear = 2024
selectedTime
constructor(
private ngZone: NgZone,
private http: HttpClient,
private modal: NzModalService,
private viewContainerRef: ViewContainerRef,
private message: NzMessageService
) {}
selectedMonth;
selectedYear = 2024;
selectedTime;
selectMonth(item) {
this.selectedMonth = item.id
this.getTuesdayThursdayNum()
this.getHigherTasks()
this.getTaskList()
this.getAllStation()
this.getCountStat()
this.selectedMonth = item.id;
this.getTuesdayThursdayNum();
this.getHigherTasks();
this.getTaskList();
this.getAllStation();
this.getCountStat();
}
selectYear(e) {
this.selectedYear = e
this.getTuesdayThursdayNum()
this.getHigherTasks()
this.getTaskList()
this.getAllStation()
this.getCountStat()
this.selectedYear = e;
this.getTuesdayThursdayNum();
this.getHigherTasks();
this.getTaskList();
this.getAllStation();
this.getCountStat();
}
//当月有几个周二周四
TuesdayThursdayNum = 0
TuesdayThursdayNum = 0;
getTuesdayThursdayNum() {
let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01'
this.http.get(`/api/TaskTargets/GetTargetCount/${selectedTime}`).subscribe((data: any) => {
console.log('最大日期', data)
this.TuesdayThursdayNum = data
})
let selectedTime =
this.selectedYear + '-' + this.selectedMonth + '-' + '01';
this.http
.get(`/api/TaskTargets/GetTargetCount/${selectedTime}`)
.subscribe((data: any) => {
console.log('最大日期', data);
this.TuesdayThursdayNum = data;
});
}
months = [
@ -56,194 +64,314 @@ export class DaMonthlyTaskOverviewComponent implements OnInit {
{ id: 9, name: '9月', isable: true },
{ id: 10, name: '10月', isable: true },
{ id: 11, name: '11月', isable: true },
{ id: 12, name: '12月', isable: true }
]
{ id: 12, name: '12月', isable: true },
];
OrganizationId
OrganizationId;
ngOnInit(): void {
// 接收来自中心的消息
(signalR.SR as any).on('receiveNotification', (message: string, senderName: string) => {
// 接收后要做的事
console.log('收到消息---', message)
})
(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
this.OrganizationId = JSON.parse(
sessionStorage.getItem('userData')
).organizationId;
this.selectedMonth = new Date().getMonth() + 1;
//上级任务指标
this.getHigherTasks()
this.getHigherTasks();
// 下级任务申请
this.getTaskList()
this.getTaskList();
// this.getSupervisor('main')
// this.getSupervisor('assisted')
//统计信息
this.getCountStat()
this.getTuesdayThursdayNum()
this.getCountStat();
this.getTuesdayThursdayNum();
//本级部署
this.getAllStation()
this.getAllStation();
}
//上级任务指标
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: [] }
]
{
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
item.data = [];
item.passed = 0;
item.inspected = 0;
});
let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01'
let selectedTime =
this.selectedYear + '-' + this.selectedMonth + '-' + '01';
let params = {
Month: selectedTime,
OrganizationId: this.OrganizationId,
PageNumber: 1,
CreationTypes: ['上级指派'],
PageSize: 9999
}
PageSize: 9999,
};
this.http.get('/api/PlanTasks', {
params: params
}).subscribe((data: any) => {
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;
});
});
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];
});
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]
})
}
openDetails(data, type) {
this.ngZone.run(() => {
//这里写需要立即渲染的代码
data.isDetails = type
data.isDetails = type;
});
}
//下级任务申请打开关闭
expand(data) {
this.ngZone.run(() => {
//这里写需要立即渲染的代码
data.isExpand = !data.isExpand
data.isExpand = !data.isExpand;
});
}
istaskauditExpanded = true
istaskauditExpanded = true;
istaskauditexpand() {
this.istaskauditExpanded = !this.istaskauditExpanded
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: 2, name: '双随机任务', finished: 0, totalCount: 0, list: [], isExpand: true }
]
{
id: 0,
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,
},
];
getTaskList() {
this.taskData = [
{ id: 0, 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'
{
id: 0,
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';
let params = {
Month: selectedTime,
OrganizationId: this.OrganizationId,
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)
}
if (element.taskName == '联络指导') {
arr2.push(element)
}
if (element.taskName == '双随机') {
arr3.push(element)
}
});
arr1.forEach(item => {
if (item.approvalStatus == '通过' || item.approvalStatus == '待检查' || item.approvalStatus == '已检查') {
this.taskData[0].finished += 1
}
});
arr2.forEach(item => {
if (item.approvalStatus == '通过' || item.approvalStatus == '待检查' || item.approvalStatus == '已检查') {
this.taskData[1].finished += 1
}
});
arr3.forEach(item => {
if (item.approvalStatus == '通过' || item.approvalStatus == '待检查' || item.approvalStatus == '已检查') {
this.taskData[2].finished += 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);
}
if (element.taskName == '联络指导') {
arr2.push(element);
}
if (element.taskName == '双随机') {
arr3.push(element);
}
});
arr1.forEach((item) => {
if (
item.approvalStatus == '通过' ||
item.approvalStatus == '待检查' ||
item.approvalStatus == '已检查'
) {
this.taskData[0].finished += 1;
}
});
arr2.forEach((item) => {
if (
item.approvalStatus == '通过' ||
item.approvalStatus == '待检查' ||
item.approvalStatus == '已检查'
) {
this.taskData[1].finished += 1;
}
});
arr3.forEach((item) => {
if (
item.approvalStatus == '通过' ||
item.approvalStatus == '待检查' ||
item.approvalStatus == '已检查'
) {
this.taskData[2].finished += 1;
}
});
this.taskData[0].list = [...arr1];
this.taskData[1].list = [...arr2];
this.taskData[2].list = [...arr3];
console.log('下级任务申请', this.taskData);
});
this.taskData[0].list = [...arr1]
this.taskData[1].list = [...arr2]
this.taskData[2].list = [...arr3]
console.log('下级任务申请', this.taskData)
})
}
assitantsupervisorList
mainsupervisorList
assitantsupervisorList;
mainsupervisorList;
getSupervisor(type) {
let params = {
inspectorType: type
}
this.http.get('/api/Users/Inspectors', {
params: params
}).subscribe((data: any) => {
console.log('检查员列表', data)
if (type == 'main') {
this.mainsupervisorList = data
} else {
this.assitantsupervisorList = data
}
})
inspectorType: type,
};
this.http
.get('/api/Users/Inspectors', {
params: params,
})
.subscribe((data: any) => {
console.log('检查员列表', data);
if (type == 'main') {
this.mainsupervisorList = data;
} else {
this.assitantsupervisorList = data;
}
});
}
allot(item) {
console.log(item)
if (this.mainsupervisorList.length == 0 || this.assitantsupervisorList.length == 0) {
console.log(item);
if (
this.mainsupervisorList.length == 0 ||
this.assitantsupervisorList.length == 0
) {
this.message.create('warning', '请从用户管理添加检查人员');
return
return;
}
const modal = this.modal.create({
nzTitle: '分配监督检查员',
@ -253,191 +381,332 @@ export class DaMonthlyTaskOverviewComponent implements OnInit {
nzMaskClosable: false,
nzComponentParams: {
mainsupervisorList: this.mainsupervisorList,
assitantsupervisorList: this.assitantsupervisorList
assitantsupervisorList: this.assitantsupervisorList,
},
nzOnOk: async () => {
if (instance.validateForm.valid) {
await new Promise((resolve, reject) => {
let body = {
mainSupervisorId: instance.validateForm.value.main,
assitantSupervisorId: instance.validateForm.value.assitant
}
assitantSupervisorId: instance.validateForm.value.assitant,
};
this.http.patch(`/api/PlanTasks/${item.id}`, body).subscribe({
next: async (data) => {
this.message.create('success', '分配成功');
resolve(data)
resolve(data);
console.log(data);
this.getTaskList()
return true
this.getTaskList();
return true;
},
error: (err) => {
this.message.create('warning', '分配失败');
reject(err)
return false
}
})
})
reject(err);
return false;
},
});
});
} else {
this.message.create('warning', '请填写完整!');
return false
return false;
}
}
},
});
const instance = modal.getContentComponent();
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!'));
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result));
modal.afterClose.subscribe((result) =>
console.log('[afterClose] The result is:', result)
);
}
//获得统计信息
countStat: any = {
statistics1: {
num: 0, percentageComplete: 0, item1: 0, item2: 0, item3: 0
num: 0,
percentageComplete: 0,
item1: 0,
item2: 0,
item3: 0,
},
statistics2: {
num: 0, percentageComplete: 0, item1: 0, item2: 0, item3: 0
num: 0,
percentageComplete: 0,
item1: 0,
item2: 0,
item3: 0,
},
statistics3: {
num: 0, percentageComplete: 0, item1: 0, item2: 0, item3: 0
}
}
num: 0,
percentageComplete: 0,
item1: 0,
item2: 0,
item3: 0,
},
};
getCountStat() {
function integer(num) {
return Math.round(num * 100) || 0
return Math.round(num * 100) || 0;
}
let selectedMonth = this.selectedMonth < 10 ? "0" + this.selectedMonth : this.selectedMonth;
let selectedTime = this.selectedYear + '-' + selectedMonth + '-' + '01'
this.http.get('/api/PlanTasks/GetCountStat', {
params: {
month: selectedTime
}
}).subscribe(data => {
console.log('统计信息', data)
this.countStat = {
statistics1: {
num: data['任务总数']['总数'], percentageComplete: integer(data['任务总数']['已完成'] / data['任务总数']['总数']), item1: integer(data['任务总数']['上级指派'] / data['任务总数']['总数']), item2: integer(data['任务总数']['自主任务'] / data['任务总数']['总数']), item3: integer(data['任务总数']['申领任务'] / data['任务总数']['总数'])
let selectedMonth =
this.selectedMonth < 10 ? '0' + this.selectedMonth : this.selectedMonth;
let selectedTime = this.selectedYear + '-' + selectedMonth + '-' + '01';
this.http
.get('/api/PlanTasks/GetCountStat', {
params: {
month: selectedTime,
},
statistics2: {
num: data['消防救援任务总数']['总数'], percentageComplete: integer(data['消防救援任务总数']['已完成'] / data['任务总数']['总数']), item1: integer(data['消防救援任务总数']['上级指派'] / data['消防救援任务总数']['总数']), item2: integer(data['消防救援任务总数']['自主任务'] / data['消防救援任务总数']['总数']), item3: integer(data['消防救援任务总数']['申领任务'] / data['消防救援任务总数']['总数'])
},
statistics3: {
num: data['检查员任务总数']['总数'], percentageComplete: integer(data['检查员任务总数']['已完成'] / data['任务总数']['总数']), item1: integer(data['检查员任务总数']['上级指派'] / data['检查员任务总数']['总数']), item2: integer(data['检查员任务总数']['自主任务'] / data['检查员任务总数']['总数']), item3: integer(data['检查员任务总数']['申领任务'] / data['检查员任务总数']['总数'])
}
}
})
})
.subscribe((data) => {
console.log('统计信息', data);
this.countStat = {
statistics1: {
num: data['任务总数']['总数'],
percentageComplete: integer(
data['任务总数']['已完成'] / data['任务总数']['总数']
),
item1: integer(
data['任务总数']['上级指派'] / data['任务总数']['总数']
),
item2: integer(
data['任务总数']['自主任务'] / data['任务总数']['总数']
),
item3: integer(
data['任务总数']['申领任务'] / data['任务总数']['总数']
),
},
statistics2: {
num: data['消防救援任务总数']['总数'],
percentageComplete: integer(
data['消防救援任务总数']['已完成'] / data['任务总数']['总数']
),
item1: integer(
data['消防救援任务总数']['上级指派'] /
data['消防救援任务总数']['总数']
),
item2: integer(
data['消防救援任务总数']['自主任务'] /
data['消防救援任务总数']['总数']
),
item3: integer(
data['消防救援任务总数']['申领任务'] /
data['消防救援任务总数']['总数']
),
},
statistics3: {
num: data['检查员任务总数']['总数'],
percentageComplete: integer(
data['检查员任务总数']['已完成'] / data['任务总数']['总数']
),
item1: integer(
data['检查员任务总数']['上级指派'] /
data['检查员任务总数']['总数']
),
item2: integer(
data['检查员任务总数']['自主任务'] /
data['检查员任务总数']['总数']
),
item3: integer(
data['检查员任务总数']['申领任务'] /
data['检查员任务总数']['总数']
),
},
};
});
}
//本级部署打开关闭
isdeployboxExpanded = true
isdeployboxExpanded = true;
isdeployboxexpand() {
this.isdeployboxExpanded = !this.isdeployboxExpanded
this.isdeployboxExpanded = !this.isdeployboxExpanded;
}
formatOne = (percent: number): string => `${percent}%\n完成率`;
//获得辖区下所有救援站
stationData = []
stationData = [];
getAllStation() {
let params = {
ContainsChildren: "true",
ContainsChildren: 'true',
PageNumber: 1,
PageSize: 9999
}
this.http.get('/api/Organizations', {
params: params
}).subscribe((data: any) => {
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)
})
PageSize: 9999,
};
this.http
.get('/api/Organizations', {
params: params,
})
})
.subscribe((data: any) => {
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
item.isExpand = !item.isExpand;
}
//获得消防站下的所有任务
getTaskListOfStation(item) {
let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01'
let selectedTime =
this.selectedYear + '-' + this.selectedMonth + '-' + '01';
let params = {
Month: selectedTime,
CompanyOrganizationId: item.id,
PageNumber: 1,
approvalStatuses: ['通过', '待检查', '已检查'],
PageSize: 9999
}
item.isLoading = true
this.http.get('/api/PlanTasks', {
params: params
}).subscribe({
next: (data: any) => {
item.isLoading = false
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
PageSize: 9999,
};
item.isLoading = true;
this.http
.get('/api/PlanTasks', {
params: params,
})
.subscribe({
next: (data: any) => {
item.isLoading = false;
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--
for (let index = 0; index < listData.length; index++) {
const element = listData[index];
if (element.data.length == 0) {
listData.splice(index, 1);
index--;
}
}
}
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(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.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((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)
item.percentage = Math.round(
(item.inspected / item.allUnitsNum) * 100
);
},
error: (err) => {
this.message.create('warning', '获取数据失败');
item.isLoading = false;
},
});
}
checkTime(e, i, element) {
if (e) {
let time = new Date(
moment(e).format('yyyy-MM-DD HH:mm:ss')
).toISOString();
i.planTime = time;
} else {
i.planTime = null;
}
let month = moment(e).format('yyyy-MM-01')
element.isLoading = true;
let body = {
planTime: i.planTime,
month:month
};
this.http.patch(`/api/PlanTasks/${i.id}`, body).subscribe({
next: (data) => {
this.message.create('success', '检查日期分配成功');
element.isLoading = false;
},
error: (err) => {
this.message.create('warning', '获取数据失败');
item.isLoading = false
}
})
this.message.create('warning', '检查日期分配失败');
element.isLoading = false;
},
});
}
}

Loading…
Cancel
Save