index.jsx 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import {
  2. deleteGuaranteeTask,
  3. getGuaranteeTaskList,
  4. } from "@/services/guaranteeTask";
  5. import { queryTable } from "@/utils/request";
  6. import { PageContainer, ProTable } from "@ant-design/pro-components";
  7. import { Link, useNavigate } from "react-router-dom";
  8. import { Button, message, Popconfirm } from "antd";
  9. import moment from "moment";
  10. import { useRef, useState } from "react";
  11. const GuaranteeTaskList = (props) => {
  12. const navigate = useNavigate();
  13. const [isOpen, setIsOpen] = useState(false);
  14. const [modalData, setModalData] = useState({});
  15. // const [storeTypeDict, setStoreTypeDict] = useState([]);
  16. const actionRef = useRef();
  17. const formRef = useRef();
  18. const handleDelete = (id) => {
  19. if (id) {
  20. deleteGuaranteeTask(id).then((res) => {
  21. // message.success("删除成功");
  22. actionRef.current.reload();
  23. });
  24. }
  25. };
  26. const onCancel = () => {
  27. setIsOpen(false);
  28. setModalData({});
  29. };
  30. const columns = [
  31. {
  32. title: "保障序号",
  33. dataIndex: "guaranteeNo",
  34. },
  35. {
  36. title: "受领人",
  37. dataIndex: "receiver",
  38. },
  39. {
  40. title: "时间区间",
  41. dataIndex: "dateRange",
  42. valueType: "dateRange",
  43. search: {
  44. transform: (value) => {
  45. console.log(value, value[0].valueOf(), "valuevalue");
  46. return {
  47. startDate: moment(value[0]).format("yyyy-MM-DD"),
  48. endDate: moment(value[1]).format("yyyy-MM-DD"),
  49. };
  50. },
  51. },
  52. },
  53. {
  54. title: "保障地点",
  55. dataIndex: "address",
  56. search: false,
  57. },
  58. {
  59. title: "保障人数",
  60. dataIndex: "totalPersonNum",
  61. search: false,
  62. },
  63. {
  64. title: "伙食标准",
  65. dataIndex: "standard",
  66. search: false,
  67. },
  68. {
  69. title: "操作",
  70. valueType: "option",
  71. width: 200,
  72. render: (_, record) => [
  73. <Button
  74. key={2}
  75. style={{ padding: 0 }}
  76. type="link"
  77. onClick={() => {
  78. navigate(`/task/evaluate/list?id=${record.id}`);
  79. }}
  80. >
  81. 评价
  82. </Button>,
  83. ],
  84. },
  85. ];
  86. return (
  87. <PageContainer>
  88. <ProTable
  89. actionRef={actionRef}
  90. formRef={formRef}
  91. postData={(data) => {
  92. return data.map((x) => ({
  93. dateRange: [x.startDate, x.endDate],
  94. ...x,
  95. }));
  96. }}
  97. rowKey="id"
  98. request={queryTable(getGuaranteeTaskList)}
  99. columns={columns}
  100. />
  101. </PageContainer>
  102. );
  103. };
  104. export default GuaranteeTaskList;