iot设备修改调试
This commit is contained in:
parent
dddc269455
commit
177a61327c
|
|
@ -12,7 +12,7 @@
|
||||||
<el-button size="mini" type="primary" @click="handelQuery()"
|
<el-button size="mini" type="primary" @click="handelQuery()"
|
||||||
>搜索</el-button
|
>搜索</el-button
|
||||||
>
|
>
|
||||||
<el-button size="mini" type="primary" @click="addDevice()"
|
<el-button size="mini" type="primary" @click="addDevice(null)"
|
||||||
>添加设备</el-button
|
>添加设备</el-button
|
||||||
>
|
>
|
||||||
<el-button size="mini" type="primary" @click="uploadCode()"
|
<el-button size="mini" type="primary" @click="uploadCode()"
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="二维码">
|
<el-table-column align="center" label="二维码">
|
||||||
<template slot-scope="{ row }">
|
<template slot-scope="{ row }">
|
||||||
<el-button type="text" size="small" @click="showQrCode(row)"
|
<el-button type="text" @click="showQrCode(row)"
|
||||||
>查看</el-button
|
>查看</el-button
|
||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -94,6 +94,13 @@
|
||||||
@click="handleDeleteAndUnbind(row.iotId, 1)"
|
@click="handleDeleteAndUnbind(row.iotId, 1)"
|
||||||
>删除</el-button
|
>删除</el-button
|
||||||
>
|
>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
style="color: #67c23a"
|
||||||
|
@click="addDevice(row)"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
<el-button
|
<el-button
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-document-delete"
|
icon="el-icon-document-delete"
|
||||||
|
|
@ -121,7 +128,7 @@
|
||||||
>
|
>
|
||||||
<!-- 设备添加表单 -->
|
<!-- 设备添加表单 -->
|
||||||
<template slot="outerContent">
|
<template slot="outerContent">
|
||||||
<template v-if="dialogConfig.outerTitle === '添加设备'">
|
<template v-if="dialogConfig.outerTitle !== '绑定记录'">
|
||||||
<el-form
|
<el-form
|
||||||
label-width="80px"
|
label-width="80px"
|
||||||
:model="addDeviceParams"
|
:model="addDeviceParams"
|
||||||
|
|
@ -172,12 +179,34 @@
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</DialogModel>
|
</DialogModel>
|
||||||
|
|
||||||
|
<!-- 二维码弹框 -->
|
||||||
|
<el-dialog
|
||||||
|
title="查看二维码"
|
||||||
|
:visible.sync="uploadOpen"
|
||||||
|
v-if="uploadOpen"
|
||||||
|
width="500px"
|
||||||
|
append-to-body
|
||||||
|
>
|
||||||
|
<div style="text-align: center">
|
||||||
|
<div class="qrCodeImg">
|
||||||
|
<div id="qrcode" class="qrcode" ref="codeItem"></div>
|
||||||
|
</div>
|
||||||
|
<div class="maCode">二维码编号:{{ rowObj.qrCode }}</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
slot="footer"
|
||||||
|
class="dialog-footer"
|
||||||
|
style="text-align: center"
|
||||||
|
></div>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import DialogModel from '@/components/DialogModel' // 弹框组件
|
import DialogModel from '@/components/DialogModel' // 弹框组件
|
||||||
import TableModel from '@/components/TableModel' // 表格组件
|
import TableModel from '@/components/TableModel' // 表格组件
|
||||||
|
import QRCode from 'qrcodejs2'
|
||||||
import { dialogConfig } from './config'
|
import { dialogConfig } from './config'
|
||||||
import {
|
import {
|
||||||
addDeviceInfoApi,
|
addDeviceInfoApi,
|
||||||
|
|
@ -204,7 +233,7 @@ export default {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
keyWords: '',
|
keyWords: '',
|
||||||
},
|
},
|
||||||
// 新增给设备数据源
|
// 新增/修改 设备数据源
|
||||||
addDeviceParams: {
|
addDeviceParams: {
|
||||||
iotType: '',
|
iotType: '',
|
||||||
iotCode: '',
|
iotCode: '',
|
||||||
|
|
@ -236,6 +265,9 @@ export default {
|
||||||
selectList: [],
|
selectList: [],
|
||||||
// 绑定记录Api
|
// 绑定记录Api
|
||||||
getDeviceBindRecordApi,
|
getDeviceBindRecordApi,
|
||||||
|
uploadOpen: false,
|
||||||
|
rowObj: {},
|
||||||
|
qrCode: '',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -252,12 +284,18 @@ export default {
|
||||||
},
|
},
|
||||||
/** 搜索按钮 */
|
/** 搜索按钮 */
|
||||||
handelQuery() {
|
handelQuery() {
|
||||||
this.getDeviceList()
|
this.getDeviceList(this.queryParams)
|
||||||
},
|
},
|
||||||
/** 添加设备 */
|
/** 添加设备 */
|
||||||
addDevice() {
|
addDevice(row) {
|
||||||
|
if (!row) {
|
||||||
|
this.dialogConfig.outerTitle = '添加设备'
|
||||||
|
} else {
|
||||||
|
this.dialogConfig.outerTitle = '修改设备'
|
||||||
|
this.addDeviceParams.iotCode = row.iotCode
|
||||||
|
this.addDeviceParams.iotType = parseInt(row.iotType)
|
||||||
|
}
|
||||||
this.dialogConfig.outerWidth = '40%'
|
this.dialogConfig.outerWidth = '40%'
|
||||||
this.dialogConfig.outerTitle = '添加设备'
|
|
||||||
this.dialogConfig.outerVisible = true
|
this.dialogConfig.outerVisible = true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -278,9 +316,12 @@ export default {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
// 1. 校验通过调后台Api
|
// 1. 校验通过调后台Api
|
||||||
const res = await addDeviceInfoApi(this.addDeviceParams)
|
const res = await addDeviceInfoApi(this.addDeviceParams)
|
||||||
|
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
this.$message.success('新增成功!')
|
let title =
|
||||||
|
this.dialogConfig.outerTitle === '添加设备'
|
||||||
|
? '新增'
|
||||||
|
: '修改'
|
||||||
|
this.$message.success(`${title}成功!`)
|
||||||
this.dialogConfig.outerVisible = false
|
this.dialogConfig.outerVisible = false
|
||||||
this.addDeviceParams.iotType = ''
|
this.addDeviceParams.iotType = ''
|
||||||
this.addDeviceParams.iotCode = ''
|
this.addDeviceParams.iotCode = ''
|
||||||
|
|
@ -346,8 +387,41 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/** 查看二维码 */
|
/** 查看二维码 */
|
||||||
showQrCode() {},
|
showQrCode(row) {
|
||||||
|
if (!row.qrCode) {
|
||||||
|
this.$message.error('当前设备没有二维码')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.rowObj = row
|
||||||
|
this.uploadOpen = true
|
||||||
|
this.qrCode = row.qrCode
|
||||||
|
let str = this.qrUrl + row.qrCode
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.codeItem.innerHTML = ''
|
||||||
|
let qrCode = new QRCode(this.$refs.codeItem, {
|
||||||
|
text: str, //二维码内容
|
||||||
|
width: 256,
|
||||||
|
height: 256,
|
||||||
|
colorDark: '#000000',
|
||||||
|
colorLight: '#ffffff',
|
||||||
|
correctLevel: QRCode.CorrectLevel.H,
|
||||||
|
})
|
||||||
|
}, 500)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.qrCodeImg {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.maCode {
|
||||||
|
margin-top: 15px;
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue