index.vue 11 KB

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