DetailModalFire.vue 12 KB

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