“linengliang”
2024-03-12 ddd7e6f6c57c2f39305e94a74650e28bbf31f9e7
src/views/WorkshopSignage.vue
@@ -1,8 +1,8 @@
<template>
  <dv-full-screen-container class="full-screen-container">
    <header class="page-header">
    <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>
@@ -17,11 +17,11 @@
        <a-button type="primary" icon="save" size="large" @click="saveDevicePositionAndSizeByApi">保存位置</a-button>
      </div>
      <div class="device-status-info">
        <div v-for="item in deviceStatusList" :key="item.value" class="single-status-info">
        <a-space v-for="item in deviceStatusList" :key="item.value" class="single-status-info">
          <div>{{ item.label }}</div>
          <div class="status-square" :style="{ backgroundColor: item.color }"></div>
          <div>{{ getDeviceNumberByStatus(item.value) }}</div>
        </div>
        </a-space>
      </div>
    </header>
@@ -36,9 +36,10 @@
          :y="item.coordinateTop"
          v-on:resizing="resize($event, index)"
          v-on:dragging="resize($event, index)"
          :parentLimitation="true"
          :minw="100"
          :minh="100"
          :parentLimitation="parentLimitation"
          :parentH="parentH"
          :minw="70"
          :minh="70"
          :isDraggable="isDraggable"
          :isResizable="isResizable"
          :stickSize="6"
@@ -77,7 +78,6 @@
            </div>
          </div>
        </VueDragResize>
      </div>
    </dv-border-box-8>
@@ -103,11 +103,13 @@
    },
    data() {
      return {
        pageHeaderHeight: 80,// 页头高度
        workshopDetails: {}, //  车间详细信息,
        isDraggable: false, // 是否开启拖拽
        isResizable: false, // 是否开启缩放
        isSwitchChecked: false, // 是否开启功能
        timingAcquisition: null, // 定时刷新是否开启
        parentH: 5000,//父级高度
        deviceList: [
          // {
          //   equipmentId: '123213213123232',// 设备ID
@@ -141,7 +143,10 @@
            value: 22,
            color: '#FF0000'
          }
        ] // 设备状态指示灯列表
        ],// 设备状态指示灯列表,
        windowHeight: null,// 当前浏览器可视区域高度((不包括工具栏、书签、底部任务栏),进入页面时计算一次,除非重新加载页面否则浏览器可视区域高度则不发生改变
        isFullScreen: false,// 进入看板页面时是否为全屏模式,不包括正常模式进入后切换为全屏模式
        parentLimitation: false// 拖拽区域是否限制在父元素区域内
      }
    },
    watch: {
@@ -186,7 +191,9 @@
            this.workshopDetails.backgroundImage
          )})`
          this.$refs.deviceContainerRef.style.height = (this.windowHeight - this.pageHeaderHeight) + 'px'
          this.parentH = this.windowHeight - this.pageHeaderHeight
          this.parentLimitation = true // 在父元素高度设置后再设置限制拖拽区域,不这样有概率导致父元素高度未设置就限制拖拽
        })
      },
@@ -273,7 +280,6 @@
      openDetail(item) {
        if (!this.isSwitchChecked) {
          if (item.equipmentStatus == 0) {
            // this.$message.warn("设备处于关机状态!");
            this.$message.warning('设备处于关机状态!')
            return false
          }
@@ -285,8 +291,15 @@
          //   setTimeout( this.$refs.equmentDetaiModel.initData(item.equipmentId),0)
          // },1000*10)
        }
      }
      },
      /**
       * 浏览器尺寸发生改变时触发
       */
      handleWindowSizeChange() {
        this.isFullScreen = !this.isFullScreen
        if (!this.isFullScreen) location.reload() // 如果为全屏模式,则在切换模式时重新加载页面以重新获取浏览器可视区域高度
      }
    },
    created() {
      if (this.$route.params.id) {
@@ -297,9 +310,19 @@
    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() {
      // 确保销毁定时器及回收资源
      // 确保销毁定时器、事件及回收资源
      clearInterval(this.timingAcquisition)
      this.timingAcquisition = null
    }
@@ -313,7 +336,6 @@
    color: #fff;
    .page-header {
      height: 80px;
      font-size: 50px;
      text-align: center;
      position: relative;
@@ -321,7 +343,7 @@
      .header-left {
        width: 450px;
        position: absolute;
        left: 0px;
        left: 0;
        top: 35px;
        display: flex;
        justify-content: space-evenly;
@@ -340,10 +362,6 @@
        justify-content: space-between;
        .single-status-info {
          width: 60px;
          display: flex;
          align-items: center;
          justify-content: space-between;
          .status-square {
            width: 14px;
@@ -357,10 +375,8 @@
    .content-container {
      width: 100%;
      height: calc(100% - 80px);
      background-repeat: no-repeat;
      background-size: 100% 100%;
      .single-device {
        position: absolute;
@@ -380,13 +396,16 @@
          width: 100%;
          height: 100%;
          display: flex;
          justify-content: space-between;
          -webkit-align-items: flex-end;
          -moz-align-items: flex-end;
          -ms-align-items: flex-end;
          .status-image {
            background-size: 100% 100%;
            background-repeat: no-repeat;
            width: 45px;
            margin-right: 10px;
            width: 10px;
            height: 60%;
            margin-right: 5px;
          }
          .device-image {