fireWarn.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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"></component>
  23. </div>
  24. </div>
  25. </template>
  26. <script setup lang="ts">
  27. import { ref, reactive, onMounted, onUnmounted } from 'vue'
  28. import { typeMenuList, componentName } from '../common.data'
  29. import { sysTypeWarnList, sysWarn } from '../common.api'
  30. import { useSystemSelect } from '/@/hooks/vent/useSystemSelect';
  31. import { useRouter } from 'vue-router';
  32. import CustomHeader from '/@/components/vent/customHeader.vue';
  33. const { options, optionValue, getSelectRow, getSysDataSource } = useSystemSelect('sys_surface_caimei'); // 参数为场景类型(设备类型管理中可以查询到)
  34. //当前加载组件
  35. let currentLoad = ref('')
  36. //内外因火灾激活索引
  37. let activeIndex = ref(0);
  38. //当前激活菜单的索引
  39. let activeIndex1 = ref(0);
  40. let menuList = reactive<any[]>([]); //左侧菜单列表
  41. let menuList1 = reactive({
  42. external: [],
  43. internal: [],
  44. });
  45. //详情数据
  46. let listData = reactive({
  47. common: {},
  48. bundletube: [],
  49. fiber: [],
  50. fire: [],
  51. co:[],
  52. smoke: [],
  53. spray: [],
  54. temperature: [],
  55. }); //详情数据
  56. let strType = ref(''); //火灾外因-区别工作面和煤层
  57. let router = useRouter()
  58. // https获取监测数据
  59. let timer: null | NodeJS.Timeout = null;
  60. function getMonitor(deviceID, flag?) {
  61. timer = setTimeout(
  62. async () => {
  63. await getSysWarnList(deviceID, 'fire');
  64. if (timer) {
  65. timer = null;
  66. }
  67. getMonitor(deviceID);
  68. },
  69. flag ? 0 : 1000
  70. );
  71. }
  72. //返回首页
  73. function getBack() {
  74. router.push('/monitorChannel/monitor-alarm-home')
  75. }
  76. //获取左侧菜单列表
  77. async function getMenuList() {
  78. let res = await sysTypeWarnList({ type: 'fire' })
  79. console.log(res, '火灾左侧菜单列表-------')
  80. if (res.length != 0) {
  81. menuList.length = 0
  82. menuList1.external = res.external;
  83. menuList1.internal = res.internal;
  84. menuList1.internal.forEach((el) => {
  85. menuList.push({
  86. name: el.systemname,
  87. warn: '低风险',
  88. type: 'on',
  89. deviceID: el.id,
  90. strtype: el.strtype,
  91. });
  92. });
  93. getMonitor(menuList[0].deviceID, true);
  94. }
  95. }
  96. //获取预警详情弹窗右侧数据
  97. function getSysWarnList(id, type) {
  98. sysWarn({ sysid: id, type: type }).then((res) => {
  99. listData.bundletube = res.bundletube;
  100. listData.fiber = res.fiber;
  101. listData.fire = res.fire;
  102. listData.co=res.co;
  103. listData.smoke = res.smoke;
  104. listData.spray = res.spray;
  105. listData.temperature = res.temperature;
  106. loadZj();
  107. });
  108. }
  109. //内外因火灾、预警指标选项切换
  110. function btnClick(ind) {
  111. activeIndex.value = ind;
  112. switch (ind) {
  113. case 0:
  114. activeIndex1.value = 0;
  115. menuList.length = 0;
  116. currentLoad.value = '';
  117. menuList1.internal.forEach((el) => {
  118. menuList.push({
  119. name: el.systemname,
  120. warn: '低风险',
  121. type: 'on',
  122. deviceID: el.id,
  123. strtype: el.strtype,
  124. });
  125. });
  126. clearTimeout(timer);
  127. getClearList();
  128. getMonitor(menuList[0].deviceID, true);
  129. break;
  130. case 1:
  131. activeIndex1.value = 0;
  132. menuList.length = 0;
  133. currentLoad.value = '';
  134. if (menuList1.external.length != 0) {
  135. menuList1.external.forEach((el) => {
  136. menuList.push({
  137. name: el.systemname,
  138. warn: '低风险',
  139. type: 'out',
  140. deviceID: el.id,
  141. strtype: el.strtype,
  142. });
  143. });
  144. clearTimeout(timer);
  145. getClearList();
  146. getMonitor(menuList[0].deviceID, true);
  147. strType.value = menuList[0].strtype;
  148. } else {
  149. menuList.length = 0;
  150. clearTimeout(timer);
  151. currentLoad.value = '';
  152. }
  153. break;
  154. case 2:
  155. activeIndex1.value = 0;
  156. menuList.length = 0;
  157. currentLoad.value = 'warnTargetFire';
  158. break;
  159. }
  160. }
  161. //菜单选项切换
  162. function cardClick(ind, item) {
  163. activeIndex1.value = ind;
  164. strType.value = item.strtype;
  165. clearTimeout(timer);
  166. getClearList();
  167. currentLoad.value = '';
  168. getMonitor(item.deviceID, true);
  169. }
  170. //加载组件
  171. function loadZj() {
  172. if (!activeIndex.value && listData.fiber.length != 0 && listData.bundletube.length != 0) {
  173. currentLoad.value = 'fireWork';
  174. } else if (!activeIndex.value && listData.bundletube.length != 0) {
  175. currentLoad.value = 'closeWall';
  176. } else if (activeIndex.value && activeIndex.value!=2) {
  177. currentLoad.value = 'mainWell';
  178. }else if(activeIndex.value==2){
  179. currentLoad.value = 'warnTargetFire';
  180. } else {
  181. currentLoad.value = '';
  182. }
  183. }
  184. //清空数据
  185. function getClearList() {
  186. listData.common = {};
  187. listData.bundletube.length = 0;
  188. listData.fiber.length = 0;
  189. listData.fire.length = 0;
  190. listData.co.length=0;
  191. listData.smoke.length = 0;
  192. listData.spray.length = 0;
  193. listData.temperature.length = 0;
  194. }
  195. onMounted(() => {
  196. getMenuList()
  197. })
  198. onUnmounted(() => {
  199. if (timer) {
  200. clearTimeout(timer);
  201. timer = undefined;
  202. }
  203. });
  204. </script>
  205. <style lang="less" scoped>
  206. .fireWarn {
  207. width: 100%;
  208. height: 100%;
  209. padding: 80px 10px 15px 10px;
  210. box-sizing: border-box;
  211. display: flex;
  212. justify-content: space-between;
  213. .alarm-menu {
  214. height: 100%;
  215. width: 15%;
  216. .type-btn {
  217. width: 100%;
  218. height: 28px;
  219. line-height: 28px;
  220. border: 1px solid #0058ee;
  221. margin-bottom: 20px;
  222. border-radius: 5px;
  223. box-sizing: border-box;
  224. display: flex;
  225. justify-content: space-between;
  226. .btn {
  227. width: 33%;
  228. height: 100%;
  229. font-size: 14px;
  230. text-align: center;
  231. color: #fff;
  232. cursor: pointer;
  233. }
  234. .btn1 {
  235. width: 33%;
  236. height: 100%;
  237. font-size: 14px;
  238. color: #fff;
  239. text-align: center;
  240. border-radius: 2px;
  241. background: #0058ee;
  242. cursor: pointer;
  243. }
  244. }
  245. .card-btn {
  246. width: 100%;
  247. height: calc(100% - 48px);
  248. overflow-y: auto;
  249. .btn {
  250. position: relative;
  251. width: 81%;
  252. height: 14%;
  253. margin-bottom: 10%;
  254. font-family: 'douyuFont';
  255. background: url('../../../../../assets/images/fire/no-choice.png') no-repeat;
  256. background-size: 100% 100%;
  257. cursor: pointer;
  258. .text {
  259. width: 80%;
  260. position: absolute;
  261. left: 50%;
  262. top: 28px;
  263. font-size: 16px;
  264. color: #01fefc;
  265. text-align: center;
  266. transform: translate(-50%, 0);
  267. }
  268. .warn {
  269. width: 100%;
  270. position: absolute;
  271. left: 50%;
  272. bottom: 14px;
  273. font-size: 14px;
  274. color: #fff;
  275. text-align: center;
  276. transform: translate(-50%, 0);
  277. }
  278. }
  279. .btn1 {
  280. position: relative;
  281. width: 100%;
  282. height: 14%;
  283. margin-bottom: 10%;
  284. font-family: 'douyuFont';
  285. background: url('../../../../../assets/images/fire/choice.png') no-repeat;
  286. background-size: 100% 100%;
  287. cursor: pointer;
  288. .text {
  289. width: 80%;
  290. position: absolute;
  291. left: 50%;
  292. top: 28px;
  293. font-size: 16px;
  294. color: #01fefc;
  295. text-align: center;
  296. transform: translate(-62%, 0);
  297. }
  298. .warn {
  299. width: 100%;
  300. position: absolute;
  301. left: 50%;
  302. bottom: 14px;
  303. font-size: 14px;
  304. color: #fff;
  305. text-align: center;
  306. transform: translate(-60%, 0);
  307. }
  308. }
  309. }
  310. }
  311. .fire-content {
  312. width: calc(85% - 10px);
  313. height: 100%;
  314. margin-left: 10px;
  315. background: url('../../../../../assets/images/fire/border.png') no-repeat;
  316. background-size: 100% 100%;
  317. }
  318. }
  319. </style>