From 8cf6372b6ecabbac3f6cbb2db703a3f7dee97234 Mon Sep 17 00:00:00 2001 From: WindowBird <13870814+windows-bird@user.noreply.gitee.com> Date: Tue, 14 Oct 2025 17:54:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E9=83=A8=E6=89=93=E5=BC=80/=E5=85=B3?= =?UTF-8?q?=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/memorial/adminMemorial.vue | 42 +- pages/memorial/compositons/floorSelector.vue | 618 +++++++++---------- 2 files changed, 348 insertions(+), 312 deletions(-) diff --git a/pages/memorial/adminMemorial.vue b/pages/memorial/adminMemorial.vue index 25032da..7dd9822 100644 --- a/pages/memorial/adminMemorial.vue +++ b/pages/memorial/adminMemorial.vue @@ -128,6 +128,33 @@ export default { } }, + // 统一构建网关命令负载 + buildGatewayPayload(command, reason) { + // 使用子组件提供的 getCurrentSelection 获取最新的楼层信息 + let selection = this.currentSelection; + if ( + this.$refs.floorSelector && + typeof this.$refs.floorSelector.getCurrentSelection === "function" + ) { + selection = this.$refs.floorSelector.getCurrentSelection(); + } + const floorId = selection?.floor?.label; + if (!floorId) { + uni.showToast({ title: "请先选择楼层", icon: "none" }); + return false; + } + console.log("floodr", floorId); + return { + // 兼容字段:同时传 floorId 与后端现用的 regionId + + regionId: String(floorId), + command, // open | close + mac: "FFFFFFFFFFFF", + timeout: "11", + reason, + }; + }, + // 选择单位并输入时长 async promptDurationAndUnit() { // 1:天 2:小时 3:分钟 4:秒 @@ -173,11 +200,20 @@ export default { }, async handleAllOpen() { - if (!this.ensureUnitSelected()) return; + const payload = this.buildGatewayPayload("open", "全开"); await this.performPut( `/app/memorial/sendCommandGateway`, - null, - "handleForceOpen", + payload, + "handleAllOpen", + ); + }, + + async handleAllClose() { + const payload = this.buildGatewayPayload("close", "全关"); + await this.performPut( + `/app/memorial/sendCommandGateway`, + payload, + "handleAllClose", ); }, diff --git a/pages/memorial/compositons/floorSelector.vue b/pages/memorial/compositons/floorSelector.vue index 8deaf86..f85a259 100644 --- a/pages/memorial/compositons/floorSelector.vue +++ b/pages/memorial/compositons/floorSelector.vue @@ -7,8 +7,8 @@ {{ floor.label }} @@ -25,8 +25,8 @@ {{ area.label }} @@ -42,8 +42,8 @@ {{ unit.label }} @@ -55,328 +55,328 @@