| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import {
- AlarmLevelInfo,
- SupportedAlarmStrategies
- } from '@/constant'
- import request from '@/utils/request'
- import {
- update,
- send,
- addTenant
- } from '@/api/base'
- export function getInformStrategy () {
- return send({
- url: '/tenant/informStrategy',
- method: 'GET',
- params: addTenant()
- }).then(({ data: { strategy } }) => Object.keys(strategy).sort().map(key => {
- return {
- level: key,
- name: AlarmLevelInfo[key],
- options: getStrategyOptions(strategy[key])
- }
- }))
- }
- function getStrategyOptions (strategy) {
- return SupportedAlarmStrategies.map(({ key, label }) => {
- return {
- key, label,
- value: strategy[key]
- }
- })
- }
- export function updateInformStrategy (strategy) {
- return update({
- url: '/tenant/informStrategy',
- method: 'POST',
- data: addTenant({ strategy })
- })
- }
- export const AUTORESTART = 'autorestart'
- export const UNATTEND = 'sensor_power'
- export const TEMPERATURE = 'Temperature'
- export const DEVIATION = 'Deviation'
- export const POWERTYPE = 'target_type'
- export function getTenantAttribute (key) {
- return send({
- url: '/tenant/attribute/query',
- method: 'GET',
- params: addTenant({ attributeKey: key })
- })
- }
- export function getTenantAttributeByBackground (key) {
- return request({
- url: '/tenant/attribute/query',
- method: 'GET',
- params: addTenant({ attributeKey: key })
- })
- }
- export function updateTenantAttribute (key, val) {
- return update({
- url: '/tenant/attribute/save',
- method: 'POST',
- data: addTenant({
- attributeKey: key,
- attributeValue: val
- })
- })
- }
- const REFRESH_KEY = 'refresh_online_seconds'
- export function getOnlineRefreshInterval () {
- return send({
- url: '/deviceOnlineInfoDetail/getExceptionOfflineConfig',
- method: 'GET'
- }).then(({ data }) => {
- return { data: data.find(({ paramKey }) => paramKey === REFRESH_KEY) }
- })
- }
- export function updateOnlineRefreshInterval (data) {
- return update({
- url: '/deviceOnlineInfoDetail/updateExceptionOfflineConfig',
- method: 'POST',
- data
- })
- }
|