123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- import {
- deleteGuaranteeTask,
- getGuaranteeTaskList,
- } from "@/services/guaranteeTask";
- import { queryTable } from "@/utils/request";
- import { PageContainer, ProTable } from "@ant-design/pro-components";
- import { Link, useNavigate } from "react-router-dom";
-
- import { Button, message, Popconfirm } from "antd";
- import moment from "moment";
- import { useRef, useState } from "react";
-
- const GuaranteeTaskList = (props) => {
- const navigate = useNavigate();
- const [isOpen, setIsOpen] = useState(false);
- const [modalData, setModalData] = useState({});
- // const [storeTypeDict, setStoreTypeDict] = useState([]);
- const actionRef = useRef();
- const formRef = useRef();
-
- const handleDelete = (id) => {
- if (id) {
- deleteGuaranteeTask(id).then((res) => {
- // message.success("删除成功");
- actionRef.current.reload();
- });
- }
- };
-
- const onCancel = () => {
- setIsOpen(false);
- setModalData({});
- };
-
- const columns = [
- {
- title: "保障序号",
- dataIndex: "guaranteeNo",
- },
- {
- title: "受领人",
- dataIndex: "receiver",
- },
- {
- title: "时间区间",
- dataIndex: "dateRange",
- valueType: "dateRange",
- search: {
- transform: (value) => {
- console.log(value, value[0].valueOf(), "valuevalue");
-
- return {
- startDate: moment(value[0]).format("yyyy-MM-DD"),
- endDate: moment(value[1]).format("yyyy-MM-DD"),
- };
- },
- },
- },
- {
- title: "保障地点",
- dataIndex: "address",
- search: false,
- },
- {
- title: "保障人数",
- dataIndex: "totalPersonNum",
- search: false,
- },
- {
- title: "伙食标准",
- dataIndex: "standard",
- search: false,
- },
-
- {
- title: "操作",
- valueType: "option",
- width: 200,
- render: (_, record) => [
- <Button
- key={2}
- style={{ padding: 0 }}
- type="link"
- onClick={() => {
- navigate(`/task/evaluate/list?id=${record.id}`);
- }}
- >
- 评价
- </Button>,
- ],
- },
- ];
-
- return (
- <PageContainer>
- <ProTable
- actionRef={actionRef}
- formRef={formRef}
- postData={(data) => {
- return data.map((x) => ({
- dateRange: [x.startDate, x.endDate],
- ...x,
- }));
- }}
- rowKey="id"
-
- request={queryTable(getGuaranteeTaskList)}
- columns={columns}
- />
- </PageContainer>
- );
- };
-
- export default GuaranteeTaskList;
|