iot设备解绑接口调试完成
This commit is contained in:
parent
5a98e03656
commit
b192d7edb7
|
|
@ -24,6 +24,14 @@ export function getDeviceBindRecordApi(query) {
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 获取设备绑定详情
|
||||||
|
export function getDeviceBindDetailsApi(params) {
|
||||||
|
return request({
|
||||||
|
url: '/material/iotMachine/getRecordListAll',
|
||||||
|
method: 'get',
|
||||||
|
params,
|
||||||
|
})
|
||||||
|
}
|
||||||
// 解绑设备
|
// 解绑设备
|
||||||
export function unbindDeviceApi(data) {
|
export function unbindDeviceApi(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,7 @@ import {
|
||||||
deleteDeviceApi,
|
deleteDeviceApi,
|
||||||
unbindDeviceApi,
|
unbindDeviceApi,
|
||||||
getDeviceBindRecordApi,
|
getDeviceBindRecordApi,
|
||||||
|
getDeviceBindDetailsApi,
|
||||||
} from '@/api/iotDevice'
|
} from '@/api/iotDevice'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -340,13 +341,33 @@ export default {
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
}).then(async () => {
|
}).then(async () => {
|
||||||
let ApiFun = type === 1 ? deleteDeviceApi : unbindDeviceApi
|
let ApiFun =
|
||||||
let params = type === 1 ? id : { id }
|
type === 1 ? deleteDeviceApi : getDeviceBindDetailsApi
|
||||||
|
let params = type === 1 ? id : { iotId: id }
|
||||||
const res = await ApiFun(params)
|
const res = await ApiFun(params)
|
||||||
if (res.code === 200) {
|
if (type === 1 && res.code === 200) {
|
||||||
this.$message.success(`${title}成功!`)
|
this.$message.success(`${title}成功!`)
|
||||||
this.getDeviceList()
|
this.getDeviceList()
|
||||||
}
|
}
|
||||||
|
if (type === 2 && res.code === 200) {
|
||||||
|
const unbindParams = {
|
||||||
|
maCode: '',
|
||||||
|
iotId: id,
|
||||||
|
id: '',
|
||||||
|
typeId: '',
|
||||||
|
}
|
||||||
|
res.data.map((e) => {
|
||||||
|
if (!e.unBindTime) {
|
||||||
|
unbindParams.maCode = e.maCode
|
||||||
|
unbindParams.id = e.id
|
||||||
|
unbindParams.typeId = e.typeId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
unbindDeviceApi(unbindParams).then((res) => {
|
||||||
|
this.$message.success(`${title}成功!`)
|
||||||
|
this.getDeviceList()
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue