Commit a1f3b701 by YG8999

设备网关绑定从设备

parent 652a017c
...@@ -42,3 +42,22 @@ export function delGateway(id) { ...@@ -42,3 +42,22 @@ export function delGateway(id) {
method: 'delete' method: 'delete'
}) })
} }
// 绑定网关下所有设备
export function addGatewayDevice(data) {
return request({
url: '/system/gateway/addGatewayDevice',
method: 'post',
data: data
})
}
// 清除网关下所有设备
export function clearGatewayDevice(data) {
return request({
url: '/system/gateway/clearGatewayDevice',
method: 'post',
data: data
})
}
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
<el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="70" align="center"/> <el-table-column type="selection" width="70" align="center"/>
<!-- <el-table-column label="${comment}" align="center" prop="id" />--> <!-- <el-table-column label="${comment}" align="center" prop="id" />-->
<el-table-column label="设备名称" align="center" prop="devName"/> <el-table-column label="设备名称" align="center" prop="devName" width="210px"/>
<!-- <el-table-column label="设备MAC" align="center" prop="devMac"/>--> <!-- <el-table-column label="设备MAC" align="center" prop="devMac"/>-->
<el-table-column label="设备ID" align="center" prop="devId"/> <el-table-column label="设备ID" align="center" prop="devId"/>
<el-table-column label="设备密码" align="center" prop="devPsw"/> <el-table-column label="设备密码" align="center" prop="devPsw"/>
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
</el-table-column> </el-table-column>
<!-- <el-table-column label="项目ID" align="center" prop="projtId"/>--> <!-- <el-table-column label="项目ID" align="center" prop="projtId"/>-->
<!-- <el-table-column label="项目密码" align="center" prop="projtPsw"/>--> <!-- <el-table-column label="项目密码" align="center" prop="projtPsw"/>-->
<el-table-column label="分组" align="center" prop="group"/> <el-table-column label="分组" align="center" prop="group" width="120px"/>
<el-table-column label="设备状态" align="center" prop="status"> <el-table-column label="设备状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.device_status" :value="scope.row.status"/> <dict-tag :options="dict.type.device_status" :value="scope.row.status"/>
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
<!-- <el-table-column label="设备位置" align="center" prop="devPosition"/>--> <!-- <el-table-column label="设备位置" align="center" prop="devPosition"/>-->
<el-table-column label="电量" align="center" prop="voltage"/> <el-table-column label="电量" align="center" prop="voltage"/>
<el-table-column label="信号值" align="center" prop="signalValue"/> <el-table-column label="信号值" align="center" prop="signalValue"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
<el-button v-if="scope.row.devType=='CCEE'" <el-button v-if="scope.row.devType=='CCEE'"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-switch" icon="el-icon-open"
@click="openOrClose(scope.row, '10')" @click="openOrClose(scope.row, '10')"
v-hasPermi="['system:device:edit']" v-hasPermi="['system:device:edit']"
>开门 >开门
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
<el-button v-if="scope.row.devType=='CCEE'" <el-button v-if="scope.row.devType=='CCEE'"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-switch" icon="el-icon-turn-off"
@click="openOrClose(scope.row, '30')" @click="openOrClose(scope.row, '30')"
v-hasPermi="['system:device:edit']" v-hasPermi="['system:device:edit']"
>关门 >关门
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
<el-button v-if="scope.row.devType=='0001'" <el-button v-if="scope.row.devType=='0001'"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-switch" icon="el-icon-switch-button"
@click="openOrClose(scope.row, '20')" @click="openOrClose(scope.row, '20')"
v-hasPermi="['system:device:edit']" v-hasPermi="['system:device:edit']"
>取电 >取电
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
<el-button v-if="scope.row.devType=='0001'" <el-button v-if="scope.row.devType=='0001'"
size="mini" size="mini"
type="text" type="text"
icon="el-icon-switch" icon="el-icon-switch-button"
@click="openOrClose(scope.row, '40')" @click="openOrClose(scope.row, '40')"
v-hasPermi="['system:device:edit']" v-hasPermi="['system:device:edit']"
>断电 >断电
......
...@@ -144,10 +144,10 @@ ...@@ -144,10 +144,10 @@
<el-table v-loading="loading" :data="gatewayList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="gatewayList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="${comment}" align="center" prop="id" />--> <!-- <el-table-column label="${comment}" align="center" prop="id" />-->
<el-table-column label="设备名称" align="center" prop="devName" /> <el-table-column label="设备名称" align="center" prop="devName" width="240px"/>
<el-table-column label="设备 MAC" align="center" prop="devMac" /> <el-table-column label="设备MAC" align="center" prop="devMac" width="130px"/>
<el-table-column label="设备ID" align="center" prop="devId" /> <el-table-column label="设备ID" align="center" prop="devId" width="130px"/>
<el-table-column label="设备密码" align="center" prop="devPsw" /> <el-table-column label="设备密码" align="center" prop="devPsw" width="100px"/>
<el-table-column label="版本号" align="center" prop="devVer"/> <el-table-column label="版本号" align="center" prop="devVer"/>
<el-table-column label="设备类型" align="center" prop="devType"> <el-table-column label="设备类型" align="center" prop="devType">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="网络分组" align="center" prop="group" /> <el-table-column label="网络分组" align="center" prop="group" width="120px"/>
<!-- <el-table-column label="设备状态" align="center" prop="status" />--> <!-- <el-table-column label="设备状态" align="center" prop="status" />-->
<!-- <el-table-column label="mqtt服务器IP/域名" align="center" prop="mqttIp" />--> <!-- <el-table-column label="mqtt服务器IP/域名" align="center" prop="mqttIp" />-->
<!-- <el-table-column label="mqtt服务器端口" align="center" prop="mqttPort" />--> <!-- <el-table-column label="mqtt服务器端口" align="center" prop="mqttPort" />-->
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
<!-- <el-table-column label="mqtt用户密码" align="center" prop="mqttPaswd" />--> <!-- <el-table-column label="mqtt用户密码" align="center" prop="mqttPaswd" />-->
<!-- <el-table-column label="备注" align="center" prop="remark" />--> <!-- <el-table-column label="备注" align="center" prop="remark" />-->
<!-- <el-table-column label="设备位置" align="center" prop="devPosition" />--> <!-- <el-table-column label="设备位置" align="center" prop="devPosition" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="260px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
...@@ -179,6 +179,21 @@ ...@@ -179,6 +179,21 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:gateway:remove']" v-hasPermi="['system:gateway:remove']"
>删除</el-button> >删除</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-remove-outline"
@click="clearGatewayDevice(scope.row)"
v-hasPermi="['system:gateway:edit']"
>清除设备</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-circle-plus-outline"
@click="addGatewayDevice(scope.row)"
v-hasPermi="['system:gateway:edit']"
>绑定设备</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -258,7 +273,7 @@ ...@@ -258,7 +273,7 @@
</template> </template>
<script> <script>
import { listGateway, getGateway, delGateway, addGateway, updateGateway } from "@/api/system/gateway"; import { listGateway, getGateway, delGateway, addGateway, updateGateway, addGatewayDevice, clearGatewayDevice } from "@/api/system/gateway";
import selectStore from "../device/selectStore.vue"; import selectStore from "../device/selectStore.vue";
export default { export default {
...@@ -292,16 +307,10 @@ export default { ...@@ -292,16 +307,10 @@ export default {
devName: null, devName: null,
devMac: null, devMac: null,
devId: null, devId: null,
devPsw: null,
devVer: null, devVer: null,
devType: null, devType: null,
group: null, group: null,
status: null, status: null
mqttIp: null,
mqttPort: null,
mqttUser: null,
mqttPaswd: null,
devPosition: null
}, },
// 表单参数 // 表单参数
form: {}, form: {},
...@@ -440,6 +449,24 @@ export default { ...@@ -440,6 +449,24 @@ export default {
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
}, },
/** 绑定网关下所有设备 */
addGatewayDevice(row) {
this.$modal.confirm('是否绑定网关MAC为"' + row.devMac + '"的从设备?').then(function() {
return addGatewayDevice(row);
}).then(() => {
this.getList();
this.$modal.msgSuccess("绑定网关从设备成功");
}).catch(() => {});
},
/** 清除网关下所有设备 */
clearGatewayDevice(row) {
this.$modal.confirm('是否清除网关MAC为"' + row.devMac + '"的从设备?').then(function() {
return clearGatewayDevice(row);
}).then(() => {
this.getList();
this.$modal.msgSuccess("清除网关从设备成功");
}).catch(() => {});
},
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('system/gateway/export', { this.download('system/gateway/export', {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment