index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <!-- 把 dedust3D 放到这里则模型可以正常旋转 -->
  4. <div id="dedust3D" v-show="activeKey == 'monitor'" style="width: 100%; height: 100%; position: absolute; overflow: hidden"> </div>
  5. <div class="scene-box">
  6. <customHeader
  7. :fieldNames="{ label: 'systemname', value: 'id', options: 'children' }"
  8. :options="options"
  9. :optionValue="optionValue"
  10. @change="getSelectRow"
  11. >
  12. 除尘风机智能管控
  13. </customHeader>
  14. <div class="center-container">
  15. <template v-if="activeKey == 'monitor'">
  16. <component :is="DedustHomeComponent" :deviceId="optionValue" />
  17. </template>
  18. <div v-else class="history-group">
  19. <div class="device-button-group" v-if="deviceList.length > 0 && activeKey !== 'faultRecord'">
  20. <div
  21. class="device-button"
  22. :class="{ 'device-active': deviceActive == device.deviceType }"
  23. v-for="(device, index) in deviceList"
  24. :key="index"
  25. @click="deviceChange(index)"
  26. >{{ device.deviceName }}</div
  27. >
  28. </div>
  29. <div class="history-container">
  30. <DedustHistory
  31. v-if="activeKey == 'monitor_history'"
  32. ref="historyTable"
  33. class="vent-margin-t-20"
  34. :deviceId="optionValue"
  35. :device-type="calcDeviceType"
  36. />
  37. <HandleHistory
  38. v-if="activeKey == 'handler_history'"
  39. ref="alarmHistoryTable"
  40. class="vent-margin-t-20"
  41. :deviceId="optionValue"
  42. :device-type="deviceType"
  43. />
  44. <component
  45. v-if="activeKey == 'faultRecord'"
  46. :is="AlarmHistoryComponent"
  47. ref="handlerHistoryTable"
  48. class="vent-margin-t-20"
  49. :deviceId="optionValue"
  50. :device-type="calcDeviceType"
  51. />
  52. </div>
  53. </div>
  54. </div>
  55. <BottomMenu @change="changeActive" />
  56. </div>
  57. </template>
  58. <script setup lang="ts">
  59. import { onBeforeMount, ref, onMounted, computed, defineAsyncComponent } from 'vue';
  60. import customHeader from '/@/components/vent/customHeader.vue';
  61. import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
  62. import DedustHistory from './components/DedustHistory.vue';
  63. import HandleHistory from './components/HandleHistory.vue';
  64. import { useRouter } from 'vue-router';
  65. import { useSystemSelect } from '/@/hooks/vent/useSystemSelect';
  66. import { useGlobSetting } from '/@/hooks/setting';
  67. const { sysOrgCode } = useGlobSetting();
  68. const DedustHomeComponent = computed(() => {
  69. // const sysOrgCode = 'sdmtjtbltmk';
  70. switch (sysOrgCode) {
  71. // 布尔台
  72. case 'sdmtjtbetmk':
  73. return defineAsyncComponent(() => import('./components/DedustHomeBet.vue'));
  74. default:
  75. return defineAsyncComponent(() => import('./components/DedustHome.vue'));
  76. }
  77. });
  78. const AlarmHistoryComponent = computed(() => {
  79. // const sysOrgCode = 'sdmtjtbltmk';
  80. switch (sysOrgCode) {
  81. // 布尔台
  82. case 'sdmtjtbetmk':
  83. return defineAsyncComponent(() => import('./components/AlarmHistoryBet.vue'));
  84. default:
  85. return defineAsyncComponent(() => import('./components/AlarmHistory.vue'));
  86. }
  87. });
  88. const { currentRoute } = useRouter();
  89. const activeKey = ref('monitor');
  90. const historyTable = ref();
  91. const alarmHistoryTable = ref();
  92. const handlerHistoryTable = ref();
  93. function changeActive(activeValue) {
  94. activeKey.value = activeValue;
  95. }
  96. const calcDeviceType = computed(() => {
  97. switch (sysOrgCode) {
  98. // 布尔台
  99. case 'sdmtjtbetmk':
  100. return 'dedustefan';
  101. default:
  102. return deviceType.value;
  103. }
  104. });
  105. const {
  106. options,
  107. optionValue,
  108. deviceType,
  109. // isRefresh,
  110. deviceActive,
  111. deviceList,
  112. // deviceValue,
  113. getSelectRow,
  114. getSysDataSource,
  115. deviceChange,
  116. getDeviceList,
  117. } = useSystemSelect('sys_surface_juejin');
  118. onBeforeMount(() => {});
  119. onMounted(async () => {
  120. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
  121. optionValue.value = currentRoute.value['query']['id'] as string;
  122. }
  123. await getSysDataSource();
  124. await getDeviceList();
  125. });
  126. </script>
  127. <style lang="less" scoped>
  128. @import '/@/design/theme.less';
  129. @import '/@/design/vent/modal.less';
  130. .history-group {
  131. padding: 0 20px;
  132. margin-top: 90px;
  133. .history-container {
  134. position: relative;
  135. background: #6195af1a;
  136. width: calc(100% + 10px);
  137. top: 0px;
  138. left: -10px;
  139. border: 1px solid #00fffd22;
  140. padding: 10px 0;
  141. box-shadow: 0 0 20px #44b4ff33 inset;
  142. }
  143. }
  144. .device-button-group {
  145. // margin: 0 20px;
  146. display: flex;
  147. pointer-events: auto;
  148. position: relative;
  149. &::after {
  150. position: absolute;
  151. content: '';
  152. width: calc(100% + 10px);
  153. height: 2px;
  154. top: 30px;
  155. left: -10px;
  156. border-bottom: 1px solid var(--vent-base-border);
  157. }
  158. .device-button {
  159. padding: 4px 15px;
  160. position: relative;
  161. display: flex;
  162. justify-content: center;
  163. align-items: center;
  164. font-size: 14px;
  165. color: var(--vent-font-color);
  166. cursor: pointer;
  167. margin: 0 3px;
  168. &::before {
  169. content: '';
  170. position: absolute;
  171. top: 0;
  172. right: 0;
  173. bottom: 0;
  174. left: 0;
  175. border: 1px solid #6176af;
  176. transform: skewX(-38deg);
  177. background-color: rgba(0, 77, 103, 85%);
  178. z-index: -1;
  179. }
  180. }
  181. .device-active {
  182. // color: #0efcff;
  183. &::before {
  184. border-color: #0efcff;
  185. box-shadow: 1px 1px 3px 1px #0efcff inset;
  186. }
  187. }
  188. }
  189. </style>