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
| import { fetchProblemsStatistic } from '../../../services/inspection/fetchInspection';
|
| /**
| * 问题复发分析
| */
| export const useRecurrence = Behavior({
| data: {
| problemStatistic: [],
| summaryText: '',
| },
| methods: {
| fetchProblemsStatistic() {
| const { startTime, endTime, scene } = this.data;
| const params = {
| starttime: startTime,
| endtime: endTime,
| sceneId: scene.guid,
| };
| return fetchProblemsStatistic(params).then(res => {
| const problemStatistic = res.data.sort((a, b) => {
| return b.count - a.count;
| });
| this.setData({ problemStatistic });
| this.summaryAnalysis();
| return res.head;
| });
| },
|
| summaryAnalysis() {
| const { problemStatistic, recentTimeText } = this.data;
| let summaryText = '';
| if (problemStatistic.length == 0) {
| summaryText = `该场景${recentTimeText}无现场问题`;
| } else {
| let totalP = 0,
| totalC = 0;
| problemStatistic.forEach(p => {
| totalP += p.count;
| totalC += p.changeCount;
| });
| const cPer = totalP == 0 ? '--' : Math.round((totalC / totalP) * 1000) / 10 + '%';
| summaryText = `该场景${recentTimeText}共发现${problemStatistic.length}种类型问题,问题总计${totalP}个,整改率${cPer}`;
| }
| this.setData({ summaryText });
| },
| },
| });
|
|