| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- import {
- add,
- update,
- send
- } from '@/api/base'
- import {
- AlarmStrategy,
- AlarmStrategies
- } from '@/constant'
- const AlarmLevel = {
- 0: '提示性预警',
- 1: '中级预警',
- 2: '紧急预警'
- }
- export function getInformStrategy (tenant) {
- return send({
- url: '/tenant/informStrategy',
- method: 'GET',
- params: { tenant }
- }).then(({ data: { strategy } }) => Object.keys(strategy).sort().map(key => {
- return {
- level: key,
- name: AlarmLevel[key],
- options: getStrategyOptions(strategy[key])
- }
- }))
- }
- function getStrategyOptions (strategy) {
- return AlarmStrategies.map(key => {
- return {
- key,
- label: AlarmStrategy[key],
- value: strategy[key]
- }
- })
- }
- export function updateInformStrategy (tenant, strategy) {
- return update({
- url: '/tenant/informStrategy',
- method: 'POST',
- data: {
- tenant,
- strategy
- }
- })
- }
- export function getTenantServiceConfig (tenant, type) {
- return send({
- url: '/device/deviceAudit/tenant/serviceConfig',
- method: 'GET',
- params: { tenant, type }
- })
- }
- export function addTenantServiceConfig (data) {
- return add({
- url: '/device/deviceAudit/tenant/serviceConfig',
- method: 'POST',
- data
- })
- }
- export function updateTenantServiceConfig (data) {
- return update({
- url: '/device/deviceAudit/tenant/serviceConfig',
- method: 'PUT',
- data
- })
- }
|