代码优化

This commit is contained in:
BianLzhaoMin 2024-08-09 15:29:09 +08:00
parent 10689a848f
commit 98d2553681
1 changed files with 24 additions and 4 deletions

View File

@ -92,6 +92,7 @@
icon="el-icon-delete"
style="color: #f56c6c"
@click="handleDeleteAndUnbind(row.iotId, 1)"
v-if="row.bindStatus === 1"
>删除</el-button
>
<el-button
@ -142,9 +143,12 @@
clearable
v-model="addDeviceParams.iotType"
>
<el-option :value="125" label="定位设备" />
<el-option :value="126" label="其他设备" />
<el-option :value="127" label="其他设备" />
<el-option
v-for="item in deviceTypeList"
:key="item.iotTypeId"
:value="item.iotTypeId"
:label="item.iotTypeName"
/>
</el-select>
</el-form-item>
<el-form-item label="设备编号" prop="iotCode">
@ -158,7 +162,7 @@
<el-form-item
label="设备状态: "
prop="iotStatus"
this.dialogConfig.outerTitle="修改设备"
v-if="dialogConfig.outerTitle === '修改设备'"
>
<el-switch
v-model="addDeviceParams.iotStatus"
@ -229,6 +233,7 @@ import {
unbindDeviceApi,
getDeviceBindRecordApi,
getDeviceBindDetailsApi,
selectList,
} from '@/api/iotDevice'
export default {
components: {
@ -276,6 +281,8 @@ export default {
sendParams: {
iotId: '',
},
//
deviceTypeList: [],
//
selectList: [],
// Api
@ -288,6 +295,7 @@ export default {
created() {
this.getDeviceList()
this.getDeviceTypeList()
},
methods: {
@ -297,6 +305,18 @@ export default {
this.deviceList = res.rows
this.total = res.total
},
//** */
async getDeviceTypeList() {
try {
const res = await selectList()
// this.typeOptions = res.data
console.log(res, '设备类型获取成功')
this.deviceTypeList = res.data
} catch (err) {
console.log('🚀 ~ getIotType ~ err:', err)
}
},
/** 搜索按钮 */
handelQuery() {
this.getDeviceList(this.queryParams)