123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- import { Component, OnInit, Input, Output, EventEmitter, ViewChild } from '@angular/core';
- import { ToolService } from 'src/app/services/tool.service';
- import { MainService } from 'src/app/services/main.service';
- import { OverlayScrollbarsComponent } from 'overlayscrollbars-ngx';
- import cloneDeep from 'lodash-es/cloneDeep'
- import { format, addHours, addDays } from 'date-fns';
- @Component({
- selector: 'app-incident-ser-visit',
- templateUrl: './incident-ser-visit.component.html',
- styleUrls: ['./incident-ser-visit.component.less']
- })
- export class IncidentSerVisitComponent implements OnInit {
- @ViewChild("osComponentRef1", {
- read: OverlayScrollbarsComponent,
- static: false,
- })
- osComponentRef1: OverlayScrollbarsComponent;
- // 切换科室,切换弹窗
- loading = false;
- visitList: any = [];// 列表
- pageIndex: number = 1;//表格当前页码
- pageSize: number = 10;//表格每页展示条数
- total: number = 0;//表格总数据量
- @Input() itsmData:any;
- @Output() closeModelHs = new EventEmitter<any>();//1.组件暴露一个 EventEmitter 属性,当事件发生时,子组件利用该属性 emits(向上弹射)事件
- constructor(private mainService: MainService, private tool: ToolService) { }
- ngOnInit() {
- this.getVisitList();
- }
- // 关闭弹窗
- hideModal() {
- this.closeModelHs.emit(JSON.stringify({ show: false }));//emits(向上弹射)事件
- }
- // 优先级颜色
- priorityColor(priorityId) {
- // 极低|低
- if(priorityId == 1 || priorityId == 2){
- return '';
- } else if(priorityId == 3){
- return 'yellow';
- } else if(priorityId == 4 || priorityId == 5){
- return 'red';
- }
- }
- // 处理人
- computedHandlerUser(item){
- if(item.state.value == 'pending' && item.currentLog){
- return item.currentLog.workerName;
- }
- if(item.state.value != 'pending' && item.handlingPersonnelUser){
- return item.handlingPersonnelUser.name;
- }
- }
- // 查看ITSM工单详情
- detailModalShow = false; //弹窗开关
- coopData:any = {};
- openItsmDetails(data) {
- this.coopData = data;
- this.detailModalShow = true;
- }
- // 关闭弹窗
- closeDetailModelOrder(e) {
- this.detailModalShow = JSON.parse(e).show;
- }
- // 弹窗确定
- confirmDetailModelOrder(e){
- console.log(e);
- this.detailModalShow = false;
- }
- // 回访-弹窗
- visitModalShow = false; //弹窗开关
- visit(data) {
- this.coopData = data;
- this.visitModalShow = true;
- }
- // 关闭弹窗
- closeVisitModelOrder(e) {
- this.visitModalShow = JSON.parse(e).show;
- }
- // 弹窗确定
- confirmVisitModelOrder(e){
- console.log(e);
- this.visitModalShow = false;
- this.getList();
- }
- // 分页获取数据
- getList(){
- this.getVisitList();
- }
- // 延期记录
- transferHandlerLog = function (currentLog) {
- if(!currentLog){
- return '';
- }
- currentLog = cloneDeep(currentLog);
- if(currentLog.extra1DTO && currentLog.extra2 && currentLog.startTime){
- if(currentLog.extra2==0.5){
- currentLog.extra2 = 4;
- return currentLog.extra1DTO.name+" "+ format(addHours(currentLog.startTime, +currentLog.extra2), "MM月dd日") + format(addHours(currentLog.startTime, +currentLog.extra2), "HH时mm分前完成");
- }else{
- return currentLog.extra1DTO.name+" "+ format(addDays(currentLog.startTime, +currentLog.extra2), "MM月dd日前完成");
- }
- }else{
- return '';
- }
- }
- // 获取回访列表
- getVisitList(){
- this.loading = true;
- let postData: any = {
- idx: 0,
- sum: 9999,
- incident: {
- // "groupIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.scopeGroups.map(v => v.id).toString() || undefined),
- "dutyIds": this.itsmData.allDuty == 1 ? undefined : (this.itsmData.checkedHos.map(v => v.id).toString() || undefined),
- "urgentType": +this.itsmData.orderScopeRadio + 1,
- "queryTask": "callback",
- "assignee": this.tool.getCurrentUserId(),
- "deleteFlag": 0,
- },
- };
- this.mainService
- .getFetchDataList("simple/data", "incident", postData)
- .subscribe((result) => {
- this.loading = false;
- this.visitList = result.list.map(v => ({...v, endDeptsName: v.endDepts ? v.endDepts.map(v => v.dept).toString() : ''}));
- });
- }
- }
|