qushaowei
2024-01-15 017886be8a6c07ccaaf6300b8c7652ddbd41d734
src/views/WorkshopSignage.vue
@@ -2,7 +2,7 @@
  <dv-full-screen-container class="full-screen-container">
    <header class="page-header" :style="{height: pageHeaderHeight+'px'}">
      {{ workshopDetails.workshopName }}
      <div class="header-left" v-has="'home:saveDevicePositionAndSize'">
      <div class="header-left" v-has="'home:saveDevicePositionAndSize'" v-if="!isFullScreen">
        <a-space>
          <span v-if="!isSwitchChecked">开启功能</span>
          <span v-else>关闭功能</span>
@@ -36,7 +36,7 @@
          :y="item.coordinateTop"
          v-on:resizing="resize($event, index)"
          v-on:dragging="resize($event, index)"
          :parentLimitation="true"
          :parentLimitation="parentLimitation"
          :minw="70"
          :minh="70"
          :isDraggable="isDraggable"
@@ -103,10 +103,6 @@
    data() {
      return {
        pageHeaderHeight: 80,// 页头高度
        taskBarHeight: window.screen.height - window.screen.availHeight,// 屏幕底部任务栏高度
        utilsBarHeight: window.outerHeight - window.innerHeight,// 浏览器工具栏高度
        normalPageHeight: 0,
        fullScreenPageHeight: 0,
        workshopDetails: {}, //  车间详细信息,
        isDraggable: false, // 是否开启拖拽
        isResizable: false, // 是否开启缩放
@@ -145,7 +141,10 @@
            value: 22,
            color: '#FF0000'
          }
        ]// 设备状态指示灯列表,
        ],// 设备状态指示灯列表,
        windowHeight: null,// 当前浏览器可视区域高度((不包括工具栏、书签、底部任务栏),进入页面时计算一次,除非重新加载页面否则浏览器可视区域高度则不发生改变
        isFullScreen: false,// 进入看板页面时是否为全屏模式,不包括正常模式进入后切换为全屏模式
        parentLimitation: false// 拖拽区域是否限制在父元素区域内
      }
    },
    watch: {
@@ -189,7 +188,9 @@
          this.$refs.deviceContainerRef.style.backgroundImage = `url(${this.getImgView(
            this.workshopDetails.backgroundImage
          )})`
          this.$refs.deviceContainerRef.style.height = this.normalPageHeight
          this.$refs.deviceContainerRef.style.height = (this.windowHeight - this.pageHeaderHeight) + 'px'
          this.parentLimitation = true // 在父元素高度设置后再设置限制拖拽区域,不这样有概率导致父元素高度未设置就限制拖拽
        })
      },
@@ -288,11 +289,16 @@
          //   setTimeout( this.$refs.equmentDetaiModel.initData(item.equipmentId),0)
          // },1000*10)
        }
      },
      /**
       * 浏览器尺寸发生改变时触发
       */
      handleWindowSizeChange() {
        if (this.isFullScreen) location.reload() // 如果页面进入时为全屏模式,则在切换模式时重新加载页面以重新获取浏览器可视区域高度
      }
    },
    created() {
      if (this.utilsBarHeight > 0) this.normalPageHeight = `calc(100% - ${this.pageHeaderHeight}px - ${this.taskBarHeight}px - ${this.utilsBarHeight}px)`
      else this.normalPageHeight = `calc(100% - ${this.pageHeaderHeight}px - ${this.taskBarHeight}px - 87px)`
      if (this.$route.params.id) {
        this.getDeviceListByApi(this.$route.params.id)
        this.getWorkshopDetailsByApi(this.$route.params.id)
@@ -301,6 +307,16 @@
    mounted() {
      // 禁止用户选中内容
      document.onselectstart = () => false
      this.windowHeight =
        window.innerHeight ||
        document.documentElement.clientHeight ||
        document.body.clientHeight
      // 判断浏览器可视区域高度是否等于分辨率,若相等则表示进入时浏览器为全屏模式
      if (this.windowHeight === screen.height) this.isFullScreen = true
      window.addEventListener('resize', this.handleWindowSizeChange)
    },
    beforeDestroy() {
      // 确保销毁定时器、事件及回收资源
@@ -324,7 +340,7 @@
      .header-left {
        width: 450px;
        position: absolute;
        left: 0px;
        left: 0;
        top: 35px;
        display: flex;
        justify-content: space-evenly;
@@ -383,7 +399,9 @@
          width: 100%;
          height: 100%;
          display: flex;
          align-items: end;
          -webkit-align-items: flex-end;
          -moz-align-items: flex-end;
          -ms-align-items: flex-end;
          .status-image {
            background-size: 100% 100%;