<style lang="less" scoped>
.title{
    padding-top: 40rpx;
    font-family: PingFang SC;
    font-size: 44rpx;
    font-weight: 500;
    line-height: 62rpx;
    color: #000000;
}
.text{
    font-family: PingFang SC;
    font-size: 32rpx;
    font-weight: 600;
    line-height: 44rpx;
    color: #1B2129;
}
.dir{
    border-right: 1px solid #E1E5EB;
    height: 30rpx;
    margin-left: 24rpx;
    margin-right: 24rpx;
}
.set-value{
    display: flex;
    align-items: center;
    padding-top: 96rpx;
    padding-bottom: 34rpx
}
.value{
    font-family: Montserrat;
    font-size: 32rpx;
    font-weight: 400;
    line-height: 38rpx;
    color: #626C78;
}
.silder-box{
    margin-bottom: 190rpx;
}
</style>

<template>
    <div>
        <div class="title">地暖</div>
        <div class="set-value">
            <div class="text">设定温度</div>
            <div class="dir"></div>
            <div class="value">{{temp}}℃</div>
        </div>
        <div class="silder-box">
            <Floorfeat-Slider
            :typeValue="floorFeatItem.tempSet"
            :maxValue="maxValue"
            :minValue="minValue"
            @silder-mouseEnd="changeSwitch($event)"
            ></Floorfeat-Slider>
        </div>
    </div>
   
</template>
<script>
import wepy from '@wepy/core';
import { setSocketHttp } from '@/packagesEnv/api/officehome.js'
wepy.component({
  props: {
    maxValue: Number,
    minValue: Number,
    floorFeatItem: Object,
    floorfeatVisible: Boolean
  },
  data: {
    defaultInactiveColor: 'rgba(196, 196, 196, 0.2)',
    temp: '--',
    changeWatchVal: true

  },
  computed: {

  },
  watch: {
    floorFeatItem(val) {
      if (this.changeWatchVal) {
        this.temp = val.tempSet || '--';
      }
    }
  },
  methods: {
    changeSwitch(val) {
      this.changeWatchVal = false;
      this.temp = val;
      let obj = {
        id: this.floorFeatItem.id,
        value: val,
        code: this.floorFeatItem.tempSetCode
      }
      let paramArr = [];
      paramArr.push(obj)
      console.log(paramArr, '----child下发指令');
      setSocketHttp(paramArr).then(res => {
      })
    }
  }
});
</script>
<config>
    {
        usingComponents: {
            "Floorfeat-Slider": "../comComponents/FloorfeatSlider"    
        }
    
    }
</config>
