index.vue 7.4 KB

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