fireWarn.vue 11 KB

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