diff --git a/pages/home/control/automatic.vue b/pages/home/control/automatic.vue index 5eb9817..b1be667 100644 --- a/pages/home/control/automatic.vue +++ b/pages/home/control/automatic.vue @@ -36,7 +36,13 @@ - + + + + - 参考温度:{{ result }} + 参考温度:{{ termList[term[current] + 'Param'].refTemp }} - - - 参数设置弹窗 + + + 参数设置弹窗 - + + :key="item.id" :index="index" @click="onDeleteItem($event, item.id)" :right-options="options"> 温度控制 第{{ index+1 }}段 - + 运行时间开始 @@ -74,36 +80,34 @@ 运行时间终止 {{ item.endTime }} - - + + + :fontSize="40" shape="icon" margin="10rpx 10rpx" @click="openSlider('temp', index)"> 温度 {{ formatValueWithUnit(item.temp, '℃') }} + :fontSize="40" shape="icon" margin="10rpx 10rpx" @click="openSlider('vent', index)"> 风口 {{ formatValueWithUnit(item.vent, '%') }} - + - - - 添加条件 + + + 添加条件 - - @@ -136,10 +140,10 @@ - + - {{ `【${selectedText} - ${currentCard.name}】设置` }} + {{ `【${selectedText} - 自动化】参数设置` }} 当前时间: {{ currentCardTime > 0 ? `${currentCardTime} 秒` : '未设置' }} @@ -160,8 +164,33 @@ - - + + + + + + + + + + {{ `【${selectedText} - 自动化】参数设置` }} + + + {{ slider.title }} + + {{ slider.unit }} + + + + + @@ -176,6 +205,7 @@ import {addLimit, getAgriByImei, updateLimit} from "../../../api/system/assets/l import store from "../../../store"; import {addRemark, updateRemark} from "../../../api/system/assets/remark"; import {generateUniqueId} from "../../../utils/agri"; +import UniSection from "../../../components/uni-section/uni-section.vue"; export default { dicts: ['sys_data_map'], @@ -252,6 +282,7 @@ export default { } }, components: { + UniSection, UniPopup // 注册弹窗组件 }, mounted() { @@ -299,12 +330,20 @@ export default { } ], showSelect:false, - result: "请选择", term:["jm1", "jm2", "jm3"], termList: { - "jm1": [], - "jm2": [], - "jm3": [], + "jm1": [], + "jm1Param":{ + refTemp: '请选择', + }, + "jm2": [], + "jm2Param":{ + refTemp: '请选择', + }, + "jm3": [], + "jm3Param":{ + refTemp: '请选择' + }, }, options: [ { @@ -326,9 +365,18 @@ export default { }, selectTime: false, timeTag: null, - timeIndex: null, + follerIndex: null, defaultTime: null, maxTermLength: 5, + autoParam:false, + slider: { + title: '请选择', + min:0, + max:100, + value:0, + unit:'', + mode: null + }, }; }, @@ -343,15 +391,24 @@ export default { }, // 左上角选择时间 confirmTemp(event) { - this.result = event[0]['label'] + this.termList[this.term[this.current] + 'Param'].refTemp = event[0]['label'] console.info(`选择温度:${event[0]['label']}`) }, // 下拉刷新以及进入组件渲染 refresh() { this.termList = { "jm1": [], + "jm1Param":{ + refTemp: '请选择', + }, "jm2": [], + "jm2Param":{ + refTemp: '请选择', + }, "jm3": [], + "jm3Param":{ + refTemp: '请选择' + }, }; this.showFlag = !((store.getters && store.getters.name !== 'admin') && this.$auth.hasRole("test")) this.$nextTick(() => { @@ -607,14 +664,76 @@ export default { // 选择运行时间 changeTime(timeTag, timeIndex) { this.timeTag = timeTag; - this.timeIndex = timeIndex; + this.follerIndex = timeIndex; this.selectTime = true; }, + openParamDialog() { + this.$refs.autoParam.open(); + }, + // 卷膜参数设置 + setAutoParam() { + var jmTerm = this.term[this.current]; + // todo 卷膜参数设置 + this.$refs.autoParam.close(); + }, + closeParamDialog() { + this.$refs.autoParam.close(); + }, // 选择时间串口点击确定 confirmTime(time) { - this.termList[this.term[this.current]][this.timeIndex][this.timeTag] = `${time.hour}:${time.minute}` + this.termList[this.term[this.current]][this.follerIndex][this.timeTag] = `${time.hour}:${time.minute}` }, - } + /** + * @param tag 参数 + * @param index 条件 + */ + openSlider(tag, index) { + var fillerTerm = this.termList[this.term[this.current]][index]; + if (tag === 'temp') { + this.slider = { + title: '适宜温度', + min: 0, + max: 40, + unit: '℃', + value: fillerTerm.temp==='选择'?0:fillerTerm.temp, + mode: tag + } + } else if (tag === 'vent') { + this.slider = { + title: '风口大小', + min: 0, + max: 100, + unit: '﹪', + value: fillerTerm.vent==='选择'?0:fillerTerm.vent, + mode: tag + } + } + this.follerIndex = index; + this.$refs.sliderDialog.open(); + }, + changeSlider(e) { + this.slider.value = e.detail.value + }, + closeSlider() { + this.$refs.sliderDialog.close(); + }, + confirmSlider() { + const slideMode = this.slider.mode; + const value = this.slider.value; + if (slideMode === 'temp') { + this.termList[this.term[this.current]][this.follerIndex].temp = value; + } else if (slideMode === 'vent') { + this.termList[this.term[this.current]][this.follerIndex].vent = value; + } + this.$refs.sliderDialog.close(); + }, + // 保存自动化条件 + saveAutoTerm() { + var termMap = this.termList; + // todo 校验、后端保存 + } + }, + }; \ No newline at end of file