index4.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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
  65. :nav-list="[
  66. {
  67. title: '监控界面',
  68. pathName: 'monitor',
  69. isHover: false,
  70. },
  71. {
  72. title: '历史监测记录',
  73. pathName: 'monitor_history',
  74. isHover: false,
  75. },
  76. {
  77. title: '操作历史记录',
  78. pathName: 'handler_history',
  79. isHover: false,
  80. },
  81. ]"
  82. @change="changeActive"
  83. />
  84. </div>
  85. </template>
  86. <script setup lang="ts">
  87. import customHeader from '/@/components/vent/customHeader.vue';
  88. import { onBeforeMount, ref, onMounted, onUnmounted, reactive, toRaw } from 'vue';
  89. import { list, getTableList } from './balancePress.api';
  90. import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
  91. import balancePressHome from './components/balancePressHome.vue';
  92. import balancePressHistory from './components/balancePressHistory.vue';
  93. import balancePressHandleHistoryVue from './components/balancePressHandleHistory.vue';
  94. import balancePressAlarmHistory from './components/balancePressAlarmHistory.vue';
  95. import { useRouter } from 'vue-router';
  96. type DeviceType = { deviceType: string; deviceName: string; datalist: any[] };
  97. const { currentRoute } = useRouter();
  98. const activeKey = ref('monitor');
  99. const loading = ref(false);
  100. const historyTable = ref();
  101. const alarmHistoryTable = ref();
  102. const handlerHistoryTable = ref();
  103. //关联设备
  104. const deviceList = ref<DeviceType[]>([]);
  105. const deviceActive = ref('');
  106. const deviceType = ref('');
  107. const options = ref();
  108. const optionValue = ref('');
  109. function changeActive(activeValue) {
  110. activeKey.value = activeValue;
  111. }
  112. function deviceChange(index) {
  113. deviceActive.value = deviceType.value = deviceList.value[index].deviceType;
  114. }
  115. // 查询关联设备列表
  116. async function getDeviceList() {
  117. const res = await list({ devicetype: 'sys', systemID: optionValue.value });
  118. const result = res.msgTxt;
  119. const deviceArr = <DeviceType[]>[];
  120. result.forEach((item) => {
  121. const data = item['datalist'].filter((data: any) => {
  122. const readData = data.readData;
  123. return Object.assign(data, readData);
  124. });
  125. if (item.type != 'sys') {
  126. deviceArr.unshift({
  127. deviceType: item.type,
  128. deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'],
  129. datalist: data,
  130. });
  131. }
  132. });
  133. deviceList.value = deviceArr;
  134. deviceActive.value = deviceArr[0].deviceType;
  135. deviceChange(0);
  136. }
  137. async function getSysDataSource() {
  138. const res = await getTableList({ strtype: 'sys_surface_junya', pagetype: 'normal' });
  139. if (!options.value) {
  140. // 初始时选择第一条数据
  141. options.value = res.records || [];
  142. if (!optionValue.value) {
  143. optionValue.value = options.value[0]['id'];
  144. getDeviceList();
  145. }
  146. }
  147. }
  148. // 切换检测数据
  149. function getSelectRow(deviceID) {
  150. // const currentData = options.value.find((item: any) => {
  151. // return item.id == deviceID
  152. // })
  153. optionValue.value = deviceID;
  154. getDeviceList();
  155. }
  156. onBeforeMount(() => {});
  157. onMounted(async () => {
  158. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) optionValue.value = currentRoute.value['query']['id'];
  159. await getSysDataSource();
  160. });
  161. onUnmounted(() => {});
  162. </script>
  163. <style lang="less" scoped>
  164. @import '/@/design/vent/modal.less';
  165. @ventSpace: zxm;
  166. .scene-box {
  167. margin-top: 20px;
  168. pointer-events: none;
  169. .history-group {
  170. padding: 0 20px;
  171. .history-container {
  172. position: relative;
  173. background: #6195af1a;
  174. width: calc(100% + 10px);
  175. top: 0px;
  176. left: -10px;
  177. border: 1px solid #00fffd22;
  178. padding: 10px 0;
  179. box-shadow: 0 0 20px #44b4ff33 inset;
  180. }
  181. }
  182. .device-button-group {
  183. // margin: 0 20px;
  184. display: flex;
  185. pointer-events: auto;
  186. position: relative;
  187. margin-top: 90px;
  188. &::after {
  189. position: absolute;
  190. content: '';
  191. width: calc(100% + 10px);
  192. height: 2px;
  193. top: 30px;
  194. left: -10px;
  195. border-bottom: 1px solid #0efcff;
  196. }
  197. .device-button {
  198. padding: 4px 15px;
  199. position: relative;
  200. display: flex;
  201. justify-content: center;
  202. align-items: center;
  203. font-size: 14px;
  204. color: #fff;
  205. cursor: pointer;
  206. margin: 0 3px;
  207. &::before {
  208. content: '';
  209. position: absolute;
  210. top: 0;
  211. right: 0;
  212. bottom: 0;
  213. left: 0;
  214. border: 1px solid #6176af;
  215. transform: skewX(-38deg);
  216. background-color: rgba(0, 77, 103, 85%);
  217. z-index: -1;
  218. }
  219. }
  220. .device-active {
  221. // color: #0efcff;
  222. &::before {
  223. border-color: #0efcff;
  224. box-shadow: 1px 1px 3px 1px #0efcff inset;
  225. }
  226. }
  227. }
  228. }
  229. .center-container {
  230. width: 100%;
  231. height: calc(100% - 200px);
  232. }
  233. .input-box {
  234. display: flex;
  235. align-items: center;
  236. padding-left: 10px;
  237. .input-title {
  238. color: #73e8fe;
  239. width: auto;
  240. }
  241. .@{ventSpace}-input-number {
  242. border-color: #ffffff88 !important;
  243. }
  244. margin-right: 10px;
  245. }
  246. </style>