UserWaterUsage.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //大用户用水量排名
  2. import React, { PureComponent } from "react";
  3. import { ScrollBoard } from "@jiaminghi/data-view-react";
  4. class UserWaterUsage extends PureComponent {
  5. constructor(props) {
  6. super(props);
  7. this.state = {
  8. config: {
  9. // 表头背景色
  10. headerBGC: "transparent",
  11. // 奇数行背景色
  12. oddRowBGC: "#0ab8d952",
  13. // 偶数行背景色
  14. evenRowBGC: "transparent",
  15. // 行号
  16. index: false,
  17. // 行号表头
  18. // indexHeader: '序号',
  19. // 宽度
  20. columnWidth: [100, 200],
  21. // 对其方式
  22. align: ["center"],
  23. // 表行数
  24. rowNum: 6,
  25. },
  26. };
  27. }
  28. render() {
  29. const { height } = this.props;
  30. const data = {
  31. header: ["排名", "水厂名称", "分数(分)"],
  32. data: [
  33. ["NO.1", "高新区水质净化一厂", "98"],
  34. ["NO.2", "济南西区污水处理厂", "97"],
  35. ["NO.3", "平阴区污水处理厂", "97.8"],
  36. ["NO.4", "光大水务二厂", "97.3"],
  37. ["NO.5", "济南清区污水处理厂", "95.5"],
  38. ["NO.6", "光大水务一厂", "95"],
  39. ["NO.7", "章丘污水处理厂", "93"],
  40. ["NO.8", "美洁污水处理厂", "94.7"],
  41. ],
  42. };
  43. const config = {
  44. ...this.state.config,
  45. ...data,
  46. };
  47. return (
  48. <div
  49. style={{
  50. width: "calc(100% - 24px)",
  51. margin: "auto",
  52. }}
  53. >
  54. <ScrollBoard
  55. config={config}
  56. style={{
  57. width: "100%",
  58. height: height,
  59. }}
  60. ></ScrollBoard>
  61. </div>
  62. );
  63. }
  64. }
  65. export default UserWaterUsage;