|
|
@@ -2,9 +2,9 @@ import {
|
|
|
addDevice, addSubDevice, delDevice, delDeviceMul, delDeviceTag,
|
|
|
getDeviceById, getDeviceCount, getDeviceList, getDeviceMsgList, addDeviceMsg, getDeviceTag,
|
|
|
getSubDeviceList, updateDeviceLabel, addDeviceCmd, getDeviceCmdList, addDeviceTag, addDeviceGroup,
|
|
|
- listDeviceGroup, postGroupBindDevice, delGroupBindDevice, getDeviceByGroup, getDevicePage, delSubDevice, getDeviceAttribute, getDevicShadow, getDeviceTopology, getDeviceSession, getDeviceAttributes, getDeviceSecret
|
|
|
+ listDeviceGroup, postGroupBindDevice, delGroupBindDevice, getDeviceByGroup, getDevicePage, delSubDevice, getDeviceAttribute, getDevicShadow, getDeviceTopology, getDeviceSession, getDeviceAttributes, getDeviceSecret, getOtaByDeviceId, getOtaPageByDeviceId, upgradationOtaByDeviceId
|
|
|
} from '@/api/iot/device'
|
|
|
-import { DeviceMsgEnum } from '@/enum/common'
|
|
|
+import { DeviceMsgEnum, OtaStatusEnum } from '@/enum/common'
|
|
|
import { message } from 'ant-design-vue'
|
|
|
import dayjs from 'dayjs'
|
|
|
|
|
|
@@ -45,6 +45,24 @@ export class DeviceContriller {
|
|
|
{ name: '设备名称', key: 'deviceLabel' }
|
|
|
]
|
|
|
|
|
|
+ static otaStatusMap = new Map([
|
|
|
+ [OtaStatusEnum.QUEUED, { key: OtaStatusEnum.QUEUED, label: '在消息队列中' }],
|
|
|
+ [OtaStatusEnum.SENT, { key: OtaStatusEnum.SENT, label: '已经发送' }],
|
|
|
+ [OtaStatusEnum.DELIVERED, { key: OtaStatusEnum.DELIVERED, label: '设备已收到' }],
|
|
|
+ [OtaStatusEnum.SUCCESSFUL, { key: OtaStatusEnum.SUCCESSFUL, label: '成功' }],
|
|
|
+ [OtaStatusEnum.TIMEOUT, { key: OtaStatusEnum.TIMEOUT, label: '超时' }],
|
|
|
+ [OtaStatusEnum.FAILED, { key: OtaStatusEnum.FAILED, label: '失败' }]
|
|
|
+ ])
|
|
|
+
|
|
|
+ static otaStatusList = [
|
|
|
+ { key: OtaStatusEnum.QUEUED, label: '在消息队列中' },
|
|
|
+ { key: OtaStatusEnum.SENT, label: '已经发送' },
|
|
|
+ { key: OtaStatusEnum.DELIVERED, label: '设备已收到' },
|
|
|
+ { key: OtaStatusEnum.SUCCESSFUL, label: '成功' },
|
|
|
+ { key: OtaStatusEnum.TIMEOUT, label: '超时' },
|
|
|
+ { key: OtaStatusEnum.FAILED, label: '失败' }
|
|
|
+ ]
|
|
|
+
|
|
|
static async page (params: IOT.API.DEVICE.QueryPamars) {
|
|
|
const { data: _data, sum } = await getDevicePage(params)
|
|
|
const data = _data.map(item => {
|
|
|
@@ -235,4 +253,17 @@ export class DeviceContriller {
|
|
|
static async getAttr (params: {deviceId: string, start: number, end: number}) {
|
|
|
return await getDeviceAttributes(params)
|
|
|
}
|
|
|
+
|
|
|
+ static async OtaByDeviceId (deviceId: string) {
|
|
|
+ return await getOtaByDeviceId(deviceId)
|
|
|
+ }
|
|
|
+
|
|
|
+ static async OtaPageByDeviceId (params: IOT.API.DEVICE.OtaQueryParams) {
|
|
|
+ return await getOtaPageByDeviceId(params)
|
|
|
+ }
|
|
|
+
|
|
|
+ static async upgradationOtaByDeviceId ({ deviceId, otaPkgId }: {deviceId: string, otaPkgId: string}) {
|
|
|
+ await upgradationOtaByDeviceId(deviceId, otaPkgId)
|
|
|
+ message.success('升级设备成功')
|
|
|
+ }
|
|
|
}
|