代码合并
This commit is contained in:
parent
9a55ef1441
commit
9808a3d03c
|
|
@ -107,7 +107,12 @@
|
|||
style="width: 280px"
|
||||
@change="changeIotType"
|
||||
>
|
||||
<el-option label="定位设备" :value="125" />
|
||||
<el-option
|
||||
v-for="item in typeOptions"
|
||||
:key="item.iotTypeId"
|
||||
:label="item.iotTypeName"
|
||||
:value="item.iotTypeId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备编号" prop="iotId">
|
||||
|
|
@ -139,7 +144,12 @@
|
|||
|
||||
<script>
|
||||
import PageHeader from '@/components/pageHeader'
|
||||
import { selectList, bindIot, getTypeList, unbindIot } from '@/api/iotDevice'
|
||||
import {
|
||||
selectList,
|
||||
bindIot,
|
||||
getTypeList,
|
||||
unbindIot,
|
||||
} from '@/api/store/iotManagement'
|
||||
|
||||
export default {
|
||||
name: 'BindIOT',
|
||||
|
|
@ -189,6 +199,8 @@ export default {
|
|||
},
|
||||
],
|
||||
},
|
||||
|
||||
typeList: [],
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
|
@ -214,6 +226,9 @@ export default {
|
|||
const res = await getTypeList(params)
|
||||
this.tableData = res.rows
|
||||
this.total = res.total
|
||||
this.tableData.forEach((e) => {
|
||||
this.typeList.push(e.iotType)
|
||||
})
|
||||
} catch (err) {
|
||||
console.log('🚀 ~ getList ~ err:', err)
|
||||
}
|
||||
|
|
@ -233,6 +248,7 @@ export default {
|
|||
},
|
||||
// 解绑
|
||||
handleUnbind(row) {
|
||||
this.typeList = this.typeList.filter((e) => e != row.iotType)
|
||||
console.log('🚀 ~ handleUnbind ~ 解绑', row)
|
||||
try {
|
||||
const params = {
|
||||
|
|
@ -292,15 +308,23 @@ export default {
|
|||
},
|
||||
// 获取下拉
|
||||
async getIotType() {
|
||||
// try {
|
||||
// const res = await selectList()
|
||||
// this.typeOptions = res.data
|
||||
// } catch (err) {
|
||||
// console.log('🚀 ~ getIotType ~ err:', err)
|
||||
// }
|
||||
try {
|
||||
const res = await selectList()
|
||||
this.typeOptions = res.data
|
||||
} catch (err) {
|
||||
console.log('🚀 ~ getIotType ~ err:', err)
|
||||
}
|
||||
},
|
||||
// 设备类型改变
|
||||
async changeIotType(iotTypeId) {
|
||||
const isType = this.typeList.some((e) => e == iotTypeId)
|
||||
if (isType) {
|
||||
this.$message.error(
|
||||
'当前机具已绑定改IOT类型设备,不可重复绑定!',
|
||||
)
|
||||
this.codeOptions = []
|
||||
return
|
||||
}
|
||||
try {
|
||||
this.codeOptions = []
|
||||
this.IOTForm.iotId = ''
|
||||
|
|
|
|||
Loading…
Reference in New Issue