generate-option.js
2.22 KB
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
// 标签
const tabs = [
{ label: 'tabWarn', value: 'warn' },
{ label: 'tabPush', value: 'push' }
]
const timeOption = {
warn: 'minute',
push: 'day'
}
// 勾选的参数
let warnParameter = {}
let pushParameter = {}
// 推送方式 0: 微信 1: 邮件
const sendTypeList = [
{ label: "tabWechatPush", value: 0 },
{ label: "tabEamilPush", value: 1 }
];
// 暂时提供可邮件的报表数据
const sendDataList = [
// { label: '客群分时统计', value: 'face_count_analyze'}
]
// 消息报警数据类型
const warnKey = ["mall", "gate", "device_status"];
// 消息推送数据类型
// face_data
const pushKey = ['mall', 'gate']
// 消息报警类型name 国际化 key
const warnLabelLocale = ["notifyKpiMall", "notifyKpiGate", "notifyDeviceStatus"];
const pushLabelLocale = ["notifyKpiMall", "notifyKpiGate", "faceData"];
// 关联消息报警数据类型和推送方式
// warnKey.forEach((item, index) => {
// warnParameter[item] = {
// label: warnLabelLocale[index],
// dataType: '',
// sendMethods: sendTypeList[0].value
// }
// });
// 关联消息推送数据类型和推送方式
// pushKey.forEach((item, index) => {
// pushParameter[item] = {
// label: pushLabelLocale[index],
// dataType: '',
// sendMethods: sendTypeList[0].value
// }
// if (item === 'face_data') {
// pushParameter[item].sendMethods = sendTypeList[1].value
// pushParameter[item].sendDataOpt = [sendDataList[0].value]
// }
// });
export function initWarnMessageOption() {
warnKey.forEach((item, index) => {
warnParameter[item] = {
label: warnLabelLocale[index],
dataType: '',
sendMethods: sendTypeList[0].value
}
});
}
export function initPushMessageOption() {
pushKey.forEach((item, index) => {
pushParameter[item] = {
label: pushLabelLocale[index],
dataType: '',
sendMethods: sendTypeList[0].value
}
if (item === 'face_data') {
pushParameter[item].sendMethods = sendTypeList[1].value
pushParameter[item].sendDataOpt = sendDataList[0].value ? [sendDataList[0].value] : null
}
});
}
// 初始化选项
initWarnMessageOption()
initPushMessageOption()
export {
tabs,
timeOption,
sendTypeList,
sendDataList,
warnParameter,
pushParameter
}