|
|
|
@ -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<void>((resolve, reject) => { |
|
|
|
|
return await new Promise<void>((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) |
|
|
|
|