zmc
2023-11-14 0ee16e9f5dd31c6c98df1a5fdcf081c8eb7f80df
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
// import rank from '@/utils/risk_estimate_common_function/rank.js';
// import dayjs from 'dayjs.js';
 
 
 
export default {
 
    // // 计算日风险值
    // calDailyRisk(allTypeRiskValue){
    //     let dailyRiskValue = allTypeRiskValue.onlineRisk*0.1 + allTypeRiskValue.validRisk*0.2 + allTypeRiskValue.exceedingRisk*0.2 + allTypeRiskValue.exceptionTypeAggregation*0.2 + allTypeRiskValue.typicalExceptionRepetitionRate*0.3
    //     return dailyRiskValue
    // },
 
    // // 计算月风险值
    // calMonthRisk(DailyRiskValues,month){
    //     // 根据月份获得该月的天数
    //     let dayNum = dayjs(month).daysInMonth() 
    //     // 累加日风险值
    //     let sum = 0
    //     for(let i in DailyRiskValues){
    //         sum += i
    //     }
    //     // 日异常类型聚集率的和/当月天数
    //     let monthRiskValue = sum /dayNum
    //     return monthRiskValue
    // },
 
    // calRiskValue(allTypeRiskValue,queryMonth){
    //     // 对设备编号进行分组
    //     let groupeObj =  rank.groupByMncode(allTypeRiskValue)
    //     // 
    //     for (let mnCode in groupeObj){
    //         // 获得设备编号对应的数据
    //         let dayData = groupeObj[mnCode]
 
    //         // 保存某设备编号该段时间的日风险值
    //         let dailyRiskValues = []
    //         // 计算日风险值
    //         for(let item in dayData){
    //             let dailyRiskValue = this.calDailyRisk(item)
    //             dailyRiskValues.push(dailyRiskValue)
    //         }
    //     }
 
    // }
 
    // 计算月度风险值
    calMonthlyRiskValue(exceptionRiskValue){
        // 保存月度风险值
        let monthlyRiskValue = []
        // 计算每个站点的月度风险值
        for(let item in exceptionRiskValue){
            let value = item.onlineRisk*0.1 + item.validRisk*0.2 + item.exceedingRisk*0.2 + item.exceptionTypeAggregation*0.2 + item.typicalExceptionRepetitionRate*0.3
            monthlyRiskValue.push(value)
        }
        return monthlyRiskValue 
    }
 
}