|
|
@ -7,6 +7,7 @@ import { HttpClient } from '@angular/common/http'; |
|
|
|
import { TreeService } from 'src/app/service/tree.service'; |
|
|
|
import { TreeService } from 'src/app/service/tree.service'; |
|
|
|
import * as moment from 'moment'; |
|
|
|
import * as moment from 'moment'; |
|
|
|
import { TaskDetailsComponent } from './task-details/task-details.component'; |
|
|
|
import { TaskDetailsComponent } from './task-details/task-details.component'; |
|
|
|
|
|
|
|
import { CreateTaskComponent } from './create-task/create-task.component'; |
|
|
|
@Component({ |
|
|
|
@Component({ |
|
|
|
selector: 'app-station-weekly-plan', |
|
|
|
selector: 'app-station-weekly-plan', |
|
|
|
templateUrl: './station-weekly-plan.component.html', |
|
|
|
templateUrl: './station-weekly-plan.component.html', |
|
|
@ -40,11 +41,13 @@ export class StationWeeklyPlanComponent implements OnInit { |
|
|
|
this.selectedMonth = item.id |
|
|
|
this.selectedMonth = item.id |
|
|
|
this.initializeData() |
|
|
|
this.initializeData() |
|
|
|
this.getTaskList() |
|
|
|
this.getTaskList() |
|
|
|
|
|
|
|
this.getTaskListPass(this.stationData[0]) |
|
|
|
} |
|
|
|
} |
|
|
|
selectYear(e) { |
|
|
|
selectYear(e) { |
|
|
|
this.selectedYear = e |
|
|
|
this.selectedYear = e |
|
|
|
this.initializeData() |
|
|
|
this.initializeData() |
|
|
|
this.getTaskList() |
|
|
|
this.getTaskList() |
|
|
|
|
|
|
|
this.getTaskListPass(this.stationData[0]) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
isExpand = true |
|
|
|
isExpand = true |
|
|
@ -98,7 +101,7 @@ export class StationWeeklyPlanComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
stationData = [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获得辖区下所有救援站
|
|
|
|
//获得辖区下所有救援站
|
|
|
|
totalCount: string |
|
|
|
totalCount: string |
|
|
@ -124,28 +127,28 @@ export class StationWeeklyPlanComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cardData = [ |
|
|
|
cardData = [ |
|
|
|
{ name: '双随机', isDetails: false, isloading: false, background: '#1D9DFF', icon: 'suiji.png', scale: '0/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', scale: '0/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', scale: '0/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', scale: '0/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', scale: '0/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', scale: '0/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', scale: '0/0', data: [] } |
|
|
|
{ name: '火灾调查', isDetails: false, isloading: false, background: '#FF404D', icon: 'huozai.png', passed: 0, inspected: 0, percentage: 0, data: [] } |
|
|
|
] |
|
|
|
] |
|
|
|
//初始化数据
|
|
|
|
//初始化数据
|
|
|
|
initializeData() { |
|
|
|
initializeData() { |
|
|
|
this.cardData = [ |
|
|
|
this.cardData = [ |
|
|
|
{ name: '双随机', isDetails: false, isloading: false, background: '#1D9DFF', icon: 'suiji.png', scale: '0/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', scale: '0/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', scale: '0/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', scale: '0/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', scale: '0/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', scale: '0/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', scale: '0/0', data: [] } |
|
|
|
{ name: '火灾调查', isDetails: false, isloading: false, background: '#FF404D', icon: 'huozai.png', passed: 0, inspected: 0, percentage: 0, data: [] } |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
this.stationData.forEach(element => { |
|
|
|
this.stationData.forEach(element => { |
|
|
|
element.isExpand = false |
|
|
|
element.isExpand = true |
|
|
|
element.isLoading = false |
|
|
|
element.isLoading = false |
|
|
|
element.data = [] |
|
|
|
element.data = [] |
|
|
|
}); |
|
|
|
}); |
|
|
@ -177,6 +180,18 @@ export class StationWeeklyPlanComponent implements OnInit { |
|
|
|
element.taskType == item.name ? this.cardData[key].data.push(element) : null |
|
|
|
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 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
resolve(data) |
|
|
|
resolve(data) |
|
|
|
console.log('并入卡片数据', this.cardData) |
|
|
|
console.log('并入卡片数据', this.cardData) |
|
|
|
}) |
|
|
|
}) |
|
|
@ -185,6 +200,65 @@ export class StationWeeklyPlanComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stationData = [ |
|
|
|
|
|
|
|
{ name: '', isExpand: true, isLoading: false, data: [], allUnitsNum: 0, awaitInspect: 0, inspected: 0, percentage: 0 } |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
async getTaskListPass(item) { |
|
|
|
|
|
|
|
let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01' |
|
|
|
|
|
|
|
let params = { |
|
|
|
|
|
|
|
Month: selectedTime, |
|
|
|
|
|
|
|
approvalStatuses: "通过", |
|
|
|
|
|
|
|
SupervisorId: this.userId, |
|
|
|
|
|
|
|
PageNumber: this.PageNumber, |
|
|
|
|
|
|
|
PageSize: this.PageSize |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
item.isLoading = true |
|
|
|
|
|
|
|
return await new Promise<void>((resolve, reject) => { |
|
|
|
|
|
|
|
this.http.get('/api/PlanTasks', { |
|
|
|
|
|
|
|
params: params |
|
|
|
|
|
|
|
}).subscribe((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: [] } |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
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-- |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
item.data = listData |
|
|
|
|
|
|
|
console.log('当前登录用户所有通过的任务', item); |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
item.percentage = Math.round(item.inspected / item.allUnitsNum) * 100 |
|
|
|
|
|
|
|
resolve(data) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//接受任务
|
|
|
|
//接受任务
|
|
|
|
accept(i, item) { |
|
|
|
accept(i, item) { |
|
|
|
this.modal.confirm({ |
|
|
|
this.modal.confirm({ |
|
|
@ -202,13 +276,8 @@ export class StationWeeklyPlanComponent implements OnInit { |
|
|
|
this.message.create('success', '已接受'); |
|
|
|
this.message.create('success', '已接受'); |
|
|
|
i.approvalStatus = '通过' |
|
|
|
i.approvalStatus = '通过' |
|
|
|
item.isloading = false |
|
|
|
item.isloading = false |
|
|
|
this.stationData.forEach(element => { |
|
|
|
item.passed += 1 |
|
|
|
if (element.id == i.company.organizationId) { |
|
|
|
this.getTaskListPass(this.stationData[0]) |
|
|
|
if (element.isExpand) { |
|
|
|
|
|
|
|
this.getTaskListOfStation(element) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
error: (err) => { |
|
|
|
error: (err) => { |
|
|
@ -237,13 +306,8 @@ export class StationWeeklyPlanComponent implements OnInit { |
|
|
|
this.message.create('success', '已拒绝'); |
|
|
|
this.message.create('success', '已拒绝'); |
|
|
|
i.approvalStatus = '驳回' |
|
|
|
i.approvalStatus = '驳回' |
|
|
|
item.isloading = false |
|
|
|
item.isloading = false |
|
|
|
this.stationData.forEach(element => { |
|
|
|
item.passed -= 1 |
|
|
|
if (element.id == i.company.organizationId) { |
|
|
|
this.getTaskListPass(this.stationData[0]) |
|
|
|
if (element.isExpand) { |
|
|
|
|
|
|
|
this.getTaskListOfStation(element) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
error: (err) => { |
|
|
|
error: (err) => { |
|
|
|
this.message.create('warning', '拒绝失败'); |
|
|
|
this.message.create('warning', '拒绝失败'); |
|
|
@ -254,9 +318,14 @@ export class StationWeeklyPlanComponent implements OnInit { |
|
|
|
nzCancelText: '取消' |
|
|
|
nzCancelText: '取消' |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
userName |
|
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
ngOnInit(): void { |
|
|
|
this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId |
|
|
|
this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId |
|
|
|
this.userId = JSON.parse(sessionStorage.getItem('userData')).id |
|
|
|
this.userId = JSON.parse(sessionStorage.getItem('userData')).id |
|
|
|
|
|
|
|
this.userName = JSON.parse(sessionStorage.getItem('userData')).name |
|
|
|
|
|
|
|
this.stationData[0].name = this.userName |
|
|
|
let roles = JSON.parse(sessionStorage.getItem('userData')).roles |
|
|
|
let roles = JSON.parse(sessionStorage.getItem('userData')).roles |
|
|
|
let isSupervisor = roles.find(item => { |
|
|
|
let isSupervisor = roles.find(item => { |
|
|
|
return item.name.indexOf('检查') != -1 |
|
|
|
return item.name.indexOf('检查') != -1 |
|
|
@ -264,9 +333,9 @@ export class StationWeeklyPlanComponent implements OnInit { |
|
|
|
isSupervisor ? this.isSupervisor = true : this.isSupervisor = false |
|
|
|
isSupervisor ? this.isSupervisor = true : this.isSupervisor = false |
|
|
|
this.selectedMonth = new Date().getMonth() + 1 |
|
|
|
this.selectedMonth = new Date().getMonth() + 1 |
|
|
|
|
|
|
|
|
|
|
|
this.getAllStation() |
|
|
|
// this.getAllStation()
|
|
|
|
this.getTaskList() |
|
|
|
this.getTaskList() |
|
|
|
|
|
|
|
this.getTaskListPass(this.stationData[0]) |
|
|
|
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
this.rollStart() |
|
|
|
this.rollStart() |
|
|
@ -313,10 +382,10 @@ export class StationWeeklyPlanComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
expandcarditem(item) { |
|
|
|
expandcarditem(item) { |
|
|
|
item.isExpand = !item.isExpand |
|
|
|
item.isExpand = !item.isExpand |
|
|
|
console.log(item) |
|
|
|
// console.log(item)
|
|
|
|
if (item.isExpand) { |
|
|
|
// if (item.isExpand) {
|
|
|
|
this.getTaskListOfStation(item) |
|
|
|
// this.getTaskListOfStation(item)
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//获得消防站下的所有任务
|
|
|
|
//获得消防站下的所有任务
|
|
|
@ -383,4 +452,54 @@ export class StationWeeklyPlanComponent implements OnInit { |
|
|
|
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!')); |
|
|
|
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)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
apply(item) { |
|
|
|
|
|
|
|
const modal = this.modal.create({ |
|
|
|
|
|
|
|
nzTitle: '新增' + item.name + '任务', |
|
|
|
|
|
|
|
nzContent: CreateTaskComponent, |
|
|
|
|
|
|
|
nzViewContainerRef: this.viewContainerRef, |
|
|
|
|
|
|
|
nzWidth: 660, |
|
|
|
|
|
|
|
nzMaskClosable: false, |
|
|
|
|
|
|
|
nzComponentParams: { |
|
|
|
|
|
|
|
title: item.name, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
nzOnOk: async () => { |
|
|
|
|
|
|
|
console.log(instance.validateForm.value) |
|
|
|
|
|
|
|
if (instance.validateForm.valid) { |
|
|
|
|
|
|
|
await new Promise((resolve, reject) => { |
|
|
|
|
|
|
|
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,
|
|
|
|
|
|
|
|
approvalStatus: '通过' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.http.post('/api/PlanTasks', body).subscribe({ |
|
|
|
|
|
|
|
next: (data) => { |
|
|
|
|
|
|
|
console.log(data) |
|
|
|
|
|
|
|
// item.data.push(data)
|
|
|
|
|
|
|
|
this.getTaskListPass(this.stationData[0]) |
|
|
|
|
|
|
|
this.message.create('success', '创建成功'); |
|
|
|
|
|
|
|
resolve(data) |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
error: (err) => { |
|
|
|
|
|
|
|
this.message.create('warning', '创建失败'); |
|
|
|
|
|
|
|
reject(err) |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.message.create('warning', '请填写完整!'); |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
const instance = modal.getContentComponent(); |
|
|
|
|
|
|
|
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!')); |
|
|
|
|
|
|
|
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|