index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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">数据存储量(GB)</div>
  28. <div class="value status-normal">{{ deviceData.databaseDiskUsage }}</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: 0,
  109. collectTotalNum: 0,
  110. collectDataByStationList: [],
  111. collectDataByDayList: [],
  112. });
  113. // 查看数据
  114. function viewData(record) {
  115. console.log(record);
  116. }
  117. //分页切换
  118. const pageChange = async (val) => {
  119. pagination.current = val.current;
  120. pagination.pageSize = val.pageSize;
  121. const res = await getDeviceAll({
  122. pageNo: pagination.current,
  123. pageSize: pagination.pageSize,
  124. });
  125. accessStatusData.value = res.records; // 赋值给响应式变量
  126. pagination.total = res.total; // 更新总条数
  127. };
  128. // 获取设备数据接口
  129. const fetchDeviceData = async () => {
  130. try {
  131. // 获取首页汇总指标数据
  132. deviceData.value = await getHomepageSummaryIndexes();
  133. // 获取设备接入情况数据
  134. const response = await getDeviceAll({
  135. pageNo: pagination.current,
  136. pageSize: pagination.pageSize,
  137. });
  138. accessStatusData.value = response.records; // 赋值给响应式变量
  139. pagination.total = response.total; // 更新总条数
  140. } catch (error) {
  141. console.error('获取设备数据失败:', error);
  142. }
  143. };
  144. // 页面挂载时调用接口获取数据
  145. onMounted(async () => {
  146. await fetchDeviceData();
  147. });
  148. </script>
  149. <style lang="less" scoped>
  150. @font-face {
  151. font-family: 'douyuFont';
  152. src: url('@/assets/font/douyuFont.otf');
  153. }
  154. .company-home {
  155. width: 100%;
  156. height: 100%;
  157. position: relative;
  158. :deep(.vent-home-header) {
  159. height: 50px;
  160. background: url('@/assets/images/vent/home/modal-top.png') no-repeat center;
  161. background-size: 100% 100%;
  162. }
  163. .company-content {
  164. position: absolute;
  165. left: 0;
  166. width: 100%;
  167. height: calc(100% - 50px);
  168. padding: 20px 20px 10px 20px;
  169. --image-border1: url('/@/assets/images/dataCenter/infoCenter/info-border1.png');
  170. --image-border2: url('/@/assets/images/dataCenter/infoCenter/info-border2.png');
  171. --image-border3: url('/@/assets/images/dataCenter/infoCenter/info-border3.png');
  172. --image-border4: url('/@/assets/images/dataCenter/infoCenter/info-border4.png');
  173. --image-split-line: url('/@/assets/images/dataCenter/infoCenter/split-line.png');
  174. --image-rank: url('/@/assets/images/dataCenter/infoCenter/rank-bg.png');
  175. .content-item {
  176. width: 100%;
  177. overflow: hidden;
  178. padding-bottom: 20px;
  179. }
  180. .item-1 {
  181. height: 20%;
  182. }
  183. .item-2 {
  184. height: 40%;
  185. grid-template-columns: 6fr 4fr;
  186. gap: 20px;
  187. :deep(table) {
  188. border-collapse: separate !important;
  189. border-spacing: 0 10px !important;
  190. .zxm-table-thead {
  191. height: 35px;
  192. background-color: unset !important;
  193. .zxm-table-cell {
  194. color: #66ffff !important;
  195. }
  196. }
  197. .zxm-table-tbody {
  198. background-color: unset !important;
  199. }
  200. .zxm-table-cell {
  201. border: none !important;
  202. background: none !important;
  203. padding: 0px;
  204. }
  205. tr {
  206. background: var(--image-rank) no-repeat !important;
  207. background-size: 100% 100% !important;
  208. }
  209. }
  210. }
  211. .item-3 {
  212. height: 40%;
  213. padding-bottom: 0;
  214. :deep(table) {
  215. border-collapse: collapse !important;
  216. // border-spacing: 0 10px !important;
  217. .zxm-table-thead {
  218. height: 35px;
  219. background-color: #0b2542 !important;
  220. border: 1px solid #1f7eb5;
  221. .zxm-table-cell {
  222. border: none !important;
  223. color: #37e0eb !important;
  224. }
  225. }
  226. .zxm-table-tbody {
  227. .zxm-table-row:nth-child(odd) {
  228. background-color: #0e3455;
  229. }
  230. /* 偶数行背景色 */
  231. .zxm-table-row:nth-child(even) {
  232. background-color: #114268 !important;
  233. }
  234. .zxm-table-cell {
  235. border: none !important;
  236. background: none !important;
  237. }
  238. }
  239. }
  240. .box-container {
  241. overflow: hidden;
  242. }
  243. }
  244. .infoBox1 {
  245. background-color: var(--image-border1) no-repeat;
  246. }
  247. .infoBox2 {
  248. background-color: var(--image-border2) no-repeat;
  249. }
  250. .infoBox3 {
  251. background-color: var(--image-border3) no-repeat;
  252. }
  253. .infoBox4 {
  254. background-color: var(--image-border4) no-repeat;
  255. }
  256. }
  257. .wrapper-1 {
  258. grid-template-columns: repeat(5, 1fr);
  259. .data-item {
  260. display: flex;
  261. align-items: center;
  262. justify-content: center;
  263. position: relative;
  264. &::after {
  265. position: absolute;
  266. right: 1px;
  267. top: 5px;
  268. display: block;
  269. width: 2px;
  270. height: 100%;
  271. background: var(--image-split-line);
  272. content: '';
  273. }
  274. &:last-child::after {
  275. display: none;
  276. }
  277. .value {
  278. font-family: 'douyuFont';
  279. color: #66ffff;
  280. margin-top: 20px;
  281. }
  282. .item-icon {
  283. width: 80px;
  284. height: 80px;
  285. background-size: 100% 100%;
  286. margin-right: 15px;
  287. }
  288. .icon1 {
  289. background-image: url('/@/assets/images/dataCenter/infoCenter/icon1.png');
  290. }
  291. .icon2 {
  292. background-image: url('/@/assets/images/dataCenter/infoCenter/icon2.png');
  293. }
  294. .icon3 {
  295. background-image: url('/@/assets/images/dataCenter/infoCenter/icon3.png');
  296. }
  297. .icon4 {
  298. background-image: url('/@/assets/images/dataCenter/infoCenter/icon4.png');
  299. }
  300. .icon5 {
  301. background-image: url('/@/assets/images/dataCenter/infoCenter/icon5.png');
  302. }
  303. }
  304. }
  305. .option-cont {
  306. display: flex;
  307. justify-content: center;
  308. align-items: center;
  309. .view-icon {
  310. width: 20px;
  311. height: 20px;
  312. background-image: url('/@/assets/images/dataCenter/infoCenter/view-icon.png');
  313. background-repeat: no-repeat;
  314. background-size: contain;
  315. background-position: center;
  316. }
  317. }
  318. }
  319. </style>