123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import { getPostsFilesList, deletePostsFiles } from "@/services/posts";
- import { queryTable } from "@/utils/request";
- import { PageContainer, ProTable, ProList } from "@ant-design/pro-components";
- import { useNavigate } from "react-router-dom";
- import { Button, message, Popconfirm } from "antd";
- import { useRef, useState, useEffect } from "react";
- import { floatMultiply, floatDivide } from "@/utils";
- import AddFiles from "./addFiles";
-
- const FilesList = (props) => {
- const [showDetail, setShowDetail] = useState(false);
- const [activeKey, setActiveKey] = useState("");
- const actionRef = useRef();
- const navigate = useNavigate();
-
- const handleDelete = (id) => {
- if (id) {
- deletePostsFiles(id).then((res) => {
- actionRef.current.reload();
- });
- }
- };
-
- return (
- <PageContainer>
- <ProList
- toolBarRender={() => {
- return [
- <AddFiles
- onsuccess={() => {
- actionRef.current.reload();
- }}
- />,
- ];
- }}
- actionRef={actionRef}
- request={queryTable(getPostsFilesList)}
- search={{}}
- rowKey="id"
- // headerTitle="基础列表"
- pagination={true}
- // showActions="hover"
- metas={{
- title: {
- dataIndex: "fileName",
- title: "文件名称",
- },
-
- actions: {
- render: (text, row) => [
- <a href={row.fileAddr} download>
- 下载
- </a>,
- <Popconfirm
- key={3}
- title="您是否确认删除 ?"
- onConfirm={() => handleDelete(row.id)}
- okText="确定"
- cancelText="取消"
- >
- {/* manualPush */}
- <Button style={{ padding: 0 }} type="link">
- 删除
- </Button>
- </Popconfirm>,
- ],
- search: false,
- },
- }}
- />
- </PageContainer>
- );
- };
-
- export default FilesList;
|