import AuthButton from "@/components/AuthButton"; import BreadTit from "@/components/BreadTit"; import LookObjTable from "@/components/LookObjTable"; import history, { urlParameter } from "@/utils/history"; import { Button } from "antd"; import React, { useCallback, useEffect, useRef } from "react"; import { useLocation } from "react-router-dom"; import styles from "./index.module.scss"; import { getObj1InfoTableAPI2, object1infoOutAPI, statusObj, } from "@/store/action/object1"; import { useDispatch, useSelector } from "react-redux"; import { RootState } from "@/store"; function LookObject1() { const dispatch = useDispatch(); // 获取地址栏参数 const location = useLocation(); const urlParamRef = useRef({}); useEffect(() => { urlParamRef.current = urlParameter(location.search); // console.log("地址栏参数", urlParamRef.current); }, [location]); // 点击返回 const cancelFu = () => { history.push({ pathname: `/object`, state: { k: urlParamRef.current.k ? urlParamRef.current.k : "1", d: urlParamRef.current.d, }, }); }; const getInfo = useCallback(async () => { const id = urlParamRef.current.id; const res1 = await object1infoOutAPI(id); const res2 = await getObj1InfoTableAPI2(id); const info = res1.data; info.statusTxt = statusObj[info.status]; const list = res2.data; dispatch({ type: "object1/getLookInfo", payload: { info, list } }); }, [dispatch]); useEffect(() => { getInfo(); }, [getInfo]); const { info, list: tableList } = useSelector( (state: RootState) => state.object1Store.lookInfo ); return (
藏品登记
/
查看
登记信息
登记编号:
{info.num}
登记人员:
{info.creatorName}
藏品来源:
{info.sourceName}
审核结果:
{info.statusTxt}
登记说明: {info.description ? info.description : "-"}
审核说明: {info.reason ? info.reason : "-"}

藏品信息
{/* 封装的表格信息 */}
{info.status === 2 ? ( history.push( `/object/1/add?k=${urlParamRef.current.k}&d=${urlParamRef.current.d}&id=${urlParamRef.current.id}` ) } > 编辑 ) : null}  
); } const MemoLookObject1 = React.memo(LookObject1); export default MemoLookObject1;