index.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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="obfurage3D" 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. <obfurageHome 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. <obfurageHistory v-if="activeKey == 'monitor_history'" ref="historyTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType"/>
  29. <obfurageHandleHistoryVue v-if="activeKey == 'handler_history'" ref="alarmHistoryTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType" />
  30. <obfurageAlarmHistory 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 './obfurage.api';
  41. import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
  42. import obfurageHome from './components/obfurageHome.vue';
  43. import obfurageHistory from './components/obfurageHistory.vue';
  44. import obfurageHandleHistoryVue from './components/obfurageHandleHistory.vue';
  45. import obfurageAlarmHistory from './components/obfurageAlarmHistory.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 sprayDataSource = ref([]);
  63. const bundleTubeDataSource = ref({});
  64. const pulpingDataSource = ref([]);
  65. const nitrogenDataSource = ref([]);
  66. const optionValue = ref('')
  67. // 监测数据
  68. const selectData = reactive({});
  69. function changeActive(activeValue) {
  70. activeKey.value = activeValue
  71. }
  72. function deviceChange(index) {
  73. deviceActive.value = deviceType.value = deviceList.value[index].deviceType
  74. }
  75. // 查询关联设备列表
  76. async function getDeviceList() {
  77. const res = await list({ devicetype: 'sys', systemID: optionValue.value });
  78. const result = res.msgTxt;
  79. const deviceArr = <DeviceType[]>[]
  80. result.forEach(item => {
  81. const data = item['datalist'].filter((data: any) => {
  82. const readData = data.readData;
  83. return Object.assign(data, readData);
  84. })
  85. if (item.type != 'sys') {
  86. deviceArr.unshift({ deviceType: item.type, deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'], datalist: data })
  87. }
  88. })
  89. deviceList.value = deviceArr
  90. deviceActive.value = deviceArr[0].deviceType
  91. deviceChange(0)
  92. };
  93. async function getSysDataSource () {
  94. const res = await list({ devicetype: 'sys_obfurage', pagetype: 'normal' });
  95. dataSource.value = res.msgTxt[0].datalist || [];
  96. dataSource.value.forEach((data: any) => {
  97. const readData = data.readData;
  98. data = Object.assign(data, readData);
  99. });
  100. if(!options.value) {
  101. // 初始时选择第一条数据
  102. options.value = dataSource.value
  103. if(!optionValue.value){
  104. optionValue.value = dataSource.value[0]['deviceID']
  105. Object.assign(selectData, dataSource.value[0])
  106. }else{
  107. const currentData = dataSource.value.find(item => item['deviceID'] === optionValue.value) || {}
  108. Object.assign(selectData, currentData)
  109. }
  110. }
  111. const data: any = toRaw(dataSource.value[selectRowIndex.value]); //maxarea
  112. return data;
  113. };
  114. // 切换检测数据
  115. function getSelectRow(deviceID){
  116. const currentData = dataSource.value.find((item: any) => {
  117. return item.deviceID == deviceID
  118. })
  119. if(currentData){
  120. optionValue.value = currentData['deviceID']
  121. Object.assign(selectData, currentData)
  122. }
  123. }
  124. onBeforeMount(() => {
  125. });
  126. onMounted(async() => {
  127. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) optionValue.value = currentRoute.value['query']['id']
  128. await getSysDataSource()
  129. await getDeviceList()
  130. });
  131. onUnmounted(() => {
  132. });
  133. </script>
  134. <style lang="less" scoped>
  135. @import '/@/design/vent/modal.less';
  136. @ventSpace: zxm;
  137. .scene-box{
  138. pointer-events: none;
  139. .history-group{
  140. padding: 0 20px;
  141. .history-container{
  142. position: relative;
  143. background: #6195af1a;
  144. width: calc(100% + 10px);
  145. top: 0px;
  146. left: -10px;
  147. border: 1px solid #00fffd22;
  148. padding: 10px 0;
  149. box-shadow: 0 0 20px #44b4ff33 inset;
  150. }
  151. }
  152. .device-button-group{
  153. // margin: 0 20px;
  154. display: flex;
  155. pointer-events: auto;
  156. position: relative;
  157. margin-top: 90px;
  158. &::after{
  159. position:absolute;
  160. content: '';
  161. width: calc(100% + 10px);
  162. height: 2px;
  163. top: 30px;
  164. left: -10px;
  165. border-bottom: 1px solid #0efcff;
  166. }
  167. .device-button{
  168. padding: 4px 15px;
  169. position: relative;
  170. display: flex;
  171. justify-content: center;
  172. align-items: center;
  173. font-size: 14px;
  174. color: #fff;
  175. cursor: pointer;
  176. margin: 0 3px;
  177. &::before{
  178. content: '';
  179. position: absolute;
  180. top: 0;
  181. right: 0;
  182. bottom: 0;
  183. left: 0;
  184. border: 1px solid #6176AF;
  185. transform: skewX(-38deg);
  186. background-color: rgba(0, 77, 103,85%);
  187. z-index: -1;
  188. }
  189. }
  190. .device-active{
  191. // color: #0efcff;
  192. &::before{
  193. border-color: #0efcff;
  194. box-shadow: 1px 1px 3px 1px #0efcff inset;
  195. }
  196. }
  197. }
  198. }
  199. .center-container{
  200. width: 100%;
  201. height: calc(100% - 200px);
  202. }
  203. :deep(.@{ventSpace}-tabs-tabpane-active) {
  204. overflow: auto;
  205. }
  206. .input-box {
  207. display: flex;
  208. align-items: center;
  209. padding-left: 10px;
  210. .input-title {
  211. color: #73e8fe;
  212. width: auto;
  213. }
  214. .@{ventSpace}-input-number {
  215. border-color: #ffffff88 !important;
  216. }
  217. margin-right: 10px;
  218. }
  219. </style>