index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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 id="workFace3D" style="width: 100%; height: 100%; position: absolute; overflow: hidden; z-index: 1; top: 0"> </div>
  8. <div
  9. id="workFace3DCSS"
  10. class="threejs-Object-CSS"
  11. v-show="!loading"
  12. style="width: 100%; height: 100%; position: absolute; pointer-events: none; overflow: hidden; z-index: 1; top: 0"
  13. >
  14. </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. <workFaceHome v-if="monitorActive == 0" :deviceId = 'optionValue' />
  27. <workFaceVentHome v-if="monitorActive == 1" :deviceId = 'optionValue' />
  28. <workFaceFireHome v-if="monitorActive == 2" :deviceId = 'optionValue'/>
  29. <workFaceDustHome v-if="monitorActive == 3" :deviceId = 'optionValue'/>
  30. <workFaceGasHome v-if="monitorActive == 4" :deviceId = 'optionValue' :gas-unit-num="gasUnitNum"/>
  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. <workFaceHistory v-if="activeKey == 'monitor_history' && isRefresh" ref="historyTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType"/>
  38. <workFaceHandleHistory v-if="activeKey == 'handler_history' && isRefresh" ref="alarmHistoryTable" class="vent-margin-t-20" :deviceId = 'optionValue' :device-type="deviceType" />
  39. <workFaceAlarmHistory v-if="activeKey == 'faultRecord' && isRefresh" 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, nextTick } from 'vue';
  48. import { mountedThree, destroy, setModelType, clearCss3D, showOrHideGasPlane } from './wokeFace.threejs';
  49. import { getTableList, systemList } from './workFace.api';
  50. import { monitorNav } from './workFace.data'
  51. import customHeader from '/@/views/vent/comment/components/customHeader.vue';
  52. import BottomMenu from '/@/views/vent/comment/components/bottomMenu.vue';
  53. import workFaceVentHome from './components/workFaceVentHome.vue';
  54. import workFaceHome from './components/workFaceHome.vue';
  55. import workFaceFireHome from './components/workFaceFireHome.vue'
  56. import workFaceDustHome from './components/workFaceDustHome.vue';
  57. import workFaceGasHome from './components/workFaceGasHome.vue';
  58. import workFaceHistory from './components/workFaceHistory.vue';
  59. import workFaceHandleHistory from './components/workFaceHandleHistory.vue';
  60. import workFaceAlarmHistory from './components/workFaceAlarmHistory.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. let modalType = '' //模型类型
  69. const historyTable = ref()
  70. const alarmHistoryTable = ref()
  71. const handlerHistoryTable = ref()
  72. //关联设备
  73. const deviceList = ref<DeviceType[]>([])
  74. const deviceActive = ref('')
  75. const deviceType = ref('')
  76. const options = ref()
  77. const optionValue = ref('')
  78. const gasUnitNum = ref(0)
  79. const isRefresh = ref(true)
  80. function changeActive(activeValue) {
  81. activeKey.value = activeValue
  82. loading.value = true
  83. if(activeKey.value === 'monitor'){
  84. gasUnitNum.value = Math.ceil(Math.random() * 10)
  85. setTimeout(() =>{
  86. loading.value = false
  87. }, 600)
  88. }else{
  89. loading.value = false
  90. clearCss3D()
  91. }
  92. nextTick(() => {
  93. setModelType(modalType, gasUnitNum.value, monitorActive.value == 4 ? true : false)
  94. })
  95. }
  96. function deviceChange(index) {
  97. deviceActive.value = deviceType.value = deviceList.value[index].deviceType
  98. isRefresh.value = false
  99. nextTick(() => {
  100. isRefresh.value = true
  101. })
  102. }
  103. async function getDeviceList() {
  104. const res = await systemList({ devicetype: 'sys', systemID: optionValue.value });
  105. const result = res.msgTxt;
  106. const deviceArr = <DeviceType[]>[]
  107. result.forEach(item => {
  108. const data = item['datalist'].filter((data: any) => {
  109. const readData = data.readData;
  110. return Object.assign(data, readData);
  111. })
  112. if (item.type != 'sys') {
  113. deviceArr.unshift({ deviceType: item.type, deviceName: item['typeName'] ? item['typeName'] : item['datalist'][0]['typeName'], datalist: data })
  114. }
  115. })
  116. deviceList.value = deviceArr
  117. deviceActive.value = deviceArr[0].deviceType
  118. deviceChange(0)
  119. };
  120. async function getSysDataSource() {
  121. const res = await getTableList({ strtype: 'sys_surface_caimei', pagetype: 'normal' });
  122. if (!options.value) {
  123. // 初始时选择第一条数据
  124. options.value = res.records || [];
  125. if (!optionValue.value) {
  126. optionValue.value = options.value[0]['id']
  127. getDeviceList()
  128. changeModalType(options.value[0])
  129. }
  130. }
  131. };
  132. // 切换检测数据
  133. async function getSelectRow(deviceID) {
  134. const currentData = options.value.find((item: any) => {
  135. return item.id == deviceID
  136. })
  137. optionValue.value = deviceID
  138. changeModalType(currentData)
  139. getDeviceList()
  140. }
  141. // 获取模型类型
  142. function changeModalType(currentData) {
  143. if (currentData['strsystype'] === 'sys_surface_caimei_modal_1') {
  144. // 单进单回
  145. modalType = 'workFace1'
  146. } else if (currentData['strsystype'] === 'sys_surface_caimei_modal_2') {
  147. // 单进双回
  148. modalType = 'workFace2'
  149. } else if (currentData['strsystype'] === 'sys_surface_caimei_modal_3') {
  150. // 双进单回
  151. modalType = 'workFace3'
  152. } else if (currentData['strsystype'] === 'sys_surface_caimei_modal_4') {
  153. // 双进双回
  154. modalType = 'workFace4'
  155. }
  156. gasUnitNum.value = Math.ceil(Math.random() * 10)
  157. setModelType(modalType, gasUnitNum.value, monitorActive.value == 4 ? true : false)
  158. }
  159. function changeMonitor(nav) {
  160. nav.isShow = true
  161. monitorNav.forEach((item, index) => {
  162. if(item.title !== nav.title) {
  163. item.isShow = false
  164. }else{
  165. monitorActive.value = index
  166. if (monitorActive.value != 4) {
  167. clearCss3D()
  168. }
  169. }
  170. })
  171. showOrHideGasPlane(monitorActive.value == 4 ? true : false)
  172. }
  173. onBeforeMount(() => {
  174. });
  175. onMounted(async() => {
  176. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) optionValue.value = currentRoute.value['query']['id']
  177. await getSysDataSource()
  178. loading.value = true;
  179. mountedThree().then(async () => {
  180. gasUnitNum.value = Math.ceil(Math.random() * 10)
  181. loading.value = false;
  182. nextTick(() => {
  183. setModelType(modalType, gasUnitNum.value, monitorActive.value == 4 ? true : false)
  184. })
  185. });
  186. });
  187. onUnmounted(() => {
  188. destroy();
  189. });
  190. </script>
  191. <style lang="less" scoped>
  192. @import '/@/design/vent/modal.less';
  193. @ventSpace: zxm;
  194. :deep(.@{ventSpace}-tabs-tabpane-active) {
  195. overflow: auto;
  196. }
  197. .scene-box{
  198. width: 100%;
  199. height: 100%;
  200. }
  201. .monitor-nav{
  202. width: 860px;
  203. height: 42px;
  204. display: flex;
  205. justify-content: center;
  206. align-items: center;
  207. // border: 1px solid #73e8fe;
  208. color: #fff;
  209. position: absolute;
  210. top: 88px;
  211. left: 50% !important;
  212. transform: translateX(-50%) !important;
  213. pointer-events: auto;
  214. background: linear-gradient(45deg, #96c5ca38, #156c7d4a);
  215. clip-path: polygon(
  216. 14px 0,
  217. calc(100% - 14px) 0,
  218. 100% 14px,
  219. 100% calc(100% - 14px),
  220. calc(100% - 14px) 100%,
  221. 14px 100%,
  222. 0 calc(100% - 14px),
  223. 0 14px
  224. );
  225. // background: url('/@/assets/images/vent/wokeFaca-nav.png') no-repeat !important;
  226. .nav-item{
  227. padding: 1px 10px;
  228. cursor: pointer;
  229. }
  230. .nav-item-active{
  231. color: #00fbff;
  232. }
  233. }
  234. .history-group{
  235. padding: 0 20px;
  236. margin-top: 90px;
  237. .history-container{
  238. position: relative;
  239. background: #6195af1a;
  240. width: calc(100% + 10px);
  241. left: -10px;
  242. border: 1px solid #00fffd22;
  243. padding: 10px 0;
  244. box-shadow: 0 0 20px #44b4ff33 inset;
  245. }
  246. }
  247. .device-button-group{
  248. // margin: 0 20px;
  249. display: flex;
  250. pointer-events: auto;
  251. position: relative;
  252. &::after{
  253. position:absolute;
  254. content: '';
  255. width: calc(100% + 10px);
  256. height: 2px;
  257. top: 30px;
  258. left: -10px;
  259. border-bottom: 1px solid #0efcff;
  260. }
  261. .device-button{
  262. padding: 4px 15px;
  263. position: relative;
  264. display: flex;
  265. justify-content: center;
  266. align-items: center;
  267. font-size: 14px;
  268. color: #fff;
  269. cursor: pointer;
  270. margin: 0 3px;
  271. &::before{
  272. content: '';
  273. position: absolute;
  274. top: 0;
  275. right: 0;
  276. bottom: 0;
  277. left: 0;
  278. border: 1px solid #6176AF;
  279. transform: skewX(-38deg);
  280. background-color: rgba(0, 77, 103,85%);
  281. z-index: -1;
  282. }
  283. }
  284. .device-active{
  285. // color: #0efcff;
  286. &::before{
  287. border-color: #0efcff;
  288. box-shadow: 1px 1px 3px 1px #0efcff inset;
  289. }
  290. }
  291. }
  292. .input-box {
  293. display: flex;
  294. align-items: center;
  295. padding-left: 10px;
  296. .input-title {
  297. color: #73e8fe;
  298. width: auto;
  299. }
  300. .@{ventSpace}-input-number {
  301. border-color: #ffffff88 !important;
  302. }
  303. margin-right: 10px;
  304. }
  305. .monitor-msg-box {
  306. width: 170px;
  307. margin-top: 100px;
  308. .monitor-msg-container {
  309. width: 170px;
  310. height: 150px;
  311. box-shadow: rgba(128, 128, 128, 0.3) 0px 0px 40px inset;
  312. border: 1px solid rgba(128, 128, 128, 0.3);
  313. background-color: transparent;
  314. }
  315. .errorColor {
  316. box-shadow: #F73B2440 0px 0px 40px inset;
  317. border: 1px solid #F73B2440;
  318. }
  319. .warningColor {
  320. box-shadow: #FF9B1740 0px 0px 40px inset;
  321. border: 1px solid #FF9B1740;
  322. }
  323. .monitor-item {
  324. padding: 10px 10px 0px 10px;
  325. color: #fff;
  326. letter-spacing: 2px;
  327. .item-title {
  328. color: #73e8fe;
  329. }
  330. .num {
  331. color: #FFA500;
  332. }
  333. }
  334. }
  335. </style>