infoCenter.data.ts 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. import { BasicColumn } from '/@/components/Table';
  2. import { ModuleDataChart } from '/@/views/vent/deviceManager/configurationTable/types';
  3. import { h } from 'vue'; // 引入vue的h函数用于创建VNode
  4. // 导入图片资源(关键步骤)
  5. import rank1 from '@/assets/images/dataCenter/infoCenter/rank-1.png';
  6. import rank2 from '@/assets/images/dataCenter/infoCenter/rank-2.png';
  7. import rank3 from '@/assets/images/dataCenter/infoCenter/rank-3.png';
  8. import rank4 from '@/assets/images/dataCenter/infoCenter/rank-4.png';
  9. // 系统数据排名
  10. export const sysDataColumn: BasicColumn[] = [
  11. {
  12. title: '',
  13. align: 'center',
  14. width: 60,
  15. // 修正customRender的类型和返回值
  16. customRender: ({ index }: { index: number }) => {
  17. // 确保index是数字类型,避免算术运算错误
  18. const numIndex = Number(index);
  19. let rankImg = '';
  20. if (numIndex === 0) {
  21. rankImg = rank1;
  22. } else if (numIndex === 1) {
  23. rankImg = rank2;
  24. } else if (numIndex === 2) {
  25. rankImg = rank3;
  26. } else {
  27. rankImg = rank4;
  28. }
  29. return h(
  30. 'div',
  31. {
  32. style: {
  33. width: '80px',
  34. height: '35px',
  35. backgroundImage: `url(${rankImg})`,
  36. backgroundSize: '100% 100%',
  37. backgroundRepeat: 'no-repeat',
  38. position: 'relative',
  39. margin: '0 15px',
  40. },
  41. },
  42. [
  43. // 排名文字
  44. h(
  45. 'span',
  46. {
  47. style: {
  48. position: 'absolute',
  49. top: '50%',
  50. left: '50%',
  51. transform: 'translate(-50%, -50%)',
  52. color: '#fff',
  53. fontSize: '14px',
  54. fontWeight: 'bold',
  55. },
  56. },
  57. `NO.${index + 1}`
  58. ), // 显示NO.1、NO.2等
  59. ]
  60. );
  61. },
  62. },
  63. {
  64. title: '设备类别',
  65. dataIndex: 'devKind',
  66. align: 'center',
  67. },
  68. {
  69. title: '设备数量',
  70. dataIndex: 'devNum',
  71. align: 'center',
  72. },
  73. {
  74. title: '数据采集量',
  75. dataIndex: 'dataCount',
  76. align: 'center',
  77. },
  78. ];
  79. //系统接入情况
  80. export const accessStatusColumn: BasicColumn[] = [
  81. {
  82. title: '序号',
  83. align: 'center',
  84. customRender: ({ index }: { index: number }) => `${index + 1}`,
  85. },
  86. {
  87. title: '设备名称',
  88. dataIndex: 'devicekind_dictText',
  89. align: 'center',
  90. },
  91. {
  92. title: '设备接入时间',
  93. dataIndex: 'createTime',
  94. align: 'center',
  95. },
  96. {
  97. title: '点位数量',
  98. dataIndex: 'monitorPointNum',
  99. align: 'center',
  100. },
  101. {
  102. title: '网络状态',
  103. dataIndex: 'netStatus',
  104. align: 'center',
  105. // 添加状态转换逻辑
  106. customRender: ({ record }) => {
  107. // 将状态值转为数字进行判断
  108. const status = Number(record.netStatus);
  109. return status === 1 ? '正常' : '断开';
  110. },
  111. },
  112. {
  113. title: '数据更新时间',
  114. dataIndex: 'dataUpdateTime',
  115. align: 'center',
  116. },
  117. {
  118. title: '操作',
  119. dataIndex: 'action',
  120. width: 200,
  121. align: 'center',
  122. slots: { customRender: 'action' },
  123. },
  124. ];
  125. // 每日采集数据表格属性
  126. export const dailyNumOption: ModuleDataChart = {
  127. type: 'bar',
  128. readFrom: '',
  129. legend: { show: false },
  130. xAxis: [
  131. {
  132. show: true,
  133. axisLabel: {
  134. rotate: 45, // 在这里配置旋转角度
  135. interval: 0,
  136. },
  137. },
  138. ],
  139. yAxis: [{ show: true, name: '', position: 'left' }],
  140. series: [{ readFrom: 'collectDataByDayList', xprop: 'day', yprop: 'total_count', label: '' }],
  141. dataZoom: [
  142. {
  143. type: 'slider' as any,
  144. show: true,
  145. xAxisIndex: 0,
  146. height: 12,
  147. bottom: 10,
  148. start: 0,
  149. handleStyle: { color: '#66ffff' },
  150. backgroundColor: 'rgba(102, 255, 255, 0.1)', // 滚动条背景色,适配UI
  151. },
  152. {
  153. type: 'inside' as any, // 支持鼠标滚轮缩放柱子
  154. xAxisIndex: 0,
  155. zoomOnMouseWheel: true,
  156. },
  157. ] as any[],
  158. };