|
|
@@ -2,7 +2,7 @@ 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, getOtaByDeviceId, getOtaPageByDeviceId, upgradationOtaByDeviceId
|
|
|
+ listDeviceGroup, postGroupBindDevice, delGroupBindDevice, getDeviceByGroup, getDevicePage, delSubDevice, getDeviceAttribute, getDevicShadow, getDeviceTopology, getDeviceSession, getDeviceAttributes, getDeviceSecret, getOtaByDeviceId, otaUpgradationRecordByDeviceId, upgradationOtaByDeviceId
|
|
|
} from '@/api/iot/device'
|
|
|
import { DeviceMsgEnum, OtaStatusEnum } from '@/enum/common'
|
|
|
import { message } from 'ant-design-vue'
|
|
|
@@ -77,13 +77,23 @@ export class DeviceContriller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- static async list (params: {modelId: string, deviceLabel: string, limit: number, lastId: string } = {
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param deviceStatus 传递对应的key,就只会返回对应状态的设备,不填写返回全部
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+ static async list (params: {modelId: string, deviceLabel: string, limit: number, lastId: string, deviceStatus: 'INIT' | 'CONNECT' | 'DISCONNECT' | 'DISABLED' | ''} = {
|
|
|
modelId: '',
|
|
|
deviceLabel: '',
|
|
|
limit: 10000,
|
|
|
- lastId: ''
|
|
|
+ lastId: '',
|
|
|
+ deviceStatus: ''
|
|
|
}) {
|
|
|
- return await getDeviceList(params)
|
|
|
+ const data = await getDeviceList(params)
|
|
|
+ return {
|
|
|
+ ...data,
|
|
|
+ data: params.deviceStatus === '' ? data.data : data.data.filter(item => item.deviceStatus === params.deviceStatus)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
static async post (data: IOT.API.DEVICE.BodyParams) {
|
|
|
@@ -269,8 +279,12 @@ export class DeviceContriller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- static async OtaPageByDeviceId (params: IOT.API.DEVICE.OtaQueryParams) {
|
|
|
- return await getOtaPageByDeviceId(params)
|
|
|
+ static async OtaUpgradationRecordByDeviceId (params: IOT.API.DEVICE.OtaQueryParams) {
|
|
|
+ const data = await otaUpgradationRecordByDeviceId(params)
|
|
|
+ return {
|
|
|
+ ...data,
|
|
|
+ data: data.data.map(item => ({ ...item, otaTime: dayjs(item.otaTime).format('YYYY-MM-DD HH:mm:ss') }))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
static async upgradationOtaByDeviceId ({ deviceId, otaPkgId }: {deviceId: string, otaPkgId: string}) {
|