代码优化

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" icon="el-icon-delete"
style="color: #f56c6c" style="color: #f56c6c"
@click="handleDeleteAndUnbind(row.iotId, 1)" @click="handleDeleteAndUnbind(row.iotId, 1)"
v-if="row.bindStatus === 1"
>删除</el-button >删除</el-button
> >
<el-button <el-button
@ -142,9 +143,12 @@
clearable clearable
v-model="addDeviceParams.iotType" v-model="addDeviceParams.iotType"
> >
<el-option :value="125" label="定位设备" /> <el-option
<el-option :value="126" label="其他设备" /> v-for="item in deviceTypeList"
<el-option :value="127" label="其他设备" /> :key="item.iotTypeId"
:value="item.iotTypeId"
:label="item.iotTypeName"
/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="设备编号" prop="iotCode"> <el-form-item label="设备编号" prop="iotCode">
@ -158,7 +162,7 @@
<el-form-item <el-form-item
label="设备状态: " label="设备状态: "
prop="iotStatus" prop="iotStatus"
this.dialogConfig.outerTitle="修改设备" v-if="dialogConfig.outerTitle === '修改设备'"
> >
<el-switch <el-switch
v-model="addDeviceParams.iotStatus" v-model="addDeviceParams.iotStatus"
@ -229,6 +233,7 @@ import {
unbindDeviceApi, unbindDeviceApi,
getDeviceBindRecordApi, getDeviceBindRecordApi,
getDeviceBindDetailsApi, getDeviceBindDetailsApi,
selectList,
} from '@/api/iotDevice' } from '@/api/iotDevice'
export default { export default {
components: { components: {
@ -276,6 +281,8 @@ export default {
sendParams: { sendParams: {
iotId: '', iotId: '',
}, },
//
deviceTypeList: [],
// //
selectList: [], selectList: [],
// Api // Api
@ -288,6 +295,7 @@ export default {
created() { created() {
this.getDeviceList() this.getDeviceList()
this.getDeviceTypeList()
}, },
methods: { methods: {
@ -297,6 +305,18 @@ export default {
this.deviceList = res.rows this.deviceList = res.rows
this.total = res.total 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() { handelQuery() {
this.getDeviceList(this.queryParams) this.getDeviceList(this.queryParams)