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 @@