|
|
|
@ -5,6 +5,7 @@ import { NzModalService } from 'ng-zorro-antd/modal';
|
|
|
|
|
import { NzMessageService } from 'ng-zorro-antd/message'; |
|
|
|
|
import { HttpClient } from '@angular/common/http'; |
|
|
|
|
import { TreeService } from 'src/app/service/tree.service'; |
|
|
|
|
import * as moment from 'moment'; |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-station-weekly-plan', |
|
|
|
|
templateUrl: './station-weekly-plan.component.html', |
|
|
|
@ -36,11 +37,13 @@ export class StationWeeklyPlanComponent implements OnInit {
|
|
|
|
|
selectedTime |
|
|
|
|
selectMonth(item) { |
|
|
|
|
this.selectedMonth = item.id |
|
|
|
|
// this.getTaskList()
|
|
|
|
|
this.initializeData() |
|
|
|
|
this.getTaskList() |
|
|
|
|
} |
|
|
|
|
selectYear(e) { |
|
|
|
|
this.selectedYear = e |
|
|
|
|
// this.getTaskList()
|
|
|
|
|
this.initializeData() |
|
|
|
|
this.getTaskList() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
isExpand = true |
|
|
|
@ -51,15 +54,48 @@ export class StationWeeklyPlanComponent implements OnInit {
|
|
|
|
|
formatOne = (percent: number): string => `${percent}%\n完成率`; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
openDetails(data, type) { |
|
|
|
|
data.isDetails = type |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
radioChange(e) { |
|
|
|
|
setTimeout(() => { |
|
|
|
|
}, 0); |
|
|
|
|
radioChange(e, i, element) { |
|
|
|
|
element.isLoading = true |
|
|
|
|
let body = { |
|
|
|
|
isSpread: e |
|
|
|
|
} |
|
|
|
|
this.http.patch(`/api/PlanTasks/${i.id}`, body).subscribe({ |
|
|
|
|
next: (data) => { |
|
|
|
|
this.message.create('success', e ? '宣传通知已发出' : '取消宣传'); |
|
|
|
|
element.isLoading = false |
|
|
|
|
}, |
|
|
|
|
error: (err) => { |
|
|
|
|
this.message.create('warning', '发送失败'); |
|
|
|
|
element.isLoading = false |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
checkTime(e, i, element) { |
|
|
|
|
if (e) { |
|
|
|
|
i.checkTime = moment(e).format('yyyy-MM-DD') |
|
|
|
|
} else { |
|
|
|
|
i.checkTime = null |
|
|
|
|
} |
|
|
|
|
element.isLoading = true |
|
|
|
|
let body = { |
|
|
|
|
checkTime: i.checkTime |
|
|
|
|
} |
|
|
|
|
this.http.patch(`/api/PlanTasks/${i.id}`, body).subscribe({ |
|
|
|
|
next: (data) => { |
|
|
|
|
this.message.create('success', '检查日期分配成功'); |
|
|
|
|
element.isLoading = false |
|
|
|
|
}, |
|
|
|
|
error: (err) => { |
|
|
|
|
this.message.create('warning', '检查日期分配失败'); |
|
|
|
|
element.isLoading = false |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
stationData = [] |
|
|
|
|
|
|
|
|
@ -87,7 +123,7 @@ export class StationWeeklyPlanComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
cardData = [ |
|
|
|
|
{ name: '双随机', isDetails: true, isloading: false, background: '#1D9DFF', icon: 'suiji.png', scale: '0/0', data: [] }, |
|
|
|
|
{ name: '双随机', isDetails: false, isloading: false, background: '#1D9DFF', icon: 'suiji.png', scale: '0/0', data: [] }, |
|
|
|
|
{ name: '行政许可', isDetails: false, isloading: false, background: '#42B983', icon: 'xuke.png', scale: '0/0', data: [] }, |
|
|
|
|
{ name: '熟悉演练', isDetails: false, isloading: false, background: '#9D80FF', icon: 'yanlian.png', scale: '0/0', data: [] }, |
|
|
|
|
{ name: '联络指导', isDetails: false, isloading: false, background: '#5483EA', icon: 'zhidao.png', scale: '0/0', data: [] }, |
|
|
|
@ -95,12 +131,31 @@ export class StationWeeklyPlanComponent implements OnInit {
|
|
|
|
|
{ name: '投诉举报', isDetails: false, isloading: false, background: '#5087FF', icon: 'tousu.png', scale: '0/0', data: [] }, |
|
|
|
|
{ name: '火灾调查', isDetails: false, isloading: false, background: '#FF404D', icon: 'huozai.png', scale: '0/0', data: [] } |
|
|
|
|
] |
|
|
|
|
//初始化数据
|
|
|
|
|
initializeData() { |
|
|
|
|
this.cardData = [ |
|
|
|
|
{ name: '双随机', isDetails: false, isloading: false, background: '#1D9DFF', icon: 'suiji.png', scale: '0/0', data: [] }, |
|
|
|
|
{ name: '行政许可', isDetails: false, isloading: false, background: '#42B983', icon: 'xuke.png', scale: '0/0', data: [] }, |
|
|
|
|
{ name: '熟悉演练', isDetails: false, isloading: false, background: '#9D80FF', icon: 'yanlian.png', scale: '0/0', data: [] }, |
|
|
|
|
{ name: '联络指导', isDetails: false, isloading: false, background: '#5483EA', icon: 'zhidao.png', scale: '0/0', data: [] }, |
|
|
|
|
{ name: '消防宣传', isDetails: false, isloading: false, background: '#FF5D2A', icon: 'xuanchuan.png', scale: '0/0', data: [] }, |
|
|
|
|
{ name: '投诉举报', isDetails: false, isloading: false, background: '#5087FF', icon: 'tousu.png', scale: '0/0', data: [] }, |
|
|
|
|
{ name: '火灾调查', isDetails: false, isloading: false, background: '#FF404D', icon: 'huozai.png', scale: '0/0', data: [] } |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
this.stationData.forEach(element => { |
|
|
|
|
element.isExpand = false |
|
|
|
|
element.isLoading = false |
|
|
|
|
element.data = [] |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isloading = false |
|
|
|
|
PageNumber = 1 |
|
|
|
|
PageSize = 9999 |
|
|
|
|
getTaskList() { |
|
|
|
|
async getTaskList() { |
|
|
|
|
this.isloading = true |
|
|
|
|
let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01' |
|
|
|
|
let params = { |
|
|
|
@ -110,18 +165,23 @@ export class StationWeeklyPlanComponent implements OnInit {
|
|
|
|
|
PageNumber: this.PageNumber, |
|
|
|
|
PageSize: this.PageSize |
|
|
|
|
} |
|
|
|
|
this.http.get('/api/PlanTasks', { |
|
|
|
|
params: params |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
this.isloading = false |
|
|
|
|
// console.log('任务申请列表', data.items);
|
|
|
|
|
data.items.forEach(element => { |
|
|
|
|
this.cardData.forEach((item, key) => { |
|
|
|
|
element.taskType == item.name ? this.cardData[key].data.push(element) : null |
|
|
|
|
var p = await new Promise<void>((resolve, reject) => { |
|
|
|
|
this.http.get('/api/PlanTasks', { |
|
|
|
|
params: params |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
this.isloading = false |
|
|
|
|
// console.log('任务申请列表', data.items);
|
|
|
|
|
data.items.forEach(element => { |
|
|
|
|
this.cardData.forEach((item, key) => { |
|
|
|
|
element.taskType == item.name ? this.cardData[key].data.push(element) : null |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
// console.log('并入卡片数据', this.cardData)
|
|
|
|
|
resolve(data) |
|
|
|
|
console.log('并入卡片数据', this.cardData) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
return p |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//接受任务
|
|
|
|
@ -141,6 +201,14 @@ export class StationWeeklyPlanComponent implements OnInit {
|
|
|
|
|
this.message.create('success', '已接受'); |
|
|
|
|
i.approvalStatus = '通过' |
|
|
|
|
item.isloading = false |
|
|
|
|
this.stationData.forEach(element => { |
|
|
|
|
if (element.id == i.company.organizationId) { |
|
|
|
|
if (element.isExpand) { |
|
|
|
|
this.getTaskListOfStation(element) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
error: (err) => { |
|
|
|
|
this.message.create('warning', '接受失败'); |
|
|
|
@ -168,6 +236,13 @@ export class StationWeeklyPlanComponent implements OnInit {
|
|
|
|
|
this.message.create('success', '已拒绝'); |
|
|
|
|
i.approvalStatus = '驳回' |
|
|
|
|
item.isloading = false |
|
|
|
|
this.stationData.forEach(element => { |
|
|
|
|
if (element.id == i.company.organizationId) { |
|
|
|
|
if (element.isExpand) { |
|
|
|
|
this.getTaskListOfStation(element) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
error: (err) => { |
|
|
|
|
this.message.create('warning', '拒绝失败'); |
|
|
|
@ -188,57 +263,106 @@ export class StationWeeklyPlanComponent implements OnInit {
|
|
|
|
|
isSupervisor ? this.isSupervisor = true : this.isSupervisor = false |
|
|
|
|
this.selectedMonth = new Date().getMonth() + 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.getAllStation() |
|
|
|
|
this.getTaskList() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.rollStart() |
|
|
|
|
}, 0); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
messageList = [1, 1, 1, 1, 1] |
|
|
|
|
timer |
|
|
|
|
rollStart() { |
|
|
|
|
var ROLL_SPEED = 100 |
|
|
|
|
var noticeList1 = document.getElementById('notice-list'); |
|
|
|
|
var noticeList2 = document.getElementById('notice-list-2'); |
|
|
|
|
var listWrapper = document.getElementById('list-wrapper'); |
|
|
|
|
noticeList2.innerHTML = noticeList1.innerHTML; |
|
|
|
|
this.timer = setInterval(rollStart, ROLL_SPEED); |
|
|
|
|
|
|
|
|
|
function rollStart() { |
|
|
|
|
if (Math.abs(_subStr(listWrapper.style.top)) >= noticeList1.clientHeight) { |
|
|
|
|
listWrapper.style.top = '0px' |
|
|
|
|
} else { |
|
|
|
|
var top = listWrapper.style.top |
|
|
|
|
listWrapper.style.top = _subStr(top) - 1 + 'px' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 截取px前数值
|
|
|
|
|
function _subStr(str) { |
|
|
|
|
var index = str.indexOf('px'); |
|
|
|
|
if (index > -1) { |
|
|
|
|
return parseFloat(str.substr(0, index + 1)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
mouseEnter() { |
|
|
|
|
window.clearInterval(this.timer); |
|
|
|
|
} |
|
|
|
|
mouseleave() { |
|
|
|
|
this.rollStart() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngOnDestroy(): void { |
|
|
|
|
console.log('退出了') |
|
|
|
|
this.mouseEnter() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
expandcarditem(item) { |
|
|
|
|
item.isExpand = !item.isExpand |
|
|
|
|
console.log(item) |
|
|
|
|
if (item.isExpand) { |
|
|
|
|
let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01' |
|
|
|
|
let params = { |
|
|
|
|
Month: selectedTime, |
|
|
|
|
CompanyOrganizationId: item.id, |
|
|
|
|
PageNumber: this.PageNumber, |
|
|
|
|
approvalStatuses: '通过', |
|
|
|
|
PageSize: this.PageSize |
|
|
|
|
} |
|
|
|
|
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: [] }, |
|
|
|
|
{ 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 |
|
|
|
|
}); |
|
|
|
|
this.getTaskListOfStation(item) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获得消防站下的所有任务
|
|
|
|
|
getTaskListOfStation(item) { |
|
|
|
|
let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01' |
|
|
|
|
let params = { |
|
|
|
|
Month: selectedTime, |
|
|
|
|
CompanyOrganizationId: item.id, |
|
|
|
|
PageNumber: this.PageNumber, |
|
|
|
|
approvalStatuses: '通过', |
|
|
|
|
PageSize: this.PageSize |
|
|
|
|
} |
|
|
|
|
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: [] }, |
|
|
|
|
{ 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-- |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
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) |
|
|
|
|
}, |
|
|
|
|
error: (err) => { |
|
|
|
|
this.message.create('warning', '获取数据失败'); |
|
|
|
|
item.isLoading = false |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
item.data = listData |
|
|
|
|
// console.log('点击的救援站通过数据', item)
|
|
|
|
|
}, |
|
|
|
|
error: (err) => { |
|
|
|
|
this.message.create('warning', '获取数据失败'); |
|
|
|
|
item.isLoading = false |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|