index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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="tunFace3DCSS"
  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="tunFace3D" 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. <tunFaceHome v-if="monitorActive == 0" :deviceId = 'optionValue' />
  27. <tunFaceVentHome v-if="monitorActive == 1" :deviceId = 'optionValue' />
  28. <tunFaceFireHome v-if="monitorActive == 2" :deviceId = 'optionValue'/>
  29. <tunFaceDustHome v-if="monitorActive == 3" :deviceId = 'optionValue'/>
  30. <tunFaceGasHome 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. <tunFaceHistory v-if="activeKey == 'monitor_history'" ref="historyTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType"/>
  38. <tunFaceHandleHistory v-if="activeKey == 'handler_history'" ref="alarmHistoryTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType" />
  39. <tunFaceAlarmHistory 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 } from './tunFace.threejs';
  49. import { systemList, getTableList } from './tunFace.api';
  50. import { monitorNav } from './tunFace.data'
  51. import customHeader from '/@/views/vent/comment/components/customHeader.vue';
  52. import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
  53. import tunFaceVentHome from './components/tunFaceVentHome.vue';
  54. import tunFaceHome from './components/tunFaceHome.vue';
  55. import tunFaceFireHome from './components/tunFaceFireHome.vue'
  56. import tunFaceDustHome from './components/tunFaceDustHome.vue';
  57. import tunFaceGasHome from './components/tunFaceGasHome.vue';
  58. import tunFaceHistory from './components/tunFaceHistory.vue';
  59. import tunFaceHandleHistory from './components/tunFaceHandleHistory.vue';
  60. import tunFaceAlarmHistory from './components/tunFaceAlarmHistory.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. setModelType('tunFace')
  87. setTimeout(() =>{
  88. loading.value = false
  89. }, 600)
  90. }else{
  91. loading.value = false
  92. }
  93. }
  94. function deviceChange(index) {
  95. deviceActive.value = deviceType.value = deviceList.value[index].deviceType
  96. }
  97. // 查询关联设备列表
  98. async function getDeviceList() {
  99. const res = await systemList({ devicetype: 'sys', systemID: optionValue.value });
  100. const result = res.msgTxt;
  101. const deviceArr = <DeviceType[]>[]
  102. result.forEach(item => {
  103. const data = item['datalist'].filter((data: any) => {
  104. const readData = data.readData;
  105. return Object.assign(data, readData);
  106. })
  107. if (item.type != 'sys') {
  108. deviceArr.unshift({ deviceType: item.type, deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'], datalist: data })
  109. }
  110. })
  111. deviceList.value = deviceArr
  112. deviceActive.value = deviceArr[0].deviceType
  113. deviceChange(0)
  114. };
  115. async function getSysDataSource() {
  116. const res = await getTableList({ strtype: 'sys_surface_juejin', pagetype: 'normal' });
  117. if (!options.value) {
  118. // 初始时选择第一条数据
  119. options.value = res.records || [];
  120. if (!optionValue.value) {
  121. optionValue.value = options.value[0]['id']
  122. getDeviceList()
  123. }
  124. }
  125. };
  126. // 切换检测数据
  127. async function getSelectRow(deviceID) {
  128. const currentData = dataSource.value.find((item: any) => {
  129. return item.deviceID == deviceID
  130. })
  131. if (currentData) {
  132. optionValue.value = currentData['deviceID']
  133. Object.assign(selectData, currentData)
  134. await getDeviceList()
  135. }
  136. }
  137. function changeMonitor(nav) {
  138. nav.isShow = true
  139. monitorNav.forEach((item, index) => {
  140. if(item.title !== nav.title) {
  141. item.isShow = false
  142. }else{
  143. monitorActive.value = index
  144. }
  145. })
  146. }
  147. onBeforeMount(() => {
  148. });
  149. onMounted(async() => {
  150. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) optionValue.value = currentRoute.value['query']['id']
  151. await getSysDataSource()
  152. await getDeviceList()
  153. loading.value = true;
  154. mountedThree().then(async () => {
  155. setModelType('tunFace')
  156. loading.value = false;
  157. });
  158. });
  159. onUnmounted(() => {
  160. destroy();
  161. });
  162. </script>
  163. <style lang="less" scoped>
  164. @import '/@/design/vent/modal.less';
  165. @ventSpace: zxm;
  166. :deep(.@{ventSpace}-tabs-tabpane-active) {
  167. height: 100%;
  168. }
  169. .scene-box{
  170. width: 100%;
  171. height: 100%;
  172. }
  173. .monitor-nav{
  174. width: 860px;
  175. height: 42px;
  176. display: flex;
  177. justify-content: center;
  178. align-items: center;
  179. // border: 1px solid #73e8fe;
  180. color: #fff;
  181. position: absolute;
  182. top: 88px;
  183. left: 50% !important;
  184. transform: translateX(-50%) !important;
  185. pointer-events: auto;
  186. background: linear-gradient(45deg, #96c5ca38, #156c7d4a);
  187. clip-path: polygon(
  188. 14px 0,
  189. calc(100% - 14px) 0,
  190. 100% 14px,
  191. 100% calc(100% - 14px),
  192. calc(100% - 14px) 100%,
  193. 14px 100%,
  194. 0 calc(100% - 14px),
  195. 0 14px
  196. );
  197. // background: url('/@/assets/images/vent/wokeFaca-nav.png') no-repeat !important;
  198. .nav-item{
  199. padding: 1px 10px;
  200. cursor: pointer;
  201. }
  202. .nav-item-active{
  203. color: #00fbff;
  204. }
  205. }
  206. .history-group{
  207. padding: 0 20px;
  208. margin-top: 90px;
  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. &::after{
  226. position:absolute;
  227. content: '';
  228. width: calc(100% + 10px);
  229. height: 2px;
  230. top: 30px;
  231. left: -10px;
  232. border-bottom: 1px solid #0efcff;
  233. }
  234. .device-button{
  235. padding: 4px 15px;
  236. position: relative;
  237. display: flex;
  238. justify-content: center;
  239. align-items: center;
  240. font-size: 14px;
  241. color: #fff;
  242. cursor: pointer;
  243. margin: 0 3px;
  244. &::before{
  245. content: '';
  246. position: absolute;
  247. top: 0;
  248. right: 0;
  249. bottom: 0;
  250. left: 0;
  251. border: 1px solid #6176AF;
  252. transform: skewX(-38deg);
  253. background-color: rgba(0, 77, 103,85%);
  254. z-index: -1;
  255. }
  256. }
  257. .device-active{
  258. // color: #0efcff;
  259. &::before{
  260. border-color: #0efcff;
  261. box-shadow: 1px 1px 3px 1px #0efcff inset;
  262. }
  263. }
  264. }
  265. .input-box {
  266. display: flex;
  267. align-items: center;
  268. padding-left: 10px;
  269. .input-title {
  270. color: #73e8fe;
  271. width: auto;
  272. }
  273. .@{ventSpace}-input-number {
  274. border-color: #ffffff88 !important;
  275. }
  276. margin-right: 10px;
  277. }
  278. .monitor-msg-box {
  279. width: 170px;
  280. margin-top: 100px;
  281. .monitor-msg-container {
  282. width: 170px;
  283. height: 150px;
  284. box-shadow: rgba(128, 128, 128, 0.3) 0px 0px 40px inset;
  285. border: 1px solid rgba(128, 128, 128, 0.3);
  286. background-color: transparent;
  287. }
  288. .errorColor {
  289. box-shadow: #F73B2440 0px 0px 40px inset;
  290. border: 1px solid #F73B2440;
  291. }
  292. .warningColor {
  293. box-shadow: #FF9B1740 0px 0px 40px inset;
  294. border: 1px solid #FF9B1740;
  295. }
  296. .monitor-item {
  297. padding: 10px 10px 0px 10px;
  298. color: #fff;
  299. letter-spacing: 2px;
  300. .item-title {
  301. color: #73e8fe;
  302. }
  303. .num {
  304. color: #FFA500;
  305. }
  306. }
  307. }
  308. </style>