index.vue 6.8 KB

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