index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <div
  3. v-show="activeKey == 'monitor' && !loading"
  4. class="bg"
  5. style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden">
  6. <a-spin :spinning="loading" />
  7. <div
  8. id="beltTun3DCSS"
  9. class="threejs-Object-CSS"
  10. v-show="!loading"
  11. style="width: 100%; height: 100%; position: absolute; pointer-events: none; overflow: hidden; z-index: 1; top: 0"
  12. >
  13. </div>
  14. <div id="beltTun3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden"> </div>
  15. </div>
  16. <div class="scene-box">
  17. <customHeader :fieldNames="{ label: 'systemname', value: 'id', options: 'children' }" :options = 'options' @change="getSelectRow" :optionValue="optionValue">皮带巷智能管控</customHeader>
  18. <div class="center-container">
  19. <template v-if="activeKey == 'monitor'">
  20. <div class="monitor-nav">
  21. <template v-for="(nav, index) in monitorNavData" :key="index">
  22. <div class="nav-item" :class="{'nav-item-active': nav.isShow}" @click="changeMonitor(nav)">{{ nav.title }} </div>
  23. <a-divider v-if="index !== monitorNav.length - 1" type="vertical" style="height: 10px; background-color: #00e1ff;" />
  24. </template>
  25. </div>
  26. <beltTunHome v-if="monitorActive == 0" :deviceId = 'optionValue' />
  27. <beltTunVentHome v-if="monitorActive == 1" :deviceId = 'optionValue' />
  28. <beltTunFireHome v-if="monitorActive == 2" :deviceId = 'optionValue'/>
  29. <beltTunDustHome v-if="monitorActive == 3" :deviceId = 'optionValue'/>
  30. <beltTunGasHome v-if="monitorActive == 4" :deviceId = 'optionValue'/>
  31. </template>
  32. <div v-else class="history-group">
  33. <div class="device-button-group" v-if="deviceList.length > 0 && activeKey !== 'faultRecord'">
  34. <div class="device-button" :class="{ 'device-active': deviceActive == device.deviceType }" v-for="(device, index) in deviceList" :key="index" @click="deviceChange(index)">{{ device.deviceName }}</div>
  35. </div>
  36. <div class="history-container">
  37. <beltTunHistory v-if="activeKey == 'monitor_history'" ref="historyTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType"/>
  38. <beltTunHandleHistory v-if="activeKey == 'handler_history'" ref="alarmHistoryTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType" />
  39. <beltTunAlarmHistory v-if="activeKey == 'faultRecord'" ref="handlerHistoryTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType"/>
  40. </div>
  41. </div>
  42. </div>
  43. <BottomMenu @change="changeActive"/>
  44. </div>
  45. </template>
  46. <script setup lang="ts">
  47. import { onBeforeMount, ref, onMounted, onUnmounted, reactive, toRaw } from 'vue';
  48. import { mountedThree, destroy, setModelType, refreshModal } from './beltTun.threejs';
  49. import { list, systemList, getTableList } from './beltTun.api';
  50. import { monitorNav } from './beltTun.data'
  51. import customHeader from '/@/views/vent/comment/components/customHeader.vue';
  52. import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
  53. import beltTunVentHome from './components/beltTunVentHome.vue';
  54. import beltTunHome from './components/beltTunHome.vue';
  55. import beltTunFireHome from './components/beltTunFireHome.vue'
  56. import beltTunDustHome from './components/beltTunDustHome.vue';
  57. import beltTunGasHome from './components/beltTunGasHome.vue';
  58. import beltTunHistory from './components/beltTunHistory.vue';
  59. import beltTunHandleHistory from './components/beltTunHandleHistory.vue';
  60. import beltTunAlarmHistory from './components/beltTunAlarmHistory.vue';
  61. import { useRouter } from 'vue-router';
  62. type DeviceType = { deviceType: string, deviceName: string, datalist: any[] };
  63. const { currentRoute } = useRouter();
  64. const activeKey = ref('monitor');
  65. const loading = ref(false);
  66. const monitorNavData = ref(monitorNav)
  67. const monitorActive = ref(0)
  68. const historyTable = ref()
  69. const alarmHistoryTable = ref()
  70. const handlerHistoryTable = ref()
  71. //关联设备
  72. const deviceList = ref<DeviceType[]>([])
  73. const deviceActive = ref('')
  74. const deviceType = ref('')
  75. const options = ref()
  76. // 默认初始是第一行
  77. const selectRowIndex = ref(0);
  78. const dataSource = ref([])
  79. const optionValue = ref('')
  80. // 监测数据
  81. const selectData = reactive({});
  82. function changeActive(activeValue) {
  83. activeKey.value = activeValue
  84. loading.value = true
  85. if(activeKey.value === 'monitor'){
  86. // refreshModal()
  87. setModelType('beltTun')
  88. setTimeout(() =>{
  89. loading.value = false
  90. }, 600)
  91. }else{
  92. loading.value = false
  93. }
  94. }
  95. function deviceChange(index) {
  96. deviceActive.value = deviceType.value = deviceList.value[index].deviceType
  97. }
  98. // 查询关联设备列表
  99. async function getDeviceList() {
  100. const res = await systemList({ devicetype: 'sys', systemID: optionValue.value });
  101. const result = res.msgTxt;
  102. const deviceArr = <DeviceType[]>[]
  103. result.forEach(item => {
  104. const data = item['datalist'].filter((data: any) => {
  105. const readData = data.readData;
  106. return Object.assign(data, readData);
  107. })
  108. if (item.type != 'sys') {
  109. deviceArr.unshift({ deviceType: item.type, deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'], datalist: data })
  110. }
  111. })
  112. deviceList.value = deviceArr
  113. deviceActive.value = deviceArr[0].deviceType
  114. deviceChange(0)
  115. };
  116. async function getSysDataSource() {
  117. const res = await getTableList({ strtype: 'sys_maintunnel_leather', pagetype: 'normal' });
  118. if (!options.value) {
  119. // 初始时选择第一条数据
  120. options.value = res.records || [];
  121. if (!optionValue.value) {
  122. optionValue.value = options.value[0]['id']
  123. getDeviceList()
  124. }
  125. }
  126. };
  127. // 切换检测数据
  128. async function getSelectRow(deviceID) {
  129. const currentData = dataSource.value.find((item: any) => {
  130. return item.deviceID == deviceID
  131. })
  132. if (currentData) {
  133. optionValue.value = currentData['deviceID']
  134. Object.assign(selectData, currentData)
  135. await getDeviceList()
  136. }
  137. }
  138. function changeMonitor(nav) {
  139. nav.isShow = true
  140. monitorNav.forEach((item, index) => {
  141. if(item.title !== nav.title) {
  142. item.isShow = false
  143. }else{
  144. monitorActive.value = index
  145. }
  146. })
  147. }
  148. onBeforeMount(() => {
  149. });
  150. onMounted(async() => {
  151. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) optionValue.value = currentRoute.value['query']['id']
  152. await getSysDataSource()
  153. await getDeviceList()
  154. loading.value = true;
  155. mountedThree().then(async () => {
  156. setModelType('beltTun')
  157. loading.value = false;
  158. });
  159. });
  160. onUnmounted(() => {
  161. destroy();
  162. });
  163. </script>
  164. <style lang="less" scoped>
  165. @import '/@/design/vent/modal.less';
  166. @ventSpace: zxm;
  167. :deep(.@{ventSpace}-tabs-tabpane-active) {
  168. overflow: auto;
  169. }
  170. .scene-box{
  171. width: 100%;
  172. height: 100%;
  173. }
  174. .monitor-nav{
  175. width: 860px;
  176. height: 42px;
  177. display: flex;
  178. justify-content: center;
  179. align-items: center;
  180. // border: 1px solid #73e8fe;
  181. color: #fff;
  182. position: absolute;
  183. top: 88px;
  184. left: 50% !important;
  185. transform: translateX(-50%) !important;
  186. pointer-events: auto;
  187. background: linear-gradient(45deg, #96c5ca38, #156c7d4a);
  188. clip-path: polygon(
  189. 14px 0,
  190. calc(100% - 14px) 0,
  191. 100% 14px,
  192. 100% calc(100% - 14px),
  193. calc(100% - 14px) 100%,
  194. 14px 100%,
  195. 0 calc(100% - 14px),
  196. 0 14px
  197. );
  198. // background: url('/@/assets/images/vent/wokeFaca-nav.png') no-repeat !important;
  199. .nav-item{
  200. padding: 1px 10px;
  201. cursor: pointer;
  202. }
  203. .nav-item-active{
  204. color: #00fbff;
  205. }
  206. }
  207. .history-group{
  208. padding: 0 20px;
  209. .history-container{
  210. position: relative;
  211. background: #6195af1a;
  212. width: calc(100% + 10px);
  213. top: 0px;
  214. left: -10px;
  215. border: 1px solid #00fffd22;
  216. padding: 10px 0;
  217. box-shadow: 0 0 20px #44b4ff33 inset;
  218. }
  219. }
  220. .device-button-group{
  221. // margin: 0 20px;
  222. display: flex;
  223. pointer-events: auto;
  224. position: relative;
  225. margin-top: 90px;
  226. &::after{
  227. position:absolute;
  228. content: '';
  229. width: calc(100% + 10px);
  230. height: 2px;
  231. top: 30px;
  232. left: -10px;
  233. border-bottom: 1px solid #0efcff;
  234. }
  235. .device-button{
  236. padding: 4px 15px;
  237. position: relative;
  238. display: flex;
  239. justify-content: center;
  240. align-items: center;
  241. font-size: 14px;
  242. color: #fff;
  243. cursor: pointer;
  244. margin: 0 3px;
  245. &::before{
  246. content: '';
  247. position: absolute;
  248. top: 0;
  249. right: 0;
  250. bottom: 0;
  251. left: 0;
  252. border: 1px solid #6176AF;
  253. transform: skewX(-38deg);
  254. background-color: rgba(0, 77, 103,85%);
  255. z-index: -1;
  256. }
  257. }
  258. .device-active{
  259. // color: #0efcff;
  260. &::before{
  261. border-color: #0efcff;
  262. box-shadow: 1px 1px 3px 1px #0efcff inset;
  263. }
  264. }
  265. }
  266. .input-box {
  267. display: flex;
  268. align-items: center;
  269. padding-left: 10px;
  270. .input-title {
  271. color: #73e8fe;
  272. width: auto;
  273. }
  274. .@{ventSpace}-input-number {
  275. border-color: #ffffff88 !important;
  276. }
  277. margin-right: 10px;
  278. }
  279. .monitor-msg-box {
  280. width: 170px;
  281. margin-top: 100px;
  282. .monitor-msg-container {
  283. width: 170px;
  284. height: 150px;
  285. box-shadow: rgba(128, 128, 128, 0.3) 0px 0px 40px inset;
  286. border: 1px solid rgba(128, 128, 128, 0.3);
  287. background-color: transparent;
  288. }
  289. .errorColor {
  290. box-shadow: #F73B2440 0px 0px 40px inset;
  291. border: 1px solid #F73B2440;
  292. }
  293. .warningColor {
  294. box-shadow: #FF9B1740 0px 0px 40px inset;
  295. border: 1px solid #FF9B1740;
  296. }
  297. .monitor-item {
  298. padding: 10px 10px 0px 10px;
  299. color: #fff;
  300. letter-spacing: 2px;
  301. .item-title {
  302. color: #73e8fe;
  303. }
  304. .num {
  305. color: #FFA500;
  306. }
  307. }
  308. }
  309. </style>