|
|
|
@ -1,6 +1,15 @@
|
|
|
|
|
import { Component, OnInit, TemplateRef, ViewContainerRef } from '@angular/core'; |
|
|
|
|
import { |
|
|
|
|
Component, |
|
|
|
|
OnInit, |
|
|
|
|
TemplateRef, |
|
|
|
|
ViewContainerRef, |
|
|
|
|
} from '@angular/core'; |
|
|
|
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
|
|
|
import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree'; |
|
|
|
|
import { |
|
|
|
|
NzFormatEmitEvent, |
|
|
|
|
NzTreeComponent, |
|
|
|
|
NzTreeNodeOptions, |
|
|
|
|
} from 'ng-zorro-antd/tree'; |
|
|
|
|
import { NzModalService } from 'ng-zorro-antd/modal'; |
|
|
|
|
import { NzMessageService } from 'ng-zorro-antd/message'; |
|
|
|
|
import { HttpClient, HttpHeaders } from '@angular/common/http'; |
|
|
|
@ -10,25 +19,31 @@ import { ApplyLookComponent } from './apply-look/apply-look.component';
|
|
|
|
|
import { ThisReceiver } from '@angular/compiler'; |
|
|
|
|
import { MethodService } from 'src/app/service/method.service'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-station-task-apply', |
|
|
|
|
templateUrl: './station-task-apply.component.html', |
|
|
|
|
styleUrls: ['./station-task-apply.component.scss'] |
|
|
|
|
styleUrls: ['./station-task-apply.component.scss'], |
|
|
|
|
}) |
|
|
|
|
export class StationTaskApplyComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
validateForm!: FormGroup; |
|
|
|
|
constructor(private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient, private toTree: TreeService, public methodService: MethodService) { } |
|
|
|
|
constructor( |
|
|
|
|
private fb: FormBuilder, |
|
|
|
|
private modal: NzModalService, |
|
|
|
|
private viewContainerRef: ViewContainerRef, |
|
|
|
|
private message: NzMessageService, |
|
|
|
|
private http: HttpClient, |
|
|
|
|
private toTree: TreeService, |
|
|
|
|
public methodService: MethodService |
|
|
|
|
) {} |
|
|
|
|
searchForm = { |
|
|
|
|
taskname: '', |
|
|
|
|
unitname: '', |
|
|
|
|
unitlevel: '', |
|
|
|
|
or: '' |
|
|
|
|
} |
|
|
|
|
OrganizationId |
|
|
|
|
or: '', |
|
|
|
|
}; |
|
|
|
|
OrganizationId; |
|
|
|
|
|
|
|
|
|
isSupervisor: boolean //是否为检查员
|
|
|
|
|
isSupervisor: boolean; //是否为检查员
|
|
|
|
|
|
|
|
|
|
months = [ |
|
|
|
|
{ id: 1, name: '1月', isable: true }, |
|
|
|
@ -42,142 +57,151 @@ export class StationTaskApplyComponent 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 } |
|
|
|
|
] |
|
|
|
|
selectedMonth |
|
|
|
|
selectedYear = 2024 |
|
|
|
|
selectedTime |
|
|
|
|
{ id: 12, name: '12月', isable: true }, |
|
|
|
|
]; |
|
|
|
|
selectedMonth; |
|
|
|
|
selectedYear = new Date().getFullYear(); |
|
|
|
|
selectedTime; |
|
|
|
|
selectMonth(item) { |
|
|
|
|
this.selectedMonth = item.id |
|
|
|
|
this.getTaskList() |
|
|
|
|
this.selectedMonth = item.id; |
|
|
|
|
this.getTaskList(); |
|
|
|
|
} |
|
|
|
|
selectYear(e) { |
|
|
|
|
this.selectedYear = e |
|
|
|
|
this.getTaskList() |
|
|
|
|
this.selectedYear = e; |
|
|
|
|
this.getTaskList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isloading = false |
|
|
|
|
totalCount |
|
|
|
|
PageNumber = 1 |
|
|
|
|
PageSize = 10 |
|
|
|
|
taskLIst = [] |
|
|
|
|
isloading = false; |
|
|
|
|
totalCount; |
|
|
|
|
PageNumber = 1; |
|
|
|
|
PageSize = 10; |
|
|
|
|
taskLIst = []; |
|
|
|
|
getTaskList() { |
|
|
|
|
this.isloading = true |
|
|
|
|
let selectedTime = this.selectedYear + '-' + this.selectedMonth + '-' + '01' |
|
|
|
|
this.isloading = true; |
|
|
|
|
let selectedTime = |
|
|
|
|
this.selectedYear + '-' + this.selectedMonth + '-' + '01'; |
|
|
|
|
let params = { |
|
|
|
|
Month: selectedTime, |
|
|
|
|
TaskName: this.searchForm.taskname, |
|
|
|
|
CompanyName: this.searchForm.unitname, |
|
|
|
|
assistantOrganizationId: this.searchForm.or, |
|
|
|
|
TaskTypes: this.isSupervisor ? ['双随机', '联络指导'] : ['熟悉演练'], |
|
|
|
|
CreatorId: this.isSupervisor ? this.userId : null,//如果是检查员需要传CreatorId只针对这个账户 如果是救援站就不需要
|
|
|
|
|
CreatorId: this.isSupervisor ? this.userId : null, //如果是检查员需要传CreatorId只针对这个账户 如果是救援站就不需要
|
|
|
|
|
CreationTypes: ['申领任务'], |
|
|
|
|
OrganizationId: this.OrganizationId, |
|
|
|
|
PageNumber: this.PageNumber, |
|
|
|
|
PageSize: this.PageSize |
|
|
|
|
} |
|
|
|
|
this.http.get('/api/PlanTasks', { |
|
|
|
|
params: params |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
this.isloading = false |
|
|
|
|
console.log('任务申请列表', data); |
|
|
|
|
this.totalCount = data.totalCount |
|
|
|
|
this.taskLIst = [...data.items] |
|
|
|
|
}) |
|
|
|
|
PageSize: this.PageSize, |
|
|
|
|
}; |
|
|
|
|
this.http |
|
|
|
|
.get('/api/PlanTasks', { |
|
|
|
|
params: params, |
|
|
|
|
}) |
|
|
|
|
.subscribe((data: any) => { |
|
|
|
|
this.isloading = false; |
|
|
|
|
console.log('任务申请列表', data); |
|
|
|
|
this.totalCount = data.totalCount; |
|
|
|
|
this.taskLIst = [...data.items]; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pageChange($event) { |
|
|
|
|
this.PageNumber = $event |
|
|
|
|
this.getTaskList() |
|
|
|
|
this.PageNumber = $event; |
|
|
|
|
this.getTaskList(); |
|
|
|
|
} |
|
|
|
|
search() { |
|
|
|
|
this.PageNumber = 1 |
|
|
|
|
this.getTaskList() |
|
|
|
|
this.PageNumber = 1; |
|
|
|
|
this.getTaskList(); |
|
|
|
|
} |
|
|
|
|
reset() { |
|
|
|
|
this.PageNumber = 1 |
|
|
|
|
this.PageNumber = 1; |
|
|
|
|
this.searchForm = { |
|
|
|
|
taskname: '', |
|
|
|
|
unitname: '', |
|
|
|
|
unitlevel: '', |
|
|
|
|
or: '' |
|
|
|
|
} |
|
|
|
|
this.getTaskList() |
|
|
|
|
or: '', |
|
|
|
|
}; |
|
|
|
|
this.getTaskList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
expandKeys |
|
|
|
|
defaultOrId: string |
|
|
|
|
expandKeys; |
|
|
|
|
defaultOrId: string; |
|
|
|
|
//获取所有组织机构
|
|
|
|
|
organizationList: any |
|
|
|
|
organizationListAll: any |
|
|
|
|
nodes: any = [] |
|
|
|
|
organizationList: any; |
|
|
|
|
organizationListAll: any; |
|
|
|
|
nodes: any = []; |
|
|
|
|
async getAllOrganization() { |
|
|
|
|
let params = { |
|
|
|
|
ContainsChildren: "true", |
|
|
|
|
ContainsChildren: 'true', |
|
|
|
|
PageNumber: 1, |
|
|
|
|
PageSize: 9999, |
|
|
|
|
code: '0000' |
|
|
|
|
} |
|
|
|
|
code: '0000', |
|
|
|
|
}; |
|
|
|
|
var p = new Promise<void>((resolve, reject) => { |
|
|
|
|
this.http.get('/api/Organizations', { |
|
|
|
|
params: params |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
data.items.forEach(element => { |
|
|
|
|
element.key = element.id |
|
|
|
|
element.title = element.name |
|
|
|
|
element.disableCheckbox = true |
|
|
|
|
element.selectable = false |
|
|
|
|
element.level == 'squadron' ? element.disableCheckbox = false : null |
|
|
|
|
}); |
|
|
|
|
this.organizationListAll = JSON.parse(JSON.stringify(data.items)) |
|
|
|
|
this.organizationList = JSON.parse(JSON.stringify(data.items)).filter(item => { |
|
|
|
|
return item.level != 'squadron' |
|
|
|
|
this.http |
|
|
|
|
.get('/api/Organizations', { |
|
|
|
|
params: params, |
|
|
|
|
}) |
|
|
|
|
resolve(data) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
return p |
|
|
|
|
.subscribe((data: any) => { |
|
|
|
|
data.items.forEach((element) => { |
|
|
|
|
element.key = element.id; |
|
|
|
|
element.title = element.name; |
|
|
|
|
element.disableCheckbox = true; |
|
|
|
|
element.selectable = false; |
|
|
|
|
element.level == 'squadron' |
|
|
|
|
? (element.disableCheckbox = false) |
|
|
|
|
: null; |
|
|
|
|
}); |
|
|
|
|
this.organizationListAll = JSON.parse(JSON.stringify(data.items)); |
|
|
|
|
this.organizationList = JSON.parse(JSON.stringify(data.items)).filter( |
|
|
|
|
(item) => { |
|
|
|
|
return item.level != 'squadron'; |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
resolve(data); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
return p; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获得所有检查员
|
|
|
|
|
supervisorList = [] |
|
|
|
|
supervisorList = []; |
|
|
|
|
|
|
|
|
|
async getSupervisor() { |
|
|
|
|
return new Promise<void>((resolve, reject) => { |
|
|
|
|
this.http.get('/api/Users/Inspectors').subscribe((data: any) => { |
|
|
|
|
console.log('检查员列表', data) |
|
|
|
|
data.forEach(element => { |
|
|
|
|
element.key = element.id |
|
|
|
|
element.title = element.name |
|
|
|
|
element.parentId = element.organizationId |
|
|
|
|
console.log('检查员列表', data); |
|
|
|
|
data.forEach((element) => { |
|
|
|
|
element.key = element.id; |
|
|
|
|
element.title = element.name; |
|
|
|
|
element.parentId = element.organizationId; |
|
|
|
|
}); |
|
|
|
|
this.supervisorList = data |
|
|
|
|
resolve(data) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.supervisorList = data; |
|
|
|
|
resolve(data); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
mainsupervisorList = [] |
|
|
|
|
assitantsupervisorList = [] |
|
|
|
|
mainsupervisorList = []; |
|
|
|
|
assitantsupervisorList = []; |
|
|
|
|
getSupervisortype(type) { |
|
|
|
|
let params = { |
|
|
|
|
inspectorType: type |
|
|
|
|
} |
|
|
|
|
this.http.get('/api/Users/Inspectors', { |
|
|
|
|
params: params |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
if (type == 'main') { |
|
|
|
|
this.mainsupervisorList = data |
|
|
|
|
} else { |
|
|
|
|
this.assitantsupervisorList = data |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
inspectorType: type, |
|
|
|
|
}; |
|
|
|
|
this.http |
|
|
|
|
.get('/api/Users/Inspectors', { |
|
|
|
|
params: params, |
|
|
|
|
}) |
|
|
|
|
.subscribe((data: any) => { |
|
|
|
|
if (type == 'main') { |
|
|
|
|
this.mainsupervisorList = data; |
|
|
|
|
} else { |
|
|
|
|
this.assitantsupervisorList = data; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//获得除了检查员的其他用户
|
|
|
|
|
users |
|
|
|
|
users; |
|
|
|
|
async getUsers() { |
|
|
|
|
var p = new Promise<void>((resolve, reject) => { |
|
|
|
|
let params = { |
|
|
|
@ -185,60 +209,66 @@ export class StationTaskApplyComponent implements OnInit {
|
|
|
|
|
OrganizationLevel: 'squadron', |
|
|
|
|
ContainsChildren: true, |
|
|
|
|
PageNumber: 1, |
|
|
|
|
PageSize: 9999 |
|
|
|
|
} |
|
|
|
|
this.http.get('/api/Users', { |
|
|
|
|
params: params |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
console.log('用户列表', data.items) |
|
|
|
|
data.items.forEach(element => { |
|
|
|
|
element.key = element.id |
|
|
|
|
element.title = element.name |
|
|
|
|
element.parentId = element.organizationId |
|
|
|
|
PageSize: 9999, |
|
|
|
|
}; |
|
|
|
|
this.http |
|
|
|
|
.get('/api/Users', { |
|
|
|
|
params: params, |
|
|
|
|
}) |
|
|
|
|
.subscribe((data: any) => { |
|
|
|
|
console.log('用户列表', data.items); |
|
|
|
|
data.items.forEach((element) => { |
|
|
|
|
element.key = element.id; |
|
|
|
|
element.title = element.name; |
|
|
|
|
element.parentId = element.organizationId; |
|
|
|
|
}); |
|
|
|
|
this.users = data.items; |
|
|
|
|
resolve(data); |
|
|
|
|
}); |
|
|
|
|
this.users = data.items |
|
|
|
|
resolve(data) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
return p |
|
|
|
|
}); |
|
|
|
|
return p; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
userId |
|
|
|
|
userId; |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.OrganizationId = JSON.parse(sessionStorage.getItem('userData')).organizationId |
|
|
|
|
this.userId = JSON.parse(sessionStorage.getItem('userData')).id |
|
|
|
|
let roles = JSON.parse(sessionStorage.getItem('userData')).roles |
|
|
|
|
let isSupervisor = roles.find(item => { |
|
|
|
|
return item.name.indexOf('检查') != -1 |
|
|
|
|
}) |
|
|
|
|
isSupervisor ? this.isSupervisor = true : this.isSupervisor = false |
|
|
|
|
this.selectedMonth = new Date().getMonth() + 1 |
|
|
|
|
this.getTaskList() |
|
|
|
|
Promise.all([this.getAllOrganization(), this.getSupervisor(), this.getUsers()]) |
|
|
|
|
.then((results) => { |
|
|
|
|
if (this.isSupervisor) { |
|
|
|
|
// let arr = [...this.users, ...this.organizationListAll]
|
|
|
|
|
let arr = [...this.organizationListAll] |
|
|
|
|
this.nodes = this.toTree.toTree(JSON.parse(JSON.stringify(arr))) |
|
|
|
|
} else { |
|
|
|
|
let arr = [...this.supervisorList, ...this.organizationList] |
|
|
|
|
this.nodes = this.toTree.toTree(JSON.parse(JSON.stringify(arr))) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.OrganizationId = JSON.parse( |
|
|
|
|
sessionStorage.getItem('userData') |
|
|
|
|
).organizationId; |
|
|
|
|
this.userId = JSON.parse(sessionStorage.getItem('userData')).id; |
|
|
|
|
let roles = JSON.parse(sessionStorage.getItem('userData')).roles; |
|
|
|
|
let isSupervisor = roles.find((item) => { |
|
|
|
|
return item.name.indexOf('检查') != -1; |
|
|
|
|
}); |
|
|
|
|
isSupervisor ? (this.isSupervisor = true) : (this.isSupervisor = false); |
|
|
|
|
this.selectedMonth = new Date().getMonth() + 1; |
|
|
|
|
this.getTaskList(); |
|
|
|
|
Promise.all([ |
|
|
|
|
this.getAllOrganization(), |
|
|
|
|
this.getSupervisor(), |
|
|
|
|
this.getUsers(), |
|
|
|
|
]).then((results) => { |
|
|
|
|
if (this.isSupervisor) { |
|
|
|
|
// let arr = [...this.users, ...this.organizationListAll]
|
|
|
|
|
let arr = [...this.organizationListAll]; |
|
|
|
|
this.nodes = this.toTree.toTree(JSON.parse(JSON.stringify(arr))); |
|
|
|
|
} else { |
|
|
|
|
let arr = [...this.supervisorList, ...this.organizationList]; |
|
|
|
|
this.nodes = this.toTree.toTree(JSON.parse(JSON.stringify(arr))); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
|
this.rollStart() |
|
|
|
|
this.rollStart(); |
|
|
|
|
}, 0); |
|
|
|
|
|
|
|
|
|
//获得主协调查人员
|
|
|
|
|
this.getSupervisortype('main') |
|
|
|
|
this.getSupervisortype('assisted') |
|
|
|
|
|
|
|
|
|
this.getSupervisortype('main'); |
|
|
|
|
this.getSupervisortype('assisted'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
timer |
|
|
|
|
timer; |
|
|
|
|
rollStart() { |
|
|
|
|
var ROLL_SPEED = 100 |
|
|
|
|
var ROLL_SPEED = 100; |
|
|
|
|
var noticeList1 = document.getElementById('notice-list'); |
|
|
|
|
var noticeList2 = document.getElementById('notice-list-2'); |
|
|
|
|
var listWrapper = document.getElementById('list-wrapper'); |
|
|
|
@ -246,18 +276,20 @@ export class StationTaskApplyComponent implements OnInit {
|
|
|
|
|
this.timer = setInterval(rollStart, ROLL_SPEED); |
|
|
|
|
|
|
|
|
|
function rollStart() { |
|
|
|
|
if (Math.abs(_subStr(listWrapper.style.top)) >= noticeList1.clientHeight) { |
|
|
|
|
listWrapper.style.top = '0px' |
|
|
|
|
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' |
|
|
|
|
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)) |
|
|
|
|
return parseFloat(str.substr(0, index + 1)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -265,20 +297,20 @@ export class StationTaskApplyComponent implements OnInit {
|
|
|
|
|
window.clearInterval(this.timer); |
|
|
|
|
} |
|
|
|
|
mouseleave() { |
|
|
|
|
this.rollStart() |
|
|
|
|
this.rollStart(); |
|
|
|
|
} |
|
|
|
|
ngOnDestroy(): void { |
|
|
|
|
console.log('退出了') |
|
|
|
|
this.mouseEnter() |
|
|
|
|
console.log('退出了'); |
|
|
|
|
this.mouseEnter(); |
|
|
|
|
} |
|
|
|
|
apply() { |
|
|
|
|
if (this.nodes.length == 0) { |
|
|
|
|
this.message.create('warning', '组织机构为空,请稍后重试'); |
|
|
|
|
return |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (this.supervisorList.length == 0) { |
|
|
|
|
this.message.create('warning', '检查员名单为空,请稍后重试'); |
|
|
|
|
return |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
const modal = this.modal.create({ |
|
|
|
|
nzTitle: '申请', |
|
|
|
@ -287,40 +319,53 @@ export class StationTaskApplyComponent implements OnInit {
|
|
|
|
|
nzWidth: 660, |
|
|
|
|
nzMaskClosable: false, |
|
|
|
|
nzComponentParams: { |
|
|
|
|
title: this.isSupervisor ? ["联络指导", "双随机"] : ["熟悉演练"], |
|
|
|
|
title: this.isSupervisor ? ['联络指导', '双随机'] : ['熟悉演练'], |
|
|
|
|
isSupervisor: this.isSupervisor, |
|
|
|
|
supervisorList: JSON.parse(JSON.stringify(this.supervisorList)), |
|
|
|
|
organizationList: JSON.parse(JSON.stringify(this.organizationList)), |
|
|
|
|
users: JSON.parse(JSON.stringify(this.users)), |
|
|
|
|
nodes: JSON.parse(JSON.stringify(this.nodes)), |
|
|
|
|
mainsupervisorList: JSON.parse(JSON.stringify(this.mainsupervisorList)), |
|
|
|
|
assitantsupervisorList: JSON.parse(JSON.stringify(this.assitantsupervisorList)) |
|
|
|
|
assitantsupervisorList: JSON.parse( |
|
|
|
|
JSON.stringify(this.assitantsupervisorList) |
|
|
|
|
), |
|
|
|
|
}, |
|
|
|
|
nzOnOk: async () => { |
|
|
|
|
console.log(instance.validateForm.value) |
|
|
|
|
console.log(instance.validateForm.value); |
|
|
|
|
if (instance.validateForm.valid && instance.selectedUnitData.id) { |
|
|
|
|
if (instance.taskType == '双随机') { |
|
|
|
|
if (!instance.validateForm.value.main || !instance.validateForm.value.assist) { |
|
|
|
|
if ( |
|
|
|
|
!instance.validateForm.value.main || |
|
|
|
|
!instance.validateForm.value.assist |
|
|
|
|
) { |
|
|
|
|
this.message.create('warning', '请填写检查人员!'); |
|
|
|
|
return false |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
await new Promise((resolve, reject) => { |
|
|
|
|
let selectedMonth = this.selectedMonth < 10 ? "0" + this.selectedMonth : this.selectedMonth; |
|
|
|
|
let selectedTime = this.selectedYear + '-' + selectedMonth + '-' + '01' |
|
|
|
|
let supervisorIds |
|
|
|
|
let assistantOrganizationIds |
|
|
|
|
let selectedMonth = |
|
|
|
|
this.selectedMonth < 10 |
|
|
|
|
? '0' + this.selectedMonth |
|
|
|
|
: this.selectedMonth; |
|
|
|
|
let selectedTime = |
|
|
|
|
this.selectedYear + '-' + selectedMonth + '-' + '01'; |
|
|
|
|
let supervisorIds; |
|
|
|
|
let assistantOrganizationIds; |
|
|
|
|
if (this.isSupervisor) { |
|
|
|
|
if (instance.taskType == '双随机') { |
|
|
|
|
supervisorIds = [instance.validateForm.value.main, instance.validateForm.value.assist] |
|
|
|
|
supervisorIds = [ |
|
|
|
|
instance.validateForm.value.main, |
|
|
|
|
instance.validateForm.value.assist, |
|
|
|
|
]; |
|
|
|
|
} else { |
|
|
|
|
supervisorIds = [] |
|
|
|
|
supervisorIds = []; |
|
|
|
|
} |
|
|
|
|
assistantOrganizationIds = instance.validateForm.value.organization |
|
|
|
|
assistantOrganizationIds = |
|
|
|
|
instance.validateForm.value.organization; |
|
|
|
|
} else { |
|
|
|
|
supervisorIds = instance.validateForm.value.organization |
|
|
|
|
assistantOrganizationIds = [] |
|
|
|
|
supervisorIds = instance.validateForm.value.organization; |
|
|
|
|
assistantOrganizationIds = []; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let body = { |
|
|
|
@ -332,36 +377,35 @@ export class StationTaskApplyComponent implements OnInit {
|
|
|
|
|
supervisorIds: supervisorIds, |
|
|
|
|
assistantOrganizationIds: assistantOrganizationIds, |
|
|
|
|
creationType: '申领任务', |
|
|
|
|
approvalStatus: '待处理' |
|
|
|
|
} |
|
|
|
|
approvalStatus: '待处理', |
|
|
|
|
}; |
|
|
|
|
this.http.post('/api/PlanTasks', body).subscribe({ |
|
|
|
|
next: (data) => { |
|
|
|
|
this.message.create('success', '创建成功'); |
|
|
|
|
resolve(data) |
|
|
|
|
this.getTaskList() |
|
|
|
|
return true |
|
|
|
|
resolve(data); |
|
|
|
|
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) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
look(item) { |
|
|
|
|
const modal = this.modal.create({ |
|
|
|
|
nzTitle: '详情', |
|
|
|
@ -372,44 +416,40 @@ export class StationTaskApplyComponent implements OnInit {
|
|
|
|
|
nzComponentParams: { |
|
|
|
|
data: item, |
|
|
|
|
}, |
|
|
|
|
nzFooter: null |
|
|
|
|
nzFooter: null, |
|
|
|
|
}); |
|
|
|
|
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) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
//删除任务
|
|
|
|
|
deleteTask(item, incomingData) { |
|
|
|
|
console.log(item) |
|
|
|
|
console.log(incomingData) |
|
|
|
|
console.log(item); |
|
|
|
|
console.log(incomingData); |
|
|
|
|
this.modal.confirm({ |
|
|
|
|
nzTitle: `确定要删除该任务吗?`, |
|
|
|
|
nzOkText: '确定', |
|
|
|
|
nzOkType: 'primary', |
|
|
|
|
nzOnOk: () => { |
|
|
|
|
this.http.delete(`/api/PlanTasks/${item.id}`).subscribe(data => { |
|
|
|
|
|
|
|
|
|
this.http.delete(`/api/PlanTasks/${item.id}`).subscribe((data) => { |
|
|
|
|
for (let index = 0; index < incomingData.length; index++) { |
|
|
|
|
const element = incomingData[index]; |
|
|
|
|
if (element.id == item.id) { |
|
|
|
|
incomingData.splice(index, 1) |
|
|
|
|
index-- |
|
|
|
|
incomingData.splice(index, 1); |
|
|
|
|
index--; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.message.create('success', '删除成功!'); |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
nzCancelText: '取消', |
|
|
|
|
nzOnCancel: () => { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
nzOnCancel: () => {}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//待检查撤销
|
|
|
|
|
revocationTask(item, taskLIst) { |
|
|
|
|
this.modal.confirm({ |
|
|
|
@ -417,21 +457,23 @@ export class StationTaskApplyComponent implements OnInit {
|
|
|
|
|
nzOkText: '确定', |
|
|
|
|
nzOkType: 'default', |
|
|
|
|
nzOnOk: () => { |
|
|
|
|
this.http.post(`/api/PlanTasks/Approval/${item.id}`, null, { |
|
|
|
|
params: { |
|
|
|
|
approvalStatus: '待处理' |
|
|
|
|
} |
|
|
|
|
}).subscribe({ |
|
|
|
|
next: (data) => { |
|
|
|
|
this.message.create('success', '已撤销'); |
|
|
|
|
item.approvalStatus = '待处理' |
|
|
|
|
}, |
|
|
|
|
error: (err) => { |
|
|
|
|
this.message.create('warning', '撤销失败'); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.http |
|
|
|
|
.post(`/api/PlanTasks/Approval/${item.id}`, null, { |
|
|
|
|
params: { |
|
|
|
|
approvalStatus: '待处理', |
|
|
|
|
}, |
|
|
|
|
}) |
|
|
|
|
.subscribe({ |
|
|
|
|
next: (data) => { |
|
|
|
|
this.message.create('success', '已撤销'); |
|
|
|
|
item.approvalStatus = '待处理'; |
|
|
|
|
}, |
|
|
|
|
error: (err) => { |
|
|
|
|
this.message.create('warning', '撤销失败'); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
nzCancelText: '取消' |
|
|
|
|
nzCancelText: '取消', |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -451,5 +493,5 @@ export enum TaskType {
|
|
|
|
|
行政许可, |
|
|
|
|
联络指导, |
|
|
|
|
消防宣传, |
|
|
|
|
火灾调查 |
|
|
|
|
火灾调查, |
|
|
|
|
} |