deviceWarn.vue 6.2 KB

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