fireWarn.vue 13 KB

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