index1.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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. debugger;
  148. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) optionValue.value = currentRoute.value['query']['id'];
  149. await getSysDataSource();
  150. actions.onGlobalStateChange((newState) => {
  151. const isMounted = newState['isMounted'];
  152. if (isMounted) {
  153. actions.setGlobalState({ isMounted: false, pageObj: { modalId: '1922122318615515138' } });
  154. loading.value = false;
  155. }
  156. });
  157. });
  158. onUnmounted(() => {});
  159. onBeforeUnmount(async () => {
  160. await unmountMicroApps(['micro-vent-2dModal']);
  161. });
  162. </script>
  163. <style lang="less" scoped>
  164. @import '/@/design/vent/modal.less';
  165. @ventSpace: zxm;
  166. @{theme-deepblue} {
  167. .scene-box {
  168. --image-border: url('/@/assets/images/themify/deepblue/fire/border.png');
  169. }
  170. }
  171. .scene-box {
  172. --image-border: url('/@/assets/images/fire/border.png');
  173. width: 100%;
  174. height: 100%;
  175. margin-top: 20px;
  176. pointer-events: none;
  177. // position: relative;
  178. // margin: 0 !important;
  179. // padding:0 !important;
  180. :deep(.left-box) {
  181. margin-top: 0px;
  182. }
  183. :deep(.right-box) {
  184. margin-top: 0px;
  185. }
  186. .history-group {
  187. padding: 0 20px;
  188. .history-container {
  189. position: relative;
  190. background: #6195af1a;
  191. width: calc(100% + 10px);
  192. top: 5px;
  193. left: -10px;
  194. // border: 1px solid #00fffd22;
  195. padding: 10px 20px;
  196. box-shadow: 0 0 20px #44b4ff33 inset;
  197. background: var(--image-border) no-repeat center;
  198. background-size: 100% 100%;
  199. height: 692px;
  200. }
  201. }
  202. .device-button-group {
  203. // margin: 0 20px;
  204. display: flex;
  205. pointer-events: auto;
  206. position: relative;
  207. margin-top: 90px;
  208. &::after {
  209. position: absolute;
  210. content: '';
  211. width: calc(100% + 10px);
  212. height: 2px;
  213. top: 30px;
  214. left: -10px;
  215. // border-bottom: 1px solid #0efcff;
  216. }
  217. .device-button {
  218. padding: 4px 15px;
  219. position: relative;
  220. display: flex;
  221. justify-content: center;
  222. align-items: center;
  223. font-size: 14px;
  224. color: #fff;
  225. cursor: pointer;
  226. margin: 0 3px;
  227. &::before {
  228. content: '';
  229. position: absolute;
  230. top: 0;
  231. right: 0;
  232. bottom: 0;
  233. left: 0;
  234. border: 1px solid #6176af;
  235. transform: skewX(-38deg);
  236. background-color: rgba(0, 77, 103, 85%);
  237. z-index: -1;
  238. }
  239. }
  240. .device-active {
  241. // color: #0efcff;
  242. &::before {
  243. border-color: #0efcff;
  244. box-shadow: 1px 1px 3px 1px #0efcff inset;
  245. }
  246. }
  247. }
  248. }
  249. .center-container {
  250. width: 100%;
  251. height: calc(100% - 200px);
  252. }
  253. .input-box {
  254. display: flex;
  255. align-items: center;
  256. padding-left: 10px;
  257. .input-title {
  258. color: #73e8fe;
  259. width: auto;
  260. }
  261. .@{ventSpace}-input-number {
  262. border-color: #ffffff88 !important;
  263. }
  264. margin-right: 10px;
  265. }
  266. </style>