deviceManger.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <!-- 设备管理器主组件:三栏布局展示设备列表、设备详情和配置信息 -->
  2. <template>
  3. <div class="device-manger">
  4. <!-- 左侧区域:设备列表 -->
  5. <div class="basic-box">
  6. <!-- DeviceLeft组件:显示设备列表,通过details事件传递选中的设备详情 -->
  7. <DeviceLeft @details="handlerDetail"></DeviceLeft>
  8. </div>
  9. <!-- 中间区域:设备详细信息展示 -->
  10. <div class="basic-box">
  11. <!-- DeviceCenter组件:接收并展示选中设备的详细数据 -->
  12. <DeviceCenter :detailData="detailData"></DeviceCenter>
  13. </div>
  14. <!-- 右侧区域:设备配置信息展示 -->
  15. <div class="basic-box">
  16. <!-- DeviceRight组件:接收并展示设备的配置数据 -->
  17. <DeviceRight :detailData="configData"></DeviceRight>
  18. </div>
  19. </div>
  20. </template>
  21. <script lang="ts" setup>
  22. // 导入Vue 3组合式API相关函数和响应式工具
  23. import { onMounted, onUnmounted, ref, computed, nextTick, onBeforeMount, watch, reactive } from 'vue';
  24. // 导入子组件:左侧设备列表、中间设备详情、右侧配置信息
  25. import DeviceLeft from './components/DeviceLeft.vue'
  26. import DeviceCenter from './components/DeviceCenter.vue'
  27. import DeviceRight from './components/DeviceRight.vue'
  28. // 设备序列号信息(暂未使用)
  29. const strserno = ref<any>({})
  30. // 响应式数据:存储选中设备的详细信息,传递给DeviceCenter组件展示
  31. const detailData = ref<any>({})
  32. // 响应式数据:存储设备的配置信息,传递给DeviceRight组件展示(包括普通配置和重启配置)
  33. const configData = ref<any>({})
  34. /**
  35. * 处理设备详情事件回调函数
  36. * @param item - 包含type和value的事件对象
  37. * - type: 事件类型 ('detail' | 'config' | 'restart')
  38. * - value: 对应的详细数据
  39. * 根据不同的类型将数据分配到对应的响应式变量中
  40. */
  41. function handlerDetail(item: any) {
  42. console.log(item, '详情--handlerDetail')
  43. switch (item.type) {
  44. // 处理设备详情类型:更新中间区域的设备详细数据
  45. case 'detail':
  46. detailData.value = item.value
  47. break
  48. // 处理配置详情类型:更新右侧区域的配置数据
  49. case 'config':
  50. configData.value = item.value
  51. break
  52. // 处理重启配置类型:更新右侧区域的配置数据(用于重启操作)
  53. case 'restart':
  54. configData.value = item.value
  55. break
  56. default:
  57. // 其他 cases 待添加
  58. }
  59. }
  60. /**
  61. * 组件挂载完成后的生命周期钩子
  62. * 用于初始化页面数据,包括:
  63. * - 获取设备配置信息
  64. * - 调用系统接口获取基础数据
  65. * - 加载监控相关信息
  66. * (当前为空实现,待后续完善业务逻辑)
  67. */
  68. onMounted(() => {
  69. });
  70. /**
  71. * 组件卸载前的生命周期钩子
  72. * 用于清理资源、移除事件监听器等收尾工作
  73. * (当前为空实现,待后续根据实际需求添加清理逻辑)
  74. */
  75. onUnmounted(() => {
  76. });
  77. </script>
  78. <!-- 样式部分:使用Less预处理器,scoped限制样式作用域 -->
  79. <style lang="less" scoped>
  80. // 导入主题配置文件,包含全局样式变量和主题定义
  81. @import '/@/design/theme.less';
  82. /* 深蓝主题模式下的设备管理器样式覆盖 */
  83. @{theme-deepblue} {
  84. .device-manger {}
  85. }
  86. /* 设备管理器主容器:采用三栏弹性布局 */
  87. .device-manger {
  88. /* CSS自定义属性:左侧和右侧区域的背景图片 */
  89. --image-box1-bg: url('@/assets/images/home-container/configurable/hsq/2-4.png');
  90. /* CSS自定义属性:中间区域(设备详情)的背景图片 */
  91. --image-box1-bg1: url('@/assets/images/home-container/configurable/hsq/2-10.png');
  92. /* 弹性布局:子元素水平排列 */
  93. display: flex;
  94. /* 子元素两端对齐,均匀分布 */
  95. justify-content: space-between;
  96. /* 容器宽度占满父元素 */
  97. width: 100%;
  98. /* 高度减去底部间距 */
  99. height: calc(100% - 10px);
  100. /* 文字颜色为白色 */
  101. color: @white;
  102. /* 相对定位:作为中间绝对定位元素的参考容器 */
  103. position: relative;
  104. /* 底部外边距 */
  105. margin-bottom: 10px;
  106. /* 深蓝色背景色 */
  107. background-color: #09172c;
  108. /* 基础盒子样式:三个栏目的通用容器 */
  109. .basic-box {
  110. /* 第一个子元素(左侧设备列表区域) */
  111. &:nth-child(1) {
  112. /* 固定宽度430px */
  113. width: 430px;
  114. /* 高度撑满父容器 */
  115. height: 100%;
  116. /* 使用CSS变量设置背景图,不重复显示 */
  117. background: var(--image-box1-bg) no-repeat;
  118. /* 背景图完全填充容器 */
  119. background-size: 100% 100%;
  120. /* 右侧外边距,与中间区域保持间距 */
  121. margin-right: 10px;
  122. }
  123. /* 第二个子元素(中间设备详情区域) */
  124. &:nth-child(2) {
  125. /* 绝对定位:相对于父容器定位 */
  126. position: absolute;
  127. /* 距离顶部63px(为标题栏预留空间) */
  128. top: 63px;
  129. /* 水平居中定位 */
  130. left: 50%;
  131. /* 通过transform实现真正的水平居中 */
  132. transform: translate(-50%, 0);
  133. /* 宽度计算:总宽度减去左右两侧的宽度(430*2=880) */
  134. width: calc(100% - 880px);
  135. /* 高度计算:总高度减去顶部偏移量 */
  136. height: calc(100% - 63px);
  137. /* 使用中间区域的专用背景图 */
  138. background: var(--image-box1-bg1) no-repeat;
  139. background-size: 100% 100%;
  140. }
  141. /* 第三个子元素(右侧配置信息区域) */
  142. &:nth-child(3) {
  143. /* 固定宽度430px,与左侧对称 */
  144. width: 430px;
  145. height: 100%;
  146. /* 使用与左侧相同的背景图 */
  147. background: var(--image-box1-bg) no-repeat;
  148. background-size: 100% 100%;
  149. /* 左侧外边距,与中间区域保持间距 */
  150. margin-left: 10px;
  151. }
  152. }
  153. }
  154. /* 深度选择器:穿透组件边界修改loading组件的定位样式 */
  155. :deep(.loading-box) {
  156. /* 重置position为默认值,避免影响布局 */
  157. position: unset;
  158. }
  159. </style>