index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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 '/@/components/vent/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. if(res && res.msgTxt && res.msgTxt.length){
  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. };
  117. async function getSysDataSource() {
  118. const res = await getTableList({ strtype: 'sys_surface_juejin', pagetype: 'normal' });
  119. if (!options.value && res) {
  120. // 初始时选择第一条数据
  121. options.value = res.records || [];
  122. if (!optionValue.value) {
  123. optionValue.value = options.value[0]['id']
  124. getDeviceList()
  125. }
  126. }
  127. };
  128. // 切换检测数据
  129. async function getSelectRow(deviceID) {
  130. const currentData = dataSource.value.find((item: any) => {
  131. return item.deviceID == deviceID
  132. })
  133. if (currentData) {
  134. optionValue.value = currentData['deviceID']
  135. Object.assign(selectData, currentData)
  136. await getDeviceList()
  137. }
  138. }
  139. function changeMonitor(nav) {
  140. nav.isShow = true
  141. monitorNav.forEach((item, index) => {
  142. if(item.title !== nav.title) {
  143. item.isShow = false
  144. }else{
  145. monitorActive.value = index
  146. }
  147. })
  148. }
  149. onBeforeMount(() => {
  150. });
  151. onMounted(async() => {
  152. loading.value = true;
  153. mountedThree().then(async () => {
  154. setModelType('tunFace')
  155. loading.value = false;
  156. });
  157. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) {
  158. optionValue.value = currentRoute.value['query']['id']
  159. }
  160. await getSysDataSource()
  161. await getDeviceList()
  162. });
  163. onUnmounted(() => {
  164. destroy();
  165. });
  166. </script>
  167. <style lang="less" scoped>
  168. @import '/@/design/vent/modal.less';
  169. @ventSpace: zxm;
  170. :deep(.@{ventSpace}-tabs-tabpane-active) {
  171. height: 100%;
  172. }
  173. .scene-box{
  174. width: 100%;
  175. height: 100%;
  176. }
  177. .monitor-nav{
  178. width: 860px;
  179. height: 42px;
  180. display: flex;
  181. justify-content: center;
  182. align-items: center;
  183. // border: 1px solid #73e8fe;
  184. color: #fff;
  185. position: absolute;
  186. top: 88px;
  187. left: 50% !important;
  188. transform: translateX(-50%) !important;
  189. pointer-events: auto;
  190. background: linear-gradient(45deg, #96c5ca38, #156c7d4a);
  191. clip-path: polygon(
  192. 14px 0,
  193. calc(100% - 14px) 0,
  194. 100% 14px,
  195. 100% calc(100% - 14px),
  196. calc(100% - 14px) 100%,
  197. 14px 100%,
  198. 0 calc(100% - 14px),
  199. 0 14px
  200. );
  201. // background: url('/@/assets/images/vent/wokeFaca-nav.png') no-repeat !important;
  202. .nav-item{
  203. padding: 1px 10px;
  204. cursor: pointer;
  205. }
  206. .nav-item-active{
  207. color: #00fbff;
  208. }
  209. }
  210. .history-group{
  211. padding: 0 20px;
  212. margin-top: 90px;
  213. .history-container{
  214. position: relative;
  215. background: #6195af1a;
  216. width: calc(100% + 10px);
  217. top: 0px;
  218. left: -10px;
  219. border: 1px solid #00fffd22;
  220. padding: 10px 0;
  221. box-shadow: 0 0 20px #44b4ff33 inset;
  222. }
  223. }
  224. .device-button-group{
  225. // margin: 0 20px;
  226. display: flex;
  227. pointer-events: auto;
  228. position: relative;
  229. &::after{
  230. position:absolute;
  231. content: '';
  232. width: calc(100% + 10px);
  233. height: 2px;
  234. top: 30px;
  235. left: -10px;
  236. border-bottom: 1px solid #0efcff;
  237. }
  238. .device-button{
  239. padding: 4px 15px;
  240. position: relative;
  241. display: flex;
  242. justify-content: center;
  243. align-items: center;
  244. font-size: 14px;
  245. color: #fff;
  246. cursor: pointer;
  247. margin: 0 3px;
  248. &::before{
  249. content: '';
  250. position: absolute;
  251. top: 0;
  252. right: 0;
  253. bottom: 0;
  254. left: 0;
  255. border: 1px solid #6176AF;
  256. transform: skewX(-38deg);
  257. background-color: rgba(0, 77, 103,85%);
  258. z-index: -1;
  259. }
  260. }
  261. .device-active{
  262. // color: #0efcff;
  263. &::before{
  264. border-color: #0efcff;
  265. box-shadow: 1px 1px 3px 1px #0efcff inset;
  266. }
  267. }
  268. }
  269. .input-box {
  270. display: flex;
  271. align-items: center;
  272. padding-left: 10px;
  273. .input-title {
  274. color: #73e8fe;
  275. width: auto;
  276. }
  277. .@{ventSpace}-input-number {
  278. border-color: #ffffff88 !important;
  279. }
  280. margin-right: 10px;
  281. }
  282. .monitor-msg-box {
  283. width: 170px;
  284. margin-top: 100px;
  285. .monitor-msg-container {
  286. width: 170px;
  287. height: 150px;
  288. box-shadow: rgba(128, 128, 128, 0.3) 0px 0px 40px inset;
  289. border: 1px solid rgba(128, 128, 128, 0.3);
  290. background-color: transparent;
  291. }
  292. .errorColor {
  293. box-shadow: #F73B2440 0px 0px 40px inset;
  294. border: 1px solid #F73B2440;
  295. }
  296. .warningColor {
  297. box-shadow: #FF9B1740 0px 0px 40px inset;
  298. border: 1px solid #FF9B1740;
  299. }
  300. .monitor-item {
  301. padding: 10px 10px 0px 10px;
  302. color: #fff;
  303. letter-spacing: 2px;
  304. .item-title {
  305. color: #73e8fe;
  306. }
  307. .num {
  308. color: #FFA500;
  309. }
  310. }
  311. }
  312. </style>