Newer
Older
import {Component, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {WorkService} from '../../work.service';
import {NzMessageService} from 'ng-zorro-antd';
import {LinkInventoryComponent} from '../../modal/link-inventory/link-inventory.component';
import {TransforComponent} from '../../modal/transfor/transfor.component';
import {CostReleationComponent} from '../../modal/cost-releation/cost-releation.component';
import {ViolationNotificationComponent} from '../../modal/violation-notification/violation-notification.component';
selector: 'smart-handle-event',
templateUrl: './handle-event.component.html',
`
:host ::ng-deep .ant-row {
margin: 20px 0;
}
:host ::ng-deep .ant-col-4 {
text-align: right;
}
h2 {
@ViewChild('smartLinkInventory') smartLinkInventory: LinkInventoryComponent;
@ViewChild('smartTransfor') smartTransfor: TransforComponent;
@ViewChild('smartCostReleation') smartCostReleation: CostReleationComponent;
@ViewChild('smartVioNoti') smartVioNoti: ViolationNotificationComponent;
constructor(private routrInfo: ActivatedRoute, private workSer: WorkService, private location: Location,
private message: NzMessageService, private datePipe: DatePipe, private commonSer: CommonService) {
this.routrInfo.queryParams.subscribe(
(res) => {
this.eventId = res.eventId;
}
);
}
ngOnInit() {
this.getDetail();
this.findTransferAndInventory();
}
//事件详情
getDetail() {
this.workSer.findByNo(this.eventId).subscribe(
(res) => {
this.event = res.data;
}
);
}
//查询事件流转信息
(res) => {
this.transforsList = res.data.transfers;
this.transforsList.forEach(e => {
e.operatorInfo = e.operatorInfo.replace(/\"/g, '').replace('{', '').replace('}', '').split(':');
});
showInventoryModal() {
this.smartLinkInventory.showModal('添加关联资产');
save() {
if (!this.obj.operateStatus) {
this.message.error('请选择处理结果');
this.commonSer.confirmThing('确认', '确定提交处理结果?', () => {
const data = {
id: this.eventId,
operateStatus: Number(this.obj.operateStatus),
inventoryId: this.linkList.map(e => {
return e.id;
}),
operateResult: this.obj.operateResult,
eventCost: this.eventCost,
eventViolationVO: this.eventViolationVO,
completeTimeStr: this.datePipe.transform(this.date, 'yyyy-MM-dd') + ' ' + this.datePipe.transform(this.time, 'HH:mm:ss')
};
this.workSer.deal(data).subscribe(
(res) => {
if (res.errCode == 10000) {
this.location.back();
this.message.success('事件处理成功');
}
showTransforModal() {
this.smartTransfor.showTransforModal('事件转派', this.eventId);
//确认完成
done() {
this.commonSer.confirmThing('确认', '确认事件完成?', () => {
const data = {
ids: []
};
data.ids.push(this.eventId);
this.workSer.confirmEvent(data).subscribe(
(res) => {
if (res.errCode == 10000) {
this.location.back();
this.message.success('事件确认成功');
}
}
);
});
}
//下载
downLoad() {
this.workSer.downloadTemplate('event', this.eventId).subscribe(
(data) => {
this.commonSer.downloadFile(this.event.fileName + '.xlsx', data);
showCostModal() {
this.smartCostReleation.showAddModal('添加关联费用');
}
// 关联费用
getCostReleation(e) {
e.eventId = this.eventId;
this.eventCost = e;
console.log(e);
}
//展示违规信息
showNotiModal() {
this.smartVioNoti.showAddModal('添加违规信息');
}
//获取违规通报信息
getNoti(e) {
e.eventId = this.eventId;
this.eventViolationVO = e;
console.log(e);
}