diff --git a/web_src/src/components/DeviceList.vue b/web_src/src/components/DeviceList.vue index c8db798f..820f2fc9 100755 --- a/web_src/src/components/DeviceList.vue +++ b/web_src/src/components/DeviceList.vue @@ -80,6 +80,18 @@ 编辑 删除 + + + + 操作 + + + + 布防 + + 撤防 + + @@ -319,8 +331,60 @@ export default { } }).catch( (error)=> { }); - } - + }, + moreClick: function (command, itemData) { + if (command === "setGuard") { + this.setGuard(itemData) + }else if (command === "resetGuard") { + this.resetGuard(itemData) + } + }, + setGuard: function (itemData) { + this.$axios({ + method: 'get', + url: `/api/device/control/guard/${itemData.deviceId}/SetGuard`, + }).then( (res)=> { + if (res.data.code === 0) { + this.$message.success({ + showClose: true, + message: "布防命令已发送" + }) + }else { + this.$message.error({ + showClose: true, + message: res.data.msg + }) + } + }).catch( (error)=> { + this.$message.error({ + showClose: true, + message: error.message + }) + }); + }, + resetGuard: function (itemData) { + this.$axios({ + method: 'get', + url: `/api/device/control/guard/${itemData.deviceId}/ResetGuard`, + }).then( (res)=> { + if (res.data.code === 0) { + this.$message.success({ + showClose: true, + message: "撤防命令已发送" + }) + }else { + this.$message.error({ + showClose: true, + message: res.data.msg + }) + } + }).catch( (error)=> { + this.$message.error({ + showClose: true, + message: error.message + }) + }); + }, } };