index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. <template>
  2. <div class="deviceMonitorWarn">
  3. <customHeader>设备监测预警</customHeader>
  4. <a-button
  5. preIcon="ant-design:rollback-outlined"
  6. type="text"
  7. size="small"
  8. style="position: absolute; left: 15px; top: -66px; color: #fff"
  9. @click="getBack"
  10. >返回</a-button
  11. >
  12. <div class="content">
  13. <div class="left-box">
  14. <div class="left-box-content">
  15. <div
  16. :class="activeIndex == index ? 'card-box1' : 'card-box'"
  17. v-for="(item, index) in cardList"
  18. :key="index"
  19. @click="cardClick(item, index)"
  20. >
  21. <div class="card-item">
  22. <div class="item-title">
  23. {{ item.title }}
  24. </div>
  25. <div class="item-sum">
  26. <span>总数:</span>
  27. <span> {{ item.sumVal }}</span>
  28. </div>
  29. <div class="item-warn">
  30. <span>报警数:</span>
  31. <span> {{ item.warnVal }}</span>
  32. </div>
  33. <div class="item-close">
  34. <span>断开数:</span>
  35. <span> {{ item.closeVal }}</span>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="right-box">
  42. <div class="right-box-content">
  43. <div class="alarm-history-table">
  44. <BasicTable :key="isShow" ref="alarmHistory" @register="registerTable" :scroll="{ x: 0, y: 590 }">
  45. <template #form-onExportXls>
  46. <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls()"> 导出</a-button>
  47. </template>
  48. </BasicTable>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </template>
  55. <script setup lang="ts">
  56. import { ref, nextTick, reactive, onMounted, onUnmounted } from 'vue';
  57. import customHeader from '/@/components/vent/customHeader.vue';
  58. import { getTotalList, getAlarmLogList } from './deviceMonitorWarn.api';
  59. import { cardList } from './deviceMonitorWarn.data';
  60. import { BasicTable } from '/@/components/Table';
  61. import { useListPage } from '/@/hooks/system/useListPage';
  62. import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
  63. import { getAutoScrollContainer } from '/@/utils/common/compUtils';
  64. import { useRouter } from 'vue-router';
  65. const props = defineProps({
  66. formConfig: {
  67. type: Object as PropType<FormProps> | undefined,
  68. default: undefined,
  69. },
  70. });
  71. let router = useRouter();
  72. let activeIndex = ref(0);
  73. let devicekindType = ref('modelsensor');
  74. let isShow = ref(0);
  75. const deviceColumns = getTableHeaderColumns('alarm_history') as [];
  76. const dataColumns = ref(deviceColumns);
  77. // 列表页面公共参数、方法
  78. const { tableContext, onExportXls } = useListPage({
  79. tableProps: {
  80. api: getAlarmLogList,
  81. columns: dataColumns,
  82. canResize: true,
  83. showTableSetting: false,
  84. showActionColumn: false,
  85. showIndexColumn: true,
  86. bordered: false,
  87. size: 'small',
  88. formConfig: {
  89. labelAlign: 'left',
  90. showAdvancedButton: false,
  91. actionColOptions: { xs: 24, sm: 12, md: 12, lg: 12, xl: 12, xxl: 12 },
  92. schemas: [
  93. {
  94. label: '是否解决',
  95. // field: 'isok',
  96. field: 'isOk',
  97. defaultValue: false,
  98. component: 'Select',
  99. componentProps: {
  100. options: [
  101. {
  102. label: '未解决',
  103. value: false,
  104. },
  105. {
  106. label: '已解决',
  107. value: true,
  108. },
  109. ],
  110. },
  111. colProps: { span: 8 },
  112. },
  113. {
  114. label: '所属系统',
  115. // field: 'kindtype',systemType
  116. field: 'systemType',
  117. component: 'Select',
  118. componentProps: {
  119. options: [
  120. {
  121. label: '通风',
  122. value: 'ventS',
  123. },
  124. {
  125. label: '防灭火',
  126. value: 'fireS',
  127. },
  128. {
  129. label: '防尘',
  130. value: 'dustS',
  131. },
  132. {
  133. label: '瓦斯',
  134. value: 'gasS',
  135. },
  136. ],
  137. },
  138. colProps: { span: 8 },
  139. },
  140. // {
  141. // label: '设备类型',
  142. // field: 'deviceKind',
  143. // component: 'MTreeSelect',
  144. // componentProps: {
  145. // virtual: false,
  146. // },
  147. // colProps: { span: 8 },
  148. // },
  149. {
  150. field: 'starttime',
  151. label: '开始时间',
  152. component: 'DatePicker',
  153. componentProps: {
  154. showTime: true,
  155. valueFormat: 'YYYY-MM-DD HH:mm:ss',
  156. getPopupContainer: getAutoScrollContainer,
  157. },
  158. colProps: {
  159. span: 8,
  160. },
  161. },
  162. ],
  163. },
  164. fetchSetting: {
  165. listField: 'records',
  166. },
  167. pagination: {
  168. current: 1,
  169. pageSize: 10,
  170. pageSizeOptions: ['10', '30', '50', '100'],
  171. },
  172. beforeFetch(params) {
  173. params['deviceKind'] = devicekindType.value;
  174. return params;
  175. },
  176. },
  177. exportConfig: {
  178. name: '预警历史列表',
  179. url: '/safety/ventanalyAlarmLog/exportXls',
  180. },
  181. });
  182. //注册table数据
  183. const [registerTable, { reload, setLoading, getForm }] = tableContext;
  184. //返回上一级
  185. function getBack() {
  186. router.push('/monitorChannel/monitor-alarm-home');
  187. }
  188. //选项切换
  189. function cardClick(item, index) {
  190. activeIndex.value = index;
  191. devicekindType.value = item.devicekind;
  192. isShow.value = new Date().getTime();
  193. }
  194. //获取左侧选项数据
  195. async function getDeviceCard() {
  196. let res = await getTotalList({});
  197. console.log(res, '左侧选项数据----------');
  198. cardList.forEach((el) => {
  199. if (res.info.devicekindInfo[el.name]) {
  200. el.sumVal = res.info.devicekindInfo[el.name].totalcount || 0;
  201. el.warnVal = res.info.devicekindInfo[el.name].count || 0;
  202. el.closeVal = res.info.devicekindInfo[el.name].netstatus || 0;
  203. el.devicekind = res.info.devicekindInfo[el.name].code || '';
  204. }
  205. });
  206. }
  207. onMounted(() => {
  208. getDeviceCard();
  209. });
  210. defineExpose({ setLoading });
  211. </script>
  212. <style lang="less" scoped>
  213. .deviceMonitorWarn {
  214. position: relative;
  215. width: calc(100% - 20px);
  216. height: calc(100% - 90px);
  217. position: relative;
  218. margin: 80px 10px 10px 10px;
  219. .content {
  220. position: relative;
  221. width: 100%;
  222. height: 100%;
  223. display: flex;
  224. justify-content: space-between;
  225. align-items: center;
  226. .left-box {
  227. width: 45%;
  228. height: 100%;
  229. // margin-right: 15px;
  230. padding: 10px;
  231. box-sizing: border-box;
  232. // background: url('@/assets/images/fire/bj1.png') no-repeat center;
  233. // background-size: 100% 100%;
  234. .left-box-content {
  235. height: 100%;
  236. display: flex;
  237. justify-content: flex-start;
  238. align-items: flex-start;
  239. flex-wrap: wrap;
  240. overflow-y: auto;
  241. .card-box {
  242. width: 265px;
  243. height: 112px;
  244. margin: 0px 5px;
  245. &:nth-child(1) {
  246. background: url('../../../../assets/images/device/cgq.png') no-repeat center;
  247. background-size: 100% 100%;
  248. }
  249. &:nth-child(2) {
  250. background: url('../../../../assets/images/device/zhufengji.png') no-repeat center;
  251. background-size: 100% 100%;
  252. }
  253. &:nth-child(3) {
  254. background: url('../../../../assets/images/device/jubufengji.png') no-repeat center;
  255. background-size: 100% 100%;
  256. }
  257. &:nth-child(4) {
  258. background: url('../../../../assets/images/device/fengmen.png') no-repeat center;
  259. background-size: 100% 100%;
  260. }
  261. &:nth-child(5) {
  262. background: url('../../../../assets/images/device/fengchuang.png') no-repeat center;
  263. background-size: 100% 100%;
  264. }
  265. &:nth-child(6) {
  266. background: url('../../../../assets/images/device/cefeng.png') no-repeat center;
  267. background-size: 100% 100%;
  268. }
  269. &:nth-child(7) {
  270. background: url('../../../../assets/images/device/yafeng.png') no-repeat center;
  271. background-size: 100% 100%;
  272. }
  273. &:nth-child(8) {
  274. background: url('../../../../assets/images/device/penling.png') no-repeat center;
  275. background-size: 100% 100%;
  276. }
  277. &:nth-child(9) {
  278. background: url('../../../../assets/images/device/penfen.png') no-repeat center;
  279. background-size: 100% 100%;
  280. }
  281. &:nth-child(10) {
  282. background: url('../../../../assets/images/device/zhudan.png') no-repeat center;
  283. background-size: 100% 100%;
  284. }
  285. &:nth-child(11) {
  286. background: url('../../../../assets/images/device/zhujiang.png') no-repeat center;
  287. background-size: 100% 100%;
  288. }
  289. &:nth-child(12) {
  290. background: url('../../../../assets/images/device/penwu.png') no-repeat center;
  291. background-size: 100% 100%;
  292. }
  293. &:nth-child(13) {
  294. background: url('../../../../assets/images/device/chuchen.png') no-repeat center;
  295. background-size: 100% 100%;
  296. }
  297. &:nth-child(14) {
  298. background: url('../../../../assets/images/device/wsgl.png') no-repeat center;
  299. background-size: 100% 100%;
  300. }
  301. &:nth-child(15) {
  302. background: url('../../../../assets/images/device/wsb.png') no-repeat center;
  303. background-size: 100% 100%;
  304. }
  305. .card-item {
  306. position: relative;
  307. width: 100%;
  308. height: 100%;
  309. color: #fff;
  310. .item-title {
  311. position: absolute;
  312. left: 130px;
  313. top: 20px;
  314. font-size: 12px;
  315. font-family: 'douyuFont';
  316. color: #01fefc;
  317. }
  318. .item-sum {
  319. position: absolute;
  320. left: 130px;
  321. top: 40px;
  322. }
  323. .item-warn {
  324. position: absolute;
  325. left: 130px;
  326. top: 60px;
  327. }
  328. .item-close {
  329. position: absolute;
  330. left: 130px;
  331. top: 80px;
  332. }
  333. }
  334. }
  335. .card-box1 {
  336. width: 265px;
  337. height: 112px;
  338. margin: 0px 5px;
  339. &:nth-child(1) {
  340. background: url('../../../../assets/images/device/cgq-1.png') no-repeat center;
  341. background-size: 100% 100%;
  342. }
  343. &:nth-child(2) {
  344. background: url('../../../../assets/images/device/zhufengji-1.png') no-repeat center;
  345. background-size: 100% 100%;
  346. }
  347. &:nth-child(3) {
  348. background: url('../../../../assets/images/device/jubufengji-1.png') no-repeat center;
  349. background-size: 100% 100%;
  350. }
  351. &:nth-child(4) {
  352. background: url('../../../../assets/images/device/fengmen-1.png') no-repeat center;
  353. background-size: 100% 100%;
  354. }
  355. &:nth-child(5) {
  356. background: url('../../../../assets/images/device/fengchuang-1.png') no-repeat center;
  357. background-size: 100% 100%;
  358. }
  359. &:nth-child(6) {
  360. background: url('../../../../assets/images/device/cefeng-1.png') no-repeat center;
  361. background-size: 100% 100%;
  362. }
  363. &:nth-child(7) {
  364. background: url('../../../../assets/images/device/yafeng-1.png') no-repeat center;
  365. background-size: 100% 100%;
  366. }
  367. &:nth-child(8) {
  368. background: url('../../../../assets/images/device/penling-1.png') no-repeat center;
  369. background-size: 100% 100%;
  370. }
  371. &:nth-child(9) {
  372. background: url('../../../../assets/images/device/penfen-1.png') no-repeat center;
  373. background-size: 100% 100%;
  374. }
  375. &:nth-child(10) {
  376. background: url('../../../../assets/images/device/zhudan-1.png') no-repeat center;
  377. background-size: 100% 100%;
  378. }
  379. &:nth-child(11) {
  380. background: url('../../../../assets/images/device/zhujiang-1.png') no-repeat center;
  381. background-size: 100% 100%;
  382. }
  383. &:nth-child(12) {
  384. background: url('../../../../assets/images/device/penwu-1.png') no-repeat center;
  385. background-size: 100% 100%;
  386. }
  387. &:nth-child(13) {
  388. background: url('../../../../assets/images/device/chuchen-1.png') no-repeat center;
  389. background-size: 100% 100%;
  390. }
  391. &:nth-child(14) {
  392. background: url('../../../../assets/images/device/wsgl-1.png') no-repeat center;
  393. background-size: 100% 100%;
  394. }
  395. &:nth-child(15) {
  396. background: url('../../../../assets/images/device/wsb-1.png') no-repeat center;
  397. background-size: 100% 100%;
  398. }
  399. .card-item {
  400. position: relative;
  401. width: 100%;
  402. height: 100%;
  403. color: #fff;
  404. .item-title {
  405. position: absolute;
  406. left: 130px;
  407. top: 20px;
  408. font-size: 12px;
  409. font-family: 'douyuFont';
  410. color: #01fefc;
  411. }
  412. .item-sum {
  413. position: absolute;
  414. left: 130px;
  415. top: 40px;
  416. }
  417. .item-warn {
  418. position: absolute;
  419. left: 130px;
  420. top: 60px;
  421. }
  422. .item-close {
  423. position: absolute;
  424. left: 130px;
  425. top: 80px;
  426. }
  427. }
  428. }
  429. }
  430. }
  431. .right-box {
  432. width: 55%;
  433. height: 100%;
  434. background: url('../../../../assets/images/fire/border.png') no-repeat center;
  435. background-size: 100% 100%;
  436. .right-box-content {
  437. height: 100%;
  438. .alarm-history-table {
  439. width: 100%;
  440. position: relative;
  441. &::after {
  442. position: absolute;
  443. content: '';
  444. width: calc(100% + 10px);
  445. height: 2px;
  446. top: 0px;
  447. left: -10px;
  448. border-bottom: 1px solid #0efcff44;
  449. }
  450. }
  451. }
  452. }
  453. }
  454. }
  455. </style>