DetailModalFire.vue 12 KB

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