deviceWarn.vue 6.1 KB

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