From 551e5bcbd8f0c41ca03a6c4a7eadddf9f6b152a6 Mon Sep 17 00:00:00 2001 From: lld <15027638633@163.com> Date: Wed, 4 Mar 2026 17:31:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=82=E6=95=B0=E8=AE=BE=E7=BD=AE=20?= =?UTF-8?q?=E5=8D=B7=E8=86=9C=E5=BC=80=E5=85=B3=E8=AE=A1=E7=AE=97=E9=A3=8E?= =?UTF-8?q?=E5=8F=A3=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/system/assets/rollerAir.js | 44 ++++++++++++++++++ pages/home/control/automatic.vue | 78 +++++++++++++++++++++++++++++--- pages/home/control/index.vue | 21 +++++++++ pages/home/control/manual.vue | 2 +- 4 files changed, 137 insertions(+), 8 deletions(-) create mode 100644 api/system/assets/rollerAir.js diff --git a/api/system/assets/rollerAir.js b/api/system/assets/rollerAir.js new file mode 100644 index 0000000..236f7f8 --- /dev/null +++ b/api/system/assets/rollerAir.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询自动化卷膜风口大小设置列表 +export function listAir(query) { + return request({ + url: '/assets/air/list', + method: 'get', + params: query + }) +} + +// 查询自动化卷膜风口大小设置详细 +export function getAir(id) { + return request({ + url: '/assets/air/' + id, + method: 'get' + }) +} + +// 新增自动化卷膜风口大小设置 +export function addAir(data) { + return request({ + url: '/assets/air', + method: 'post', + data: data + }) +} + +// 修改自动化卷膜风口大小设置 +export function updateAir(data) { + return request({ + url: '/assets/air', + method: 'put', + data: data + }) +} + +// 删除自动化卷膜风口大小设置 +export function delAir(id) { + return request({ + url: '/assets/air/' + id, + method: 'delete' + }) +} diff --git a/pages/home/control/automatic.vue b/pages/home/control/automatic.vue index 3ca3ea3..5dc40c8 100644 --- a/pages/home/control/automatic.vue +++ b/pages/home/control/automatic.vue @@ -26,7 +26,7 @@ + @click.stop="handleCardClick(1 - status[card.type], card.type, 0)"> + + + + {{ card.name }} + + + + + + + { if (res.confirm) { // 组装消息 this.message = JSON.stringify({[`${type}1`]: status}) - // 控制设备 - this.$emit("publicMsg", this.message) + + this.$emit(emitFunction, this.message); //todo // this.testAuto(type); @@ -732,6 +779,7 @@ export default { } }); }, + // --------------------共同逻辑------------------------------ // 添加条件更新窗口高度 updateSwiperHeight() { if (this.termList[this.current]['terms'].length>3) { @@ -799,7 +847,12 @@ export default { this.selectTime = true; }, openParamDialog() { - this.rollerParam = JSON.parse(JSON.stringify(this.termList[this.current].config)); + var config = this.termList[this.current].config; + this.rollerParam = JSON.parse(JSON.stringify(config)); + this.paramCard = [ + {type: `${config.roller}k`, name: '卷膜开'}, + {type: `${config.roller}g`, name: '卷膜关'} + ] this.$refs.autoParam.open(); }, // 卷膜参数设置 @@ -816,6 +869,10 @@ export default { "操作提示"); return; } + this.rollerParam.ventTotalLen = this.rollerParam.autoTotalLen; + if (this.rollerParam.manualTotalLen > 0) { + this.rollerParam.ventTotalLen = this.rollerParam.manualTotalLen; + } this.termList[this.current]['config'] = {...this.rollerParam} this.$refs.autoParam.close(); }, @@ -1102,6 +1159,13 @@ export default { } .modal-container_{ padding: 30rpx 40rpx; + .uni-forms-item:nth-child(1) { + margin-bottom: 16rpx; + } + .card-grid { + padding: 20rpx 0; + gap: 30rpx; + } } .modal-title { font-size: 30rpx; diff --git a/pages/home/control/index.vue b/pages/home/control/index.vue index dfc58ae..239d0bc 100644 --- a/pages/home/control/index.vue +++ b/pages/home/control/index.vue @@ -32,8 +32,10 @@ :dtu_remark="dtu_remark" :selectedText="selectedText" :value="value" + :ventTotalLen="ventTotalLen" :agriId="agriId" @publicMsg="publishMessage" + @sendSettingMsg="sendSettingMsg" @getAgriRemark="getRemarkByImei" @getAgriLimit="getAgriByImei" /> @@ -154,6 +156,7 @@ export default { jm3gLimit: 0 }, testMsg:'由于线上为真实数据。任何操作均可影响线上功能,故仅作演示', + ventTotalLen:0 }; }, onLoad(option) { @@ -380,6 +383,21 @@ export default { } }, + sendSettingMsg(message) { + if (!this.connected || !message) { + return + } + const clientId = mqttUtil.getMqttState().clientId; + const controlTopic = `frontend/${clientId}/${this.imei}/config`; + // 调用全局MQTT工具类发布消息 + const publishSuccess = mqttUtil.publishMqtt(controlTopic, message); + if (publishSuccess) { + this.addMessage(`【指令已发送】imei: ${controlTopic},指令: ${message}`); + } else { + this.addMessage(`发布失败:设备:[${controlTopic}]`) + } + }, + // 消息回调逻辑完全保留(仅依赖全局工具类转发消息) ackMessage(topic, payload) { // 1. 先判断是否是目标订阅主题(如frontend/\\w+/control/\\w+") @@ -458,6 +476,9 @@ export default { this.fontStyle = 'font-size:16px;' this.makeSpecialData(msgData, true); } + if ("ventTotalLen" in msgData) { + this.ventTotalLen = msgData.ventTotalLen; + } } }, diff --git a/pages/home/control/manual.vue b/pages/home/control/manual.vue index c01ce1d..6b1fd8e 100644 --- a/pages/home/control/manual.vue +++ b/pages/home/control/manual.vue @@ -319,7 +319,7 @@ export default { } uni.showModal({ title: '操作提示:', - content: '确定' + (status === 1 ? "运行" : "暂停") + '【' + this.selectedText + '】设备?', + content: `确定 ${status === 1 ? "运行" : "暂停"} 【${this.selectedText} - ${op}】设备?`, cancelText: '取消', confirmText: '确定', success: (res) => {