DetailModalFire.vue 15 KB

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