index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div class="company-home">
  3. <customHeader>{{ mainTitle }}</customHeader>
  4. <div class="company-content">
  5. <div class="content-item item-1">
  6. <infoBox class="infoBox1">
  7. <template #title> 设备数据量 </template>
  8. <template #container>
  9. <div class="content-wrapper wrapper-1 grid">
  10. <div class="data-item">
  11. <div class="item-icon icon1"></div>
  12. <div>
  13. <div class="label">接入设备数量</div>
  14. <div class="value">{{ deviceData.deviceCount }} </div>
  15. </div>
  16. </div>
  17. <div class="data-item">
  18. <div class="item-icon icon2"></div>
  19. <div>
  20. <div class="label">接入点位数量</div>
  21. <div class="value status-normal">{{ deviceData.monitorParamsCount }}</div>
  22. </div>
  23. </div>
  24. <div class="data-item">
  25. <div class="item-icon icon3"></div>
  26. <div>
  27. <div class="label">数据存储量(MB)</div>
  28. <div class="value status-normal">{{ deviceData.databaseDiskUsage.total_size_mb }}</div>
  29. </div>
  30. </div>
  31. <div class="data-item">
  32. <div class="item-icon icon4"></div>
  33. <div>
  34. <div class="label">消息总数量(条)</div>
  35. <div class="value status-normal">{{ deviceData.collectTotalNum }}</div>
  36. </div>
  37. </div>
  38. <div class="data-item">
  39. <div class="item-icon icon5"></div>
  40. <div>
  41. <div class="label">共享接口数量</div>
  42. <div class="value status-normal">2</div>
  43. </div>
  44. </div>
  45. </div>
  46. </template>
  47. </infoBox>
  48. </div>
  49. <div class="content-item item-2 grid">
  50. <infoBox class="infoBox2">
  51. <template #title> 每日采集数据量 </template>
  52. <template #container>
  53. <div class="content-wrapper">
  54. <CustomChart :chart-config="dailyNumOption" :chart-data="deviceData" height="245px" />
  55. </div>
  56. </template>
  57. </infoBox>
  58. <infoBox class="infoBox3">
  59. <template #title> 系统数据量排名 </template>
  60. <template #container>
  61. <div class="content-wrapper">
  62. <a-table size="small" :dataSource="deviceData.collectDataByStationList" :columns="sysDataColumn" :pagination="false" />
  63. </div>
  64. </template>
  65. </infoBox>
  66. </div>
  67. <div class="content-item item-3">
  68. <infoBox class="infoBox4">
  69. <template #title> 设备接入情况 </template>
  70. <template #container>
  71. <div class="content-wrapper">
  72. <a-table size="small" :dataSource="accessStatusData" :columns="accessStatusColumn" :pagination="pagination" @change="pageChange">
  73. <template #action="{ record }">
  74. <div class="option-cont">
  75. <div class="view-icon"></div>
  76. <a class="table-action-link" @click="viewData(record)">查看数据</a>
  77. </div>
  78. </template>
  79. </a-table>
  80. </div>
  81. </template>
  82. </infoBox>
  83. </div>
  84. </div>
  85. </div>
  86. </template>
  87. <script lang="ts" setup>
  88. import { ref, onMounted, reactive } from 'vue';
  89. import customHeader from '/@/components/vent/customHeader.vue';
  90. import infoBox from './components/infoBox.vue';
  91. import { sysDataColumn, accessStatusColumn, dailyNumOption } from './infoCenter.data';
  92. import CustomChart from '@/views/vent/home/configurable/components/detail/CustomChart.vue';
  93. import { getDeviceAll, getHomepageSummaryIndexes } from './infoCenter.api';
  94. let mainTitle = ref('智能通风数据中心');
  95. //分页参数配置
  96. const pagination = reactive({
  97. current: 1, // 当前页码
  98. pageSize: 5, // 每页显示条数
  99. total: 0, // 总条目数,后端返回
  100. // showTotal: (total, range) => `${range[0]}-${range[1]} 条,总共 ${total} 条`, // 分页右下角显示信息
  101. });
  102. // 设备接入情况数据
  103. const accessStatusData = ref([]);
  104. // 数据中心首页设备数据
  105. const deviceData = ref({
  106. monitorParamsCount: 0,
  107. deviceCount: 0,
  108. databaseDiskUsage: {
  109. total_size_bytes: 0,
  110. total_size_mb: 0,
  111. total_size_gb: 0,
  112. },
  113. collectTotalNum: 0,
  114. collectDataByStationList: [],
  115. collectDataByDayList: [],
  116. });
  117. // 查看数据
  118. function viewData(record) {
  119. console.log(record);
  120. }
  121. //分页切换
  122. const pageChange = async (val) => {
  123. pagination.current = val.current;
  124. pagination.pageSize = val.pageSize;
  125. const res = await getDeviceAll({
  126. pageNo: pagination.current,
  127. pageSize: pagination.pageSize,
  128. });
  129. accessStatusData.value = res.records; // 赋值给响应式变量
  130. pagination.total = res.total; // 更新总条数
  131. };
  132. // 获取设备数据接口
  133. const fetchDeviceData = async () => {
  134. try {
  135. // 获取首页汇总指标数据
  136. deviceData.value = await getHomepageSummaryIndexes();
  137. // 获取设备接入情况数据
  138. const response = await getDeviceAll({
  139. pageNo: pagination.current,
  140. pageSize: pagination.pageSize,
  141. });
  142. accessStatusData.value = response.records; // 赋值给响应式变量
  143. pagination.total = response.total; // 更新总条数
  144. } catch (error) {
  145. console.error('获取设备数据失败:', error);
  146. }
  147. };
  148. // 页面挂载时调用接口获取数据
  149. onMounted(async () => {
  150. await fetchDeviceData();
  151. });
  152. </script>
  153. <style lang="less" scoped>
  154. @font-face {
  155. font-family: 'douyuFont';
  156. src: url('@/assets/font/douyuFont.otf');
  157. }
  158. .company-home {
  159. width: 100%;
  160. height: 100%;
  161. position: relative;
  162. :deep(.vent-home-header) {
  163. height: 50px;
  164. background: url('@/assets/images/vent/home/modal-top.png') no-repeat center;
  165. background-size: 100% 100%;
  166. }
  167. .company-content {
  168. position: absolute;
  169. left: 0;
  170. width: 100%;
  171. height: calc(100% - 50px);
  172. padding: 20px 20px 10px 20px;
  173. --image-border1: url('/@/assets/images/dataCenter/infoCenter/info-border1.png');
  174. --image-border2: url('/@/assets/images/dataCenter/infoCenter/info-border2.png');
  175. --image-border3: url('/@/assets/images/dataCenter/infoCenter/info-border3.png');
  176. --image-border4: url('/@/assets/images/dataCenter/infoCenter/info-border4.png');
  177. --image-split-line: url('/@/assets/images/dataCenter/infoCenter/split-line.png');
  178. --image-rank: url('/@/assets/images/dataCenter/infoCenter/rank-bg.png');
  179. .content-item {
  180. width: 100%;
  181. overflow: hidden;
  182. padding-bottom: 20px;
  183. }
  184. .item-1 {
  185. height: 20%;
  186. }
  187. .item-2 {
  188. height: 40%;
  189. grid-template-columns: 6fr 4fr;
  190. gap: 20px;
  191. :deep(table) {
  192. border-collapse: separate !important;
  193. border-spacing: 0 10px !important;
  194. .zxm-table-thead {
  195. height: 35px;
  196. background-color: unset !important;
  197. .zxm-table-cell {
  198. color: #66ffff !important;
  199. }
  200. }
  201. .zxm-table-tbody {
  202. background-color: unset !important;
  203. }
  204. .zxm-table-cell {
  205. border: none !important;
  206. background: none !important;
  207. padding: 0px;
  208. }
  209. tr {
  210. background: var(--image-rank) no-repeat !important;
  211. background-size: 100% 100% !important;
  212. }
  213. }
  214. }
  215. .item-3 {
  216. height: 40%;
  217. padding-bottom: 0;
  218. :deep(table) {
  219. border-collapse: collapse !important;
  220. // border-spacing: 0 10px !important;
  221. .zxm-table-thead {
  222. height: 35px;
  223. background-color: #0b2542 !important;
  224. border: 1px solid #1f7eb5;
  225. .zxm-table-cell {
  226. border: none !important;
  227. color: #37e0eb !important;
  228. }
  229. }
  230. .zxm-table-tbody {
  231. .zxm-table-row:nth-child(odd) {
  232. background-color: #0e3455;
  233. }
  234. /* 偶数行背景色 */
  235. .zxm-table-row:nth-child(even) {
  236. background-color: #114268 !important;
  237. }
  238. .zxm-table-cell {
  239. border: none !important;
  240. background: none !important;
  241. }
  242. }
  243. }
  244. .box-container {
  245. overflow: hidden;
  246. }
  247. }
  248. .infoBox1 {
  249. background-color: var(--image-border1) no-repeat;
  250. }
  251. .infoBox2 {
  252. background-color: var(--image-border2) no-repeat;
  253. }
  254. .infoBox3 {
  255. background-color: var(--image-border3) no-repeat;
  256. }
  257. .infoBox4 {
  258. background-color: var(--image-border4) no-repeat;
  259. }
  260. }
  261. .wrapper-1 {
  262. grid-template-columns: repeat(5, 1fr);
  263. .data-item {
  264. display: flex;
  265. align-items: center;
  266. justify-content: center;
  267. position: relative;
  268. &::after {
  269. position: absolute;
  270. right: 1px;
  271. top: 5px;
  272. display: block;
  273. width: 2px;
  274. height: 100%;
  275. background: var(--image-split-line);
  276. content: '';
  277. }
  278. &:last-child::after {
  279. display: none;
  280. }
  281. .value {
  282. font-family: 'douyuFont';
  283. color: #66ffff;
  284. margin-top: 20px;
  285. }
  286. .item-icon {
  287. width: 80px;
  288. height: 80px;
  289. background-size: 100% 100%;
  290. margin-right: 15px;
  291. }
  292. .icon1 {
  293. background-image: url('/@/assets/images/dataCenter/infoCenter/icon1.png');
  294. }
  295. .icon2 {
  296. background-image: url('/@/assets/images/dataCenter/infoCenter/icon2.png');
  297. }
  298. .icon3 {
  299. background-image: url('/@/assets/images/dataCenter/infoCenter/icon3.png');
  300. }
  301. .icon4 {
  302. background-image: url('/@/assets/images/dataCenter/infoCenter/icon4.png');
  303. }
  304. .icon5 {
  305. background-image: url('/@/assets/images/dataCenter/infoCenter/icon5.png');
  306. }
  307. }
  308. }
  309. .option-cont {
  310. display: flex;
  311. justify-content: center;
  312. align-items: center;
  313. .view-icon {
  314. width: 20px;
  315. height: 20px;
  316. background-image: url('/@/assets/images/dataCenter/infoCenter/view-icon.png');
  317. background-repeat: no-repeat;
  318. background-size: contain;
  319. background-position: center;
  320. }
  321. }
  322. }
  323. </style>