infoCenter.data.ts 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. export const sysDataColumn: BasicColumn[] = [
  6. {
  7. title: '',
  8. align: 'center',
  9. width: 60,
  10. // 修正customRender的类型和返回值
  11. customRender: ({ index }: { index: number }) => {
  12. // 确保index是数字类型,避免算术运算错误
  13. const numIndex = Number(index);
  14. let rankImg = '';
  15. if (numIndex === 0) {
  16. rankImg = '/src/assets/images/dataCenter/infoCenter/rank-1.png';
  17. } else if (numIndex === 1) {
  18. rankImg = '/src/assets/images/dataCenter/infoCenter/rank-2.png';
  19. } else if (numIndex === 2) {
  20. rankImg = '/src/assets/images/dataCenter/infoCenter/rank-3.png';
  21. } else {
  22. rankImg = '/src/assets/images/dataCenter/infoCenter/rank-4.png';
  23. }
  24. return h(
  25. 'div',
  26. {
  27. style: {
  28. width: '80px',
  29. height: '35px',
  30. backgroundImage: `url(${rankImg})`,
  31. backgroundSize: '100% 100%',
  32. backgroundRepeat: 'no-repeat',
  33. position: 'relative',
  34. margin: '0 15px',
  35. },
  36. },
  37. [
  38. // 排名文字
  39. h(
  40. 'span',
  41. {
  42. style: {
  43. position: 'absolute',
  44. top: '50%',
  45. left: '50%',
  46. transform: 'translate(-50%, -50%)',
  47. color: '#fff',
  48. fontSize: '14px',
  49. fontWeight: 'bold',
  50. },
  51. },
  52. `NO.${index + 1}`
  53. ), // 显示NO.1、NO.2等
  54. ]
  55. );
  56. },
  57. },
  58. {
  59. title: '分站id',
  60. dataIndex: 'sub_id',
  61. align: 'center',
  62. ifShow: false,
  63. },
  64. {
  65. title: '分站名称',
  66. dataIndex: 'strName',
  67. align: 'center',
  68. },
  69. {
  70. title: '数据采集量',
  71. dataIndex: 'total_num',
  72. align: 'center',
  73. },
  74. ];
  75. //系统接入情况
  76. export const accessStatusColumn: BasicColumn[] = [
  77. {
  78. title: '序号',
  79. align: 'center',
  80. customRender: ({ index }: { index: number }) => `${index + 1}`,
  81. },
  82. {
  83. title: '设备名称',
  84. dataIndex: 'devicekind_dictText',
  85. align: 'center',
  86. },
  87. {
  88. title: '设备接入时间',
  89. dataIndex: 'createTime',
  90. align: 'center',
  91. },
  92. {
  93. title: '点位数量',
  94. dataIndex: 'monitorPointNum',
  95. align: 'center',
  96. },
  97. {
  98. title: '网络状态',
  99. dataIndex: 'netStatus',
  100. align: 'center',
  101. // 添加状态转换逻辑
  102. customRender: ({ record }) => {
  103. // 将状态值转为数字进行判断
  104. const status = Number(record.netStatus);
  105. return status === 1 ? '正常' : '断开';
  106. },
  107. },
  108. {
  109. title: '数据更新时间',
  110. dataIndex: 'dataUpdateTime',
  111. align: 'center',
  112. },
  113. {
  114. title: '操作',
  115. dataIndex: 'action',
  116. width: 200,
  117. align: 'center',
  118. slots: { customRender: 'action' },
  119. },
  120. ];
  121. // 每日采集数据表格属性
  122. export const dailyNumOption: ModuleDataChart = {
  123. type: 'bar',
  124. readFrom: '',
  125. legend: { show: false },
  126. xAxis: [{ show: true }],
  127. yAxis: [{ show: true, name: '', position: 'left' }],
  128. series: [{ readFrom: 'collectDataByDayList', xprop: 'day', yprop: 'total_count', label: '' }],
  129. };
  130. // 模拟设备数据
  131. export const deviceData = {
  132. monitorParamsCount: 1727,
  133. deviceCount: 4,
  134. databaseDiskUsage: 10165,
  135. collectDataByStationList: [
  136. {
  137. sub_id: '1696417397868986370',
  138. strName: '调试http协议束管',
  139. total_num: 258,
  140. },
  141. {
  142. sub_id: '1696417397868986370',
  143. strName: '调试http协议束管',
  144. total_num: 256,
  145. },
  146. {
  147. sub_id: '1696417397868986370',
  148. strName: '调试http协议束管',
  149. total_num: 254,
  150. },
  151. {
  152. sub_id: '1696417397868986370',
  153. strName: '调试http协议束管',
  154. total_num: 252,
  155. },
  156. ],
  157. collectTotalNum: 258,
  158. collectDataByDayList: [
  159. {
  160. day: '2025-10-29',
  161. total_count: '30',
  162. },
  163. {
  164. day: '2025-10-30',
  165. total_count: '165',
  166. },
  167. {
  168. day: '2025-10-31',
  169. total_count: '63',
  170. },
  171. {
  172. day: '2025-11-01',
  173. total_count: '30',
  174. },
  175. {
  176. day: '2025-11-02',
  177. total_count: '165',
  178. },
  179. {
  180. day: '2025-11-03',
  181. total_count: '63',
  182. },
  183. {
  184. day: '2025-11-04',
  185. total_count: '30',
  186. },
  187. {
  188. day: '2025-11-05',
  189. total_count: '165',
  190. },
  191. {
  192. day: '2025-11-06',
  193. total_count: '63',
  194. },
  195. ],
  196. };