代码合并

This commit is contained in:
BianLzhaoMin 2024-08-09 10:09:29 +08:00
parent 9a55ef1441
commit 9808a3d03c
1 changed files with 32 additions and 8 deletions

View File

@ -107,7 +107,12 @@
style="width: 280px" style="width: 280px"
@change="changeIotType" @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-select>
</el-form-item> </el-form-item>
<el-form-item label="设备编号" prop="iotId"> <el-form-item label="设备编号" prop="iotId">
@ -139,7 +144,12 @@
<script> <script>
import PageHeader from '@/components/pageHeader' import PageHeader from '@/components/pageHeader'
import { selectList, bindIot, getTypeList, unbindIot } from '@/api/iotDevice' import {
selectList,
bindIot,
getTypeList,
unbindIot,
} from '@/api/store/iotManagement'
export default { export default {
name: 'BindIOT', name: 'BindIOT',
@ -189,6 +199,8 @@ export default {
}, },
], ],
}, },
typeList: [],
} }
}, },
created() { created() {
@ -214,6 +226,9 @@ export default {
const res = await getTypeList(params) const res = await getTypeList(params)
this.tableData = res.rows this.tableData = res.rows
this.total = res.total this.total = res.total
this.tableData.forEach((e) => {
this.typeList.push(e.iotType)
})
} catch (err) { } catch (err) {
console.log('🚀 ~ getList ~ err:', err) console.log('🚀 ~ getList ~ err:', err)
} }
@ -233,6 +248,7 @@ export default {
}, },
// //
handleUnbind(row) { handleUnbind(row) {
this.typeList = this.typeList.filter((e) => e != row.iotType)
console.log('🚀 ~ handleUnbind ~ 解绑', row) console.log('🚀 ~ handleUnbind ~ 解绑', row)
try { try {
const params = { const params = {
@ -292,15 +308,23 @@ export default {
}, },
// //
async getIotType() { async getIotType() {
// try { try {
// const res = await selectList() const res = await selectList()
// this.typeOptions = res.data this.typeOptions = res.data
// } catch (err) { } catch (err) {
// console.log('🚀 ~ getIotType ~ err:', err) console.log('🚀 ~ getIotType ~ err:', err)
// } }
}, },
// //
async changeIotType(iotTypeId) { async changeIotType(iotTypeId) {
const isType = this.typeList.some((e) => e == iotTypeId)
if (isType) {
this.$message.error(
'当前机具已绑定改IOT类型设备不可重复绑定',
)
this.codeOptions = []
return
}
try { try {
this.codeOptions = [] this.codeOptions = []
this.IOTForm.iotId = '' this.IOTForm.iotId = ''