fireWarn.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. <template>
  2. <customHeader :options="options" @change="getSelectRow" :optionValue="optionValue"> 火灾监测预警 </customHeader>
  3. <div class="fireWarn">
  4. <a-button
  5. preIcon="ant-design:rollback-outlined"
  6. type="text"
  7. size="small"
  8. style="position: absolute; left: 15px; top: 15px; color: #fff"
  9. @click="getBack"
  10. >返回</a-button
  11. >
  12. <div class="alarm-menu">
  13. <div class="type-btn">
  14. <div :class="activeIndex == index ? 'btn1' : 'btn'" v-for="(item, index) in typeMenuList" :key="index" @click="btnClick(index)">
  15. {{ item.name }}
  16. </div>
  17. </div>
  18. <div class="card-btn">
  19. <div :class="activeIndex1 == ind ? 'btn1' : 'btn'" v-for="(item, ind) in menuList" :key="ind" @click="cardClick(ind, item)">
  20. <div class="text">{{ item.name }}</div>
  21. <div class="warn">{{ item.warn }}</div>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="fire-content">
  26. <component :is="componentName[currentLoad]" :listData="listData" :strType="strType" :tableList="tableLists" />
  27. </div>
  28. </div>
  29. </template>
  30. <script setup lang="ts">
  31. import { ref, reactive, onMounted, onUnmounted, defineAsyncComponent } from 'vue';
  32. import { typeMenuList, componentName } from '../common.data';
  33. import { sysTypeWarnList, sysWarn } from '../common.api';
  34. import { useSystemSelect } from '/@/hooks/vent/useSystemSelect';
  35. import { useGlobSetting } from '/@/hooks/setting';
  36. import { useRouter } from 'vue-router';
  37. import CustomHeader from '/@/components/vent/customHeader.vue';
  38. const { options, optionValue, getSelectRow, getSysDataSource } = useSystemSelect('sys_surface_caimei'); // 参数为场景类型(设备类型管理中可以查询到)
  39. //当前加载组件
  40. let currentLoad = ref('');
  41. //内外因火灾激活索引
  42. let activeIndex = ref(0);
  43. //当前激活菜单的索引
  44. let activeIndex1 = ref(0);
  45. let menuList = reactive<any[]>([]); //左侧菜单列表
  46. let menuList1 = reactive({
  47. external: [],
  48. internal: [],
  49. info: [],
  50. });
  51. //详情数据
  52. let listData = reactive({
  53. common: {},
  54. bundletube: [],
  55. fiber: [],
  56. fire: [],
  57. co: [],
  58. smoke: [],
  59. spray: [],
  60. temperature: [],
  61. }); //详情数据
  62. let strType = ref(''); //火灾外因-区别工作面和煤层
  63. let router = useRouter();
  64. let tableLists = ref<any[]>([]);
  65. // https获取监测数据
  66. let timer: null | NodeJS.Timeout = null;
  67. function getMonitor(deviceID, flag?) {
  68. timer = setTimeout(
  69. async () => {
  70. await getSysWarnList(deviceID, 'fire');
  71. if (timer) {
  72. timer = null;
  73. }
  74. getMonitor(deviceID);
  75. },
  76. flag ? 0 : 1000
  77. );
  78. }
  79. //返回首页
  80. function getBack() {
  81. router.push('/monitorChannel/monitor-alarm-home');
  82. }
  83. //获取左侧菜单列表
  84. async function getMenuList() {
  85. let res = await sysTypeWarnList({ type: 'fire' });
  86. console.log(res, '火灾左侧菜单列表-------');
  87. if (res.length != 0) {
  88. menuList.length = 0;
  89. menuList1.external = res.external;
  90. menuList1.internal = res.internal;
  91. menuList1.info = res.info;
  92. if (menuList1.internal && menuList1.internal.length > 0) {
  93. menuList1.internal.forEach((el) => {
  94. menuList.push({
  95. name: el.systemname,
  96. warn: '低风险',
  97. type: 'on',
  98. deviceID: el.id,
  99. strtype: el.strtype,
  100. });
  101. });
  102. }
  103. getMonitor(menuList[0].deviceID, true);
  104. }
  105. }
  106. //获取预警详情弹窗右侧数据
  107. function getSysWarnList(id, type) {
  108. sysWarn({ sysid: id, type: type }).then((res) => {
  109. listData.bundletube = res.bundletube;
  110. listData.fiber = res.fiber;
  111. listData.fire = res.fire;
  112. listData.co = res.co;
  113. listData.smoke = res.smoke;
  114. listData.spray = res.spray;
  115. listData.temperature = res.temperature;
  116. loadZj();
  117. });
  118. }
  119. //内外因火灾、预警指标选项切换
  120. function btnClick(ind) {
  121. activeIndex.value = ind;
  122. switch (ind) {
  123. case 0:
  124. activeIndex1.value = 0;
  125. menuList.length = 0;
  126. currentLoad.value = '';
  127. menuList1.internal.forEach((el) => {
  128. menuList.push({
  129. name: el.systemname,
  130. warn: '低风险',
  131. type: 'on',
  132. deviceID: el.id,
  133. strtype: el.strtype,
  134. });
  135. });
  136. clearTimeout(timer);
  137. getClearList();
  138. getMonitor(menuList[0].deviceID, true);
  139. break;
  140. case 1:
  141. activeIndex1.value = 0;
  142. menuList.length = 0;
  143. currentLoad.value = '';
  144. if (menuList1.external.length != 0) {
  145. menuList1.external.forEach((el) => {
  146. menuList.push({
  147. name: el.systemname,
  148. warn: '低风险',
  149. type: 'out',
  150. deviceID: el.id,
  151. strtype: el.strtype,
  152. });
  153. });
  154. clearTimeout(timer);
  155. getClearList();
  156. getMonitor(menuList[0].deviceID, true);
  157. strType.value = menuList[0].strtype;
  158. } else {
  159. menuList.length = 0;
  160. clearTimeout(timer);
  161. currentLoad.value = '';
  162. }
  163. break;
  164. case 2:
  165. clearTimeout(timer);
  166. menuList.length = 0;
  167. activeIndex1.value = 0;
  168. menuList1.info.forEach((el) => {
  169. menuList.push({
  170. name: el.sysname,
  171. warn: '正常',
  172. deviceID: el.sysid,
  173. strtype: '',
  174. });
  175. });
  176. loadZb();
  177. break;
  178. }
  179. }
  180. //加载预警指标组件
  181. function loadZb() {
  182. // menuList1.info.forEach((el) => {
  183. // if (el.list.length != 0) {
  184. // el.list.forEach(v => {
  185. // if (v.alarmName == '缓慢氧化阶段(吸氧蓄热期)') {
  186. // v.warnGrade = '绿色预警'
  187. // } else if (v.alarmName == '加速氧化阶段(自热期)') {
  188. // v.warnGrade = '黄色预警'
  189. // } else if (v.alarmName == '剧烈氧化阶段(燃烧期)') {
  190. // v.warnGrade = '红色预警'
  191. // }
  192. // })
  193. // } else {
  194. // tableLists.value.length = 0
  195. // }
  196. // });
  197. tableLists.value = menuList1.info[0].list;
  198. const { sysOrgCode } = useGlobSetting();
  199. switch (sysOrgCode) {
  200. case 'sdmtjtbdmk': // 宝德
  201. currentLoad.value = 'warnFireBd';
  202. return currentLoad.value;
  203. case 'sdmtjtbetmk': // 布尔台
  204. currentLoad.value = 'warnFireBrt';
  205. return currentLoad.value;
  206. default:
  207. currentLoad.value = 'warnFireBrt';
  208. return currentLoad.value;
  209. }
  210. }
  211. //菜单选项切换
  212. function cardClick(ind, item) {
  213. if (activeIndex.value != 2) {
  214. activeIndex1.value = ind;
  215. strType.value = item.strtype;
  216. clearTimeout(timer);
  217. getClearList();
  218. currentLoad.value = '';
  219. getMonitor(item.deviceID, true);
  220. } else {
  221. clearTimeout(timer);
  222. activeIndex1.value = ind;
  223. tableLists.value = menuList1.info[ind].list;
  224. }
  225. }
  226. //加载组件
  227. function loadZj() {
  228. if (!activeIndex.value && listData.fiber.length != 0 && listData.bundletube.length != 0) {
  229. currentLoad.value = 'fireWork';
  230. } else if (!activeIndex.value && listData.bundletube.length != 0) {
  231. currentLoad.value = 'closeWall';
  232. } else if (activeIndex.value && activeIndex.value != 2) {
  233. currentLoad.value = 'mainWell';
  234. } else {
  235. currentLoad.value = '';
  236. }
  237. }
  238. //清空数据
  239. function getClearList() {
  240. listData.common = {};
  241. listData.bundletube.length = 0;
  242. listData.fiber.length = 0;
  243. listData.fire.length = 0;
  244. listData.co.length = 0;
  245. listData.smoke.length = 0;
  246. listData.spray.length = 0;
  247. listData.temperature.length = 0;
  248. }
  249. onMounted(() => {
  250. getMenuList();
  251. });
  252. onUnmounted(() => {
  253. if (timer) {
  254. clearTimeout(timer);
  255. timer = undefined;
  256. }
  257. });
  258. </script>
  259. <style lang="less" scoped>
  260. .fireWarn {
  261. width: 100%;
  262. height: 100%;
  263. padding: 80px 10px 15px 10px;
  264. box-sizing: border-box;
  265. display: flex;
  266. justify-content: space-between;
  267. .alarm-menu {
  268. height: 100%;
  269. width: 15%;
  270. .type-btn {
  271. width: 100%;
  272. height: 28px;
  273. line-height: 28px;
  274. background-color: rgba(15, 55, 108, 0.8);
  275. border: 2px solid #1b6eab;
  276. margin-bottom: 20px;
  277. border-radius: 5px;
  278. box-sizing: border-box;
  279. display: flex;
  280. justify-content: space-between;
  281. .btn {
  282. width: 33%;
  283. height: 24px;
  284. line-height: 24px;
  285. font-size: 14px;
  286. text-align: center;
  287. color: #fff;
  288. cursor: pointer;
  289. }
  290. .btn1 {
  291. width: 33%;
  292. height: 24px;
  293. line-height: 24px;
  294. font-size: 14px;
  295. color: #fff;
  296. text-align: center;
  297. border-radius: 2px;
  298. background: #209dfc;
  299. cursor: pointer;
  300. }
  301. }
  302. .card-btn {
  303. width: 100%;
  304. height: calc(100% - 48px);
  305. overflow-y: auto;
  306. .btn {
  307. position: relative;
  308. width: 81%;
  309. height: 14%;
  310. margin-bottom: 10%;
  311. font-family: 'douyuFont';
  312. background: url('../../../../../assets/images/fire/no-choice.png') no-repeat;
  313. background-size: 100% 100%;
  314. cursor: pointer;
  315. .text {
  316. width: 80%;
  317. position: absolute;
  318. left: 50%;
  319. top: 28px;
  320. font-size: 16px;
  321. color: #01fefc;
  322. text-align: center;
  323. transform: translate(-50%, 0);
  324. }
  325. .warn {
  326. width: 100%;
  327. position: absolute;
  328. left: 50%;
  329. bottom: 14px;
  330. font-size: 14px;
  331. color: #fff;
  332. text-align: center;
  333. transform: translate(-50%, 0);
  334. }
  335. }
  336. .btn1 {
  337. position: relative;
  338. width: 100%;
  339. height: 14%;
  340. margin-bottom: 10%;
  341. font-family: 'douyuFont';
  342. background: url('../../../../../assets/images/fire/choice.png') no-repeat;
  343. background-size: 100% 100%;
  344. cursor: pointer;
  345. .text {
  346. width: 80%;
  347. position: absolute;
  348. left: 50%;
  349. top: 28px;
  350. font-size: 16px;
  351. color: #01fefc;
  352. text-align: center;
  353. transform: translate(-62%, 0);
  354. }
  355. .warn {
  356. width: 100%;
  357. position: absolute;
  358. left: 50%;
  359. bottom: 14px;
  360. font-size: 14px;
  361. color: #fff;
  362. text-align: center;
  363. transform: translate(-60%, 0);
  364. }
  365. }
  366. }
  367. }
  368. .fire-content {
  369. width: calc(85% - 10px);
  370. height: 100%;
  371. margin-left: 10px;
  372. background: url('../../../../../assets/images/fire/border.png') no-repeat;
  373. background-size: 100% 100%;
  374. }
  375. }
  376. // .fireWarn1 {
  377. // width: 100%;
  378. // height: 100%;
  379. // padding: 80px 10px 15px 10px;
  380. // box-sizing: border-box;
  381. // .alarm-menu {
  382. // width: 100%;
  383. // .type-btn {
  384. // width: 25%;
  385. // height: 36px;
  386. // line-height: 36px;
  387. // background-color: rgba(15, 55, 108, .8);
  388. // border: 2px solid #1b6eab;
  389. // border-radius: 5px;
  390. // box-sizing: border-box;
  391. // display: flex;
  392. // justify-content: space-between;
  393. // .btn {
  394. // width: 33%;
  395. // height: 32px;
  396. // line-height: 32px;
  397. // font-size: 14px;
  398. // text-align: center;
  399. // color: #fff;
  400. // cursor: pointer;
  401. // }
  402. // .btn1 {
  403. // width: 33%;
  404. // height: 32px;
  405. // line-height: 32px;
  406. // font-size: 14px;
  407. // color: #fff;
  408. // text-align: center;
  409. // border-radius: 2px;
  410. // background: #209dfc;
  411. // cursor: pointer;
  412. // }
  413. // }
  414. // .card-btn {
  415. // width: 100%;
  416. // height: calc(100% - 36px);
  417. // overflow-y: auto;
  418. // display: none;
  419. // }
  420. // }
  421. // .fire-content {
  422. // height: calc(100% - 30px)
  423. // }
  424. // }
  425. </style>