index3.vue 7.4 KB

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