import AuthButton from "@/components/AuthButton"; import BreadTit from "@/components/BreadTit"; import ImageLazy from "@/components/ImageLazy"; import LookModal from "@/components/LookObjTable/LookModal"; import { RootState } from "@/store"; import { object4infoOutAPI, returnObject4API } from "@/store/action/object4"; import { statusObjCK2 } from "@/utils/dataChange"; import history, { urlParameter } from "@/utils/history"; import { MessageFu } from "@/utils/message"; import { Button, Popconfirm, Table } from "antd"; import React, { useCallback, useEffect, useMemo, useRef, useState, } from "react"; import { useDispatch, useSelector } from "react-redux"; import { useLocation } from "react-router-dom"; import styles from "./index.module.scss"; function LookObject4() { const dispatch = useDispatch(); // 获取地址栏参数 const location = useLocation(); const urlParamRef = useRef({}); useEffect(() => { urlParamRef.current = urlParameter(location.search); // console.log("地址栏参数", urlParamRef.current); }, [location]); const getInfo = useCallback(async () => { const id = urlParamRef.current.id; const res1 = await object4infoOutAPI(id); const info = res1.data.entity; const list = res1.data.child; info.statusTxt = statusObjCK2[info.status]; dispatch({ type: "object4/getLookInfo", payload: { info, list } }); }, [dispatch]); useEffect(() => { getInfo(); }, [getInfo]); const { info, list: tableList } = useSelector( (state: RootState) => state.object4Store.lookInfo ); // 点击返回 const cancelFu = () => { history.push({ pathname: `/object/4`, state: { k: urlParamRef.current.k ? urlParamRef.current.k : "1", d: urlParamRef.current.d, }, }); }; // 控制弹窗的显示隐藏 const [show, setShow] = useState(false); // 点击表格里面的查看 const lookIdRef = useRef(-1); const lookGoods = useCallback((id: number) => { lookIdRef.current = id; setShow(true); }, []); // 表格格式 const columns = useMemo(() => { const tempArr = [ { title: "缩略图", render: (item: any) => ( ), }, { title: "藏品编号名称", dataIndex: "dictNum", }, { title: "藏品编号", render: (item: any) => (item.num ? item.num : "-"), }, { title: "藏品名称", dataIndex: "name", }, { title: "类别", dataIndex: "dictGoodType", }, { title: "完残程度", dataIndex: "complete", }, { title: "出库位置", dataIndex: "outLocation", }, { title: "出库状态", render: (item: any) => item.storageStatus === "out" ? "待归还" : item.storageStatus === "in" ? "已归还" : "-", }, { title: "操作", render: (item: any) => ( <> ), }, ]; return tempArr; }, [lookGoods]); // 选中的表格数据 const [tableSelectList, setTableSelectList] = useState([]); // 表格的多选和禁选 const rowSelection = { selectedRowKeys: tableSelectList, onChange: (selectedRowKeys: any) => { setTableSelectList(selectedRowKeys); }, getCheckboxProps: (record: any) => ({ disabled: record.storageStatus === "in" || info.status !== 3, // 已归还的禁止选中 }), }; // 点击归还 const returnGoodsFu = useCallback(async () => { console.log("---------点击了归还", tableSelectList); const obj = { goodsIds: tableSelectList.join(","), id: info.id, }; const res: any = await returnObject4API(obj); if (res.code === 0) { MessageFu.success("归还成功!"); // 清空表格选中状态和数据 setTableSelectList([]); getInfo(); } }, [getInfo, info.id, tableSelectList]); return (
出库管理
/
{info.status === 3 ? "查看-归还" : "查看"}
出库信息
出库编号:
{info.num}
出库人员:
{info.creatorName}
出库类型:
{info.outType}
审核结果:
{info.statusTxt}
登记说明: {info.description ? info.description : "-"}
审核说明: {info.reason ? info.reason : "-"}

藏品信息 {info.status === 3 ? (
归还
) : null}
{/* 表格信息 */}
{info.status === 2 ? ( history.push( `/object/4/add?k=${urlParamRef.current.k}&d=${urlParamRef.current.d}&id=${urlParamRef.current.id}` ) } > 编辑 ) : null}  
{/* 点击查看出来的对话框 */} {show ? ( setShow(false)} /> ) : null} ); } const MemoLookObject4 = React.memo(LookObject4); export default MemoLookObject4;