incident-ser-call.component.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
  2. import { format, startOfDay, endOfDay } from 'date-fns';
  3. import { MainService } from 'src/app/services/main.service';
  4. import { ToolService } from 'src/app/services/tool.service';
  5. import { NzMessageService } from 'ng-zorro-antd';
  6. @Component({
  7. selector: 'app-incident-ser-call',
  8. templateUrl: './incident-ser-call.component.html',
  9. styleUrls: ['./incident-ser-call.component.less']
  10. })
  11. export class IncidentSerCallComponent implements OnInit {
  12. // 切换科室,切换弹窗
  13. loading = false;
  14. messageList: any = [];// 通话记录列表
  15. pageIndex: number = 1;//表格当前页码
  16. pageSize: number = 10;//表格每页展示条数
  17. total: number = 0;//表格总数据量
  18. searchDTO: any = {};
  19. @Input() itsmData:any;
  20. @Input() hsmsData:any;
  21. @Output() closeModelHs = new EventEmitter<any>();//1.组件暴露一个 EventEmitter 属性,当事件发生时,子组件利用该属性 emits(向上弹射)事件
  22. constructor(
  23. private mainService: MainService,
  24. private tool: ToolService,
  25. private message: NzMessageService,
  26. ) { }
  27. ngOnInit() {
  28. this.getMessageList(1);
  29. }
  30. // 关闭弹窗
  31. hideModal() {
  32. this.closeModelHs.emit({ show: false });//emits(向上弹射)事件
  33. }
  34. // 搜索
  35. search() {
  36. this.getMessageList(1);
  37. }
  38. // 重置
  39. reset() {
  40. this.searchDTO = {};
  41. this.getMessageList(1);
  42. }
  43. // 回放录音
  44. coopData:any = {};
  45. recordingModalShow = false; //弹窗开关
  46. maskFlag:any = false;
  47. recordcall(data) {
  48. this.maskFlag = this.message.loading("正在加载中..", {
  49. nzDuration: 0,
  50. }).messageId;
  51. this.mainService.getCallLogPath({ path: data.path, hosId: data.hosId }).subscribe((result) => {
  52. this.message.remove(this.maskFlag);
  53. this.maskFlag = false;
  54. if (result["state"] == 200) {
  55. this.coopData = { relativePath: result["relativePath"] };
  56. this.recordingModalShow = true;
  57. }
  58. });
  59. }
  60. // 关闭弹窗
  61. closeRecordingModelOrder(e) {
  62. this.recordingModalShow = JSON.parse(e).show;
  63. }
  64. // 分页获取数据
  65. getList(){
  66. this.getMessageList();
  67. }
  68. // 获取通话记录列表
  69. getMessageList(idx?) {
  70. if (idx) {
  71. this.pageIndex = 1;
  72. }
  73. console.log(this.itsmData)
  74. console.log(this.hsmsData)
  75. let hosIds;
  76. if(this.itsmData.mdv2Switch){
  77. if(this.itsmData.allDuty == 1){
  78. hosIds = undefined;
  79. }else{
  80. hosIds = this.itsmData.checkedHos.map(v => v.id).toString();
  81. }
  82. }
  83. if(this.hsmsData.hsmsSwitch){
  84. if(this.itsmData.mdv2Switch){
  85. if(this.itsmData.allDuty == 1){
  86. hosIds = undefined;
  87. }else{
  88. hosIds += ',' + this.hsmsData.checkedHos;
  89. }
  90. }else{
  91. hosIds = this.hsmsData.checkedHos.toString();
  92. }
  93. }
  94. let postData = {
  95. idx: this.pageIndex - 1,
  96. sum: this.pageSize,
  97. callLog: {
  98. hosIds,
  99. dTMFA: this.searchDTO.dTMFA || undefined,
  100. dTMFB: this.searchDTO.dTMFB || undefined,
  101. responseTime: this.searchDTO.responseTime ? format(this.searchDTO.responseTime, 'yyyy-MM-dd HH:mm:ss') : undefined,
  102. }
  103. }
  104. this.loading = true;
  105. this.mainService.getFetchDataList('simple/data','callLog',postData).subscribe(data => {
  106. this.loading = false;
  107. this.messageList = data.list || [];
  108. this.total = data.totalNum;
  109. })
  110. }
  111. }