generate-option.js 2.22 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'}
]

// 消息报警数据类型
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
}