DetailModalFire.vue 12 KB

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