Zjcs.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import * as React from 'react';
  2. import Box from "@mui/material/Box";
  3. import 'handsontable/dist/handsontable.full.min.css';
  4. //import 'handsontable/styles/ht-theme-main.min.css';
  5. import { HandsonTable } from 'handsontable/base';
  6. import {HotTable} from "@handsontable/react";
  7. //import { registerAllModules } from 'handsontable/registry';
  8. import {RichTreeView } from "@mui/x-tree-view/RichTreeView";
  9. import { Grid } from '@mui/material';
  10. import Tab from "@mui/material/Tab";
  11. import TabContext from "@mui/lab/TabContext";
  12. import TabList from "@mui/lab/TabList";
  13. import TabPanel from "@mui/lab/TabPanel";
  14. import Stack from "@mui/material/Stack";
  15. //import { registerPlugin, NestedRows } from 'handsontable/plugins';
  16. //registerPlugin(NestedRows);
  17. import Service from './Service';
  18. export default function Zjcs({name, bh}) {
  19. const [detail, setDetail] = React.useState([
  20. {
  21. "序号" : null, "清单编码": null, "名称" : null, "计算基数" : null,
  22. "计算基础" : null, "费率" : null, "金额" : null, "项目类别" : null}
  23. ]);
  24. const hotRef = React.useRef(null);
  25. React.useEffect(
  26. () => {
  27. Service.generateZjcs(name, bh).then(x=>{
  28. setDetail(x);
  29. });
  30. }, [bh]
  31. );
  32. return (
  33. <HotTable
  34. nestedRows={true}
  35. data={detail
  36. }
  37. ref = {hotRef}
  38. contextMenu={true}
  39. bindRowsWithHeaders={true}
  40. fixedRowsTop={0}
  41. fixedColumnsStart={2}
  42. manualColumnResize={true}
  43. rowHeaders={true}
  44. colHeaders={["序号", "清单编码", "名称", "计算基数", "计算基础", "费率", "金额" , "项目类别" ]}
  45. height="600"
  46. readOnly={true}
  47. selectionMode="single"
  48. autoWrapRow={false}
  49. autoWrapCol={false}
  50. licenseKey="non-commercial-and-evaluation" // for non-commercial use only
  51. />
  52. );
  53. }