generate-option.js 2.73 KB
// 标签
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', dataType: null },
    { label: '门店客群统计', value: 'face_analyze', dataType: null },
    { label: '门店客群统计2', value: 'mall_hour_count_data', dataType: null }
]

// 消息报警数据类型
const warnKey = ["device_status", "mall", "gate", "other_gate", "gate_data_fluctuate", "contract_remind"];
// 消息推送数据类型
const pushKey = ['mall', 'gate', 'main_store', 'face_data']
    // 消息报警类型name 国际化 key
const warnLabelLocale = ["deviceOffline", "mallLackData", "peripheralMonitoryPointLackData", "nonPeripheralMonitoryPointLackData", "peripheralMonitoryPoint", "contractRemind"];
const pushLabelLocale = ["mallData", "peripheralMonitoryPointData", "mainData", "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]
        }
    });
}

// 初始化选项
// initWarnMessageOption()
// initPushMessageOption()

export {
    tabs,
    timeOption,
    sendTypeList,
    sendDataList,
    warnParameter,
    pushParameter,

    warnKey,
    pushKey,
    warnLabelLocale,
    pushLabelLocale
}