Ver código fonte

Merge branch 'master' of http://39.106.8.246:3003/sagacloud/sagacloud-sagacare-weChat

chenzhen2 1 ano atrás
pai
commit
5985b6bb55

+ 3 - 1
src/packagesEnv/pages/officehome/Header/space-basic.wpy

@@ -26,12 +26,13 @@
             <div class="g-fl room-name">
                 <span class="name_text">{{officeData.localName}}</span>
                 <has-person
-                    v-if="officeData.isPassengerPass !== undefined"
+                    v-if="officeData.isPassengerPass !== undefined && IsShowPerson"
                     :isPassengerPass="officeData.isPassengerPass"
                 ></has-person>
             </div>
             <div>
                 <residen-work
+                    v-if="options.roomType =='开放'"
                     :IsResiden="true"
                     :spaceId="options.spaceId"
                     :userInfo="userInfo"
@@ -47,6 +48,7 @@ import config from '@/config'
 
 wepy.component({
   props: {
+    IsShowPerson: Boolean,
     officeData: Object,
     options: Object,
     userInfo: Object

+ 0 - 5
src/packagesEnv/pages/officehome/airHand/air-hand-card.wpy

@@ -171,14 +171,12 @@ import config from '@config'
 import { isWithinLocation } from '@/service/location'
 import store from '@/store'
 import { mapState } from '@wepy/x'
-import { checkSpaceControl } from '@/packagesEnv/pages/common.js'
 
 let infoTimer
 const barWidth = 17
 
 wepy.component({
   props: {
-    isControl: Boolean, // 是否可控
     roomType: String, // 房间类型
     // hasBlowing: Boolean, // 有无变风量
     roomHasScene: Boolean, // 加班场景
@@ -313,7 +311,6 @@ wepy.component({
         })
     },
     allAirClick(val) {
-      if (!checkSpaceControl(this.isControl)) return
       this.getAirInfo()
       this.allAirShow = !val
     },
@@ -326,7 +323,6 @@ wepy.component({
       this.$emit('setCanScroll', true)
     },
     eachAirOpen(aindex) {
-      if (!checkSpaceControl(this.isControl)) return
       isWithinLocation()
         .then(() => {
           this.allDevices[aindex].open = !this.allDevices[aindex].open
@@ -498,7 +494,6 @@ wepy.component({
       return true
     },
     changeZongAir(btnType, value) {
-      if (!checkSpaceControl(this.isControl)) return
       if (!this.airData.isOpen && btnType != 'sw') return
       isWithinLocation()
         .then(() => {

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 1219
src/packagesEnv/pages/officehome/components/air-adjust-hand.wpy


+ 0 - 644
src/packagesEnv/pages/officehome/components/air-adjust.wpy

@@ -1,644 +0,0 @@
-<template>
-    <div class="air-adjust office-card g-fl">
-        <div class="air-content">
-            <div class="air-adjust-env">
-                <div>
-                    <span class="envname">空调</span>
-                    <div
-                        class="envnum"
-                        @tap.stop="showDetail('Tdb,RH')"
-                    >{{temperature ? temperature :'--'}}<span>℃</span></div>
-                </div>
-                <div
-                    class="air-status"
-                    v-if="hasAir"
-                >
-                    <span>{{airData.isOpen ? '空调已开启' : '空调已关闭'}}</span>
-                </div>
-                <div
-                    class="room-air-status"
-                    v-if="airData.isOpen"
-                >
-                    <image
-                        v-if="airData.icon==1 || airData.icon==2 || airData.icon==3"
-                        class="room-air-img"
-                        src="{{h5StaticPath + airRunImg}}"
-                    />
-                    <span class="air-common-text air-status-text">{{airData.spaceStatus}}</span>
-                </div>
-                <div
-                    v-else
-                    style="height:52rpx"
-                >
-
-                </div>
-            </div>
-            <div class="air-adjust-btn">
-                <image
-                    :src="h5StaticPath+airImg"
-                    alt=""
-                    lazyload
-                />
-            </div>
-            <div class="air-switch">
-                <switch
-                    v-if="hasAir && !isACATVA"
-                    :isACATFC="isACATFC"
-                    :seasonType="seasonType"
-                    :isHand="'auto'"
-                    :showWorkTime="showWorkTime"
-                    :checked="airData.isOpen"
-                    :eqTitle="eqTitle"
-                    @component-switch-change="airChange($event)"
-                ></switch>
-            </div>
-        </div>
-        <!-- 空调 调节 -->
-        <div v-if="airData.isOpen">
-            <div class="air-control-item">
-                <div class="air-control-item-box">
-                    <!-- <div
-                        class="envnum-common"
-                        :class="[airTemSt]"
-                        v-show="glistenFlag"
-                    >{{airData.designTemperature}}<span>℃</span></div> -->
-                    <span class="air-common-text change-text">温度调节</span>
-                </div>
-                <div class="air-common-switch">
-                    <div
-                        class="switch"
-                        :class="{'yell': suspendUpFlag} "
-                        @click="changeAir(4, 'temp','toCold')"
-                    >
-                        <image src="{{h5StaticPath}}arrow_down_grey.png" />
-                    </div>
-                    <div
-                        class="switch"
-                        :class="{'yell': suspendUpFlag} "
-                        @click=" changeAir(2, 'temp','toWarm')"
-                    >
-                        <image src="{{h5StaticPath}}arrow_up_grey.png" />
-                    </div>
-                </div>
-            </div>
-            <!--Pj1101050038  ACATVA没有风量调节 和开关按钮 -->
-            <div
-                class="air-control-item"
-                v-if="!isACATVA"
-            >
-                <div class="air-control-item-box">
-                    <!-- <div class="envnum-common air-envnum-comon">
-                        <span
-                            class="envnum-common-wind"
-                            v-for="(item,index) in windGearArr"
-                            :key="index"
-                            :class="{'windBlack': item == windGear}"
-                        >{{item}}</span>
-                    </div> -->
-                    <span class="air-common-text change-text">风量调节</span>
-                </div>
-                <div class="air-common-switch">
-                    <div
-                        class="switch"
-                        :class="{'yell': suspendUpFlag} "
-                        @click="changeAir(5,'wind','toWindLow')"
-                    >
-                        <image src="{{h5StaticPath}}wind_small.png" />
-                    </div>
-                    <div
-                        class="switch"
-                        :class="{'yell': suspendUpFlag} "
-                        @click="changeAir(6,'wind','toWindUp')"
-                    >
-                        <image src="{{h5StaticPath}}wind_big.png" />
-                    </div>
-                </div>
-            </div>
-        </div>
-    </div>
-</template>
-
-<script>
-import wepy from '@wepy/core'
-import { changeTempHttp, getFeedbackDocumentsHttp, getTempRangeHttp, getSeasonType } from '@/packagesEnv/api/officehome.js'
-import config from '@/config'
-import { isWithinLocation } from '@/service/location'
-import moment from 'moment'
-import store from '@/store'
-import { mapState } from '@wepy/x'
-import { checkSpaceControl } from '@/packagesEnv/pages/common.js'
-
-let infoTimer
-let feedbackTimer
-
-wepy.component({
-  props: {
-    isControl: Boolean, // 是否可控
-    roomType: String, // 房间类型
-        // hasBlowing: Boolean, // 有无变风量
-    roomHasScene: Boolean, // 加班场景
-    temperature: Number,
-    objectId: String,
-    hasAir: {
-      type: Boolean,
-      default: true
-    }, // 有无空调
-    projectId: String,
-    isACATVA: Boolean,
-    isACATFC: Boolean,
-    airVolumes: Array, // 风量信息
-    airVisible: Boolean
-  },
-  store,
-  data: {
-    showWorkTime: false, // 展示是否需要预约时间
-    h5StaticPath: config.h5StaticPath + '/page-officehome/',
-    visible: false,
-    eqTitle: '空调',
-    airImg: 'air_close.png',
-    airTemSt: 'colorBlack',
-    glistenFlag: true,
-    windGear: 0, // 风量档位
-    windGearArr: [1, 2, 3], // 风量3/5个档位
-    airData: {
-      avg: '--',                // 算法调节温度(目标值)
-      icon: 1,                // 固定框文案ID 7 为关机,其它都是开机
-      spaceStatus: '',    // 固定框文案展示
-      notice: '',                // 弹框文案展示
-      isOpen: false // 空调开关 true 是开
-    },
-    watchObjectIdEnd: false, // 监听空间ID
-    tempMax: '--',
-    tempMin: '--',
-    seasonType: ''
-  },
-  watch: {
-    airVisible(val) {
-      if (!val) {
-        console.log('---关闭定时器')
-        clearInterval(feedbackTimer)
-      }
-    },
-    hasAir(val) {
-      if (!val) {
-        clearInterval(infoTimer)
-        this.airData.isOpen = false
-        this.airImg = 'air_close.png'
-      }
-    },
-    objectId(val) {
-            //   this.glistenAirTemHttp();
-
-      if (val) {
-        clearInterval(infoTimer) // 定时器先清理 再设定
-        infoTimer = setInterval(() => {
-          this.getInfo()
-        }, 1000)
-      } else {
-        this.airData.isOpen = false
-        this.airImg = 'air_close.png'
-      }
-    }
-
-  },
-  computed: {
-    ...mapState({isNowTime: state => state.officehome.isNowTime}),
-
-    airRunImg() {
-      let imgStr = ''
-      switch (this.airData.icon) {
-        case 1:
-          imgStr = 'temp-keep.png'
-          break
-        case 2:
-          imgStr = 'temp_cold.svg'
-          break
-        case 3:
-          imgStr = 'temp_sun.png'
-          break
-        default:
-          imgStr = ''
-          break
-      }
-      return imgStr
-    }
-  },
-  ready() {
-    this.querySeasonType()
-  },
-  detached() {
-    this.airData.isOpen = false
-    this.airData.icon = 1
-
-    clearInterval(feedbackTimer)
-    clearInterval(infoTimer)
-  },
-  methods: {
-    querySeasonType() {
-      const params = {
-        projectId: this.projectId,
-        date: moment().format('YYYYMMDD') // 当天日期
-      }
-      if (!this.seasonType) {
-        getSeasonType(params).then(res => {
-          this.seasonType = res.data || ''
-        }).catch(() => {
-        })
-      }
-    },
-    showDetail(funcid) {
-      this.$emit('showDetail', { funcid: funcid })
-      wx.uma.trackEvent('officeHome_changeAir_temperature', { key: 'roomTemperature' })
-    },
-    async getInfo() {
-      await this.getAirInfo('info')
-            //   this.judgeAirLevel();
-            //   this.glistenAirTem();
-    },
-
-        // 空调信息airTemp
-    getAirInfo(type, btnType, feedbackId) {
-      const paramObj = {
-        projectId: 'Pj1101080259', // 项目id
-        objectId: this.objectId // 空间id
-      }
-      if (type === 'feedback') {
-        paramObj.id = feedbackId
-      }
-      getFeedbackDocumentsHttp(paramObj).then(res => {
-        if (type !== 'feedback') {
-          res.isOpen = false
-          this.airData = res
-          this.airData.designTemperature = res.designTemperature ? res.designTemperature.toFixed(1) : '--'
-
-          if (this.airData.icon === 7) {
-            this.airData.isOpen = false
-            this.airImg = 'air_close.png'
-                        // 如果是过渡季 并且 是ATVA 空调 开启时则显示 过渡季节运行中...
-          } else if (this.airData.icon != 6) {
-            this.airData.isOpen = true
-            this.airImg = 'openair.png'
-
-            if (this.isACATVA && this.seasonType == 'Transition') {
-              this.airData.spaceStatus = '过渡季节运行中...'
-              this.airData.icon = 1
-            }
-          }
-        }
-                //   弹窗
-        if (type === 'feedback' && res.notice && btnType != 'sw') {
-          clearInterval(feedbackTimer) // 拿到反馈文案清除定时器
-          this.$emit('airTemp', {notice: res.notice, remark: res.remark})
-        }
-      })
-    },
-
-        // 空调温度 闪烁
-    glistenAirTemHttp() {
-      getTempRangeHttp().then(res => {
-        this.tempMax = res.tempMax
-        this.tempMin = res.tempMin
-      })
-    },
-        // glistenAirTem() {
-        //   clearInterval(timer);
-        //   if (this.airData.avg >= this.tempMax || this.airData.avg <= this.tempMin) {
-        //     this.airData.avg >= this.tempMax ? (this.airTemSt = 'colorRed') : (this.airTemSt = 'colorBlue');
-        //     const _this = this;
-        //     timer = setInterval(() => {
-        //       _this.glistenFlag = !_this.glistenFlag;
-        //     }, 500);
-        //   } else {
-        //     this.glistenFlag = true;
-        //     this.airTemSt = 'colorBlack';
-        //   }
-        // },
-
-        // judgeAirLevel() {
-        //         // - 空调风量判断 -
-        //   let blowObj = this.airVolumes ? this.airVolumes[0] : {};
-        //   let airLevel = 0;
-        //   if (blowObj.data === undefined || blowObj.data === 0 || !this.airData.isOpen) {
-        //     this.airLevel = 0;
-        //     return;
-        //   }
-        //   this.windGearArr = [1, 2, 3];
-        //   switch (blowObj.code) {
-        //     case 'AirSpeedGear':
-        //       this.windGearArr = [1, 2, 3, 4, 5]; // AirSpeedGear是五个挡位
-        //       airLevel = blowObj.data;
-        //       break;
-        //     case 'FanGear':
-        //       airLevel = blowObj.data;
-        //       break;
-        //     case 'SupplyAirFlow':
-        //       let avg = (blowObj.maxAirFlow - blowObj.minAirFlow) / 3;
-        //       if (blowObj.data > blowObj.minAirFlow && blowObj.data <= blowObj.minAirFlow + avg) {
-        //         airLevel = 1;
-        //       } else if (blowObj.data > blowObj.minAirFlow + avg && blowObj.data <= blowObj.minAirFlow + avg * 2) {
-        //         airLevel = 2;
-        //       } else {
-        //         airLevel = 3;
-        //       }
-        //       break;
-
-        //     default:
-        //       break;
-        //   }
-        //   this.windGear = airLevel;
-        // },
-
-    vibrateLong() {
-      if (wx.canIUse('vibrateLong')) {
-        wx.vibrateLong()
-      } else {
-        wx.vibrateShort()
-      }
-    },
-    vibrateShort() {
-      if (wx.canIUse('vibrateShort')) {
-        wx.vibrateShort()
-      } else {
-        wx.vibrateLong()
-      }
-    },
-
-    airChange(value) {
-      if (!checkSpaceControl(this.isControl)) return
-      const itemId = value ? 12 : 10 // 10关闭 12开启
-      console.log('itemId', itemId, value)
-      let btnTypeDetail = ''
-      if (itemId == 12) {
-        btnTypeDetail = 'openAir'
-      } else {
-        btnTypeDetail = 'closeAir'
-      }
-      this.changeAir(itemId, 'sw', btnTypeDetail)
-    },
-    onClose() {
-      this.visible = false
-    },
-    popShow() {
-      this.visible = true
-    },
-
-    checkAirCanOpen(itemId) { // 判断空调是否能开启
-      if (!this.roomHasScene && !this.isNowTime) {
-        wx.showToast({
-          title: '大厦该时段无空调提供',
-          icon: 'info',
-          duration: 1000
-        })
-        return false
-      }
-      if (itemId === 12) { // 12表示开空调
-        console.log(this.isNowTime, 'this.isNowTime')
-        if (this.roomHasScene && !this.isNowTime) {
-          this.$emit('component-open-workTimePop', true)
-          return false
-        }
-      }
-      return true
-    },
-    changeAir(itemId, btnType, btnTypeDetail) {
-      if (!checkSpaceControl(this.isControl)) return
-            // 如果是过渡季 并且ACATVA 空调  则不能调节温度 不能开
-    //   console.log('btnType,this.isACATVA,this.seasonType', btnType, this.isACATVA, this.isACATFC, this.seasonType);
-      if (btnType == 'temp' && this.isACATVA && this.seasonType == 'Transition') {
-        setTimeout(() => {
-          wx.showToast({
-            title: '目前为过渡季节,大厦无冷热水供应,空调无法调节',
-            duration: 2600,
-            icon: 'none'
-          })
-        }, 0)
-        return
-      }
-      isWithinLocation().then(() => {
-        if (this.roomType === '开放') {
-          this.showWorkTime = this.checkAirCanOpen(itemId)
-          if (!this.showWorkTime) return
-        }
-        wx.uma.trackEvent(`officeHome_changeAir_${btnTypeDetail}`, { key: btnTypeDetail })
-        this.vibrateShort()
-        const paramObj = {
-          objectId: this.objectId, // 空间id
-          valueType: 1, // 固定为1
-          itemId: itemId  //   1,有点冷  2,冷死了 3,有点热 4,热死了
-        }
-                // 如果不是开关空调
-        if (btnType != 'sw') {
-          this.$emit('airShowVisible', {
-            'toWhere': btnTypeDetail,
-            'designTemperature': 0 }
-                    )
-        }
-        console.log('空调下发指令')
-                //  下达指令
-        changeTempHttp(paramObj).then(res => {
-          if (btnType != 'sw') {
-            this.$emit('airShowVisible', {
-              'toWhere': btnTypeDetail,
-              'designTemperature': res.designTemperature }
-                        )
-            if (res.notice) {
-              this.$emit('airTemp', {notice: res.notice, remark: res.remark})
-            } else {
-              feedbackTimer = setInterval(() => {
-                this.getAirInfo('feedback', btnType, res.id) // 调节反馈文案
-              }, 1000)
-            }
-          }
-        }).catch(() => {
-        })
-      }).catch(() => {
-      })
-    }
-  }
-
-})
-</script>
-
-<style lang="less" scoped>
-.air-common-text {
-    padding-top: 2rpx;
-    font-family: PingFang SC;
-    font-size: 22rpx;
-    font-weight: 400;
-    line-height: 30rpx;
-    color: rgba(196, 196, 196, 1);
-    &.air-status-text {
-        width: 60%;
-        overflow: hidden;
-        text-overflow: ellipsis;
-        white-space: nowrap;
-        color: #827f7f;
-    }
-
-    &.change-text {
-        font-size: 28rpx;
-        line-height: 40rpx;
-    }
-}
-.office-card {
-    box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.07),
-        0px 4px 10px rgba(0, 0, 0, 0.05);
-    border-radius: 50rpx;
-    background: #ffffff;
-    margin-bottom: 30rpx;
-}
-
-.air-adjust {
-    position: relative;
-    // height: 280rpx;
-    .air-content {
-        padding: 48rpx 30rpx 0rpx 60rpx;
-        box-sizing: border-box;
-    }
-
-    .air-switch {
-        position: absolute;
-        top: 190rpx;
-        right: 30rpx;
-    }
-
-    .air-adjust-env {
-        .envname {
-            font-family: PingFang SC;
-            color: rgba(77, 82, 98, 1);
-            font-size: 32rpx;
-            font-weight: 600;
-            line-height: 44rpx;
-        }
-        .envnum {
-            font-family: Montserrat;
-            font-size: 64rpx;
-            font-weight: 400;
-            line-height: 64rpx;
-            padding-top: 10rpx;
-            color: #1b144e;
-            label {
-                font-family: Mulish;
-                font-weight: 800;
-                font-size: 24rpx;
-                margin-left: 6rpx;
-                line-height: 30rpx;
-                vertical-align: top;
-                color: #c4c4c4;
-            }
-        }
-    }
-    .air-status {
-        padding-top: 20rpx;
-        font-family: PingFang SC;
-        font-size: 28rpx;
-        font-weight: 400;
-        line-height: 40rpx;
-        color: rgba(196, 196, 196, 1);
-    }
-
-    .room-air-status {
-        padding-top: 6rpx;
-        padding-bottom: 20rpx;
-        display: flex;
-        align-items: center;
-        .room-air-img {
-            margin-right: 7rpx;
-            width: 28rpx;
-            height: 28rpx;
-        }
-    }
-
-    .air-adjust-btn {
-        flex: 1;
-        image {
-            position: absolute;
-            top: 0;
-            right: 0;
-            width: 314rpx;
-            height: 220rpx;
-        }
-    }
-}
-.air-control-item {
-    padding: 20rpx 28rpx 16rpx 56rpx;
-    box-sizing: border-box;
-    display: flex;
-    justify-content: space-between;
-    border-top: 1px solid rgba(196, 196, 196, 0.4);
-    .air-control-item-box {
-        display: flex;
-        align-items: center;
-    }
-    .envnum-common {
-        font-family: Montserrat;
-        font-size: 40rpx;
-        font-weight: 500;
-        line-height: 48rpx;
-        color: rgba(77, 82, 98, 1);
-        &.air-envnum-comon {
-            display: flex;
-            align-items: center;
-        }
-        .envnum-common-wind {
-            font-family: Montserrat;
-            font-size: 24rpx;
-            font-weight: 500;
-            line-height: 30rpx;
-            margin-right: 10rpx;
-            color: rgba(196, 196, 196, 1);
-            &.windBlack {
-                font-size: 40rpx;
-                line-height: 48rpx;
-                color: rgba(77, 82, 98, 1);
-            }
-        }
-        &.colorRed {
-            color: red;
-        }
-        &.colorBlue {
-            color: rgba(94, 139, 207, 1);
-        }
-        &.colorBlack {
-            color: rgba(77, 82, 98, 1);
-        }
-        label {
-            font-size: 11px;
-            line-height: 13px;
-            color: rgba(196, 196, 196, 1);
-            vertical-align: top;
-        }
-    }
-    .air-common-switch {
-        display: flex;
-    }
-    .switch:first-child {
-        margin-right: 40rpx;
-    }
-    .switch {
-        display: flex;
-        justify-content: center;
-        align-items: center;
-        height: 80rpx;
-        width: 80rpx;
-        background: #c4c4c433;
-        border-radius: 50%;
-        image {
-            width: 40rpx;
-            height: 40rpx;
-        }
-        &.yell {
-            background: rgba(61, 203, 204, 0.3);
-        }
-    }
-}
-</style>
-
-<config>
-{
-    usingComponents: {
-        "switch": "./switch"    
-    }
-
-}
-</config>

+ 72 - 80
src/packagesEnv/pages/officehome/components/lamp-adjust.wpy

@@ -293,17 +293,15 @@
 </template>
 
 <script>
-import wepy from '@wepy/core';
+import wepy from '@wepy/core'
 import { setallLampHttp, getLampHttp, getStatusHttp } from '@/packagesEnv/api/officehome.js'
-import { isWithinLocation } from '@/service/location';
-import { checkSpaceControl } from '@/packagesEnv/pages/common.js'
-import config from '@/config';
-import store from '@/store';
-import { mapState } from '@wepy/x';
-let fifteenTimer = null;
+import { isWithinLocation } from '@/service/location'
+import config from '@/config'
+import store from '@/store'
+import { mapState } from '@wepy/x'
+let fifteenTimer = null
 wepy.component({
   props: {
-    isControl: Boolean, // 是否可控
     equipConfig: Array, // 设备配置情况
     controlMode: Number, // 手动模式
     roomType: String, // 房间类型
@@ -332,11 +330,11 @@ wepy.component({
   },
   watch: {
     spaceId() {
-      this.showLamps = false; // 恢复初始化值
-      this.allowSvg = 'down_Arrow.svg';
+      this.showLamps = false // 恢复初始化值
+      this.allowSvg = 'down_Arrow.svg'
 
-      this.getLampList();
-      this.getTwoTimerLoop();
+      this.getLampList()
+      this.getTwoTimerLoop()
     },
     lampHide(nval) {
       if (this.showLamps) {
@@ -346,14 +344,13 @@ wepy.component({
 
   },
   detached() {
-    clearInterval(this.lightsStatusTimer);
-    this.lightsStatusTimer = null;
-    clearTimeout(fifteenTimer);
-    fifteenTimer = null;
+    clearInterval(this.lightsStatusTimer)
+    this.lightsStatusTimer = null
+    clearTimeout(fifteenTimer)
+    fifteenTimer = null
   },
   methods: {
     openColourPop(obj) {
-      if (!checkSpaceControl(this.isControl)) return;
             //  灯开时 才能调节色温
       if (obj.runStatus && (obj.bright || obj.colorTemperature)) {
         this.$emit('component-open-colourPop', obj)
@@ -363,89 +360,89 @@ wepy.component({
     setLampItem(item) {
       if (item.lightType === 1) {
         if (item.switch) {
-          item.lampImg = 'lamp_small_open.png';
+          item.lampImg = 'lamp_small_open.png'
         } else {
-          item.lampImg = 'lamp_small_close.png';
+          item.lampImg = 'lamp_small_close.png'
         }
       } else {
         if (item.switch) {
-          item.lampImg = 'atmLamp_small_open.png';
+          item.lampImg = 'atmLamp_small_open.png'
         } else {
-          item.lampImg = 'atmLamp_small_close.png';
+          item.lampImg = 'atmLamp_small_close.png'
         }
       }
     },
     // 大于三个灯时,展示的数量
     showLampCount() {
-      let arr = [];
+      let arr = []
       this.initData.map((item, idx) => {
-        this.setLampItem(item);
+        this.setLampItem(item)
         if (this.initData.length < 3 || !this.showLamps) {
           if (idx < 2) {
-            arr.push(item);
+            arr.push(item)
           }
         } else {
-          arr = [...this.initData];
+          arr = [...this.initData]
         }
       })
       this.lampList = JSON.parse(JSON.stringify(arr))
     },
     getLampList() {
       getLampHttp({ spaceId: this.spaceId }).then(res => {
-        const content = res.content || [];
-        if (!content.length) return;
-        let flag = false;
+        const content = res.content || []
+        if (!content.length) return
+        let flag = false
         for (let index = 0; index < content.length; index++) {
-          let item = content[index];
-          item.switch = !!item.runStatus;
+          let item = content[index]
+          item.switch = !!item.runStatus
           if (item.runStatus) {
-            flag = true;
+            flag = true
           }
         }
-        this.lampSw = flag;
-        this.initData = JSON.parse(JSON.stringify(res.content));//  灯的数据
-        this.total = this.initData.length;
+        this.lampSw = flag
+        this.initData = JSON.parse(JSON.stringify(res.content))//  灯的数据
+        this.total = this.initData.length
         this.showLampCount()
       })
     },
     vibrateShort() {
       if (wx.canIUse('vibrateShort')) {
-        wx.vibrateShort();
+        wx.vibrateShort()
       } else {
-        wx.vibrateLong();
+        wx.vibrateLong()
       }
     },
         // 手动模式下设备是否可控
     checkControlMode(id) {
-      let flag = false;
+      let flag = false
       if (!this.controlMode) {
         return flag
       }
 
             //  总开关
       if (id === 'allLamp') {
-        let canOpen = true;
+        let canOpen = true
         for (let i = 0; i < this.equipConfig.length; i++) {
-          const ele = this.equipConfig[i];
+          const ele = this.equipConfig[i]
           for (let j = 0; j < this.lampList.length; j++) {
-            const jele = this.lampList[j];
+            const jele = this.lampList[j]
                         // 有可控设备
             if (ele.equipmentId === jele.id && ele.isExeSpaceTime) {
-              canOpen = false;
-              return;
+              canOpen = false
+              return
             }
           }
         }
-        flag = canOpen;
+        flag = canOpen
       } else {
         this.equipConfig.map(item => {
                     //  设备不受控制 可直接开灯
           if (item.equipmentId === id && !item.isExeSpaceTime) {
-            flag = true;
+            flag = true
           }
                     // 设备受控 且有当前工作时间 可直接开灯
           if (item.equipmentId === id && this.isNowTime && item.isExeSpaceTime) {
-            flag = true;
+            flag = true
           }
         })
       }
@@ -455,97 +452,92 @@ wepy.component({
     checkLampCanOpen(value, id) { // 判断灯是否能开启
       if (value) {
                 // 手动模式下设备是否可控
-        let canControl = this.checkControlMode(id);
+        let canControl = this.checkControlMode(id)
                 // 有场景无时间 得预约
         if (this.roomHasScene && !this.isNowTime && !canControl) {
                     // 手动模式下
-          this.controlMode && this.$emit('component-EquipType-workTimePop', id);
-          this.$emit('component-open-workTimePop', true);
+          this.controlMode && this.$emit('component-EquipType-workTimePop', id)
+          this.$emit('component-open-workTimePop', true)
           return false
         }
       }
       return true
     },
     eqChange(value, id, index) {
-      if (!checkSpaceControl(this.isControl)) return;
       isWithinLocation().then(() => {
         if (this.roomType === '开放') {
-          this.showWorkTime = this.checkLampCanOpen(value, id);
-          if (!this.showWorkTime) return;
+          this.showWorkTime = this.checkLampCanOpen(value, id)
+          if (!this.showWorkTime) return
         }
-        this.fifteenTimeout();
-        let params = [];
+        this.fifteenTimeout()
+        let params = []
         if (id === 'allLamp') {
-          wx.uma.trackEvent(`officeHome_lamp_card_Switch_${value}`, { key: value ? '卡片-开灯' : '卡片-关灯' });
-          params = this.initData;
+          params = this.initData
           params.forEach(item => {
             item.switch = value
           })
          // 前端现更改灯的状态,15s后获取设备状态
           this.lampList.map(item => {
-            item.switch = value;
+            item.switch = value
             this.setLampItem(item)
           })
           this.initData.map(item => {
-            item.switch = value;
+            item.switch = value
             this.setLampItem(item)
           })
-          this.lampSw = value;
+          this.lampSw = value
         } else {
-          wx.uma.trackEvent(`officeHome_lamp_list_Switch_${value}`, { key: value ? '列表-开灯' : '列表-关灯' });
-          params = [{ id: id, switch: value }];
+          params = [{ id: id, switch: value }]
           //  前端现更改灯的状态,15s后获取设备状态
           if (this.lampList.length === 1) {
-            this.lampSw = value;
+            this.lampSw = value
           }
           this.lampList.map(item => {
             if (item.id === id) {
-              item.switch = value;
+              item.switch = value
               this.setLampItem(item)
             }
           })
           this.initData.map(item => {
             if (item.id === id) {
-              item.switch = value;
+              item.switch = value
               this.setLampItem(item)
             }
           })
         }
-        this.fifteenTimeout();
-        setallLampHttp(params).then(res => {});
-        this.vibrateShort();
+        this.fifteenTimeout()
+        setallLampHttp(params).then(res => {})
+        this.vibrateShort()
       })
     },
     // 15s 之后再请求状态
     fifteenTimeout() {
-      clearInterval(this.lightsStatusTimer);
-      this.lightsStatusTimer = null;
-      clearTimeout(fifteenTimer);
-      fifteenTimer = null;
+      clearInterval(this.lightsStatusTimer)
+      this.lightsStatusTimer = null
+      clearTimeout(fifteenTimer)
+      fifteenTimer = null
       fifteenTimer = setTimeout(() => {
-        this.getTwoTimerLoop();
-      }, 1000 * 15);
+        this.getTwoTimerLoop()
+      }, 1000 * 15)
     },
     getTwoTimerLoop() {
-      clearInterval(this.lightsStatusTimer);
-      this.lightsStatusTimer = null;
+      clearInterval(this.lightsStatusTimer)
+      this.lightsStatusTimer = null
       this.lightsStatusTimer = setInterval(() => {
-        this.getLampList();
-      }, 2 * 1000); // 2秒描刷接口
+        this.getLampList()
+      }, 2 * 1000) // 2秒描刷接口
     },
 
         // 灯列表
     handleShow() {
-      if (!checkSpaceControl(this.isControl)) return;
-      if (!this.lampList.length) return;
+      if (!this.lampList.length) return
       this.showLamps = !this.showLamps
       if (!this.showLamps) {
         this.allowSvg = 'down_Arrow.svg'
       } else {
         this.allowSvg = 'up_Arrow.svg'
       }
-      this.setLampList();
-      wx.uma.trackEvent('officeHome_lamp_show', { key: this.showLamps ? '展开' : '收起' });
+      this.setLampList()
     },
     setLampList() {
       this.showLampCount()

+ 0 - 895
src/packagesEnv/pages/officehome/components/period-time-slider.wpy

@@ -1,895 +0,0 @@
-<style lang="less">
-.componet-period-time-slider {
-    width: 100%;
-    height: 182rpx;
-    position: relative;
-    z-index: 2;
-    overflow-x: hidden;
-}
-
-.componet-period-time-slider .peroid-content-wrapper {
-    width: 658rpx;
-    position: absolute;
-    // left: 48rpx;
-    // right: 48rpx;
-    height: 182rpx;
-}
-
-.componet-period-time-slider .period-time-scroller {
-    position: absolute;
-    left: 32rpx;
-    right: 32rpx;
-    overflow: hidden;
-}
-
-.componet-period-time-slider .sliders-scroller-wrapper {
-    display: inline-block;
-    position: relative;
-    // border-right: 1px solid #c4c4c4;
-    height: 100%;
-}
-.componet-period-time-slider .sliders-list {
-    height: 100%;
-    width: 100%;
-}
-
-.componet-period-time-slider .sliders-wrapper {
-    width: 40px;
-    height: 100%;
-    display: inline-block;
-    vertical-align: bottom;
-    box-sizing: border-box;
-    position: relative;
-    z-index: 10;
-    &:last-child {
-        height: 154rpx;
-        border-right: 1px solid #c4c4c4;
-    }
-}
-
-.componet-period-time-slider .disabled-block {
-    position: absolute;
-    height: 120rpx;
-    // line-height: 120rpx;
-    left: 0;
-    right: 0;
-    background-repeat: repeat;
-}
-
-.componet-period-time-slider .sliders {
-    width: 100%;
-    height: 100%;
-    display: flex;
-    flex-direction: column;
-    justify-content: flex-end;
-    position: relative;
-}
-
-.componet-period-time-slider .sliders .label {
-    width: 100%;
-    box-sizing: border-box;
-    height: 62rpx;
-    position: relative;
-    .split {
-        position: absolute;
-        height: 34rpx;
-        width: 1px;
-        left: 0;
-        bottom: 0;
-        background: #c4c4c4;
-    }
-    .text {
-        position: absolute;
-        left: 14rpx;
-        top: 0;
-        font-weight: 500;
-        font-size: 26rpx;
-        line-height: 32rpx;
-        color: #656872;
-        font-family: Montserrat;
-    }
-}
-
-.componet-period-time-slider .sliders .slider-block {
-    width: 100%;
-    height: 120rpx;
-
-    box-sizing: border-box;
-    background-repeat: repeat;
-    &.hasBorder {
-        border-left: 1px solid #ccc;
-    }
-    &.is-booked-selected-slider {
-        background-color: rgba(229, 87, 79, 0.6);
-    }
-    &.is-can-selected-slider {
-        background-color: rgba(0, 220, 35, 0.2);
-    }
-}
-
-.componet-period-time-slider .selected-area {
-    height: 120rpx;
-    position: absolute;
-    bottom: 0;
-    box-sizing: border-box;
-    display: flex;
-    flex-direction: row;
-    justify-content: space-between;
-    z-index: 12;
-    &.showBg {
-        background: rgba(0, 220, 35, 0.2);
-    }
-}
-
-.componet-period-time-slider .selected-area.disabled {
-    // background-color: rgba(255, 77, 94, 0.26);
-}
-
-.componet-period-time-slider .booked-area {
-    height: 100%;
-    position: absolute;
-    bottom: 0;
-    font-size: 24rpx;
-    line-height: 112rpx;
-    text-align: center;
-    color: rgba(6, 6, 61, 0.3);
-    z-index: 11;
-    .bg {
-        position: absolute;
-        bottom: 0;
-        height: 120rpx;
-        width: 100%;
-        background-repeat: repeat;
-    }
-    &.selected {
-        z-index: 12;
-        .bg {
-            background-color: rgba(255, 232, 35, 0.2);
-        }
-    }
-    .booked-user-info {
-        padding: 18rpx;
-        background: #ffffff;
-        box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.08);
-        border-radius: 54rpx;
-        position: absolute;
-        bottom: 66rpx;
-        left: 50%;
-        transform: translateX(-50%);
-        display: flex;
-        flex-direction: row;
-        align-items: center;
-        z-index: 13;
-        text-align: left;
-        .avatar {
-            width: 72rpx;
-            height: 72rpx;
-            display: block;
-            border-radius: 50%;
-        }
-        .info {
-            width: 156rpx;
-            margin-left: 22rpx;
-            .name {
-                font-weight: 500;
-                font-size: 28rpx;
-                line-height: 40rpx;
-                color: #000000;
-                margin-top: 2rpx;
-                white-space: nowrap;
-                text-overflow: ellipsis;
-                overflow: hidden;
-            }
-            .time {
-                color: #656872;
-                font-weight: 500;
-                font-size: 20rpx;
-                line-height: 24rpx;
-                font-family: Montserrat;
-            }
-        }
-    }
-}
-
-.componet-period-time-slider .selected-area .start,
-.componet-period-time-slider .selected-area .end {
-    position: absolute;
-    height: 100%;
-    width: 50rpx;
-    background: transparent;
-    /* display: flex;
-  flex-direction: row;
-  justify-content: center; */
-}
-
-.componet-period-time-slider .selected-area .start {
-    left: 0;
-    transform: translateX(-50%);
-}
-
-.componet-period-time-slider .selected-area .end {
-    right: 0;
-    transform: translateX(50%);
-}
-
-.componet-period-time-slider .selected-area .start-axis {
-    /* right:-20%; */
-    // margin-left: 20rpx;
-    left: 50%;
-    transform: translateX(-50%);
-}
-
-.componet-period-time-slider .selected-area .end-axis {
-    // margin-left: 30rpx;
-    right: 50%;
-    transform: translateX(50%);
-}
-
-.componet-period-time-slider .selected-area .axis {
-    height: 100%;
-    width: 3px;
-    background-color: #00dc23;
-    position: absolute;
-}
-
-.componet-period-time-slider .selected-area .axis.disabled {
-    background-color: #e5574f;
-    &::before {
-        border-color: #e5574f;
-    }
-}
-
-.componet-period-time-slider .selected-area .end-axis:before {
-    content: ' ';
-    position: absolute;
-    height: 24rpx;
-    width: 24rpx;
-    background-color: #fff;
-    border: 3px solid #00dc23;
-    box-sizing: border-box;
-    top: 50%;
-    left: 50%;
-    transform: translate(-50%, -50%);
-    z-index: 13;
-    border-radius: 50%;
-}
-</style>
-
-<template>
-    <div
-        class="componet-period-time-slider"
-        v-on:touchend.stop="stopPragation"
-    >
-        <div class="peroid-content-wrapper">
-            <scroller-x
-                @componet-scroller-x-scroll="scroll"
-                containerId="peroid-content-wrapper"
-                canMove="{{!isSelectPeriodIng}}"
-                scrollLeft="{{scrollLeft}}"
-            >
-                <div class="sliders-scroller-wrapper">
-                    <div class="sliders-list">
-                        <div
-                            class="sliders-wrapper"
-                            v-for="(item,index) in sliders"
-                            data-index="{{index}}"
-                        >
-                            <div class="sliders">
-                                <div
-                                    class="label"
-                                    v-if="index%2==0"
-                                >
-                                    <div class="split"></div>
-                                    <div class="text">{{item.label}}</div>
-                                </div>
-                                <!-- slider-block class判断逻辑:如果选中了, 则需判断该块的状态来增加对应的背景色 -->
-                                <!-- slider-block style判断逻辑: 
-                一: 如果是过去的状态下: 1-需要展示过去状态需要红斜线(该块不是预定状态下(因为预定的斜线在booked-area里合并展示) 2- 是在选择区域,选择区域在过去状态需要红斜线)展示红斜线 
-                二: 如果展示未运营时间范围内且disabledUnopened 则需要展示 红斜线-->
-                                <div
-                                    class="{{'slider-block' + (item.isInSelectArea ? (item.isBooked || item.status=='unOpened' || item.status=='past')?' is-booked-selected-slider':' is-can-selected-slider' :'') + (index%2==0? ' hasBorder':'')}}"
-                                    v-on:click="selectPeriod"
-                                    data-index="{{index}}"
-                                    style="{{((item.status=='past'&& (showPastDisabled || item.isInSelectArea)) ||  (disabledUnopened && item.status=='unOpened'))? 'background-color:'+'#e3e3e3' : ''+';'+(item.isBooked?'background-image:url('+h5StaticPath+'/page-meeting-room/bg_disabled_red_v2.svg)':'')}}"
-                                ></div>
-                            </div>
-                        </div>
-                    </div>
-                    <div
-                        @click="deleteSelectedBookArea"
-                        class="{{'selected-area'+(canBookSelectArea?'': 'disabled') + (isSelectPeriodIng? ' showBg': '')}}"
-                        v-if="startIndex!==null"
-                        style="{{'left:' +selectArealeft + 'px;right:'+ selectAreaRight+ 'px;' }}"
-                    >
-                        <div
-                            class="start"
-                            data-from="start"
-                        >
-                            <div class="{{'start-axis axis'+ (!firstSelectSliderCanBook?' disabled': '')}}"></div>
-                        </div>
-                        <div
-                            class="end"
-                            v-on:touchmove.stop="changeEndTimeMove"
-                            v-on:touchstart.stop="changeEndTimeStart"
-                            v-on:touchend.stop="changeEndTimeEnd"
-                        >
-                            <div
-                                class="{{'end-axis axis'+ (!endSelectSliderCanBook ? 'disabled': '')}}"
-                                data-from="end"
-                            ></div>
-                        </div>
-                    </div>
-
-                    <!-- <div
-                        class="{{'booked-area' + (index === selectedBookAreaIndex? ' selected': '')}}"
-                        v-for="(item,index) in formattedBookList"
-                        :key="index"
-                        style="{{'left:' +item.left + 'px;right:'+ (item.right)+ 'px;'}}"
-                        bindlongtap="{{deleteSelectedBookArea(index)}}"
-                    >
-                        <div
-                            class="bg"
-                            style="{{'background-image:url('+h5StaticPath+'/page-meeting-room/bg_disabled_red_v2.svg)'}}"
-                        ></div>
-                    </div> -->
-                </div>
-            </scroller-x>
-        </div>
-    </div>
-</template>
-
-<script>
-import {
-    generateTimeValuesByArea,
-    SliderUnit
-} from '@/service/meetingTimes';
-import { generateTimeSliders,TimeStart,TimeEnd } from '@/packagesEnv/pages/common.js'
-let SliderWidth = 40; // ('单位为px');
-let startX = 0;
-let scrollerMarginLeft = 16; // ('单位为px');
-let axiosWidth = 56; // ('单位为px');
-let componentWrapInfo = {};
-let maxScrollLeft = 0;
-let addTimer = null;
-let reduceTimer = null;
-let overRightMoveX = 0;
-let reduceLeftMoveX = 0;
-let SlidersWrapperTotaLength = ((TimeEnd - TimeStart) / SliderUnit) * SliderWidth;
-let ShowAreaLength = 0;
-import wepy from '@wepy/core';
-import config from '@/config';
-wepy.component({
-    data: {
-        sliders: [],
-        bookedTimeValues: [], //这个用来判断当前slider是否是占用的
-        formattedBookList: [], //这个用来展示占用人名字居中的
-        startIndex: null,
-        duration: 0,
-        selectArealeft: 0,
-        selectAreaRight: '100%',
-        sliderFrom: '', //end,触发结束轴,start触发增加轴,
-        scrollLeft: 0,
-        isSelectPeriodIng: false, //用来标记是否在滑动选时间中
-        componentWrapWidth: 375,
-        h5StaticPath: config.h5StaticPath,
-        scrollLeftByTouch: 0, //用来记录自身滚动值,与设置的值区分开,防止多次设置组件内部滚动值会出现抖动
-        featuresVersion: config.featuresVersion,
-        selectedBookAreaIndex: null
-    },
-    props: {
-        selectValue: Object,
-        disabledPast: {
-            type: Boolean,
-            default: false
-        },
-        defaultSelectedPeriod: Object,
-        bookedList: Array,
-        hiddenBookedUserName: {
-            type: Boolean,
-            default: false
-        },
-        openStartTime: {
-            type: Number
-        },
-        openEndTime: {
-            type: Number
-        },
-        disabledUnopened: {
-            type: Boolean,
-            default: false
-        },
-        showPastDisabled: {
-            type: Boolean,
-            default: false
-        }
-    },
-    ready() {
-        this.getComponentWrapInfo().then(({ area }) => {
-            ShowAreaLength = area;
-            maxScrollLeft = ShowAreaLength - SlidersWrapperTotaLength;
-            const { selectValue } = this;
-            if (selectValue && selectValue.start && selectValue.end) {
-                // 防止此时选择时间列表还未全部渲染完毕
-                setTimeout(() => {
-                    this.setValeByStartAndValue(selectValue.start, selectValue.end);
-                }, 500);
-            }
-        });
-
-    },
-    computed: {
-        sliders() {
-            let sliders = generateTimeSliders(
-                this.openStartTime,
-                this.openEndTime,
-                this.disabledPast
-            );
-            // 找出已经booked, 并标记isBooked
-            if (this.formattedBookList && this.formattedBookList.length !== 0) {
-                sliders = sliders.map(slider => {
-                    let item = { ...slider };
-                    let sliderHasBooked = this.bookedTimeValues.find(
-                        time => slider.value == time
-                    );
-                    if (typeof sliderHasBooked === 'number') {
-                        item.isBooked = true;
-                    }
-                    return { ...item };
-                });
-            }
-            
-            // 找出在selectesArea里面的, 并标记isInSelectArea
-            if (this.startIndex !== null && this.duration) {
-                let start = sliders[this.startIndex].value;
-                let end = start + this.duration * SliderUnit;
-                sliders = sliders.map((slider, index) => {
-                    let isInSelectArea = false;
-                    if (slider.value >= start && slider.value < end) {
-                        isInSelectArea = true;
-                    }
-                    return { ...slider, isInSelectArea };
-                });
-            }
-            return sliders;
-        },
-        formattedBookList() {
-            let { formattedBookList } = this.formattedPeriodBookList(this.bookedList);
-            return formattedBookList;
-
-        },
-        bookedTimeValues() {
-            let {
-                formattedBookList,
-                bookedTimeValues
-            } = this.formattedPeriodBookList(this.bookedList);
-            return bookedTimeValues;
-
-        },
-        canBookSelectArea() {
-            let { canBooked } = this.selectAareaCanBook();
-            return canBooked;
-        },
-        firstSelectSliderCanBook() {
-            let { firstCanBook } = this.selectAareaCanBook();
-            return firstCanBook;
-        },
-        endSelectSliderCanBook() {
-            let { endCanBook } = this.selectAareaCanBook();
-            return endCanBook;
-        }
-    },
-    watch: {
-        selectValue: function (newSelectValue, oldSelectValue) {
-            if (JSON.stringify(oldSelectValue) !== JSON.stringify(newSelectValue)) {
-                if (newSelectValue.from !== 'outer') {
-                    return;
-                }
-                if (newSelectValue && newSelectValue.start && newSelectValue.end) {
-                    this.setValeByStartAndValue(newSelectValue.start, newSelectValue.end);
-                } else {
-                    this.reset();
-                }
-            }
-        },
-        bookedList: function (newBookedList, oldBooledList) {
-            if (JSON.stringify(oldBooledList) !== JSON.stringify(newBookedList)) {
-                // this.changedSlidersWithBookList();
-                const { selectValue } = this;
-                if (selectValue && selectValue.start && selectValue.end) {
-                    this.setValeByStartAndValue(selectValue.start, selectValue.end);
-                }
-            }
-        },
-        disabledPast: function (newDisabledPast, oldDisabledPast) {
-            const { selectValue } = this;
-            if (selectValue && selectValue.start && selectValue.end) {
-                this.setValeByStartAndValue(selectValue.start, selectValue.end);
-            }
-        }
-    },
-    methods: {
-        formattedPeriodBookList(bookedList) {
-            let formattedBookList = [],
-                bookedTimeValues = [];
-            if (!bookedList || (bookedList && bookedList.length == 0)) {
-                return { formattedBookList, bookedTimeValues };
-            }
-            formattedBookList = bookedList.map(booked => {
-                //todo
-                let { start, end } = booked;
-                let duration = (end - start) / SliderUnit;
-                let list = generateTimeValuesByArea(start, end);
-                bookedTimeValues = bookedTimeValues.concat(list);
-                let left = ((start - TimeStart) / SliderUnit) * SliderWidth; 
-
-                let right = SlidersWrapperTotaLength - left - duration * SliderWidth;
-                return { ...booked, duration, left, right };
-            });
-            return { formattedBookList, bookedTimeValues };
-        },
-        reset() {
-            this.startIndex = null;
-            this.duration = 0;
-            this.scrollLeft = 0;
-            this.selectArealeft = 0;
-            this.selectAreaRight = 0;
-        },
-        setValeByStartAndValue(start, end) {
-            let duration = (end - start) / SliderUnit;
-            let startIndex = this.sliders.findIndex(item => item.value == start);
-            let scrollLeft = -(startIndex * SliderWidth) + 50;
-            if (scrollLeft > 0) {
-                scrollLeft = 0;
-            } else if (scrollLeft < maxScrollLeft) {
-                scrollLeft = maxScrollLeft;
-            }
-            this.startIndex = startIndex;
-            this.duration = duration;
-            this.scrollLeftByTouch = scrollLeft; //同时也要记录;
-            setTimeout(() => {
-                this.scrollLeft = scrollLeft;
-            }, 100); // 防止初始是,时间轴列表还未渲染完,此时设置滚动不生效
-            const { canBookSelectArea } = this;
-            this.$emit(
-                'component-period-time-slider-judgecanselectedend',
-                canBookSelectArea
-            );
-            this.setSelectArea(startIndex, duration);
-        },
-        selectAareaCanBook() {
-            const { startIndex, duration, sliders, disabledPast } = this;
-
-            let canBooked = true;
-            let firstCanBook = true;
-            let endCanBook = true;
-            // 只有当有值才去判断
-            if (sliders && sliders.length && duration && !isNaN(startIndex)) {
-                let start = sliders[startIndex].value;
-                let selectedSliders = [];
-                for (let i = 0; i < duration; i++) {
-                    selectedSliders.push(start + i * SliderUnit);
-                }
-                selectedSliders.forEach((selectedItem, index) => {
-                    let selectSlider = sliders.find(item => item.value == selectedItem);
-                    if (
-                        (selectSlider && disabledPast && selectSlider.status == 'past') ||
-                        (selectSlider && selectSlider.status === 'unOpened')
-                    ) {
-                        canBooked = false;
-                        // 在不能预约的块里面是否有第一个,
-                        if (index == 0) {
-                            firstCanBook = false;
-                        }
-                        //再不能最后一个
-                        if (index == selectedSliders.length - 1) {
-                            endCanBook = false;
-                        }
-                    }
-                });
-            }
-
-            return { canBooked, firstCanBook, endCanBook };
-        },
-        scroll(scrollLeft) {
-            this.scrollLeftByTouch = scrollLeft;
-        },
-        selectPeriod(e) {
-            let index = e.$wx.target.dataset.index;
-            // if (this.index === index) {
-            //   this.cancelSelect();
-            // } else {
-            //   this.selectSlider(index)
-            // }
-            this.resetCanBook();
-            this.selectSlider(index);
-            this.onEndSelectFun();
-        },
-        resetCanBook() {
-            this.canBookSelectArea = true;
-        },
-        cancelSelect() {
-            this.startIndex = null;
-            this.duration = 0;
-            this.selectArealeft = 0;
-            this.selectAreaRight = 0; //默认保留一个宽度;
-        },
-        selectSlider(index) {
-            this.startIndex = index;
-            this.duration = 1;
-            this.setSelectArea(index, 1);
-            this.selectedBookAreaIndex = null;
-        },
-        setSelectArea(startIndex, duration) {
-            // console.log('设置偏移值',left, right);
-            let left = SliderWidth * startIndex;
-            let right = SlidersWrapperTotaLength - left - duration * SliderWidth;
-            this.selectArealeft = parseInt(left);
-            this.selectAreaRight = parseInt(right);
-        },
-        changeEndTimeStart(e) {
-            startX = Number(e.touches[0].pageX);
-            this.isSelectPeriodIng = true;
-        },
-        changeEndTimeMove(e) {
-            let {
-                scrollLeftByTouch,
-                startIndex,
-                duration,
-                selectArealeft,
-                selectAreaRight
-            } = this;
-            let touch = e.touches[0],
-                x = Number(touch.pageX);
-            let from = e.target.dataset.from;
-            if (x === startX) {
-                // 没有实质性的移动,不做处理,提高性能
-                return;
-            }
-            let touchLength = parseInt(x - startX);
-            startX = x;
-            //左边最起始x位置
-            let leftLimit = scrollerMarginLeft;
-            //因为要保证最少有一格,故滑动start轴最右边是当前结束位置向前移一格
-            let startLimit =
-                scrollerMarginLeft +
-                SliderWidth * (startIndex + duration - 1) +
-                scrollLeftByTouch;
-            //右边最大结束x位置
-            let rightLimit = scrollerMarginLeft + componentWrapInfo.width;
-            //因为要保证最少有一格,故滑动end轴结束位置为当前开始位置加一格
-            let endLimit =
-                scrollerMarginLeft + SliderWidth * (startIndex + 1) + scrollLeftByTouch;
-            //end 轴往前滑
-
-            if (touchLength >= 0 && x >= ShowAreaLength) {
-                this.clerReduceTimer();
-                // console.log('超出右边界,增加右边');
-                this.scrollToRightEdgBySelectArea(touchLength);
-                return;
-            }
-
-            // if (touchLength <= 0 && (selectArealeft + scrollLeftByTouch) < 0) {
-            //   this.clearAddTimer();
-            //   console.log('左边看不见,可以减少左边');
-            //   this.reduceSelectAreaRight();
-            //   return
-            // }
-
-            if (
-                touchLength <= 0 &&
-                SlidersWrapperTotaLength -
-                (selectAreaRight - touchLength) -
-                selectArealeft <=
-                SliderWidth
-            ) {
-                //保证一格,不让滑了
-                this.selectAreaRight =
-                    SlidersWrapperTotaLength - selectArealeft - SliderWidth;
-                return;
-            }
-
-            this.clearAddTimer();
-            this.clerReduceTimer();
-            // console.log('正常滑动增加或减少');
-            this.selectAreaRight = selectAreaRight - touchLength;
-        },
-        scrollToRightEdgBySelectArea() {
-            let { scrollLeftByTouch, selectAreaRight } = this;
-            if (addTimer) {
-                return;
-            }
-
-            addTimer = setInterval(() => {
-                // console.log('进入增加定时器');
-                overRightMoveX = overRightMoveX + 1;
-                let translateX = scrollLeftByTouch - overRightMoveX;
-                let newSelectAreaRight = selectAreaRight - overRightMoveX; //同时selectAreaRight也要变小
-                if (translateX <= maxScrollLeft) {
-                    //如果超出边界值,就不在滑动了
-                    this.clearAddTimer();
-                    this.scrollLeftByTouch = maxScrollLeft; //同时也要记录;
-                    this.scrollLeft = maxScrollLeft;
-                    this.selectAreaRight = 0;
-                    return;
-                }
-                this.scrollLeftByTouch = translateX; //同时也要记录;
-                this.scrollLeft = translateX;
-                this.selectAreaRight = newSelectAreaRight;
-            }, 10);
-        },
-
-        reduceSelectAreaRight() {
-            let { scrollLeftByTouch, selectArealeft, selectAreaRight } = this;
-            if (addTimer) {
-                this.clearAddTimer();
-            }
-            if (reduceTimer) {
-                return;
-            }
-
-            reduceTimer = setInterval(() => {
-                // console.log('进入减少定时器');
-                let toMinScrollLeft = false;
-                reduceLeftMoveX = reduceLeftMoveX + 1;
-                let translateX = scrollLeftByTouch + reduceLeftMoveX; //scroll增加,滚动减小
-                let right = selectAreaRight + reduceLeftMoveX; //right增加,选择区域减小
-
-                let minScrollLeft = -selectArealeft;
-                if (translateX >= minScrollLeft) {
-                    //当滚动到当前选项结束开始位置位于屏幕左测开始位置
-                    toMinScrollLeft = true;
-                }
-
-                this.scrollLeftByTouch = toMinScrollLeft ? minScrollLeft : translateX; //同时记录
-                this.scrollLeft = toMinScrollLeft ? minScrollLeft : translateX;
-                this.selectAreaRight = right;
-
-                if (SlidersWrapperTotaLength - right - selectArealeft <= SliderWidth) {
-                    //如果right 减小到与left 只剩一格,则不再减少,并且设置为1格的间距
-                    this.clerReduceTimer(); //就不再滑动了
-                    // console.log('保证一格了,不再减少了');
-                    this.scrollLeftByTouch = toMinScrollLeft ? minScrollLeft : translateX; //同时记录
-                    this.scrollLeft = toMinScrollLeft ? minScrollLeft : translateX;
-                    this.selectAreaRight =
-                        SlidersWrapperTotaLength - selectArealeft - SliderWidth;
-                }
-            }, 10);
-        },
-
-        clearAddTimer() {
-            if (addTimer) {
-                // console.log('清楚增加定时器');
-                overRightMoveX = 0;
-                addTimer = clearInterval(addTimer);
-            }
-        },
-        clerReduceTimer() {
-            if (reduceTimer) {
-                // console.log('清楚减少定时器');
-                reduceLeftMoveX = 0;
-                reduceTimer = clearInterval(reduceTimer);
-            }
-        },
-        moveLeftToScreenLeft() {
-            const { scrollLeftByTouch, selectArealeft } = this;
-            let distance = selectArealeft + scrollLeftByTouch;
-            if (distance <= 0) {
-                this.scrollLeft = scrollLeftByTouch - distance;
-            }
-        },
-
-        moveRihtToScreenRight() {
-            const { scrollLeftByTouch, selectAreaRight } = this;
-            let distance =
-                SlidersWrapperTotaLength -
-                selectAreaRight +
-                scrollLeftByTouch -
-                ShowAreaLength;
-            if (distance > 0) {
-                this.scrollLeft = scrollLeftByTouch - distance;
-            }
-        },
-        changeEndTimeEnd() {
-            this.clerReduceTimer();
-            this.clearAddTimer();
-            this.isSelectPeriodIng = false;
-            let { selectAreaRight, selectArealeft, startIndex } = this;
-            let numbers;
-            let remainder;
-            let selectAreaX =
-                SlidersWrapperTotaLength - selectAreaRight - selectArealeft;
-            // console.log('touchEnd', selectAreaX)
-            let moveNumbers = (Math.abs(selectAreaX) / SliderWidth)
-                .toString()
-                .split('.');
-            numbers = parseInt(moveNumbers[0]);
-            remainder = parseFloat('0.' + moveNumbers[1]);
-            if (Math.abs(remainder) >= 0.5) {
-                ++numbers;
-                //如果进一的时候,屏幕看不到了,则多滚一点
-                this.moveRihtToScreenRight();
-            }
-            // console.log('滑动结束', startIndex, duration);
-            this.duration = numbers;
-            this.startIndex = startIndex;
-            this.setSelectArea(startIndex, numbers);
-            startX = 0;
-            this.onEndSelectFun();
-            // 钉钉短震动(仅在 iPhone 7 / 7 Plus 以上及 Android 机型生效)
-            if (wx.canIUse('vibrateShort')) {
-                wx.vibrateShort();
-            }
-        },
-        getComponentWrapInfo() {
-
-            if (SlidersWrapperTotaLength && ShowAreaLength) {
-                return Promise.resolve({
-                    total: SlidersWrapperTotaLength,
-                    area: ShowAreaLength
-                });
-            }
-            return new Promise((resolve, reject) => {
-                setTimeout(() => {
-                    this.$wx
-                        .createSelectorQuery()
-                        .select('.peroid-content-wrapper')
-                        .boundingClientRect()
-                        .exec(ret => {
-                            if (!ret[0].width) {
-                                reject();
-                                return;
-                            }
-                            return resolve({
-                                area: ret[0].width
-                            });
-                        });
-                }, 300);
-
-            });
-        },
-        onEndSelectFun() {
-            const { startIndex, duration, sliders } = this;
-            let start = sliders[startIndex].value;
-            let end = start + duration * SliderUnit;
-            let hasUuBooked = this.hasUuBooked();
-            // console.log(start,'start!!!!!');
-            // console.log(end,'end!!!!!');
-            this.$emit('component-period-time-slider-select', { start, end,hasUuBooked });
-
-            this.$emit(
-                'component-period-time-slider-judgecanselectedend',
-                this.canBookSelectArea
-            );
-        },
-        stopPragation() { },
-        hasUuBooked(){ // 选区有新的增加
-            let hasUuBooked = false;
-            this.sliders.forEach((item,idx) => {
-                if (item.isInSelectArea && !item.isBooked) {
-                    hasUuBooked = true;
-                }
-            });
-            return hasUuBooked
-        },
-        deleteSelectedBookArea() { // 点击 删除
-            // console.log('1111');
-            let hasUuBooked = this.hasUuBooked();
-            if (hasUuBooked)return
-            // console.log('222');
-            this.$emit('component-bookList-delete')
-            // this.selectedBookAreaIndex = idx;
-        }
-    }
-});
-</script>
-
-<config>
-{
-  "usingComponents":{
-    "scroller-x": "~@/components/common/scroller-x"
-  },
-  componentPlaceholder: {
-    'scroller-x': 'view'
-  }
-}
-</config

+ 41 - 45
src/packagesEnv/pages/officehome/components/socket-card.wpy

@@ -56,17 +56,15 @@
 </template>
 
 <script>
-import wepy from '@wepy/core';
+import wepy from '@wepy/core'
 import { setSocketHttp, getSocketHttp } from '@/packagesEnv/api/officehome.js'
-import { isWithinLocation } from '@/service/location';
-import config from '@/config';
-import store from '@/store';
-import { checkSpaceControl } from '@/packagesEnv/pages/common.js'
-import { mapState, mapActions } from '@wepy/x';
-let timer = null;
+import { isWithinLocation } from '@/service/location'
+import config from '@/config'
+import store from '@/store'
+import { mapState, mapActions } from '@wepy/x'
+let timer = null
 wepy.component({
   props: {
-    isControl: Boolean, // 是否可控
     roomHasScene: String,
     roomType: String,
     controlMode: Number,
@@ -97,28 +95,28 @@ wepy.component({
     ...mapState({ isNowTime: state => state.officehome.isNowTime }),
     socketLength() {
             // 灯的个数 大于 1 为true,
-      let length = false;
+      let length = false
       if (this.socketList.length > 1) {
-        length = true;
+        length = true
       } else {
-        length = false;
+        length = false
       }
       return length
     }
   },
   watch: {
     spaceId() {
-      this.showsockets = false; // 恢复初始化值
-      this.allowSvg = 'down_Arrow.svg';
-      this.onlyOne = true; // 切换空间重新触发
-      this.handlerTimer();
+      this.showsockets = false // 恢复初始化值
+      this.allowSvg = 'down_Arrow.svg'
+      this.onlyOne = true // 切换空间重新触发
+      this.handlerTimer()
     },
     openEquipList(newVal) {
       if (newVal.length) {
         let arr = []
         newVal.map(item => {
           if (item.type === 'CFIDSC') {
-            item.switch = true;
+            item.switch = true
             item.id = item.objectId
             item.switchCode = 'EquipSwitchSet'
             item.value = 1
@@ -127,23 +125,23 @@ wepy.component({
         })
         if (arr.length) {
           setSocketHttp(arr).then(res => {
-            this.handlerTimer();
+            this.handlerTimer()
           })
         }
       }
     }
   },
   detached() {
-    clearInterval(timer);
-    timer = null;
+    clearInterval(timer)
+    timer = null
   },
   methods: {
      // 判断窗帘是否能开启
     checkSocketCanOpen(value, id) {
       if (value) {
         if (this.roomHasScene && !this.isNowTime) { // 有场景无时间 得预约
-          this.controlMode && this.$emit('component-EquipType-workTimePop', id);
-          this.$emit('component-open-workTimePop', true);
+          this.controlMode && this.$emit('component-EquipType-workTimePop', id)
+          this.$emit('component-open-workTimePop', true)
 
           return false
         }
@@ -154,67 +152,65 @@ wepy.component({
     allsocket() {
       this.socketSw = !this.socketSw
       this.socketList.forEach(item => {
-        item.value = this.socketSw ? 1 : 0;
-      });
-      return this.socketList;
+        item.value = this.socketSw ? 1 : 0
+      })
+      return this.socketList
     },
 
         // 控制插座
     eqChange(value, id, item) {
-      if (!checkSpaceControl(this.isControl)) return;
       isWithinLocation().then(() => {
       /* 插座功能暂时没有加班功能  if (this.roomType === '开放') {
           this.showWorkTime = this.checkSocketCanOpen(value, id);
           if (!this.showWorkTime) return;
         } */
-        let paramsArr = [];
+        let paramsArr = []
         if (id === 'allsocket') {
-          paramsArr = this.allsocket();
+          paramsArr = this.allsocket()
         } else {
-          item.value = value ? 1 : 0;
+          item.value = value ? 1 : 0
           paramsArr.push(item)
         }
         setSocketHttp(paramsArr).then(() => {
-          this.handlerTimer();
+          this.handlerTimer()
         })
-        this.vibrateShort();
+        this.vibrateShort()
       })
     },
     // 定时调
     handlerTimer() {
-      this.getsocketList();
-      clearInterval(timer);
-      timer = null;
+      this.getsocketList()
+      clearInterval(timer)
+      timer = null
       timer = setInterval(() => {
-        this.getsocketList();
-      }, 1000 * 8);
+        this.getsocketList()
+      }, 1000 * 8)
     },
     getsocketList() {
       getSocketHttp({ spaceId: this.spaceId }).then(res => {
-        this.socketSw = res.data.runStatus;
+        this.socketSw = res.data.runStatus
         this.socketList = res.data.equipList || []
-        this.onlyOne && this.$emit('component-showSocket', this.socketList.length);
-        this.onlyOne = false;
+        this.onlyOne && this.$emit('component-showSocket', this.socketList.length)
+        this.onlyOne = false
         for (let index = 0; index < this.socketList.length; index++) {
-          const element = this.socketList[index];
-          element.runStatus = !!element.runStatus;
+          const element = this.socketList[index]
+          element.runStatus = !!element.runStatus
           element.code = element.switchCode
         }
       })
     },
     vibrateShort() {
       if (wx.canIUse('vibrateShort')) {
-        wx.vibrateShort();
+        wx.vibrateShort()
       } else {
-        wx.vibrateLong();
+        wx.vibrateLong()
       }
     },
 
         // 灯列表
     changeSwitchLR(val) {
-      if (!checkSpaceControl(this.isControl)) return;
-      if (!this.socketLength) return;
-      this.showsockets = !val;
+      if (!this.socketLength) return
+      this.showsockets = !val
     }
   }
 })

+ 0 - 437
src/packagesEnv/pages/officehome/components/work-scene.wpy

@@ -1,437 +0,0 @@
-<style lang="less" scoped>
-.work-scene {
-    border-top: 1px solid #c4c4c466;
-    // height: 184rpx;
-    // padding: 28rpx 40rpx 40rpx 40rpx;
-     height:92px;
-    display: flex;
-    padding:0 40rpx;
-    justify-content: space-around;
-    align-items: center;
-}
-.off {
-    display: flex;
-    padding: 26rpx 24rpx;
-    text-align: center;
-    box-sizing: border-box;
-    align-items: center;
-    width: 156rpx;
-    height: 116rpx;
-    background: rgba(159, 183, 205, 0.15);
-    border-radius: 32rpx;
-    margin-left: 18rpx;
-    .text-font {
-        padding-left: 16rpx;
-        width: 52rpx;
-        height: 64rpx;
-        height: 64rpx;
-        font-family: 'Montserrat';
-        font-style: normal;
-        font-weight: 500;
-        font-size: 26rpx;
-        color: #4d5262;
-    }
-}
-.imgSt {
-    width: 40rpx;
-    height: 40rpx;
-}
-.book {
-    display: flex;
-    justify-content: space-between;
-    align-items: center;
-    width: 100%;
-    height: 116rpx;
-    background: rgba(159, 183, 205, 0.15);
-    &.hasWorkTime {
-        background:  rgba(61, 203, 204, 0.3);
-    }
-    border-radius: 16px;
-    padding-left: 24rpx;
-    .work-box {
-        // margin-left: 16rpx;
-        display: flex;
-        align-items: center;
-        // width: 220rpx;
-        .fontSi {
-            padding-top: 8rpx;
-            font-family: 'Montserrat';
-            font-style: normal;
-            font-weight: 500;
-            font-size: 30rpx;
-            line-height: 36rpx;
-            color: #1f2429;
-        }
-        .text-font {
-            font-family: 'Montserrat';
-            font-style: normal;
-            font-weight: 500;
-            font-size: 24rpx;
-            line-height: 30rpx;
-            color: #4d5262;
-        }
-    }
-
-    .book-box {
-        margin-right: 8rpx;
-        width: 96rpx;
-        height: 100rpx;
-        display: flex;
-        justify-content: center;
-        align-items: center;
-        padding: 9px;
-        box-sizing: border-box;
-        background: #ffffff;
-        box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.1),
-            0px 4px 10px rgba(0, 0, 0, 0.07);
-        border-radius: 32rpx;
-        &.bigWidth {
-            width: 196rpx;
-        }
-        .book-font {
-            // width: 52rpx;
-            // height: 64rpx;
-            font-family: 'PingFang SC';
-            font-style: normal;
-            font-weight: 400;
-            font-size: 26rpx;
-            line-height: 32rpx;
-            text-align: center;
-            color: #000000;
-        }
-    }
-}
-</style>
-<template>
-    <div class="work-scene">
-        <div
-            class="book"
-            :class="{'hasWorkTime': timeText === '工作时间' && hasWorkTime}"
-            @click="changeWorkStatus"
-        >
-            <div
-                class="work-box"
-                v-if="hasWorkTime"
-            >
-                <div class="imgSt">
-                    <img
-                        style="width:100%;height:100%"
-                        src="{{h5StaticPath+'icon-work.svg'}}"
-                        alt=""
-                        lazyload
-                    >
-                </div>
-                <div style="margin-left:20rpx">
-                    <div class="text-font">{{timeText}}</div>
-                    <div class="fontSi">{{timeRange}}</div>
-                </div>
-            </div>
-            <div
-                class="work-box"
-                v-else
-            >
-                <div class="imgSt">
-                    <img
-                        style="width:100%;height:100%"
-                        src="{{h5StaticPath+'icon-work.svg'}}"
-                        alt=""
-                        lazyload
-                    >
-                </div>
-                <div style="margin-left:20rpx">
-                    <div class="text-font">请选择工作时间段</div>
-                    <div
-                        class="text-font"
-                        style="padding-top: 8rpx;"
-                    >将自动开启办公服务</div>
-                </div>
-
-            </div>
-            <div
-                class="book-box"
-                :class="{'bigWidth':!(isWorkOff &&  !inCusRangeTime)}"
-            >
-                <div class="book-font">预约时间</div>
-            </div>
-
-        </div>
-
-        <div
-            class="off"
-            v-if="isWorkOff && !inCusRangeTime"
-            @click="handleWorkOff"
-        >
-            <div class="imgSt">
-                <img
-                    style="width:100%;height:100%"
-                    src="{{h5StaticPath+'icon-work-over.svg'}}"
-                    alt=""
-                    lazyload
-                >
-            </div>
-            <div class="text-font">我要离开</div>
-        </div>
-    </div>
-</template>
-<script>
-
-import wepy from '@wepy/core';
-import moment from 'moment';
-import store from '@/store';
-import config from '@/config';
-import { mapState, mapActions } from '@wepy/x';
-import { saveBatchCustomScene } from '@/packagesEnv/api/officehome.js'
-import { checkSpaceControl } from '@/packagesEnv/pages/common.js'
-function HHmm(time, num) {
-  const HH = time.slice(num, num + 2);
-  const mm = time.slice(num + 2, num + 4);
-  return `${HH}:${mm}`
-}
-let timer = null;
-let isClickTimer = null;
-wepy.component({
-
-  props: {
-    workDayTime: Object,
-    isControl: Boolean // 是否可控
-  },
-  store,
-  data: {
-    h5StaticPath: config.h5StaticPath + '/page-officehome/',
-    isWorkOff: false, // 到下班时间
-    hasWorkTime: true, // 有工作时间
-    workTimeList: [], // 工作时间列表
-    currentTimeRange: [], // 当前工作区间
-    timeRange: '', // 工作时间区间
-    timeText: '--', // 工作时间文案
-    inCusRangeTime: false // 在服务时间内
-  },
-  computed: {
-
-  },
-  watch: {
-    workDayTime(newVal) {
-      if (newVal.data) {
-        clearInterval(timer);
-        timer = null;
-        this.getData()
-        timer = setInterval(() => {
-          this.getData();
-        }, 1000 * 10);
-      }
-    }
-  },
-  detached() {
-    clearInterval(timer);
-    timer = null;
-  },
-  methods: {
-    ...mapActions([
-      'setCusTime',
-      'setIsNowTime'
-    ]),
-
-    isHasWorkTime() { // 有工作时间
-      let flag = false;
-      this.workTimeList.forEach((item, idx) => {
-        if (item.length !== 0) {
-          flag = true
-        }
-      })
-      if (this.timeRange) { // 有时间段
-        flag = true
-      }
-      return flag
-    },
-    concatText(today, val) {
-      let text = '';
-      if (today === val) {
-        text = '今日'
-      }
-      if (Number(val) === (Number(today) + 1)) {
-        text = '次日'
-      }
-      if (Number(val) > (Number(today) + 1)) {
-        const weekDay = moment(val).weekday();
-        const weekArr = ['周日', '周一', '周二', '周三', '周四', '周五', '周六' ];
-        text = weekArr[weekDay];
-      }
-      return text
-    },
-    bookDayText(val, cusFlag) { // 预约显示日期
-      if (cusFlag || (this.isWorkOff && !this.inCusRangeTime)) {
-        return '工作时间'
-      }
-      if (!val.length) return ''
-      const startDate = val[0].slice(0, 8);
-      const endDate = val[1].slice(0, 8);
-      const today = moment().format('YYYYMMDD');
-      let startText = this.concatText(today, startDate);
-      let endText = this.concatText(today, endDate);
-      if (startText === endText) {
-        return `已预约-${endText}`
-      } else {
-        return `已预约(${startText}-${endText})`
-      }
-    },
-    showTimeText(val, cusFlag) {  // 显示时间文案
-      if (!this.hasWorkTime) {
-        this.hasWorkTime = false;        // console.log(this.workTimeList.length, '没有时间表,结束');
-        return;
-      }
-      const nowTime = moment().format('YYYYMMDDHHmmss');
-      let nowtimeFlag = false;
-      val.forEach((item, idx) => {
-        const start = item[0];
-        const end = item[1];
-        if (nowTime >= end) {
-          this.workTimeList.splice(idx, 1, []);  // 已经过去的从列表删除
-        }
-        if (start <= nowTime && nowTime <= end) { // 当前在这个区间内
-          this.timeText = '工作时间'
-          this.setIsNowTime(true)
-          this.isWorkOff = true; // 过服务定制时间
-          this.currentTimeRange = item;
-          nowtimeFlag = true;
-        }
-      })
-      if (!this.hasWorkTime) return;
-      if (!nowtimeFlag) {
-        this.currentTimeRange = this.workTimeList.find(item => item.length !== 0);
-        this.timeText = this.bookDayText(this.currentTimeRange[0])
-      }
-      const startTime = HHmm(this.currentTimeRange[0], 8);
-      const endTime = HHmm(this.currentTimeRange[1], 8);
-      this.timeRange = `${startTime} ~ ${endTime}`
-      this.setCusTime({ cusStartTime: startTime, cusEndTime: endTime })
-      this.timeText = this.bookDayText(this.currentTimeRange, cusFlag); // 预约显示日期
-    },
-    arrTrans(num, arr) { // 一维数组转换为二维数组
-      const iconsArr = []; // 声明数组
-      arr.forEach((item, index) => {
-        const page = Math.floor(index / num); // 计算该元素为第几个素组内
-        if (!iconsArr[page]) { // 判断是否存在
-          iconsArr[page] = [];
-        }
-        iconsArr[page].push(item);
-      });
-      const nowDayTime = moment().format('YYYYMMDDHHmmss');
-      let resultArr = [];
-      iconsArr.find((item, idx) => {
-        let itemEnd = item[1];
-        if (nowDayTime > itemEnd) {
-        } else {
-          resultArr.push(item)
-        }
-      })
-      return resultArr;
-    },
-    getData() {
-      this.setIsNowTime(false)
-      this.isWorkOff = false;
-      let resData = this.workDayTime.data || []
-      let timeArr = []; // 时间组
-      let cusFlag = false; // 服务定制内
-      let cusEle = {};
-      this.setCusTime({
-        cusStartTime: '',
-        cusEndTime: ''
-      })
-      resData.forEach((ele, eleIdx) => {
-        const nowDay = moment().format('YYYYMMDD');
-        const nowTime = moment().format('HHmmss');
-        this.inCusRangeTime = false;
-        if (ele.date === nowDay && ele.cusStartTime && nowTime >= ele.cusStartTime && nowTime < ele.cusEndTime) { // 是当天且有服务定制
-          cusFlag = true;
-          cusEle = ele;
-          timeArr.push(`${ele.date}${ele.cusStartTime}`);
-          timeArr.push(`${ele.date}${ele.cusEndTime}`);
-        }
-        if (ele.customSceneList) {
-          let bookItemArr = ele.customSceneList;
-          bookItemArr.forEach((item, idx) => {
-            timeArr.push(`${item.startDate}${item.startTime}`);
-            timeArr.push(`${item.startDate}${item.endTime}`);
-          })
-        }
-      })
-      if (cusFlag) { // 服务定制时间
-        this.isWorkOff = false;
-        this.inCusRangeTime = true;
-        this.hasWorkTime = true;
-        this.setIsNowTime(true)
-        // return;
-      }
-
-      if (timeArr.length === 0) {  // 没有预约时间
-        this.workTimeList = [];
-        this.hasWorkTime = false;
-        return
-      }
-
-      timeArr.sort(); //  排序
-      let timeArrCopy = JSON.parse(JSON.stringify(timeArr));
-      timeArrCopy.forEach((item, idx) => {
-        let date = Number(item.slice(0, 8));
-        let time = item.slice(8, 16);
-        let nextItem = timeArrCopy[idx + 1] || '';
-        let nextDate = Number(nextItem.slice(0, 8));
-        let nextTime = nextItem.slice(8, 16);
-        if (time === nextTime && nextDate === date) { // 去重
-          timeArr.splice(timeArr.findIndex(jtem => jtem === item), 1);
-          timeArr.splice(timeArr.findIndex(jtem => jtem === nextItem), 1);
-        }
-        if (time === '240000' && nextTime === '000000' && (nextDate - 1 === date)) { // 时间段跨天相邻
-          timeArr.splice(timeArr.findIndex(jtem => jtem === item), 1);
-          timeArr.splice(timeArr.findIndex(jtem => jtem === nextItem), 1);
-        }
-      })
-            //   console.log(timeArr, 'timeArrtimeArrtimeArrtimeArrtimeArr');
-      let timeArrResult = this.arrTrans(2, timeArr) // 一维数组转换为二维数组
-      if (timeArrResult.length === 0) {
-        this.hasWorkTime = false;
-        return
-      }
-      this.workTimeList = JSON.parse(JSON.stringify(timeArrResult));
-      this.hasWorkTime = this.isHasWorkTime();
-    //   console.log(this.workTimeList, '        this.workTimeList');
-      this.showTimeText(timeArrResult, cusFlag);// 显示时间文案
-    },
-    handleWorkOff() { // 我要离开
-      if (!checkSpaceControl(this.isControl)) return;
-      if (wx.canIUse('vibrateShort')) {
-        wx.vibrateShort();
-      } else {
-        wx.vibrateLong();
-      }
-      this.$emit('component-open-sceneShowpop', 'showWorkOff')
-      const currentStart = this.currentTimeRange[0];
-      const currenEnd = this.currentTimeRange[1];
-      let paramsArr = [];
-      this.workDayTime.data.forEach((ele, eleIdx) => {
-        let bookItemArr = ele.customSceneList || [];
-        if (bookItemArr.length > 0) {
-          bookItemArr.find(item => {
-            const itemStart = `${item.startDate}${item.startTime}`
-            const itemEnd = `${item.startDate}${item.endTime}`
-            if (currentStart <= itemStart && itemEnd <= currenEnd) {
-              item.type = 1
-              paramsArr.push(item);
-            }
-          })
-        }
-      })
-      saveBatchCustomScene({ 'historyBookList': paramsArr, 'type': 'workOff' }).then(res => {
-        this.$emit('component-get-workTimeData');
-        clearTimeout(isClickTimer);
-      })
-    },
-
-    changeWorkStatus() {
-      if (!checkSpaceControl(this.isControl)) return;
-      this.$emit('component-open-workTimePop', true)
-    }
-  }
-
-})
-</script>

Diferenças do arquivo suprimidas por serem muito extensas
+ 2119 - 2751
src/packagesEnv/pages/officehome/index.wpy


+ 0 - 475
src/packagesEnv/pages/officehome/workOvertime.wpy

@@ -1,475 +0,0 @@
-<style lang="less" scoped>
-.workOvertime {
-    .space-title {
-        font-weight: 500;
-        font-size: 52rpx;
-        line-height: 72rpx;
-        color: #000000;
-        margin-bottom: 4rpx;
-        word-break: break-all;
-    }
-    .space-text {
-        color: #c4c4c4;
-        font-size: 26rpx;
-        line-height: 36rpx;
-    }
-    .period-selector {
-        padding-top: 40rpx;
-    }
-    .btn-box {
-        display: flex;
-        justify-content: space-around;
-        padding-top: 90rpx;
-        .btn {
-            height: 100rpx;
-            width: 240rpx;
-            border-radius: 50rpx;
-            border: 1px solid #c3c7cb;
-            text-align: center;
-            line-height: 100rpx;
-            &.sub {
-                border-color: white;
-                background: rgba(61, 203, 204, 1);
-                color: #FFFFFF;
-                width: 390rpx;
-            }
-            &.dis-sub {
-                background: #c3c7cb;
-            }
-        }
-    }
-    .min {
-        color: #c3c7cb;
-        font-size: 12px;
-    }
-}
-</style>
-<template>
-    <div class="workOvertime">
-        <div class="space-title">{{localName}} 申请延时 </div>
-        <div class="space-text">延时期间,空间相关设备会开启</div>
-        <div class="fliter-area">
-            <div class="date-selector">
-                <date-selector
-                    @component-date-selector-select="changeSelectedData"
-                    :selectValue="date"
-                ></date-selector>
-            </div>
-            <div class="period-selector">
-                <period-time-slider
-                    v-if="showAndHidden"
-                    disabledPast="{{disabledPast}}"
-                    :showPastDisabled="true"
-                    :disabledUnopened="true"
-                    @component-period-time-slider-select="selectedPeriod"
-                    @component-bookList-delete="bookListDelete"
-                    :selectValue="period"
-                    :bookedList="roomData.bookedList[date]"
-                    @component-period-time-slider-judgecanselectedend="judgeCanSelectedEnd"
-                    :hiddenBookedUserName="roomData.classification==1"
-                    :openStartTime="openStartTime"
-                    :openEndTime="openEndTime"
-                ></period-time-slider>
-            </div>
-        </div>
-        <div class="btn-box">
-            <span
-                class="btn"
-                @click="handleCancel"
-            >取消</span>
-            <span
-                class="{{'btn'+' sub'+(canBooked ? '':' dis-sub')}}"
-                @click="handleSubmit"
-                :disabled="!canBooked"
-            >提交申请
-                <span class="min">{{sstext}}</span>
-            </span>
-        </div>
-    </div>
-</template>
-<script>
-import wepy from '@wepy/core'
-import store from '@/store'
-import { saveBatchCustomScene } from '@/packagesEnv/api/officehome.js'
-
-import config from '@/config'
-import moment from 'moment'
-import {
-    getNowDate,
-    getNowTime,
-    SliderUnit
-} from '@/service/meetingTimes'
-import {
-    formateBookedList,
-    formateTimeValue,
-    formateDateValue,
-    formateTimeToColon,
-    formateTimeToValue,
-    dateToDate,
-    endtimeToUnitTime,
-    startimeToUnitTime
-} from '@/packagesEnv/pages/common.js'
-function timeRangeLowLastTime(val) {
-  let newVal = val + SliderUnit * 4
-  if (newVal > 24) {
-    return 24
-  }
-  return newVal
-}
-let resData = {}
-let timer = null
-wepy.component({
-  props: {
-    localName: String,
-    workDayTime: Object,
-    objectId: Object,
-    countDownTwoMin: Number
-  },
-  store,
-  data: {
-    date: getNowDate(),
-    currentCheckedItem: [], // 当前选中项
-    disabledPast: true,
-    roomId: '',
-    hasCus: false, // 是否有服务定制
-    openStartTime: null, // 服务定制开始时间
-    openEndTime: null, //  服务定制结束时间
-    customTime: { // 记录服务定制初始值
-      start: '',
-      end: ''
-    },
-    canBooked: false, // 标记是否可以预定
-    period: null,
-    roomData: {
-      bookedList: []
-    },
-    deleteBookedListIdx: null,
-    showAndHidden: true,
-    sstext: '' // 倒计时展示
-
-  },
-  watch: {
-    workDayTime(newVal) {
-      if (newVal) {
-        resData = newVal
-        this.cusTime()
-      }
-    },
-    countDownTwoMin(ss) {
-      this.text = ''
-      if (ss < 60 && ss !== 0) {
-        this.sstext = `( ${ss} s )`
-      } else {
-        this.sstext = ''
-      }
-    }
-  },
-  ready() {
-    this.setDefaultPeriod()
-  },
-  detached() {
-  },
-  methods: {
-    cusTime() { // 服务定制时间及预约时段
-      let copyResData = JSON.parse(JSON.stringify(resData));
-      (copyResData.data || []).forEach(item => {
-        item.date = dateToDate(item.date)
-        if (item.date === this.date) {
-          this.hasCus = true
-          item.cusStartTime = item.cusStartTime ? item.cusStartTime : '000000'
-          item.cusEndTime = item.cusEndTime ? item.cusEndTime : '000000'
-          this.customTime = {
-            start: item.cusStartTime,
-            end: item.cusEndTime
-          }
-          const start = startimeToUnitTime(item.cusStartTime)
-          const end = endtimeToUnitTime(item.cusEndTime)
-          this.openStartTime = formateTimeToValue(start)
-          this.openEndTime = formateTimeToValue(end) - 0.5
-
-          item.customSceneList && item.customSceneList.find(item => {
-                        // console.log(item, 'yuyue');
-            item.startDate = dateToDate(item.startDate)
-            item.endDate = dateToDate(item.endDate)
-          })
-          this.currentCheckedItem = item.customSceneList || []
-        }
-      })
-      if (!this.hasCus) {
-        this.openStartTime = ''
-        this.openEndTime = ''
-      }
-      setTimeout(() => {
-        this.roomData.bookedList = formateBookedList(this.currentCheckedItem)
-      }, 200)
-    },
-    handleCancel() { // 取消
-      this.$emit('component-close-visible', false)
-    },
-    deleteOrAdd(type) { // 删除或者增加
-      const bookListDayArr = this.roomData.bookedList[this.date] || []
-      let workType = 0  // 0 预约加班,1 取消,2 加班(我来了), 3 最后一个走
-      if (type === 'cancel') {
-        workType = 1
-      } else {
-        const nowTime = getNowTime().juggeValue
-        if ((this.period.start <= nowTime) && nowTime <= this.period.end) {
-          workType = 2
-        } else {
-          workType = 0
-        }
-      }
-      let historyBookList = [] // 历史选择的时段
-      bookListDayArr && bookListDayArr.forEach((item, idx) => {
-        if (
-                    (this.period.start <= item.start && item.start <= this.period.end) ||
-                    (this.period.start <= item.end && item.end <= this.period.end) ||
-                    (item.start <= this.period.start && this.period.end <= item.end)
-                ) {  // 跟选择的时段有交集
-          item.type = 1
-          historyBookList.push(item)
-        }
-      })
-      const date = formateDateValue(this.date)
-      let newBooklist = {
-        startDate: date,
-        endDate: date,
-        startTime: formateTimeValue(this.period.start),
-        endTime: formateTimeValue(this.period.end),
-        type: workType,
-        objectId: this.objectId,
-        customSceneEqType: 'ALL'  // 来源 AC 空调入口, SE 灯入口 ALL 加班入口
-      }
-      return { historyBookList, newBooklist }
-    },
-    bookAndPried(newBooklist, historyBookList) {
-      const newBookStart = newBooklist.startTime
-      const newBookEnd = newBooklist.endTime
-      let bookedrange = []; // 已选择的区间
-      (historyBookList || []).forEach((item, idx) => {
-        bookedrange.push(item.startTime)
-        bookedrange.push(item.endTime)
-      })
-      bookedrange = [...new Set(bookedrange)]
-      bookedrange.sort()
-      const bookedrangeStart = bookedrange[0]
-      const bookedrangeEnd = bookedrange[bookedrange.length - 1]
-      return { newBookStart, newBookEnd, bookedrangeStart, bookedrangeEnd }
-    },
-    bookListDelete() { // 删除一条加班记录
-      let { historyBookList, newBooklist } = this.deleteOrAdd('cancel')
-      let { newBookStart, newBookEnd, bookedrangeStart, bookedrangeEnd } = this.bookAndPried(newBooklist, historyBookList)
-      let saveBookList = []
-      if (bookedrangeStart === newBookStart && bookedrangeEnd === newBookEnd) {
-                // 选区全部包括
-      } else {
-        if (bookedrangeStart === newBookStart) { // 选区的开始重合
-          newBooklist.startTime = newBookEnd
-          newBooklist.endTime = bookedrangeEnd
-          saveBookList.push(newBooklist)
-          console.log('选区的开始重合')
-        } else if (bookedrangeEnd === newBookEnd) { // 选区的结束重合
-          newBooklist.startTime = bookedrangeStart
-          newBooklist.endTime = newBookStart
-          saveBookList.push(newBooklist)
-          console.log('选区的结束重合')
-        } else { // 选区中间
-          newBooklist.startTime = bookedrangeStart
-          newBooklist.endTime = newBookStart
-          saveBookList.push(newBooklist)
-          const newBooklistTwo = JSON.parse(JSON.stringify(newBooklist))
-          newBooklistTwo.startTime = newBookEnd
-          newBooklistTwo.endTime = bookedrangeEnd
-          saveBookList.push(newBooklistTwo)
-          console.log('选区的中间')
-        }
-      }
-      const nowTime = moment().format('HHmmss')
-      saveBookList.find(item => {
-        if (nowTime >= item.startTime && nowTime <= item.endTime) {
-          item.type = 2
-        } else {
-          item.type = 0
-        }
-      })
-
-      let arr = [...historyBookList, ...saveBookList]
-      let paramsArr = []
-      arr.map(item => {
-        if (item.startTime < item.endTime) {
-          paramsArr.push(item)
-        }
-      })
-      let deleStart = newBookStart
-      let deleEnd = newBookEnd
-      if (deleStart < this.customTime.end && deleStart > this.customTime.start) {
-        deleStart = this.customTime.end
-      }
-      if (deleEnd > this.customTime.start && deleEnd < this.customTime.end) {
-        deleEnd = this.customTime.start
-      }
-
-      let _this = this
-      wx.showModal({
-        title: '',
-        content: `删除 ${formateTimeToColon(deleStart)}-${formateTimeToColon(deleEnd)} 预约时间?`,
-        success: function (sm) {
-          if (sm.confirm) {
-            saveBatchCustomScene({ 'historyBookList': paramsArr, type: 'delete' }).then(res => {
-              _this.$emit('component-set-countDown')
-              _this.$emit('component-close-visible', false)
-            })
-          } else {
-                        // console.log('取消');
-          }
-        }
-      })
-
-            // this.roomData.bookedList.splice(deleteBookedListIdx, 1)
-            /*   let arr = this.roomData.bookedList[this.date];
-              arr.splice(deleteBookedListIdx, 1);
-              this.roomData.bookedList[this.date] = arr */
-    },
-    handleSubmit() { // 提交申T请
-      if (!this.canBooked) return
-      if (timer) return
-      timer = setTimeout(() => { }, 1000 * 2)
-      this.canBooked = false
-      let { historyBookList, newBooklist } = this.deleteOrAdd('save')
-      let { newBookStart, newBookEnd, bookedrangeStart, bookedrangeEnd } = this.bookAndPried(newBooklist, historyBookList)
-      if (bookedrangeStart <= newBookStart && newBookEnd <= bookedrangeEnd) {
-        if (this.period.hasUuBooked) {
-          newBooklist.startTime = bookedrangeStart
-          newBooklist.endTime = bookedrangeEnd
-        }
-      } else {
-        if (((bookedrangeStart < newBookEnd) && (newBookEnd < bookedrangeEnd)) || newBookEnd === bookedrangeStart) {
-                    //    开始时间早于 已经预约的时间
-          newBooklist.endTime = bookedrangeEnd
-        }
-        if (((bookedrangeStart < newBookStart) && (newBookStart < bookedrangeEnd)) || newBookStart === bookedrangeEnd) {
-                    // 结束时间时间晚于 已经预约的时间
-          newBooklist.startTime = bookedrangeStart
-        }
-      }
-      if (newBooklist.startTime > this.customTime.start &&
-                newBooklist.startTime < this.customTime.end) {
-        newBooklist.startTime = this.customTime.end
-      }
-      if (newBooklist.endTime > this.customTime.start &&
-                newBooklist.endTime < this.customTime.end) {
-        newBooklist.endTime = this.customTime.start
-      }
-
-      saveBatchCustomScene({ historyBookList, newBooklist })
-      .then(res => {
-        clearTimeout(timer)
-        timer = null
-        this.$emit('component-set-countDown')
-        this.$emit('component-close-visible', false)
-        // this.canBooked = true;
-      })
-      .catch(() => {
-        clearTimeout(timer)
-        timer = null
-        this.$emit('component-set-countDown')
-        this.$emit('component-close-visible', false)
-      })
-    },
-    setDefaultPeriod() {    // 默认选中时间
-      let nowHour = getNowTime().juggeValue
-      if (this.openStartTime !== this.openEndTime) { // 有服务定制  服务定制向后两个小时
-        const realOpenEndTime = this.openEndTime + 0.5
-        if (nowHour > this.openStartTime && nowHour < realOpenEndTime) { // 服务定制中
-          this.period = {
-            start: realOpenEndTime,
-            end: timeRangeLowLastTime(realOpenEndTime),
-            from: 'outer'
-          }
-        }
-        if (nowHour >= realOpenEndTime || nowHour === this.openStartTime) { // 服务定制后
-          this.period = {
-            start: nowHour,
-            end: timeRangeLowLastTime(nowHour),
-            from: 'outer'
-          }
-          return
-        }
-        if (nowHour < this.openStartTime) { // 服务定制前
-          if ((this.openStartTime - nowHour) >= 2) {
-            this.period = {
-              start: nowHour,
-              end: timeRangeLowLastTime(nowHour),
-              from: 'outer'
-            }
-          } else {
-            this.period = {
-              start: nowHour,
-              end: nowHour + (this.openStartTime - nowHour),
-              from: 'outer'
-            }
-          }
-        }
-      } else { // 没有服务定制
-        this.period = {
-          start: nowHour,
-          end: timeRangeLowLastTime(nowHour),
-          from: 'outer'
-        }
-      }
-    },
-    selectedPeriod({ start, end, hasUuBooked }) {
-      this.period = { start, end, hasUuBooked }
-    },
-    judgeCanSelectedEnd(canBooked) {
-      this.canBooked = canBooked
-    },
-    changeSelectedData(date) {  // 选择日期
-      this.selectedDate(date)
-            //   this.getServeTime(date);
-      this.cusTime()
-    },
-    selectedDate(date) {
-      this.date = date
-      this.disabledPast = date == getNowDate()
-    },
-    getServeTime(date) {
-            /*  if (!this.roomId) {
-               return;
-             } */
-            //   this.openStartTime = formateTimeToValue('24:00');
-            //   this.openEndTime = formateTimeToValue('24:00');
-      this.canBooked = false
-            /*  getMeetingRoomServerTime({
-               id: this.roomId,
-               day: date
-             }).then(res => {
-               let result = res.data || {};
-               if (result.businessFlag) {
-                  // 如果营业
-                 this.openStartTime = formateTimeToValue(result.startTime);
-                 this.openEndTime = formateTimeToValue(result.endTime);
-               } else {
-                 // 不营业, 全天标红,利用这种方式去标红
-                 this.openStartTime = formateTimeToValue('24:00');
-                 this.openEndTime = formateTimeToValue('24:00');
-                 this.canBooked = false;
-               }
-             }); */
-    }
-  }
-})
-</script>
-
-
-
-
-<config>
-{
-    "backgroundColor": "#fff",
-    "usingComponents": {
-      "period-time-slider": "./components/period-time-slider",
-      "date-selector":"./components/date-selector",
-    }
-}
-</config>