|
@@ -5,48 +5,76 @@
|
|
|
<!-- 空调按钮 -->
|
|
|
<view class="panel">
|
|
|
<view class="panel-t">
|
|
|
- <view>{{switchStatus==0?'空调未开启':'空调已开启'}}</view>
|
|
|
- <view @click="switchFun()" :class="switchStatus==0?'color-A':'color-B'">{{switchStatus==0?'开启':'关闭'}}</view>
|
|
|
+ <view>{{infraredControllerForm.name}}</view>
|
|
|
+ <view @click="switchFun()" :class="infraredControllerForm.switchType==1?'color-A':'color-B'">{{infraredControllerForm.switchType==1?'开启':'关闭'}}</view>
|
|
|
</view>
|
|
|
<view class="panel-m" >
|
|
|
- <view @click="temperatureFun(index)" :class="keystrokeIndex==index?'color-C':''" v-for="(item,index) in keystrokeData" :key="index">{{item}}</view>
|
|
|
+ <view @click="temperatureFun(index)" :class="infraredControllerForm.functionType==item.value?'color-C':''" v-for="(item,index) in infraredControllerData.functionList" :key="index">{{item.label}}</view>
|
|
|
</view>
|
|
|
<view class="panel-b">
|
|
|
<view @click="subtract">-</view>
|
|
|
- <view>{{result}}℃</view>
|
|
|
+ <view v-for="(item,index) in infraredControllerData.orderList" :key="index" v-if="item.value == infraredControllerForm.orderType">{{item.value}}</view>
|
|
|
<view @click="add">+</view>
|
|
|
</view>
|
|
|
+ <view class="panel-button" @click="mangerControl">确定</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import {} from '@/pages_manage/api/index.js'
|
|
|
+ import {
|
|
|
+ iotAppHardwareOperatingHardware,
|
|
|
+ } from '@/pages_manage/api/index.js'
|
|
|
import { config } from '@/api/request/config.js'
|
|
|
export default {
|
|
|
name: "airConditioning",
|
|
|
props: {
|
|
|
- subjectData: {},
|
|
|
+ airConditioningData: {},
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
baseUrl:config.base_url,
|
|
|
- //开关状态
|
|
|
- switchStatus:0,
|
|
|
- keystrokeData:['制热 ','制冷','送风'],
|
|
|
- keystrokeIndex:0,
|
|
|
- num1: 0,
|
|
|
+ /****************** 红外控制器相关 ******************/
|
|
|
+ infraredControllerType:false,
|
|
|
+ infraredControllerTitle:"",
|
|
|
+ infraredControllerForm:{
|
|
|
+ name:null,//设备名称
|
|
|
+ switchType:null,//0.关 1.开
|
|
|
+ functionType:null, //1.制冷 2.制热 3.通风
|
|
|
+ orderType:null, //温度指令
|
|
|
+ hardwareNo:null, //设备编号
|
|
|
+ },
|
|
|
+ infraredControllerData:{
|
|
|
+ functionList:[
|
|
|
+ {label:'制冷',value:'1'},
|
|
|
+ {label:'制热',value:'2'},
|
|
|
+ {label:'通风',value:'3'},
|
|
|
+ ],
|
|
|
+ orderList:[
|
|
|
+ {label:"18°C",value:18},
|
|
|
+ {label:"19°C",value:19},
|
|
|
+ {label:"20°C",value:20},
|
|
|
+ {label:"21°C",value:21},
|
|
|
+ {label:"22°C",value:22},
|
|
|
+ {label:"23°C",value:23},
|
|
|
+ {label:"24°C",value:24},
|
|
|
+ {label:"25°C",value:25},
|
|
|
+ {label:"26°C",value:26},
|
|
|
+ {label:"27°C",value:27},
|
|
|
+ ],
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- result() {
|
|
|
- return this.num1;
|
|
|
- },
|
|
|
- },
|
|
|
created() {
|
|
|
|
|
|
},
|
|
|
mounted() {
|
|
|
-
|
|
|
+ this.$set(this,'infraredControllerForm',{
|
|
|
+ name:this.airConditioningData.hardwareName,
|
|
|
+ switchType:parseInt(this.airConditioningData.switchType),
|
|
|
+ functionType:this.airConditioningData.switchType == 0 ? 1 : parseInt(this.airConditioningData.functionType),
|
|
|
+ orderType:this.airConditioningData.switchType == 1 && this.airConditioningData.functionType !=3 ? parseInt(this.airConditioningData.orderType):18,
|
|
|
+ hardwareNo:this.airConditioningData.hardwareNo,
|
|
|
+ });
|
|
|
},
|
|
|
methods: {
|
|
|
// 返回按钮
|
|
@@ -64,12 +92,45 @@
|
|
|
this.$set(this, 'keystrokeIndex',index);
|
|
|
},
|
|
|
add() {
|
|
|
- this.num1 += 1;
|
|
|
+ if(this.infraredControllerForm.orderType<27){
|
|
|
+ this.infraredControllerForm.orderType++
|
|
|
+ }
|
|
|
},
|
|
|
subtract() {
|
|
|
- this.num1 -= 1;
|
|
|
+ if(this.infraredControllerForm.orderType>18){
|
|
|
+ this.infraredControllerForm.orderType--
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
+ //设备开关
|
|
|
+ async mangerControl() {
|
|
|
+ let text = '';
|
|
|
+ if(this.infraredControllerForm.switchType == 1){
|
|
|
+ if(this.infraredControllerForm.functionType != 3){
|
|
|
+ text = '1-' + this.infraredControllerForm.functionType + '-' + this.infraredControllerForm.orderType;
|
|
|
+ }else {
|
|
|
+ text = '1-3';
|
|
|
+ }
|
|
|
+ }else if(this.infraredControllerForm.switchType == 0){
|
|
|
+ text = '0';
|
|
|
+ }
|
|
|
+ let switchData = {
|
|
|
+ hardwareNo:this.infraredControllerForm.hardwareNo,
|
|
|
+ command:text
|
|
|
+ };
|
|
|
+ const {
|
|
|
+ data
|
|
|
+ } = await iotAppHardwareOperatingHardware(switchData);
|
|
|
+ if (data.code == 200) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '操作成功',
|
|
|
+ icon: "none",
|
|
|
+ mask: true,
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ this.backPage();
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
},
|
|
|
}
|
|
@@ -91,7 +152,7 @@
|
|
|
/* 空调面板 */
|
|
|
.panel{
|
|
|
width: 710rpx;
|
|
|
- height: 430rpx;
|
|
|
+ height: 530rpx;
|
|
|
background: #FFFFFF;
|
|
|
border-radius: 20rpx;
|
|
|
padding:34rpx 30rpx 0rpx;
|
|
@@ -200,6 +261,15 @@
|
|
|
text-align: center;
|
|
|
}
|
|
|
}
|
|
|
+ .panel-button{
|
|
|
+ text-align: center;
|
|
|
+ line-height: 80rpx;
|
|
|
+ font-size: 32rpx;
|
|
|
+ background: #0183fa;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ color: #fff;
|
|
|
+ margin-top: 40rpx;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|