|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
import { Component, 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';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-da-monthly-task-overview',
|
|
|
|
templateUrl: './da-monthly-task-overview.component.html',
|
|
|
|
styleUrls: ['./da-monthly-task-overview.component.scss']
|
|
|
|
})
|
|
|
|
export class DaMonthlyTaskOverviewComponent implements OnInit {
|
|
|
|
|
|
|
|
constructor(private http: HttpClient, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService) { }
|
|
|
|
|
|
|
|
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')
|
|
|
|
}
|
|
|
|
|
|
|
|
selectedMonth
|
|
|
|
selectedYear = 2022
|
|
|
|
selectedTime
|
|
|
|
selectMonth(item) {
|
|
|
|
this.selectedMonth = item.id
|
|
|
|
this.getTaskList()
|
|
|
|
}
|
|
|
|
selectYear(e) {
|
|
|
|
this.selectedYear = e
|
|
|
|
console.log('年', e)
|
|
|
|
this.getTaskList()
|
|
|
|
}
|
|
|
|
months = [
|
|
|
|
{ id: 1, name: '1月', isable: true },
|
|
|
|
{ id: 2, name: '2月', isable: true },
|
|
|
|
{ id: 3, name: '3月', isable: true },
|
|
|
|
{ id: 4, name: '4月', isable: true },
|
|
|
|
{ id: 5, name: '5月', isable: true },
|
|
|
|
{ id: 6, name: '6月', isable: true },
|
|
|
|
{ id: 7, name: '7月', isable: true },
|
|
|
|
{ id: 8, name: '8月', isable: true },
|
|
|
|
{ id: 9, name: '9月', isable: true },
|
|
|
|
{ id: 10, name: '10月', isable: true },
|
|
|
|
{ id: 11, name: '11月', isable: true },
|
|
|
|
{ id: 12, name: '12月', isable: true }
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
istaskauditExpanded = true
|
|
|
|
istaskauditexpand() {
|
|
|
|
this.istaskauditExpanded = !this.istaskauditExpanded
|
|
|
|
}
|
|
|
|
|
|
|
|
isdeployboxExpanded = true
|
|
|
|
isdeployboxexpand() {
|
|
|
|
this.isdeployboxExpanded = !this.isdeployboxExpanded
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
shuxiTaskData = {
|
|
|
|
isExpand: true
|
|
|
|
}
|
|
|
|
zhidaoTaskData = {
|
|
|
|
isExpand: true
|
|
|
|
}
|
|
|
|
PageNumber = 1
|
|
|
|
PageSize = 9999
|
|
|
|
|
|
|
|
taskData = [
|
|
|
|
{ id: 0, name: '熟悉演练任务', finished: 0, totalCount: 0, list: [], isExpand: true },
|
|
|
|
{ id: 1, 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 }
|
|
|
|
]
|
|
|
|
let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01'
|
|
|
|
console.log('查询时间', selectedTime)
|
|
|
|
let params = {
|
|
|
|
Month: selectedTime,
|
|
|
|
OrganizationId: this.OrganizationId,
|
|
|
|
PageNumber: this.PageNumber,
|
|
|
|
PageSize: this.PageSize
|
|
|
|
}
|
|
|
|
this.http.get('/api/PlanTasks', {
|
|
|
|
params: params
|
|
|
|
}).subscribe((data: any) => {
|
|
|
|
let arr1 = []
|
|
|
|
let arr2 = []
|
|
|
|
data.items.forEach(element => {
|
|
|
|
if (element.taskName == '熟悉演练') {
|
|
|
|
arr1.push(element)
|
|
|
|
}
|
|
|
|
if (element.taskName == '联络指导') {
|
|
|
|
arr2.push(element)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
arr1.forEach(item => {
|
|
|
|
if (!!item.approvalStatus) {
|
|
|
|
this.taskData[0].finished += 1
|
|
|
|
}
|
|
|
|
});
|
|
|
|
arr2.forEach(item => {
|
|
|
|
if (!!item.approvalStatus) {
|
|
|
|
this.taskData[1].finished += 1
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.taskData[0].totalCount = arr1.length
|
|
|
|
this.taskData[0].list = [...arr1]
|
|
|
|
this.taskData[1].totalCount = arr2.length
|
|
|
|
this.taskData[1].list = [...arr2]
|
|
|
|
|
|
|
|
this.isloading = false
|
|
|
|
})
|
|
|
|
}
|
|
|
|
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
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
allot(item) {
|
|
|
|
console.log(item)
|
|
|
|
if (this.mainsupervisorList.length == 0 || this.assitantsupervisorList.length == 0) {
|
|
|
|
this.message.create('warning', '请从用户管理添加检查人员');
|
|
|
|
return
|
|
|
|
}
|
|
|
|
const modal = this.modal.create({
|
|
|
|
nzTitle: '分配监督检查员',
|
|
|
|
nzContent: AllotPersonComponent,
|
|
|
|
nzViewContainerRef: this.viewContainerRef,
|
|
|
|
nzWidth: 485,
|
|
|
|
nzMaskClosable: false,
|
|
|
|
nzComponentParams: {
|
|
|
|
mainsupervisorList: this.mainsupervisorList,
|
|
|
|
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
|
|
|
|
}
|
|
|
|
this.http.patch(`/api/PlanTasks/${item.id}`, body).subscribe({
|
|
|
|
next: async (data) => {
|
|
|
|
this.message.create('success', '分配成功');
|
|
|
|
resolve(data)
|
|
|
|
this.getTaskList()
|
|
|
|
return true
|
|
|
|
},
|
|
|
|
error: (err) => {
|
|
|
|
this.message.create('warning', '分配失败');
|
|
|
|
reject(err)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
this.message.create('warning', '请填写完整!');
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
const instance = modal.getContentComponent();
|
|
|
|
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!'));
|
|
|
|
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result));
|
|
|
|
}
|
|
|
|
|
|
|
|
agree(item) {
|
|
|
|
this.modal.confirm({
|
|
|
|
nzTitle: `确定要同意该申请吗?`,
|
|
|
|
nzOkText: '确定',
|
|
|
|
nzOkType: 'default',
|
|
|
|
nzOnOk: () => {
|
|
|
|
this.http.post(`/api/PlanTasks/Approval/${item.id}`, null, {
|
|
|
|
params: {
|
|
|
|
approvalStatus: 'approved'
|
|
|
|
}
|
|
|
|
}).subscribe({
|
|
|
|
next: (data) => {
|
|
|
|
this.message.create('success', '审核成功');
|
|
|
|
this.getTaskList()
|
|
|
|
},
|
|
|
|
error: (err) => {
|
|
|
|
this.message.create('warning', '审核失败');
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
nzCancelText: '取消'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
reject(item) {
|
|
|
|
this.modal.confirm({
|
|
|
|
nzTitle: `确定要驳回该申请吗?`,
|
|
|
|
nzOkText: '确定',
|
|
|
|
nzOkType: 'default',
|
|
|
|
nzOnOk: () => {
|
|
|
|
this.http.post(`/api/PlanTasks/Approval/${item.id}`, null, {
|
|
|
|
params: {
|
|
|
|
approvalStatus: 'reject'
|
|
|
|
}
|
|
|
|
}).subscribe({
|
|
|
|
next: (data) => {
|
|
|
|
this.message.create('success', '审核成功');
|
|
|
|
this.getTaskList()
|
|
|
|
},
|
|
|
|
error: (err) => {
|
|
|
|
this.message.create('warning', '审核失败');
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
nzCancelText: '取消'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expand(data) {
|
|
|
|
data.isExpand = !data.isExpand
|
|
|
|
}
|
|
|
|
|
|
|
|
formatOne = (percent: number): string => `${percent}%\n完成率`;
|
|
|
|
|
|
|
|
|
|
|
|
cardData = [
|
|
|
|
{ name: '重大活动', isDetails: false, background: '#FF9203', icon: 'huodong.png' },
|
|
|
|
{ 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' }
|
|
|
|
]
|
|
|
|
|
|
|
|
openDetails(data, type) {
|
|
|
|
data.isDetails = type
|
|
|
|
}
|
|
|
|
xxx = false
|
|
|
|
radioChange(e) {
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
this.xxx = !this.xxx
|
|
|
|
}, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
stationData = [
|
|
|
|
{ name: '历下区A消防救援站', isExpand: true },
|
|
|
|
{ name: '历下区B消防救援站', isExpand: false },
|
|
|
|
{ name: '历下区C消防救援站', isExpand: false }
|
|
|
|
]
|
|
|
|
expandcarditem(item) {
|
|
|
|
item.isExpand = !item.isExpand
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|