DetailModalFire.vue 12 KB

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