index1.vue 6.5 KB

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