import React, { useCallback, useEffect, useMemo, useRef, useState, } from "react"; import styles from "./index.module.scss"; import { useDispatch, useSelector } from "react-redux"; import { Button, Input, Popconfirm } from "antd"; import { A5_APIdel, A5_APIgetList } from "@/store/action/A5goods"; import { RootState } from "@/store"; import { A5tableType } from "@/types"; import { MessageFu } from "@/utils/message"; import A5add from "./A5add"; import MyTable from "@/components/MyTable"; import { A5tableC } from "@/utils/tableData"; // const optionsArr = [ // { value: "", label: "全部" }, // { value: "三维文物", label: "三维文物" }, // { value: "平面文物", label: "平面文物" }, // { value: "油画", label: "油画" }, // { value: "电子书", label: "电子书" }, // ]; function A5goods() { const dispatch = useDispatch(); const [fromData, setFromData] = useState({ pageNum: 1, pageSize: 10, searchKey: "", dictType: "", }); const getListFu = useCallback(() => { dispatch(A5_APIgetList(fromData)); }, [dispatch, fromData]); useEffect(() => { getListFu(); }, [getListFu]); const [inputKey, setInputKey] = useState(1); // 标题的输入 const timeRef = useRef(-1); const fromKeyChangeFu = useCallback( (e: React.ChangeEvent, key: "searchKey") => { clearTimeout(timeRef.current); timeRef.current = window.setTimeout(() => { setFromData({ ...fromData, [key]: e.target.value, pageNum: 1 }); }, 500); }, [fromData] ); // 点击重置 const resetSelectFu = useCallback(() => { setInputKey(Date.now()); setFromData({ pageNum: 1, pageSize: 10, searchKey: "", dictType: "", }); }, []); const tableInfo = useSelector((state: RootState) => state.A5goods.tableInfo); // 点击删除 const delTableFu = useCallback( async (id: number) => { const res = await A5_APIdel(id); if (res.code === 0) { MessageFu.success("删除成功!"); getListFu(); } }, [getListFu] ); const tableLastBtn = useMemo(() => { return [ { title: "操作", render: (item: A5tableType) => ( <> delTableFu(item.id)} > ), }, ]; }, [delTableFu]); // 点击新增和编辑 const [addId, setAddId] = useState(0); return (
馆藏管理
{/* 顶部筛选 */}
搜索项: fromKeyChangeFu(e, "searchKey")} />
{/*
类别: