index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div class="air-door">
  3. <customHeader>风门集中同控</customHeader>
  4. <div class="main-container">
  5. <div class="container-left">
  6. <doorMenuL :menuData="menuData" />
  7. </div>
  8. <div class="container-right">
  9. <doorContentR :infoData="menuData" :visibleTs30="visibleTs30" />
  10. </div>
  11. </div>
  12. </div>
  13. </template>
  14. <script setup lang="ts">
  15. import { ref, onMounted, provide, onUnmounted } from 'vue'
  16. import customHeader from '/@/components/vent/customHeader.vue';
  17. import doorMenuL from './components/door-menu-l.vue'
  18. import doorContentR from './components/door-content-r.vue'
  19. import { getDevice, upcoming } from './airdoor.api'
  20. let menuData = ref<any[]>([]);
  21. //控制定时设置提示弹窗显示/隐藏
  22. let visibleTs30 = ref(false);
  23. // https获取监测数据
  24. let timer: null | NodeJS.Timeout = null;
  25. function getMonitor(flag?) {
  26. timer = setTimeout(
  27. async () => {
  28. await upcomingList()
  29. //获取左侧菜单数据
  30. await getMenuList()
  31. if (timer) {
  32. timer = null;
  33. }
  34. getMonitor(false);
  35. },
  36. flag ? 0 : 5000
  37. );
  38. }
  39. //左侧数据
  40. async function getMenuList() {
  41. let res = await getDevice({ devicetype: "gate", pagetype: "normal" })
  42. console.log(res, 'menuList')
  43. menuData.value = res.msgTxt[0].datalist || []
  44. }
  45. async function upcomingList() {
  46. let res = await upcoming({})
  47. console.log(res, '定时30秒')
  48. if (res.length) {
  49. visibleTs30.value = true
  50. } else {
  51. visibleTs30.value = false
  52. }
  53. }
  54. onMounted(() => {
  55. getMenuList()
  56. getMonitor(true)
  57. })
  58. onUnmounted(() => {
  59. if (timer) {
  60. clearTimeout(timer);
  61. timer = undefined;
  62. }
  63. });
  64. provide('visibleTs30', visibleTs30)
  65. </script>
  66. <style lang="less" scoped>
  67. @import '/@/design/theme.less';
  68. @{theme-deepblue} {
  69. .air-door {
  70. --image-left-bd: url('@/assets/images/themify/deepblue/home-container/configurable/wind-door/left-bd.png');
  71. --image-right-bd: url(/@/assets/images/themify/deepblue/home-container/configurable/wind-door/right-bd.png);
  72. }
  73. }
  74. .air-door {
  75. --image-left-bd: url('@/assets/images/home-container/configurable/wind-door/left-bd.png');
  76. --image-right-bd: url(/@/assets/images/home-container/configurable/wind-door/right-bd.png);
  77. position: relative;
  78. width: 100%;
  79. height: 100%;
  80. .main-container {
  81. display: flex;
  82. width: 100%;
  83. margin-top: 70px;
  84. height: calc(100% - 70px);
  85. padding: 10px;
  86. box-sizing: border-box;
  87. }
  88. .container-left {
  89. width: 320px;
  90. height: 100%;
  91. padding: 20px 10px;
  92. margin-right: 10px;
  93. // border: 1px solid #99e8ff66;
  94. // background: #27546e1a;
  95. background-image: var(--image-left-bd);
  96. background-size: 100% 100%;
  97. overflow-y: auto;
  98. // box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  99. // -moz-box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  100. // -webkit-box-shadow: 0px 0px 50px 1px rgb(149 235 255 / 5%) inset;
  101. }
  102. .container-right {
  103. width: calc(100% - 335px);
  104. height: 100%;
  105. background-image: var(--image-right-bd);
  106. background-size: 100% 100%;
  107. padding: 20px 10px;
  108. box-sizing: border-box;
  109. }
  110. }
  111. </style>