123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import React from "react";
  2. import { Button, Card, Popconfirm } from "antd";
  3. import { useSearchParams } from "react-router-dom";
  4. import Page from "@/components/Page";
  5. import Wangeditor from "@/components/Wangeditor";
  6. import { getTaCheckStandById, putTaCheckStand } from "@/service/tacheckstand";
  7. export default (props) => {
  8. const [loading, setLoading] = React.useState(false);
  9. const [editable, setEditAble] = React.useState(false);
  10. const [detail, setDetail] = React.useState(false);
  11. const [searchParams] = useSearchParams();
  12. const id = searchParams.get("id");
  13. const onChange = (e) => {
  14. setDetail({
  15. ...(detail || {}),
  16. content: e,
  17. });
  18. };
  19. const onSubmit = (e) => {
  20. setLoading(true);
  21. putTaCheckStand(id, detail)
  22. .then(() => {
  23. setLoading(false);
  24. })
  25. .catch(() => {
  26. setLoading(false);
  27. });
  28. };
  29. React.useEffect(() => {
  30. setLoading(true);
  31. getTaCheckStandById(id)
  32. .then((res) => {
  33. setDetail(res);
  34. setLoading(false);
  35. })
  36. .catch(() => {
  37. setLoading(false);
  38. });
  39. }, []);
  40. return (
  41. <Page>
  42. <Card
  43. loading={loading}
  44. extra={
  45. <Button type="primary" onClick={onSubmit}>
  46. 提交
  47. </Button>
  48. }
  49. >
  50. <Wangeditor
  51. value={detail?.content}
  52. toolbarConfig={{
  53. toolbarKeys: [
  54. "headerSelect",
  55. "blockquote",
  56. "|",
  57. "bold",
  58. "underline",
  59. "italic",
  60. "color",
  61. "fontSize",
  62. "|",
  63. "bulletedList",
  64. "numberedList",
  65. ],
  66. }}
  67. onChange={onChange}
  68. />
  69. </Card>
  70. </Page>
  71. );
  72. };