index2.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. <template>
  2. <customHeader :fieldNames="{ label: 'systemname', value: 'id', options: 'children' }" :options = 'options' @change="getSelectRow" :optionValue="optionValue">均压与低氧管控</customHeader>
  3. <div class="bg"
  4. style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden">
  5. <a-spin :spinning="loading" />
  6. <div id="balancePress3D" v-show="!loading" style="width: 100%; height: 100%; position: absolute; overflow: hidden"> </div>
  7. </div>
  8. <div class="scene-box">
  9. <div class="center-container">
  10. <balancePressHome v-if="activeKey == 'monitor'" :deviceId = 'optionValue' />
  11. <div v-else class="history-group">
  12. <div class="device-button-group" v-if="deviceList.length > 0">
  13. <div class="device-button" :class="{ 'device-active': deviceActive == device.deviceType }" v-for="(device, index) in deviceList" :key="index" @click="deviceChange(index)">{{ device.deviceName }}</div>
  14. </div>
  15. <div class="history-container">
  16. <balancePressHistory v-if="activeKey == 'monitor_history'" ref="historyTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType"/>
  17. <balancePressHandleHistoryVue v-if="activeKey == 'handler_history'" ref="alarmHistoryTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType" />
  18. <balancePressAlarmHistory v-if="activeKey == 'faultRecord'" ref="handlerHistoryTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType"/>
  19. </div>
  20. </div>
  21. </div>
  22. <BottomMenu @change="changeActive"/>
  23. </div>
  24. </template>
  25. <script setup lang="ts">
  26. import customHeader from '/@/components/vent/customHeader.vue';
  27. import { onBeforeMount, ref, onMounted, onUnmounted, reactive, toRaw } from 'vue';
  28. import { list, getTableList } from './balancePress.api';
  29. import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
  30. import balancePressHome from './components/balancePressHome1.vue';
  31. import balancePressHistory from './components/balancePressHistory.vue';
  32. import balancePressHandleHistoryVue from './components/balancePressHandleHistory.vue';
  33. import balancePressAlarmHistory from './components/balancePressAlarmHistory.vue';
  34. import { useRouter } from 'vue-router';
  35. type DeviceType = { deviceType: string, deviceName: string, datalist: any[] };
  36. const { currentRoute } = useRouter();
  37. const activeKey = ref('monitor');
  38. const loading = ref(false);
  39. const historyTable = ref()
  40. const alarmHistoryTable = ref()
  41. const handlerHistoryTable = ref()
  42. //关联设备
  43. const deviceList = ref<DeviceType[]>([])
  44. const deviceActive = ref('')
  45. const deviceType = ref('')
  46. const options = ref()
  47. const optionValue = ref('')
  48. function changeActive(activeValue) {
  49. activeKey.value = activeValue
  50. }
  51. function deviceChange(index) {
  52. deviceActive.value = deviceType.value = deviceList.value[index].deviceType
  53. }
  54. // 查询关联设备列表
  55. async function getDeviceList() {
  56. const res = await list({ devicetype: 'sys', systemID: optionValue.value });
  57. const result = res.msgTxt;
  58. const deviceArr = <DeviceType[]>[]
  59. result.forEach(item => {
  60. const data = item['datalist'].filter((data: any) => {
  61. const readData = data.readData;
  62. return Object.assign(data, readData);
  63. })
  64. if (item.type != 'sys') {
  65. deviceArr.unshift({ deviceType: item.type, deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'], datalist: data })
  66. }
  67. })
  68. deviceList.value = deviceArr
  69. deviceActive.value = deviceArr[0].deviceType
  70. deviceChange(0)
  71. };
  72. async function getSysDataSource () {
  73. const res = await getTableList({ strtype: 'sys_surface_junya', pagetype: 'normal' });
  74. if (!options.value) {
  75. // 初始时选择第一条数据
  76. options.value = res.records || [];
  77. if (!optionValue.value) {
  78. optionValue.value = options.value[0]['id']
  79. getDeviceList()
  80. }
  81. }
  82. };
  83. // 切换检测数据
  84. function getSelectRow(deviceID){
  85. // const currentData = options.value.find((item: any) => {
  86. // return item.id == deviceID
  87. // })
  88. optionValue.value = deviceID
  89. getDeviceList()
  90. // setModelType('balancePressTun')
  91. }
  92. onBeforeMount(() => {
  93. });
  94. onMounted(async() => {
  95. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) optionValue.value = currentRoute.value['query']['id']
  96. await getSysDataSource()
  97. });
  98. onUnmounted(() => {
  99. });
  100. </script>
  101. <style lang="less" scoped>
  102. @import '/@/design/vent/modal.less';
  103. @ventSpace: zxm;
  104. .scene-box{
  105. margin-top: 20px;
  106. pointer-events: none;
  107. .history-group{
  108. padding: 0 20px;
  109. .history-container{
  110. position: relative;
  111. background: #6195af1a;
  112. width: calc(100% + 10px);
  113. top: 0px;
  114. left: -10px;
  115. border: 1px solid #00fffd22;
  116. padding: 10px 0;
  117. box-shadow: 0 0 20px #44b4ff33 inset;
  118. }
  119. }
  120. .device-button-group{
  121. // margin: 0 20px;
  122. display: flex;
  123. pointer-events: auto;
  124. position: relative;
  125. margin-top: 90px;
  126. &::after{
  127. position:absolute;
  128. content: '';
  129. width: calc(100% + 10px);
  130. height: 2px;
  131. top: 30px;
  132. left: -10px;
  133. border-bottom: 1px solid #0efcff;
  134. }
  135. .device-button{
  136. padding: 4px 15px;
  137. position: relative;
  138. display: flex;
  139. justify-content: center;
  140. align-items: center;
  141. font-size: 14px;
  142. color: #fff;
  143. cursor: pointer;
  144. margin: 0 3px;
  145. &::before{
  146. content: '';
  147. position: absolute;
  148. top: 0;
  149. right: 0;
  150. bottom: 0;
  151. left: 0;
  152. border: 1px solid #6176AF;
  153. transform: skewX(-38deg);
  154. background-color: rgba(0, 77, 103,85%);
  155. z-index: -1;
  156. }
  157. }
  158. .device-active{
  159. // color: #0efcff;
  160. &::before{
  161. border-color: #0efcff;
  162. box-shadow: 1px 1px 3px 1px #0efcff inset;
  163. }
  164. }
  165. }
  166. }
  167. .center-container{
  168. width: 100%;
  169. height: calc(100% - 200px);
  170. }
  171. .input-box {
  172. display: flex;
  173. align-items: center;
  174. padding-left: 10px;
  175. .input-title {
  176. color: #73e8fe;
  177. width: auto;
  178. }
  179. .@{ventSpace}-input-number {
  180. border-color: #ffffff88 !important;
  181. }
  182. margin-right: 10px;
  183. }
  184. </style>