|
|
@@ -97,8 +97,8 @@ export class DeviceContriller {
|
|
|
}
|
|
|
|
|
|
static async post (data: IOT.API.DEVICE.BodyParams) {
|
|
|
- await addDevice(data)
|
|
|
- message.success('新增成功')
|
|
|
+ const { code } = await addDevice(data)
|
|
|
+ if (code === 200) message.success('新增成功')
|
|
|
}
|
|
|
|
|
|
static async del (id: string | string[]) {
|
|
|
@@ -127,13 +127,13 @@ export class DeviceContriller {
|
|
|
|
|
|
/** 新增子设备 */
|
|
|
static async postSub (data: IOT.API.DEVICE.SubBodyParams) {
|
|
|
- await addSubDevice(data)
|
|
|
- message.success('新增成功')
|
|
|
+ const { code } = await addSubDevice(data)
|
|
|
+ if (code === 200) message.success('新增成功')
|
|
|
}
|
|
|
|
|
|
static async delSub (id: string) {
|
|
|
- await delSubDevice(id)
|
|
|
- message.success('删除成功')
|
|
|
+ const { code } = await delSubDevice(id)
|
|
|
+ if (code === 200) message.success('删除成功')
|
|
|
}
|
|
|
|
|
|
static async ListTag (params: {deviceId: number | string}) {
|
|
|
@@ -141,18 +141,18 @@ export class DeviceContriller {
|
|
|
}
|
|
|
|
|
|
static async delTag (id: string) {
|
|
|
- await delDeviceTag(id)
|
|
|
- message.success('删除标签成功')
|
|
|
+ const { code } = await delDeviceTag(id)
|
|
|
+ if (code === 200) message.success('删除标签成功')
|
|
|
}
|
|
|
|
|
|
static async postTag (data: IOT.API.DEVICE.DeviceTag[]) {
|
|
|
- await addDeviceTag(data)
|
|
|
- message.success('新增标签成功')
|
|
|
+ const { code } = await addDeviceTag(data)
|
|
|
+ if (code === 200) message.success('新增标签成功')
|
|
|
}
|
|
|
|
|
|
static async updateLabel (data: {id: string, deviceLabel: string}) {
|
|
|
- await updateDeviceLabel(data)
|
|
|
- message.success('修改设备名称成功')
|
|
|
+ const { code } = await updateDeviceLabel(data)
|
|
|
+ if (code === 200) message.success('修改设备名称成功')
|
|
|
}
|
|
|
|
|
|
static async count () {
|
|
|
@@ -193,14 +193,14 @@ export class DeviceContriller {
|
|
|
|
|
|
/** 命令下发 新增命令 */
|
|
|
static async addDeviceCmd (data: { deviceId: string, cmdLabel: string, cmdParameters: any}) {
|
|
|
- await addDeviceCmd(data)
|
|
|
- message.success('新增命令成功')
|
|
|
+ const { code } = await addDeviceCmd(data)
|
|
|
+ if (code === 200) message.success('新增命令成功')
|
|
|
}
|
|
|
|
|
|
/** 设备分组 新增分组 */
|
|
|
static async postDeviceGroup (data: { groupLabel: string, upperGroupId: string }) {
|
|
|
- await addDeviceGroup(data)
|
|
|
- message.success('新增分组成功')
|
|
|
+ const { code } = await addDeviceGroup(data)
|
|
|
+ if (code === 200) message.success('新增分组成功')
|
|
|
}
|
|
|
|
|
|
/** 设备分组 查询分组 */
|
|
|
@@ -210,8 +210,8 @@ export class DeviceContriller {
|
|
|
|
|
|
/** 设备分组 设备绑定分组 */
|
|
|
static async postGroupBindDevice (data: { deviceGroupId: string, deviceId: string }[]) {
|
|
|
- await postGroupBindDevice(data)
|
|
|
- message.success('绑定成功')
|
|
|
+ const { code } = await postGroupBindDevice(data)
|
|
|
+ if (code === 200) message.success('绑定成功')
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -219,8 +219,8 @@ export class DeviceContriller {
|
|
|
* @param data - 参数 `data` 是一个包含两个属性的对象:
|
|
|
*/
|
|
|
static async delGroupBindDevice (data: { deviceGroupId: string, deviceId: string }[]) {
|
|
|
- await delGroupBindDevice(data)
|
|
|
- message.success('取消绑定成功')
|
|
|
+ const { code } = await delGroupBindDevice(data)
|
|
|
+ if (code === 200) message.success('取消绑定成功')
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -266,7 +266,6 @@ export class DeviceContriller {
|
|
|
|
|
|
static async OtaByDeviceId (deviceId: string) {
|
|
|
const data = await getOtaByDeviceId(deviceId)
|
|
|
- console.log('data.data.otaPkgLabel:', data.data.otaPkgLabel === '--')
|
|
|
|
|
|
return {
|
|
|
...data,
|