index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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 id="damper3DCSS" v-show="!loading" style="width: 100%; height: 100%; top:0; left: 0; position: absolute; overflow: hidden;">
  8. <div>
  9. <div ref="elementContent" class="elementContent">
  10. <p><span class="data-title">压力(Pa):</span>{{selectData.frontRearDP}}</p>
  11. <p><span class="data-title">动力源压力(MPa):</span>{{selectData.sourcePressure}}</p>
  12. <p><span class="data-title">故障诊断:</span>
  13. <i
  14. :class="{'state-icon': true, 'open': selectData.messageBoxStatus, 'close': !selectData.messageBoxStatus}"
  15. ></i>{{selectData.fault}}</p>
  16. </div>
  17. </div>
  18. </div> -->
  19. </div>
  20. <div class="scene-box">
  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 '/@/components/vent/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 && 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. margin-top: 20px;
  117. pointer-events: none;
  118. .history-group{
  119. padding: 0 20px;
  120. .history-container{
  121. position: relative;
  122. background: #6195af1a;
  123. width: calc(100% + 10px);
  124. top: 0px;
  125. left: -10px;
  126. border: 1px solid #00fffd22;
  127. padding: 10px 0;
  128. box-shadow: 0 0 20px #44b4ff33 inset;
  129. }
  130. }
  131. .device-button-group{
  132. // margin: 0 20px;
  133. display: flex;
  134. pointer-events: auto;
  135. position: relative;
  136. margin-top: 90px;
  137. &::after{
  138. position:absolute;
  139. content: '';
  140. width: calc(100% + 10px);
  141. height: 2px;
  142. top: 30px;
  143. left: -10px;
  144. border-bottom: 1px solid #0efcff;
  145. }
  146. .device-button{
  147. padding: 4px 15px;
  148. position: relative;
  149. display: flex;
  150. justify-content: center;
  151. align-items: center;
  152. font-size: 14px;
  153. color: #fff;
  154. cursor: pointer;
  155. margin: 0 3px;
  156. &::before{
  157. content: '';
  158. position: absolute;
  159. top: 0;
  160. right: 0;
  161. bottom: 0;
  162. left: 0;
  163. border: 1px solid #6176AF;
  164. transform: skewX(-38deg);
  165. background-color: rgba(0, 77, 103,85%);
  166. z-index: -1;
  167. }
  168. }
  169. .device-active{
  170. // color: #0efcff;
  171. &::before{
  172. border-color: #0efcff;
  173. box-shadow: 1px 1px 3px 1px #0efcff inset;
  174. }
  175. }
  176. }
  177. }
  178. .center-container{
  179. width: 100%;
  180. height: calc(100% - 200px);
  181. }
  182. .input-box {
  183. display: flex;
  184. align-items: center;
  185. padding-left: 10px;
  186. .input-title {
  187. color: #73e8fe;
  188. width: auto;
  189. }
  190. .@{ventSpace}-input-number {
  191. border-color: #ffffff88 !important;
  192. }
  193. margin-right: 10px;
  194. }
  195. </style>