| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- import {
- addAiBoxForward,
- aiboxLevelUp,
- delAiBoxForward,
- dimensionAiBox,
- getAiBoxEvent,
- getAiBoxForward,
- getAiBoxList,
- getAiBoxPage,
- getStream,
- getSys,
- getTaskByClientId,
- getWarnOssUrl,
- reboot,
- refreshStream,
- refreshSys,
- refreshTask,
- updateAiBoxForward
- } from '@/api/cvs/aibox'
- import { getAig } from '@/api/cvs/aiboxCloud'
- import { updateForward } from '@/api/iot/rule'
- import { message } from 'ant-design-vue'
- export class AiboxController {
- static eventType: {EventType: CVS.AiBox.eventType, EventName: string}[] = [
- { EventType: '0', EventName: '人脸识别' },
- { EventType: '1', EventName: '人流统计' },
- { EventType: '2', EventName: '明烟明火' },
- { EventType: '3', EventName: '抽烟打电话' },
- { EventType: '4', EventName: '口罩检测' },
- { EventType: '5', EventName: '安全帽检测' },
- { EventType: '6', EventName: '越线监测' },
- { EventType: '7', EventName: '区域围栏' },
- { EventType: '8', EventName: '反光衣检测' },
- { EventType: '9', EventName: '电动车检测' }
- ]
- static eventTypeMap = new Map([
- ['0', '人脸识别'],
- ['1', '人流统计'],
- ['2', '明烟明火'],
- ['3', '抽烟打电话'],
- ['4', '口罩检测'],
- ['5', '安全帽检测'],
- ['6', '越线监测'],
- ['7', '区域围栏'],
- ['8', '反光衣检测'],
- ['9', '电动车检测']
- ])
- static async page (params: COMMON.API.QueryParams & {name?: string, state: 'OFFLINE' | 'ONLINE'}) {
- return await getAiBoxPage(params)
- }
- static async list () {
- const { code, data } = await getAiBoxList()
- if (code === 200) {
- return data
- }
- }
- static async dimension (data: Partial<CVS.AiBox.AiBox>) {
- const { code, msg } = await dimensionAiBox(data)
- code === 200 ? message.success('修改成功') : message.error(msg)
- }
- static async levelUp (params: {devId: string, aiId: string, version: string, file: any}) {
- const { code, data } = await aiboxLevelUp(params)
- code === 200 && data ? message.success('升级成功') : message.error('升级失败')
- }
- static async taskById (clientId: string) {
- const { code, data } = await getTaskByClientId(clientId)
- if (code === 200) {
- return data
- }
- }
- static async refreshTask (clientId: string) {
- await refreshTask(clientId)
- }
- static async stream (clientId: string) {
- const { code, data } = await getStream(clientId)
- if (code === 200) {
- return data
- }
- }
- static async refreshStream (clientId: string) {
- await refreshStream(clientId)
- }
- static async sys (clientId: string) {
- const { code, data } = await getSys(clientId)
- if (code === 200) {
- return data
- }
- }
- static async warnOssUrl () {
- const { code, data } = await getWarnOssUrl()
- if (code === 200) {
- return data
- }
- }
- static async refreshSys (clientId: string) {
- await refreshSys(clientId)
- }
- static async reboot (clientId: string) {
- const { code, msg } = await reboot(clientId)
- code === 200 ? message.success('重启成功') : message.error(msg)
- }
- static async event (params: {devId: string, eventType: CVS.AiBox.eventType, start: string, end: string}) {
- return await getAiBoxEvent(params)
- }
- static async forward () {
- return await getAiBoxForward()
- }
- static async addForward (data: CVS.AiBox.Forward) {
- const { code, msg } = await addAiBoxForward(data)
- code === 200 ? message.success('新增成功') : message.error(msg)
- }
- static async updateForward (data: CVS.AiBox.Forward) {
- const { code, msg } = await updateAiBoxForward(data)
- code === 200 ? message.success('修改成功') : message.error(msg)
- }
- static async delForward (id: string, _data: CVS.AiBox.Forward) {
- const { code, msg, data } = await delAiBoxForward(id, _data)
- code === 200 && data ? message.success('删除成功') : message.error('删除失败')
- }
- }
|