DetailModal.vue 6.1 KB

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