|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
|
import { Component, Input, OnInit } from '@angular/core';
|
|
|
|
import { NzMessageService } from 'ng-zorro-antd/message';
|
|
|
|
import { NzModalService } from 'ng-zorro-antd/modal';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-task-details',
|
|
|
|
templateUrl: './task-details.component.html',
|
|
|
|
styleUrls: ['./task-details.component.scss']
|
|
|
|
})
|
|
|
|
export class TaskDetailsComponent implements OnInit {
|
|
|
|
@Input() data?: any;
|
|
|
|
@Input() parent?: any;
|
|
|
|
constructor(private http: HttpClient, private modal: NzModalService, private message: NzMessageService) { }
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
}
|
|
|
|
//接受任务
|
|
|
|
accept(i) {
|
|
|
|
|
|
|
|
console.log(this.parent)
|
|
|
|
this.modal.confirm({
|
|
|
|
nzTitle: `确定要接受该任务吗?`,
|
|
|
|
nzOkText: '确定',
|
|
|
|
nzOkType: 'default',
|
|
|
|
nzOnOk: () => {
|
|
|
|
this.http.post(`/api/PlanTasks/Approval/${i.id}`, null, {
|
|
|
|
params: {
|
|
|
|
approvalStatus: '通过'
|
|
|
|
}
|
|
|
|
}).subscribe({
|
|
|
|
next: (data) => {
|
|
|
|
this.message.create('success', '已接受');
|
|
|
|
i.approvalStatus = '通过'
|
|
|
|
this.parent.stationData.forEach(element => {
|
|
|
|
if (element.id == i.company.organizationId) {
|
|
|
|
if (element.isExpand) {
|
|
|
|
this.parent.getTaskListOfStation(element)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.data.passed += 1
|
|
|
|
},
|
|
|
|
error: (err) => {
|
|
|
|
this.message.create('warning', '接受失败');
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
nzCancelText: '取消'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
//拒绝任务
|
|
|
|
reject(i) {
|
|
|
|
this.modal.confirm({
|
|
|
|
nzTitle: `确定要拒绝该任务吗?`,
|
|
|
|
nzOkText: '确定',
|
|
|
|
nzOkType: 'default',
|
|
|
|
nzOnOk: () => {
|
|
|
|
this.http.post(`/api/PlanTasks/Approval/${i.id}`, null, {
|
|
|
|
params: {
|
|
|
|
approvalStatus: '驳回'
|
|
|
|
}
|
|
|
|
}).subscribe({
|
|
|
|
next: (data) => {
|
|
|
|
this.message.create('success', '已拒绝');
|
|
|
|
i.approvalStatus = '驳回'
|
|
|
|
this.parent.stationData.forEach(element => {
|
|
|
|
if (element.id == i.company.organizationId) {
|
|
|
|
if (element.isExpand) {
|
|
|
|
this.parent.getTaskListOfStation(element)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
this.data.passed -= 1
|
|
|
|
},
|
|
|
|
error: (err) => {
|
|
|
|
this.message.create('warning', '拒绝失败');
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
nzCancelText: '取消'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|