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