index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  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="monitorActive == 4"
  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, 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. }
  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_3') {
  147. // 双进单回
  148. modalType = 'workFace3'
  149. } else if (currentData['strsystype'] === 'sys_surface_caimei_modal_4') {
  150. // 双进双回
  151. modalType = 'workFace4'
  152. }
  153. // gasUnitNum.value = Math.ceil(Math.random() * 4)
  154. gasUnitNum.value = 4
  155. setModelType(modalType, gasUnitNum.value, monitorActive.value == 4 ? true : false)
  156. }
  157. function changeMonitor(nav) {
  158. nav.isShow = true
  159. monitorNav.forEach((item, index) => {
  160. if(item.title !== nav.title) {
  161. item.isShow = false
  162. }else{
  163. monitorActive.value = index
  164. if (monitorActive.value != 4) {
  165. }
  166. }
  167. })
  168. showOrHideGasPlane(monitorActive.value == 4 ? true : false)
  169. }
  170. onBeforeMount(() => {
  171. });
  172. onMounted(async() => {
  173. if (currentRoute.value && currentRoute.value['query'] && currentRoute.value['query']['id']) optionValue.value = currentRoute.value['query']['id']
  174. await getSysDataSource()
  175. loading.value = true;
  176. mountedThree().then(async () => {
  177. // gasUnitNum.value = Math.ceil(Math.random() * 10)
  178. gasUnitNum.value = 4
  179. loading.value = false;
  180. nextTick(() => {
  181. setModelType(modalType, gasUnitNum.value, monitorActive.value == 4 ? true : false)
  182. })
  183. });
  184. });
  185. onUnmounted(() => {
  186. destroy();
  187. });
  188. </script>
  189. <style lang="less" scoped>
  190. @import '/@/design/vent/modal.less';
  191. @ventSpace: zxm;
  192. :deep(.@{ventSpace}-tabs-tabpane-active) {
  193. overflow: auto;
  194. }
  195. .scene-box{
  196. width: 100%;
  197. height: 100%;
  198. }
  199. .monitor-nav{
  200. width: 860px;
  201. height: 42px;
  202. display: flex;
  203. justify-content: center;
  204. align-items: center;
  205. // border: 1px solid #73e8fe;
  206. color: #fff;
  207. position: absolute;
  208. top: 88px;
  209. left: 50% !important;
  210. transform: translateX(-50%) !important;
  211. pointer-events: auto;
  212. background: linear-gradient(45deg, #96c5ca38, #156c7d4a);
  213. clip-path: polygon(
  214. 14px 0,
  215. calc(100% - 14px) 0,
  216. 100% 14px,
  217. 100% calc(100% - 14px),
  218. calc(100% - 14px) 100%,
  219. 14px 100%,
  220. 0 calc(100% - 14px),
  221. 0 14px
  222. );
  223. // background: url('/@/assets/images/vent/wokeFaca-nav.png') no-repeat !important;
  224. .nav-item{
  225. padding: 1px 10px;
  226. cursor: pointer;
  227. }
  228. .nav-item-active{
  229. color: #00fbff;
  230. }
  231. }
  232. .history-group{
  233. padding: 0 20px;
  234. margin-top: 90px;
  235. .history-container{
  236. position: relative;
  237. background: #6195af1a;
  238. width: calc(100% + 10px);
  239. left: -10px;
  240. border: 1px solid #00fffd22;
  241. padding: 10px 0;
  242. box-shadow: 0 0 20px #44b4ff33 inset;
  243. }
  244. }
  245. .device-button-group{
  246. // margin: 0 20px;
  247. display: flex;
  248. pointer-events: auto;
  249. position: relative;
  250. &::after{
  251. position:absolute;
  252. content: '';
  253. width: calc(100% + 10px);
  254. height: 2px;
  255. top: 30px;
  256. left: -10px;
  257. border-bottom: 1px solid #0efcff;
  258. }
  259. .device-button{
  260. padding: 4px 15px;
  261. position: relative;
  262. display: flex;
  263. justify-content: center;
  264. align-items: center;
  265. font-size: 14px;
  266. color: #fff;
  267. cursor: pointer;
  268. margin: 0 3px;
  269. &::before{
  270. content: '';
  271. position: absolute;
  272. top: 0;
  273. right: 0;
  274. bottom: 0;
  275. left: 0;
  276. border: 1px solid #6176AF;
  277. transform: skewX(-38deg);
  278. background-color: rgba(0, 77, 103,85%);
  279. z-index: -1;
  280. }
  281. }
  282. .device-active{
  283. // color: #0efcff;
  284. &::before{
  285. border-color: #0efcff;
  286. box-shadow: 1px 1px 3px 1px #0efcff inset;
  287. }
  288. }
  289. }
  290. .input-box {
  291. display: flex;
  292. align-items: center;
  293. padding-left: 10px;
  294. .input-title {
  295. color: #73e8fe;
  296. width: auto;
  297. }
  298. .@{ventSpace}-input-number {
  299. border-color: #ffffff88 !important;
  300. }
  301. margin-right: 10px;
  302. }
  303. .monitor-msg-box {
  304. width: 170px;
  305. margin-top: 100px;
  306. .monitor-msg-container {
  307. width: 170px;
  308. height: 150px;
  309. box-shadow: rgba(128, 128, 128, 0.3) 0px 0px 40px inset;
  310. border: 1px solid rgba(128, 128, 128, 0.3);
  311. background-color: transparent;
  312. }
  313. .errorColor {
  314. box-shadow: #F73B2440 0px 0px 40px inset;
  315. border: 1px solid #F73B2440;
  316. }
  317. .warningColor {
  318. box-shadow: #FF9B1740 0px 0px 40px inset;
  319. border: 1px solid #FF9B1740;
  320. }
  321. .monitor-item {
  322. padding: 10px 10px 0px 10px;
  323. color: #fff;
  324. letter-spacing: 2px;
  325. .item-title {
  326. color: #73e8fe;
  327. }
  328. .num {
  329. color: #FFA500;
  330. }
  331. }
  332. }
  333. </style>