index.tsx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import { useMemo, useState } from "react";
  2. import { Button, Input, Table } from "antd";
  3. import { PlusOutlined } from "@ant-design/icons";
  4. import { useNavigate } from "react-router-dom";
  5. import { PageContainer } from "@/components";
  6. import style from "./index.module.scss";
  7. import { TEMPLATE_TABS } from "./constants";
  8. const { Search } = Input;
  9. const TemplatePage = () => {
  10. const navigate = useNavigate();
  11. const [tab, setTab] = useState(TEMPLATE_TABS.GRADING);
  12. const isGrading = useMemo(() => tab === TEMPLATE_TABS.GRADING, [tab]);
  13. const handleTab = (type: TEMPLATE_TABS) => {
  14. setTab(type);
  15. };
  16. return (
  17. <PageContainer
  18. title="考核模板"
  19. headerSlot={
  20. <div className={style.pageTools}>
  21. <div>
  22. <Button
  23. type="primary"
  24. ghost={!isGrading}
  25. size="large"
  26. onClick={handleTab.bind(undefined, TEMPLATE_TABS.GRADING)}
  27. >
  28. 定级评估模板 11
  29. </Button>
  30. <Button
  31. type="primary"
  32. ghost={isGrading}
  33. size="large"
  34. onClick={handleTab.bind(undefined, TEMPLATE_TABS.RUNNING)}
  35. >
  36. 运行评估模板 0
  37. </Button>
  38. </div>
  39. <div className={style.pageToolsRight}>
  40. {isGrading ? (
  41. <>
  42. <label>搜索</label>
  43. <Search
  44. size="large"
  45. placeholder="请输入模板名称"
  46. allowClear
  47. style={{ width: 170 }}
  48. />
  49. </>
  50. ) : (
  51. ""
  52. )}
  53. <Button
  54. type="primary"
  55. icon={<PlusOutlined />}
  56. size="large"
  57. className={style.secondButton}
  58. onClick={() => navigate("/assessment/template/create")}
  59. >
  60. 新增定级评估模板
  61. </Button>
  62. </div>
  63. </div>
  64. }
  65. >
  66. <Table
  67. className="cus-table large"
  68. columns={[
  69. {
  70. title: "名称",
  71. dataIndex: "name",
  72. key: "name",
  73. align: "center",
  74. },
  75. {
  76. title: "说明",
  77. dataIndex: "description",
  78. key: "description",
  79. align: "center",
  80. },
  81. ]}
  82. />
  83. </PageContainer>
  84. );
  85. };
  86. export default TemplatePage;