diff --git a/pages/home/control/index.vue b/pages/home/control/index.vue index 15f1b34..15e2d5e 100644 --- a/pages/home/control/index.vue +++ b/pages/home/control/index.vue @@ -37,12 +37,14 @@ :liveData="liveData" :show="show" :status="status" + :limitTimes="limitTimes" :dtu_remark="dtu_remark" :selectedText="selectedText" :value="value" :agriId="agriId" @publicMsg="publishMessage" - @getRemark="getRemarkByImei" + @getAgriRemark="getRemarkByImei" + @getAgriLimit="getAgriByImei" /> @@ -68,6 +70,7 @@ import {getRemarkByImei} from "../../../api/system/assets/remark"; import CustomRefresher from "../../../components/custom-refresher/custom-refresher.vue"; import ZPaging from "../../../uni_modules/z-paging/components/z-paging/z-paging.vue"; import {findDtuDataByInfo} from "../../../api/system/data"; +import {getAgriByImei} from "../../../api/system/assets/limit"; export default { dicts: ['sys_data_map'], @@ -129,6 +132,19 @@ export default { jm3g: 0, deviceTime:"正在加载中..." }, + // 新增:限位时间配置 + limitTimes: { + jbkLimit: 0, + jbgLimit: 0, + jlkLimit: 0, + jlgLimit: 0, + jm1kLimit: 0, + jm1gLimit: 0, + jm2kLimit: 0, + jm2gLimit: 0, + jm3kLimit: 0, + jm3gLimit: 0 + }, testMsg:'由于线上为真实数据。任何操作均可影响线上功能,故仅作演示', }; }, @@ -173,8 +189,6 @@ export default { this.change(this.imei) mqttUtil.setOnMessageCallback(this.ackMessage); this.$refs.paging.complete(); - - this.$refs[this.currentMode?"autoPage":"manualPage"].getAgriByImei(); }, getNewSpecialData() { getNewSpecialData().then(response => { @@ -210,6 +224,7 @@ export default { this.liveData.temp = "最后更新时间:"+response.data.time; this.fontStyle = 'font-size:16px;' }) + this.getAgriByImei(); // 备注 this.getRemarkByImei(); if (e!=="862538065276939"){ @@ -228,7 +243,16 @@ export default { } }); }, - + getAgriByImei() { + getAgriByImei(this.imei).then(response => { + if (response.code === 200) { + if (!response.data) { + return; + } + this.limitTimes = response.data; + } + }) + }, getAgriList() { listAgri().then(response => { if (response.code === 200) { @@ -543,6 +567,7 @@ export default { .card { border-radius: 20rpx; overflow: hidden; + height: calc(100vh - var(--window-top, 0px) - 100rpx); } .switch-row { display: flex; diff --git a/pages/home/control/manual.vue b/pages/home/control/manual.vue index 4a89982..d65db39 100644 --- a/pages/home/control/manual.vue +++ b/pages/home/control/manual.vue @@ -132,7 +132,7 @@ // 优化:抽离魔法值常量 import UniPopup from "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.vue"; // 引入弹窗组件 import mqttUtil from '@/utils/mqtt'; -import {addLimit, getAgriByImei, updateLimit} from "../../../api/system/assets/limit"; +import {addLimit, updateLimit} from "../../../api/system/assets/limit"; import store from "../../../store"; import {addRemark, updateRemark} from "../../../api/system/assets/remark"; @@ -168,6 +168,12 @@ export default { return {} } }, + limitTimes: { + type: Object, + default() { + return {} + } + }, show: { type: Object, default() { @@ -242,19 +248,6 @@ export default { // 优化:声明响应式变量 connected connected: false, imei: '', - // 新增:限位时间配置 - limitTimes: { - jbkLimit: 0, - jbgLimit: 0, - jlkLimit: 0, - jlgLimit: 0, - jm1kLimit: 0, - jm1gLimit: 0, - jm2kLimit: 0, - jm2gLimit: 0, - jm3kLimit: 0, - jm3gLimit: 0 - }, // 优化:温湿度卡片配置(固定顺序:温度1→2→3→4,湿度1→2→3→4) sensorCard:{}, }; @@ -434,7 +427,7 @@ export default { : await addLimit(limitTimes); if (limitRes.code === 200) { isAllSuccess = true; - this.getAgriByImei(); + this.$emit("getAgriLimit") } } @@ -450,7 +443,7 @@ export default { ? await updateRemark(dtu_remark) : await addRemark(dtu_remark); if (remarkRes.code === 200) { - this.$emit("getRemark") + this.$emit("getAgriRemark") isAllSuccess = true; } } @@ -540,16 +533,7 @@ export default { } }); }, - getAgriByImei() { - getAgriByImei(this.imei).then(response => { - if (response.code === 200) { - if (!response.data) { - return; - } - this.limitTimes = response.data; - } - }) - }, + } };