index1.vue 7.7 KB

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