Riku
2024-08-13 cf693a5227f17bbf2201512128d267281a8c5695
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/**
 * 现场巡查监管相关数据接口
 */
import { get, post } from '../baseRequset';
import { inspectUrl, inspectPicUrl } from '../../config/index';
import { transSceneType } from '../../model/sceneType';
import { getInspectionStatisticList } from '../../model/inspection';
import { getProblemList } from '../../model/problem';
import dayjs from 'dayjs';
 
// 获取巡查任务数及各自问题数统计
function fetchInspectionStatistic(area) {
  // 两个系统之间的场景类型需要转换
  area.scensetypeid = transSceneType(area.scensetypeid);
  return post(
    {
      url: `/task/progress`,
      data: area,
    },
    inspectUrl,
  ).then(res => {
    return res.data;
  });
}
 
// 获取各问题类型发生的数量统计
function fetchProblemsStatistic(area) {
  area.scensetypeid = transSceneType(area.scensetypeid);
  return post(
    {
      url: `/problemlist/getStatisticalResult`,
      data: area,
    },
    inspectUrl,
  ).then(res => {
    return res;
  });
}
 
//
function fetchSubtasksByProType({ area, pType }) {
  area.scensetypeid = transSceneType(area.scensetypeid);
  return post(
    {
      url: `/problemlist/type/subtask`,
      params: { pType: pType },
      data: area,
    },
    inspectUrl,
  ).then(res => {
    if (res.data.data) {
      res.data.data.forEach(d => {
        d.planstarttime = dayjs(d.planstarttime).format('MM月DD日');
        d.planendtime = dayjs(d.planstarttime).format('MM月DD日');
        d.executionstarttime;
      });
    }
    return res.data;
  });
}
 
function fetchSubtask(subtaskId) {
  return get(
    {
      url: `/subtask/${subtaskId}`,
    },
    inspectUrl,
  ).then(res => {
    return res.data;
  });
}
 
function fetchSubtaskSummary({ sceneId, startTime, endTime }) {
  return get(
    {
      url: `/subtask/byScene`,
      params: {
        sceneId: sceneId,
        startTime: startTime,
        endTime: endTime,
      },
    },
    inspectUrl,
  ).then(res => {
    return res.data;
  });
}
 
function fetchSubtaskSummaryByArea(area) {
  area.scensetypeid = transSceneType(area.scensetypeid);
  return post(
    {
      url: `/subtask/summary/area`,
      data: area,
    },
    inspectUrl,
  ).then(res => {
    res.data.data = getInspectionStatisticList(res.data.data);
    return res.data;
    // res.data = getInspectionStatisticList(res.data);
    // return res;
  });
}
 
/**
 * 获取巡查任务的问题及整改详情
 * @param {String} subtaskId
 * @param {boolean} all 是否获取未审核及审核不通过的问题
 */
function fetchProblems(subtaskId, all) {
  return get(
    {
      url: `/problemlist/subtask`,
      params: {
        stGuid: subtaskId,
        all: all ? all : false,
      },
    },
    inspectUrl,
  ).then(res => {
    res.data = getProblemList(res.data);
    return res.data;
  });
}
 
export {
  fetchInspectionStatistic,
  fetchProblemsStatistic,
  fetchSubtasksByProType,
  fetchSubtask,
  fetchSubtaskSummary,
  fetchSubtaskSummaryByArea,
  fetchProblems,
};