DetailModalFire.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  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. let data=[
  200. {
  201. readData:{
  202. temperature:10,
  203. ch2val:'1.1',
  204. chval:'1.1',
  205. co2val:'1.1',
  206. coval:'1.1',
  207. gasval:'1.1'
  208. },
  209. readTime:'2023-12-22',
  210. strinstallpos:'测试'
  211. }
  212. ]
  213. listData.bundletube = data,
  214. listData.fiber = res.fiber
  215. listData.fire = res.fire,
  216. listData.smoke = res.smoke,
  217. listData.spray = res.spray,
  218. listData.temperature = res.temperature,
  219. console.log(listData, '火灾详情弹窗右侧数据');
  220. loadZj()
  221. } else if (type == 'vent' || type == 'dust' || type == 'gas') {
  222. console.log(res, '详情')
  223. listData.common = res
  224. }
  225. });
  226. }, 1000)
  227. }
  228. watch(
  229. () => props.moduleName,
  230. (val) => {
  231. if (val == 'fire') {
  232. current.value = '';
  233. titleName.value = '火灾监测';
  234. isShowModule.value = true;
  235. getSysTypeWarnList('fire');
  236. } else if (val == 'dust') {
  237. current.value = '';
  238. titleName.value = '粉尘监测';
  239. isShowModule.value = false;
  240. current.value = 'dustPage';
  241. getSysTypeWarnList('dust');
  242. } else if (val == 'vent') {
  243. current.value = '';
  244. titleName.value = '通风监测';
  245. isShowModule.value = false;
  246. current.value = 'ventilate';
  247. getSysTypeWarnList('vent');
  248. } else if (val == 'gas') {
  249. current.value = '';
  250. titleName.value = '瓦斯监测';
  251. isShowModule.value = false;
  252. current.value = 'gasPage';
  253. getSysTypeWarnList('gas');
  254. }
  255. },
  256. { immediate: true, deep: true }
  257. );
  258. onMounted(async () => { });
  259. </script>
  260. <style scoped lang="less">
  261. @import '/@/design/vent/color.less';
  262. @import '/@/design/vent/modal.less';
  263. .alarm-modal {
  264. position: relative;
  265. z-index: 999;
  266. max-height: calc(100vh - 150px);
  267. .@{ventSpace}-tabs {
  268. max-height: calc(100vh - 100px);
  269. }
  270. .containers {
  271. width: 100%;
  272. height: calc(100vh - 159px);
  273. display: flex;
  274. justify-content: space-between;
  275. .alarm-menu {
  276. height: 100%;
  277. width: 272px;
  278. .type-btn {
  279. width: 192px;
  280. height: 28px;
  281. line-height: 28px;
  282. border: 1px solid #0058ee;
  283. margin-bottom: 20px;
  284. border-radius: 5px;
  285. box-sizing: border-box;
  286. display: flex;
  287. justify-content: space-between;
  288. .btn {
  289. width: 50%;
  290. height: 100%;
  291. font-size: 14px;
  292. text-align: center;
  293. color: #fff;
  294. cursor: pointer;
  295. }
  296. .btn1 {
  297. width: 50%;
  298. height: 100%;
  299. font-size: 14px;
  300. color: #fff;
  301. text-align: center;
  302. border-radius: 2px;
  303. background: #0058ee;
  304. cursor: pointer;
  305. }
  306. }
  307. .card-btn {
  308. width: 100%;
  309. height: calc(100% - 48px);
  310. overflow-y: auto;
  311. .btn {
  312. position: relative;
  313. width: 212px;
  314. height: 99px;
  315. margin-bottom: 30px;
  316. font-family: 'douyuFont';
  317. background: url('../../../../assets/images/fire/no-choice.png') no-repeat;
  318. background-size: 100% 100%;
  319. cursor: pointer;
  320. .text {
  321. width: 80%;
  322. position: absolute;
  323. left: 50%;
  324. top: 22px;
  325. font-size: 16px;
  326. color: #01fefc;
  327. text-align: center;
  328. transform: translate(-50%, 0);
  329. }
  330. .warn {
  331. width: 100%;
  332. position: absolute;
  333. left: 50%;
  334. top: 68px;
  335. font-size: 16px;
  336. color: #fff;
  337. text-align: center;
  338. transform: translate(-50%, 0);
  339. }
  340. }
  341. .btn1 {
  342. position: relative;
  343. width: 262px;
  344. height: 99px;
  345. margin-bottom: 30px;
  346. font-family: 'douyuFont';
  347. background: url('../../../../assets//images//fire/choice.png') no-repeat;
  348. background-size: 100% 100%;
  349. cursor: pointer;
  350. .text {
  351. width: 80%;
  352. position: absolute;
  353. left: 50%;
  354. top: 22px;
  355. font-size: 16px;
  356. color: #01fefc;
  357. text-align: center;
  358. transform: translate(-62%, 0);
  359. }
  360. .warn {
  361. width: 100%;
  362. position: absolute;
  363. left: 50%;
  364. top: 68px;
  365. font-size: 16px;
  366. color: #fff;
  367. text-align: center;
  368. transform: translate(-60%, 0);
  369. }
  370. }
  371. }
  372. }
  373. .alarm-content {
  374. width: calc(100% - 282px);
  375. height: 100%;
  376. margin-left: 10px;
  377. background: url('../../../../assets//images/fire/border.png') no-repeat;
  378. background-size: 100% 100%;
  379. }
  380. }
  381. }
  382. :deep(.@{ventSpace}-tabs-tabpane-active) {
  383. height: 100%;
  384. }
  385. :deep(.@{ventSpace}-tabs-card) {
  386. .@{ventSpace}-tabs-tab {
  387. background: linear-gradient(#2cd1ff55, #1eb0ff55);
  388. border-color: #74e9fe;
  389. border-radius: 0%;
  390. &:hover {
  391. color: #64d5ff;
  392. }
  393. }
  394. .@{ventSpace}-tabs-tab.@{ventSpace}-tabs-tab-active .@{ventSpace}-tabs-tab-btn {
  395. color: aqua;
  396. }
  397. .@{ventSpace}-tabs-nav::before {
  398. border-color: #74e9fe;
  399. }
  400. .@{ventSpace}-picker,
  401. .@{ventSpace}-select-selector {
  402. width: 100% !important;
  403. background: #00000017 !important;
  404. border: 1px solid @vent-form-item-boder !important;
  405. input,
  406. .@{ventSpace}-select-selection-item,
  407. .@{ventSpace}-picker-suffix {
  408. color: #fff !important;
  409. }
  410. .@{ventSpace}-select-selection-placeholder {
  411. color: #b7b7b7 !important;
  412. }
  413. }
  414. .@{ventSpace}-pagination-next,
  415. .action,
  416. .@{ventSpace}-select-arrow,
  417. .@{ventSpace}-picker-separator {
  418. color: #fff !important;
  419. }
  420. .@{ventSpace}-table-cell-row-hover {
  421. background: #264d8833 !important;
  422. }
  423. .@{ventSpace}-table-row-selected {
  424. background: #00c0a311 !important;
  425. td {
  426. background-color: #00000000 !important;
  427. }
  428. }
  429. .@{ventSpace}-table-thead {
  430. // background: linear-gradient(#004a8655 0%, #004a86aa 10%) !important;
  431. background: #3d9dd45d !important;
  432. &>tr>th,
  433. .@{ventSpace}-table-column-title {
  434. // color: #70f9fc !important;
  435. border-color: #84f2ff !important;
  436. border-left: none !important;
  437. border-right: none !important;
  438. padding: 7px;
  439. }
  440. }
  441. .@{ventSpace}-table-tbody {
  442. tr>td {
  443. padding: 12px;
  444. }
  445. }
  446. .@{ventSpace}-table-tbody>tr:hover.@{ventSpace}-table-row>td {
  447. background-color: #26648855 !important;
  448. }
  449. .jeecg-basic-table-row__striped {
  450. // background: #97efff11 !important;
  451. td {
  452. background-color: #97efff11 !important;
  453. }
  454. }
  455. }
  456. </style>