index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <div class="warnRecordFire">
  3. <div class="record-left">
  4. <basicTree :treeData="treeData" @selectChange="selectChange"></basicTree>
  5. </div>
  6. <div class="record-right">
  7. <div class="search-box">
  8. <div class="search-label">监测日期 :</div>
  9. <div class="search-time">
  10. <a-range-picker v-model:value="TimeRange" :format="dateFormat" @change="onDataChange" />
  11. </div>
  12. </div>
  13. <div class="content-record">
  14. <a-table size="small" :dataSource="dataSource" :columns="columns" :scroll="{ y: 730 }" :pagination="pagination"
  15. @change="pageChange">
  16. <template #action="{ record }">
  17. <a-button type="link" style="color:#3DF6FF">
  18. 查看
  19. </a-button>
  20. </template>
  21. </a-table>
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. <script lang="ts" setup>
  27. import { ref, reactive, onMounted, onUnmounted } from 'vue'
  28. import basicTree from '../../common/basicTree.vue'
  29. import { getFireAreaInfo, getFireWarnHistory } from './warnRecordFire.api'
  30. import {columns} from './warnRecordFire.data'
  31. import dayjs, { Dayjs } from 'dayjs';
  32. let areaCode = ref('')
  33. let treeData = reactive<any[]>([])
  34. let dateFormat = ref('YYYY-MM-DD');
  35. let TimeRange = ref<[Dayjs, Dayjs]>([dayjs(dayjs(new Date().getTime()).format('YYYY-MM-DD'), dateFormat.value), dayjs(dayjs(new Date().getTime() + 24 * 60 * 60 * 1000).format('YYYY-MM-DD'), dateFormat.value)])
  36. let dataSource = ref<any[]>([])
  37. let pagination = reactive({
  38. current: 1, // 当前页码
  39. pageSize: 10, // 每页显示条数
  40. total: 0, // 总条目数,后端返回
  41. // showTotal: (total, range) => `${range[0]}-${range[1]} 条,总共 ${total} 条`, // 分页右下角显示信息
  42. showSizeChanger: true, // 是否可改变每页显示条数
  43. pageSizeOptions: ['10', '20', '50',], // 可选的每页显示条数
  44. })
  45. //获取树形菜单数据
  46. async function getTreeList() {
  47. let res = await getFireAreaInfo({})
  48. console.log(res, 'tree列表')
  49. if (res.length != 0) {
  50. treeData.length = 0
  51. res.forEach(el => {
  52. treeData.push({ name: el.areaName, value: el.ind, id: el.ind, pid: null, areaCode: el.areaCode, warningLevel: el.warningLevel })
  53. })
  54. areaCode.value = areaCode.value ? areaCode.value : treeData[0]['areaCode']
  55. }
  56. }
  57. //树形菜单选项切换
  58. function selectChange(treeNode) {
  59. console.log(treeNode, 'treeNode--------')
  60. pagination.current = 1
  61. dataSource.value = dataSource.value.filter(v => v.areaName == treeNode.node.dataRef.title)
  62. }
  63. //时间选项切换
  64. function onDataChange(value, dateString) {
  65. TimeRange.value = [value[0], value[1]]
  66. }
  67. //获取预警记录
  68. async function getFireWarnHistoryList() {
  69. let ttime_begin = `${dayjs(TimeRange.value[0]).format('YYYY-MM-DD')} 00:00:00`
  70. let ttime_end = `${dayjs(TimeRange.value[1]).format('YYYY-MM-DD')} 00:00:00`
  71. let res = await getFireWarnHistory({ pageNo: pagination.current, pageSize: pagination.pageSize, ttime_begin: ttime_begin, ttime_end: ttime_end })
  72. console.log(res, '预警记录------------')
  73. if (res.result.records.length != 0) {
  74. res.result.records.forEach(el => {
  75. el.zhType = '火灾'
  76. el.isLk = '未联控'
  77. })
  78. dataSource.value = res.result.records
  79. pagination.total = res.result.total
  80. }
  81. }
  82. //分页切换
  83. function pageChange(page,page1) {
  84. console.log(page,page1,'page------')
  85. pagination.current=page.current
  86. pagination.pageSize=page.pageSize
  87. }
  88. onMounted(() => {
  89. getTreeList()
  90. getFireWarnHistoryList()
  91. })
  92. </script>
  93. <style lang="less" scoped>
  94. .warnRecordFire {
  95. display: flex;
  96. position: relative;
  97. align-items: center;
  98. justify-content: space-between;
  99. width: calc(100% - 20px);
  100. height: 928px;
  101. margin: 0 10px;
  102. background: #282828;
  103. .record-left {
  104. width: 220px;
  105. height: 100%;
  106. background-color: rgb(27 35 39 / 80%);
  107. }
  108. .record-right {
  109. box-sizing: border-box;
  110. width: calc(100% - 230px);
  111. height: 100%;
  112. margin-left: 10px;
  113. padding: 15px 10px;
  114. overflow-y: auto;
  115. background-color: rgb(27 35 39 / 80%);
  116. .search-box {
  117. display: flex;
  118. box-sizing: border-box;
  119. align-items: center;
  120. width: 100%;
  121. height: 60px;
  122. padding: 0 15px;
  123. }
  124. }
  125. }
  126. :deep(.vMonitor-table) {
  127. background-color: transparent;
  128. color: #fff;
  129. }
  130. :deep(.vMonitor-table-wrapper .vMonitor-table-thead >tr>th) {
  131. padding: 4px 0;
  132. border-bottom: none;
  133. background: rgb(34 127 173/ 50%);
  134. color: #04ffdb;
  135. }
  136. :deep(.vMonitor-table-thead >tr>th:not(:last-child):not(.vMonitor-table-selection-column):not(.vMonitor-table-row-expand-icon-cell):not([colspan])::before) {
  137. background: transparent;
  138. }
  139. :deep(.vMonitor-table-wrapper .vMonitor-table-cell-scrollbar:not([rowspan])) {
  140. box-shadow: none;
  141. }
  142. :deep(.vMonitor-table-wrapper .vMonitor-table:not(.vMonitor-table-bordered) .vMonitor-table-tbody >tr >td) {
  143. border-top: none;
  144. }
  145. :deep(.vMonitor-table.vMonitor-table-small .vMonitor-table-tbody>tr>td) {
  146. padding: 4px 8px;
  147. }
  148. :deep(.vMonitor-table-wrapper .vMonitor-table-tbody >tr >td.vMonitor-table-cell-row-hover) {
  149. background: rgb(38 74 96) !important;
  150. }
  151. :deep(.vMonitor-table-wrapper .vMonitor-table-tbody >tr.vMonitor-table-row:hover>td) {
  152. background: rgb(38 74 96) !important;
  153. }
  154. </style>