From a1cf42d1fe6d95a6f910e88c35bcc6c3ec341e02 Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Wed, 15 Oct 2025 17:11:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E9=AB=98=E9=A3=8E=E9=99=A9=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=8F=90=E4=BE=9B=E5=AE=89=E5=85=A8=E4=BF=9D=E9=9A=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/memorial/adminMemorial.vue | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pages/memorial/adminMemorial.vue b/pages/memorial/adminMemorial.vue index e5c4245..1766ba8 100644 --- a/pages/memorial/adminMemorial.vue +++ b/pages/memorial/adminMemorial.vue @@ -106,6 +106,20 @@ export default { return true; }, + // 确认提示封装,返回是否确认 + async confirmAction(message) { + const res = await new Promise((resolve) => { + uni.showModal({ + title: "确认操作", + content: message, + confirmText: "确认", + cancelText: "取消", + success: (r) => resolve(r), + }); + }); + return !!(res && res.confirm); + }, + // 通用 PUT 请求封装:包含 Loading 与结果提示 async performPut(url, data, logTag = "performPut") { uni.showLoading({ title: "处理中...", mask: true }); @@ -228,6 +242,8 @@ export default { }, async handleAllOpen() { + const ok = await this.confirmAction("确定要全部开启吗?"); + if (!ok) return; const payload = this.buildGatewayPayload("open", "全开"); await this.performPut( `/app/memorial/sendCommandGateway`, @@ -237,6 +253,8 @@ export default { }, async handleAllClose() { + const ok = await this.confirmAction("确定要全部关闭吗?"); + if (!ok) return; const payload = this.buildGatewayPayload("close", "全关"); await this.performPut( `/app/memorial/sendCommandGateway`, @@ -248,6 +266,8 @@ export default { // 底部按钮:强制开启 async handleForceOpen() { if (!this.ensureUnitSelected()) return; + const ok = await this.confirmAction("确定要强制开启该单元吗?"); + if (!ok) return; await this.performPut( `/bst/memorial/open/${this.selectedUnitId}`, null, @@ -258,6 +278,8 @@ export default { // 底部按钮:强制关闭 async handleForceClose() { if (!this.ensureUnitSelected()) return; + const ok = await this.confirmAction("确定要强制关闭该单元吗?"); + if (!ok) return; await this.performPut( `/bst/memorial/close/${this.selectedUnitId}`, null, @@ -268,6 +290,8 @@ export default { // 底部按钮:时长归零 async handleResetDuration() { if (!this.ensureUnitSelected()) return; + const ok = await this.confirmAction("确定要将该单元时长归零吗?"); + if (!ok) return; await this.performPut( `/bst/memorial/reset/${this.selectedUnitId}`, null,