import { Component, OnInit, ViewChild } from '@angular/core'; import { RhAndonService } from '../../andon.service'; import { RhSafeAny, RhBaseDto, RhTableQueryOptionDto, DataResultT } from 'rh-base/model'; import { MsgHelper, RhApiUrlsService } from 'rh-base/core'; import { AndonCallProcessRecordsDto, AndonCallProcessRecordsQueryDto } from '../../andon-module'; import { DynamicFormComponent } from 'rh-base/shared'; @Component({ selector: 'rh-call-record', templateUrl: './call-record.component.html', styleUrls: ['./call-record.component.css'] }) export class CallRecordComponent implements OnInit { @ViewChild('QueryForm', { static: false }) queryFormCmt!: DynamicFormComponent; dataResult!: DataResultT; defaultQueryDto!: RhBaseDto; dataLoading = false; /**抽屉的显隐 */ isShowDrawer = false; /** 时间轴 */ timeLineList: AndonCallProcessRecordsDto[] = []; timeLineDto!: RhBaseDto | RhSafeAny; AndonCallOrderStatus: RhSafeAny = {}; constructor(private rhAndonService: RhAndonService, private apiUrl: RhApiUrlsService) {} ngOnInit(): void { this.getAndonCallOrderStatus(); } // 调用查询 getDatas(option?: RhTableQueryOptionDto) { // console.log(this.queryFormCmt); setTimeout(() => { this.queryFormCmt.submitDefaultForm(null, option); }); } refreshDatas(option: RhTableQueryOptionDto) { this.getDatas(option); } /** * form查询完成上弹事件绑定方法 * @param dataset */ resultDataChange(dataset: RhSafeAny) { this.dataResult = dataset; } iconShow(item: RhBaseDto) { // } /** * * @param status */ dataLoadingChange(status: boolean) { this.dataLoading = status; } getAndonCallOrderStatus() { this.apiUrl.GetOrderStatusSelectItems('AndonCallOrderStatus').subscribe((result) => { if (result && result.Success) { result.Attach.forEach((f) => (this.AndonCallOrderStatus[f.Value as string] = f.Text)); } else { this.AndonCallOrderStatus = {}; } }); } /** * 打开抽屉 * @param event */ openTimelineBtnFun(event: RhBaseDto) { const dto = event['data']; this.timeLineDto = { OrderCode: dto?.OrderCode // CallCategoryCode: dto?.CallCategoryCode, // CallCategoryItemCode: dto?.CallCategoryItemCode, // ProcessNode: dto?.ProcessNode, // ProcessorCode: dto?.ProcessorCode }; this.rhAndonService.GetAndonCallProcessRecordsDatas(this.timeLineDto as AndonCallProcessRecordsQueryDto).subscribe((res) => { if (res.Success) { res.Attach.sort((a, b) => { return new Date(a.ProcessTime as RhSafeAny).getTime() - new Date(b.ProcessTime as RhSafeAny).getTime(); }); this.timeLineList = res.Attach; this.isShowDrawer = true; } else { MsgHelper.ShowWarningMessage('查询呼叫记录失败!' + res.Message); } }); } closeTimeLine() { this.isShowDrawer = false; } }