deviceWarn.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <customHeader :options="options" @change="getSelectRow" :optionValue="optionValue"> 设备监测预警 </customHeader>
  3. <div class="alarm-modal">
  4. <a-button
  5. v-if="!hasPermission('deviceWarn:return')"
  6. preIcon="ant-design:rollback-outlined"
  7. type="text"
  8. size="small"
  9. style="position: absolute; left: 15px; top: 15px; color: #fff"
  10. @click="getBack"
  11. >返回</a-button
  12. >
  13. <div class="device-type-box">
  14. <div v-for="(item, index) in iconsMonitorDevice" :key="index" class="device-icon-box">
  15. <img :src="item.url" :alt="item.text" />
  16. </div>
  17. </div>
  18. <a-tabs class="tabs-box" type="card" v-model:activeKey="activeKey" @change="tabChange">
  19. <a-tab-pane key="1" tab="未处理预警">
  20. <div v-if="activeKey == '1'" class="box-bg table-box" style="margin-bottom: 10px">
  21. <MonitorTable
  22. ref="SensorMonitorRef"
  23. :columns="levelColumns"
  24. :dataSource="dataSource"
  25. design-scope="alarm"
  26. :isShowSelect="false"
  27. title="预警监测"
  28. :scroll="{ y: 530 }"
  29. >
  30. <template #filterCell="{ column, record }">
  31. <a-tag v-if="column.dataIndex === 'warnFlag'" :color="record.warnFlag == 0 ? 'green' : 'red'">{{
  32. record.warnFlag == 0 ? '正常' : '报警'
  33. }}</a-tag>
  34. <a-tag v-if="column.dataIndex === 'netStatus'" :color="record.netStatus == '0' ? '#f00' : 'green'">{{
  35. record.netStatus == '0' ? '断开' : '连接'
  36. }}</a-tag>
  37. </template>
  38. </MonitorTable>
  39. </div>
  40. </a-tab-pane>
  41. <a-tab-pane key="2" tab="报警历史">
  42. <div class="tab-item box-bg">
  43. <AlarmHistoryTable v-if="activeKey == '2'" :columns="levelHisColumns" designScope="alarm-history" />
  44. </div>
  45. </a-tab-pane>
  46. </a-tabs>
  47. </div>
  48. </template>
  49. <script lang="ts" setup>
  50. import { onMounted, ref, defineEmits, reactive, onUnmounted, watch } from 'vue';
  51. import MonitorTable from '../../comment/MonitorTable.vue';
  52. import AlarmHistoryTable from '../alarmHistoryTable.vue';
  53. import CustomHeader from '/@/components/vent/customHeader.vue';
  54. import { warningList } from '../alarm.api';
  55. import { levelColumns, levelHisColumns,iconsMonitorDevice } from '../alarm.data';
  56. import { useSystemSelect } from '/@/hooks/vent/useSystemSelect';
  57. import { useRouter } from 'vue-router';
  58. import { usePermission } from '/@/hooks/web/usePermission';
  59. const { hasPermission } = usePermission();
  60. const { options, optionValue, getSelectRow, getSysDataSource } = useSystemSelect('sys_surface_caimei'); // 参数为场景类型(设备类型管理中可以查询到)
  61. // 默认初始是第一行
  62. const activeKey = ref('1');
  63. const dataSource = ref([]);
  64. const tabChange = (activeKeyVal) => {
  65. activeKey.value = activeKeyVal;
  66. };
  67. let router = useRouter();
  68. // https获取监测数据
  69. let timer: null | NodeJS.Timeout = null;
  70. function getMonitor(flag = false) {
  71. if (Object.prototype.toString.call(timer) === '[object Null]') {
  72. timer = setTimeout(
  73. async () => {
  74. await getDataSource();
  75. if (timer) {
  76. timer = null;
  77. }
  78. getMonitor();
  79. },
  80. flag ? 0 : 10000
  81. );
  82. }
  83. }
  84. //返回首页
  85. function getBack() {
  86. router.push('/monitorChannel/monitor-alarm-home');
  87. }
  88. //设备预警监测列表
  89. async function getDataSource() {
  90. const res = await warningList({ isok: 0 });
  91. dataSource.value = res.list || [];
  92. }
  93. onMounted(async () => {
  94. getMonitor(true);
  95. });
  96. onUnmounted(() => {
  97. if (timer) {
  98. clearTimeout(timer);
  99. timer = undefined;
  100. }
  101. });
  102. </script>
  103. <style scoped lang="less">
  104. @import '/@/design/vent/color.less';
  105. @import '/@/design/vent/modal.less';
  106. .padding-0 {
  107. padding: 10px 0 !important;
  108. }
  109. .alarm-modal {
  110. position: relative;
  111. padding: 80px 10px 15px 10px;
  112. box-sizing: border-box;
  113. z-index: 999;
  114. max-height: calc(100% - 150px);
  115. .@{ventSpace}-tabs {
  116. max-height: calc(100% - 100px);
  117. // .tab-item {
  118. // height: 100px;
  119. // // max-height: calc(100vh - 170px);
  120. // }
  121. }
  122. .device-type-box {
  123. width: 1898px;
  124. height: 120px;
  125. color: #fff;
  126. position: absolute;
  127. top: 130px;
  128. // border: 1px solid #4d7ad855;
  129. // border-radius: 2px;
  130. // background-color: #001d3055;
  131. // -webkit-backdrop-filter: blur(8px);
  132. // backdrop-filter: blur(8px);
  133. // box-shadow: 0 0 10px #5984e055 inset;
  134. display: flex;
  135. flex-direction: row;
  136. .device-icon-box {
  137. width: 110px;
  138. height: 110px;
  139. border: 1px solid rgba(25, 237, 255, 0.4);
  140. box-shadow: inset 0 0 20px #00c5ff44;
  141. background: rgba(0, 0, 0, 0.06666667);
  142. margin: 0 8px;
  143. }
  144. }
  145. .title-text {
  146. position: absolute;
  147. top: -14px;
  148. left: 0;
  149. width: 100%;
  150. text-align: center;
  151. color: #fff;
  152. }
  153. .table-box {
  154. height: 650px;
  155. padding: 20px 10px;
  156. margin-bottom: 15px;
  157. }
  158. .box-bg {
  159. border: 1px solid #4d7ad855;
  160. border-radius: 2px;
  161. // background-color: #001d3055;
  162. // -webkit-backdrop-filter: blur(8px);
  163. // backdrop-filter: blur(8px);
  164. box-shadow: 0 0 10px #5984e055 inset;
  165. // background-color: #00b3ff12;
  166. }
  167. .charts-box {
  168. height: calc(40vh - 80px);
  169. padding: 5px 10px;
  170. margin-top: 10px;
  171. }
  172. }
  173. :deep(.@{ventSpace}-tabs-tabpane-active) {
  174. height: 100%;
  175. }
  176. :deep(.@{ventSpace}-tabs-card) {
  177. .@{ventSpace}-tabs-tab {
  178. background: linear-gradient(#2cd1ff55, #1eb0ff55);
  179. border-color: #74e9fe;
  180. border-radius: 0%;
  181. &:hover {
  182. color: #64d5ff;
  183. }
  184. }
  185. .@{ventSpace}-tabs-tab.@{ventSpace}-tabs-tab-active .@{ventSpace}-tabs-tab-btn {
  186. color: aqua;
  187. }
  188. .@{ventSpace}-tabs-nav {
  189. // padding-bottom: 120px;
  190. }
  191. .@{ventSpace}-tabs-nav::before {
  192. border-color: #74e9fe;
  193. }
  194. .@{ventSpace}-picker,
  195. .@{ventSpace}-select-selector {
  196. width: 100% !important;
  197. background: #00000017 !important;
  198. border: 1px solid @vent-form-item-border !important;
  199. input,
  200. .@{ventSpace}-select-selection-item,
  201. .@{ventSpace}-picker-suffix {
  202. color: #fff !important;
  203. }
  204. .@{ventSpace}-select-selection-placeholder {
  205. color: #b7b7b7 !important;
  206. }
  207. }
  208. .@{ventSpace}-pagination-next,
  209. .action,
  210. .@{ventSpace}-select-arrow,
  211. .@{ventSpace}-picker-separator {
  212. color: #fff !important;
  213. }
  214. .@{ventSpace}-table-cell-row-hover {
  215. background: #264d8833 !important;
  216. }
  217. .@{ventSpace}-table-row-selected {
  218. background: #00c0a311 !important;
  219. td {
  220. background-color: #00000000 !important;
  221. }
  222. }
  223. .@{ventSpace}-table-thead {
  224. // background: linear-gradient(#004a8655 0%, #004a86aa 10%) !important;
  225. background: #3d9dd45d !important;
  226. & > tr > th,
  227. .@{ventSpace}-table-column-title {
  228. // color: #70f9fc !important;
  229. border-color: #84f2ff !important;
  230. border-left: none !important;
  231. border-right: none !important;
  232. padding: 7px;
  233. }
  234. }
  235. .@{ventSpace}-table-tbody {
  236. tr > td {
  237. padding: 12px;
  238. }
  239. }
  240. .@{ventSpace}-table-tbody > tr:hover.@{ventSpace}-table-row > td {
  241. background-color: #26648855 !important;
  242. }
  243. .jeecg-basic-table-row__striped {
  244. // background: #97efff11 !important;
  245. td {
  246. background-color: #97efff11 !important;
  247. }
  248. }
  249. }
  250. </style>