From a9c3b58642a927b4745bfa4d167f374cd46a04d6 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 28 Oct 2024 10:51:56 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E5=B8=83?= =?UTF-8?q?=E9=98=B2/=E6=92=A4=E9=98=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web_src/src/components/DeviceList.vue | 68 ++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 2 deletions(-) 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 + }) + }); + }, } };