index.vue 7.3 KB

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