DetailModalFire.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. <template>
  2. <BasicModal @register="register" :title="titleName" width="100%" v-bind="$attrs" @ok="onSubmit" @cancel="onSubmit"
  3. :defaultFullscreen="true">
  4. <div class="alarm-modal">
  5. <div class="containers">
  6. <div class="alarm-menu">
  7. <div class="type-btn" v-if="isShowModule">
  8. <div :class="activeIndex == index ? 'btn1' : 'btn'" v-for="(item, index) in typeMenuList" :key="index"
  9. @click="btnClick(index)">
  10. {{ item.name }}
  11. </div>
  12. </div>
  13. <div class="card-btn">
  14. <div :class="activeIndex1 == ind ? 'btn1' : 'btn'" v-for="(item, ind) in menuList" :key="ind"
  15. @click="cardClick(ind, item)">
  16. <div class="text">{{ item.name }}</div>
  17. <div class="warn">{{ item.warn }}</div>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="alarm-content">
  22. <component :is="componentName[current]" :listData="listData" :strType="strType" />
  23. </div>
  24. </div>
  25. </div>
  26. </BasicModal>
  27. </template>
  28. <script lang="ts" setup>
  29. import { onMounted, ref, defineEmits, reactive, onUnmounted, watch, markRaw, defineAsyncComponent, defineProps } from 'vue';
  30. import { BasicModal, useModalInner } from '/@/components/Modal';
  31. import { typeMenuList, componentName } from './fire.data';
  32. import { sysTypeWarnList, sysWarn } from './alarm.api';
  33. let props = defineProps({
  34. moduleObj: {
  35. type: Object,
  36. default: () => {
  37. return {}
  38. }
  39. }
  40. });
  41. let listData = reactive({
  42. common: {},
  43. bundletube: [],
  44. fiber: [],
  45. fire: [],
  46. smoke: [],
  47. spray: [],
  48. temperature: [],
  49. }); //详情数据
  50. let isShowModule = ref(true); //是否显示内外因火灾切换按钮
  51. let titleName = ref('');
  52. let menuList = reactive<any[]>([]); //左侧菜单列表
  53. let menuList1 = reactive({
  54. external: [],
  55. internal: []
  56. })
  57. //内外因火灾激活索引
  58. let activeIndex = ref(0);
  59. //当前激活菜单的索引
  60. let activeIndex1 = ref(0);
  61. //当前加载组件
  62. let current = ref('');
  63. let strType = ref('')//火灾外因-区别工作面和煤层
  64. const emit = defineEmits(['close', 'register']);
  65. // 注册 modal
  66. const [register, { closeModal }] = useModalInner();
  67. // https获取监测数据
  68. let timer: null | NodeJS.Timeout = null;
  69. function getMonitor(deviceID) {
  70. timer = setTimeout(
  71. async () => {
  72. await getSysWarnList(deviceID, props.moduleObj.moduleName);
  73. if (timer) {
  74. timer = null;
  75. }
  76. getMonitor(deviceID);
  77. },
  78. 500
  79. );
  80. }
  81. //清空数据
  82. function getClearList() {
  83. listData.common = {}
  84. listData.bundletube.length = 0
  85. listData.fiber.length = 0
  86. listData.fire.length = 0
  87. listData.smoke.length = 0
  88. listData.spray.length = 0
  89. listData.temperature.length = 0
  90. }
  91. async function onSubmit() {
  92. activeIndex1.value = 0;
  93. activeIndex.value=0
  94. getClearList()
  95. clearTimeout(timer)
  96. emit('close');
  97. closeModal();
  98. }
  99. //内外因火灾选项切换
  100. function btnClick(ind) {
  101. activeIndex.value = ind;
  102. switch (ind) {
  103. case 0:
  104. activeIndex1.value = 0;
  105. menuList.length = 0
  106. current.value = '';
  107. menuList1.internal.forEach(el => {
  108. menuList.push({
  109. name: el.systemname,
  110. warn: '低风险',
  111. type: 'on',
  112. deviceID: el.id,
  113. strtype: el.strtype,
  114. })
  115. })
  116. clearTimeout(timer)
  117. getClearList()
  118. getMonitor(menuList[0].deviceID)
  119. break;
  120. case 1:
  121. activeIndex1.value = 0;
  122. menuList.length = 0
  123. current.value = '';
  124. if (menuList1.external.length != 0) {
  125. menuList1.external.forEach(el => {
  126. menuList.push({
  127. name: el.systemname,
  128. warn: '低风险',
  129. type: 'out',
  130. deviceID: el.id,
  131. strtype: el.strtype,
  132. })
  133. })
  134. clearTimeout(timer)
  135. getClearList()
  136. getMonitor(menuList[0].deviceID)
  137. strType.value = menuList[0].strtype
  138. } else {
  139. menuList.length = 0
  140. clearTimeout(timer)
  141. current.value = ''
  142. }
  143. break;
  144. }
  145. }
  146. //菜单选项切换
  147. function cardClick(ind, item) {
  148. activeIndex1.value = ind;
  149. strType.value = item.strtype
  150. clearTimeout(timer)
  151. getClearList()
  152. if (props.moduleObj.moduleName == 'fire') {
  153. current.value = ''
  154. }
  155. getMonitor(item.deviceID)
  156. }
  157. //加载组件
  158. function loadZj() {
  159. if (!activeIndex.value && listData.fiber.length != 0 && listData.bundletube.length != 0) {
  160. current.value = 'fireWork'
  161. } else if (!activeIndex.value && listData.bundletube.length != 0) {
  162. current.value = 'closeWall'
  163. } else if (activeIndex.value) {
  164. current.value = 'mainWell'
  165. // current.value = ''
  166. } else {
  167. current.value = ''
  168. }
  169. }
  170. //获取预警详情弹窗左侧数据
  171. function getSysTypeWarnList(data) {
  172. sysTypeWarnList({ type: data }).then((res) => {
  173. if (props.moduleObj.moduleName == 'vent') {
  174. res.forEach((el) => {
  175. menuList.push({
  176. name: el.deviceName,
  177. warn: el.netStatus ? '高风险' : '低风险',
  178. type: 'on',
  179. deviceID: el.deviceID,
  180. strtype: el.deviceType
  181. });
  182. });
  183. getMonitor(menuList[0].deviceID);
  184. } else if (props.moduleObj.moduleName == 'fire') {
  185. menuList1.external = res.external
  186. menuList1.internal = res.internal
  187. menuList1.internal.forEach(el => {
  188. menuList.push({
  189. name: el.systemname,
  190. warn: '低风险',
  191. type: 'on',
  192. deviceID: el.id,
  193. strtype: el.strtype
  194. });
  195. })
  196. getMonitor(menuList[0].deviceID);
  197. } else if (props.moduleObj.moduleName == 'dust') {
  198. res.forEach((el) => {
  199. menuList.push({
  200. name: el.systemname,
  201. warn: '低风险',
  202. type: 'on',
  203. deviceID: el.id,
  204. strtype: el.strtype
  205. });
  206. });
  207. getMonitor(menuList[0].deviceID);
  208. } else if (props.moduleObj.moduleName == 'gas') {
  209. res.forEach((el) => {
  210. menuList.push({
  211. name: el.systemname,
  212. warn: '低风险',
  213. type: 'on',
  214. deviceID: el.id,
  215. strtype: el.strtype
  216. });
  217. });
  218. getMonitor(menuList[0].deviceID);
  219. }
  220. });
  221. }
  222. //获取预警详情弹窗右侧数据
  223. function getSysWarnList(id, type) {
  224. sysWarn({ sysid: id, type: type }).then((res) => {
  225. if (type == 'fire') {
  226. listData.bundletube = res.bundletube,
  227. listData.fiber = res.fiber
  228. listData.fire = res.fire,
  229. listData.smoke = res.smoke,
  230. listData.spray = res.spray,
  231. listData.temperature = res.temperature,
  232. loadZj()
  233. } else if (type == 'vent' || type == 'dust' || type == 'gas') {
  234. listData.common = res
  235. }
  236. });
  237. }
  238. watch(
  239. () => props.moduleObj,
  240. (val) => {
  241. if (val.moduleName == 'fire') {
  242. menuList.length = 0
  243. menuList1.external.length = 0
  244. menuList1.internal.length = 0
  245. current.value = '';
  246. titleName.value = '火灾监测';
  247. isShowModule.value = true;
  248. getSysTypeWarnList('fire');
  249. } else if (val.moduleName == 'dust') {
  250. menuList.length = 0
  251. current.value = '';
  252. titleName.value = '粉尘监测';
  253. isShowModule.value = false;
  254. current.value = 'dustPage';
  255. getSysTypeWarnList('dust');
  256. } else if (val.moduleName == 'vent') {
  257. menuList.length = 0
  258. current.value = '';
  259. titleName.value = '通风监测';
  260. isShowModule.value = false;
  261. current.value = 'ventilate';
  262. getSysTypeWarnList('vent');
  263. } else if (val.moduleName == 'gas') {
  264. menuList.length = 0
  265. current.value = '';
  266. titleName.value = '瓦斯监测';
  267. isShowModule.value = false;
  268. current.value = 'gasPage';
  269. getSysTypeWarnList('gas');
  270. }
  271. },
  272. { immediate: true, deep: true }
  273. );
  274. onMounted(async () => { });
  275. </script>
  276. <style scoped lang="less">
  277. @import '/@/design/vent/color.less';
  278. @import '/@/design/vent/modal.less';
  279. .alarm-modal {
  280. position: relative;
  281. z-index: 999;
  282. max-height: calc(100vh - 150px);
  283. .@{ventSpace}-tabs {
  284. max-height: calc(100vh - 100px);
  285. }
  286. .containers {
  287. width: 100%;
  288. height: calc(100vh - 159px);
  289. display: flex;
  290. justify-content: space-between;
  291. .alarm-menu {
  292. height: 100%;
  293. // width: 272px;
  294. width: 15%;
  295. .type-btn {
  296. width: 68%;
  297. height: 28px;
  298. line-height: 28px;
  299. border: 1px solid #0058ee;
  300. margin-bottom: 20px;
  301. border-radius: 5px;
  302. box-sizing: border-box;
  303. display: flex;
  304. justify-content: space-between;
  305. .btn {
  306. width: 50%;
  307. height: 100%;
  308. font-size: 14px;
  309. text-align: center;
  310. color: #fff;
  311. cursor: pointer;
  312. }
  313. .btn1 {
  314. width: 50%;
  315. height: 100%;
  316. font-size: 14px;
  317. color: #fff;
  318. text-align: center;
  319. border-radius: 2px;
  320. background: #0058ee;
  321. cursor: pointer;
  322. }
  323. }
  324. .card-btn {
  325. width: 100%;
  326. height: calc(100% - 48px);
  327. overflow-y: auto;
  328. .btn {
  329. position: relative;
  330. width: 81%;
  331. height: 14%;
  332. margin-bottom: 10%;
  333. font-family: 'douyuFont';
  334. background: url('../../../../assets/images/fire/no-choice.png') no-repeat;
  335. background-size: 100% 100%;
  336. cursor: pointer;
  337. @media screen and (max-width:1920px) {
  338. .text {
  339. width: 80%;
  340. position: absolute;
  341. left: 50%;
  342. top: 22px;
  343. font-size: 16px;
  344. color: #01fefc;
  345. text-align: center;
  346. transform: translate(-50%, 0);
  347. }
  348. }
  349. @media screen and (min-width:1921px) and (max-width:2560px) {
  350. .text {
  351. width: 100%;
  352. position: absolute;
  353. left: 50%;
  354. top: 38px;
  355. font-size: 16px;
  356. color: #01fefc;
  357. text-align: center;
  358. transform: translate(-50%, 0);
  359. }
  360. }
  361. @media screen and (max-width:1920px) {
  362. .warn {
  363. width: 100%;
  364. position: absolute;
  365. left: 50%;
  366. top: 64px;
  367. font-size: 16px;
  368. color: #fff;
  369. text-align: center;
  370. transform: translate(-50%, 0);
  371. }
  372. }
  373. @media screen and (min-width: 1921px) and (max-width:2560px) {
  374. .warn {
  375. width: 100%;
  376. position: absolute;
  377. left: 50%;
  378. top: 103px;
  379. font-size: 16px;
  380. color: #fff;
  381. text-align: center;
  382. transform: translate(-50%, 0);
  383. }
  384. }
  385. }
  386. .btn1 {
  387. position: relative;
  388. width: 100%;
  389. height: 14%;
  390. margin-bottom: 10%;
  391. font-family: 'douyuFont';
  392. background: url('../../../../assets//images//fire/choice.png') no-repeat;
  393. background-size: 100% 100%;
  394. cursor: pointer;
  395. @media screen and (max-width:1920px) {
  396. .text {
  397. width: 80%;
  398. position: absolute;
  399. left: 50%;
  400. top: 22px;
  401. font-size: 16px;
  402. color: #01fefc;
  403. text-align: center;
  404. transform: translate(-62%, 0);
  405. }
  406. }
  407. @media screen and (min-width: 1921px) and (max-width:2560px) {
  408. .text {
  409. width: 100%;
  410. position: absolute;
  411. left: 50%;
  412. top: 38px;
  413. font-size: 16px;
  414. color: #01fefc;
  415. text-align: center;
  416. transform: translate(-60%, 0);
  417. }
  418. }
  419. @media screen and (max-width:1920px) {
  420. .warn {
  421. width: 100%;
  422. position: absolute;
  423. left: 50%;
  424. top: 64px;
  425. font-size: 16px;
  426. color: #fff;
  427. text-align: center;
  428. transform: translate(-60%, 0);
  429. }
  430. }
  431. @media screen and (min-width: 1921px) and (max-width:2560px) {
  432. .warn {
  433. width: 100%;
  434. position: absolute;
  435. left: 50%;
  436. top: 103px;
  437. font-size: 16px;
  438. color: #fff;
  439. text-align: center;
  440. transform: translate(-60%, 0);
  441. }
  442. }
  443. }
  444. }
  445. }
  446. .alarm-content {
  447. width: calc(85% - 10px);
  448. height: 100%;
  449. margin-left: 10px;
  450. background: url('../../../../assets//images/fire/border.png') no-repeat;
  451. background-size: 100% 100%;
  452. }
  453. }
  454. }
  455. :deep(.@{ventSpace}-tabs-tabpane-active) {
  456. height: 100%;
  457. }
  458. :deep(.@{ventSpace}-tabs-card) {
  459. .@{ventSpace}-tabs-tab {
  460. background: linear-gradient(#2cd1ff55, #1eb0ff55);
  461. border-color: #74e9fe;
  462. border-radius: 0%;
  463. &:hover {
  464. color: #64d5ff;
  465. }
  466. }
  467. .@{ventSpace}-tabs-tab.@{ventSpace}-tabs-tab-active .@{ventSpace}-tabs-tab-btn {
  468. color: aqua;
  469. }
  470. .@{ventSpace}-tabs-nav::before {
  471. border-color: #74e9fe;
  472. }
  473. .@{ventSpace}-picker,
  474. .@{ventSpace}-select-selector {
  475. width: 100% !important;
  476. background: #00000017 !important;
  477. border: 1px solid @vent-form-item-boder !important;
  478. input,
  479. .@{ventSpace}-select-selection-item,
  480. .@{ventSpace}-picker-suffix {
  481. color: #fff !important;
  482. }
  483. .@{ventSpace}-select-selection-placeholder {
  484. color: #b7b7b7 !important;
  485. }
  486. }
  487. .@{ventSpace}-pagination-next,
  488. .action,
  489. .@{ventSpace}-select-arrow,
  490. .@{ventSpace}-picker-separator {
  491. color: #fff !important;
  492. }
  493. .@{ventSpace}-table-cell-row-hover {
  494. background: #264d8833 !important;
  495. }
  496. .@{ventSpace}-table-row-selected {
  497. background: #00c0a311 !important;
  498. td {
  499. background-color: #00000000 !important;
  500. }
  501. }
  502. .@{ventSpace}-table-thead {
  503. // background: linear-gradient(#004a8655 0%, #004a86aa 10%) !important;
  504. background: #3d9dd45d !important;
  505. &>tr>th,
  506. .@{ventSpace}-table-column-title {
  507. // color: #70f9fc !important;
  508. border-color: #84f2ff !important;
  509. border-left: none !important;
  510. border-right: none !important;
  511. padding: 7px;
  512. }
  513. }
  514. .@{ventSpace}-table-tbody {
  515. tr>td {
  516. padding: 12px;
  517. }
  518. }
  519. .@{ventSpace}-table-tbody>tr:hover.@{ventSpace}-table-row>td {
  520. background-color: #26648855 !important;
  521. }
  522. .jeecg-basic-table-row__striped {
  523. // background: #97efff11 !important;
  524. td {
  525. background-color: #97efff11 !important;
  526. }
  527. }
  528. }</style>