济南项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

85 lines
2.5 KiB

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: '取消'
});
}
}