123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- 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<any>({});
- 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 (
- <div className={styles.LookObject1}>
- <div className="breadTit">
- <BreadTit>
- <div className="breadTitRow">藏品登记</div>
- <div className="splitStr">/</div>
- <div className="breadTitRow active">查看</div>
- </BreadTit>
- </div>
- <div className="objectSonMain">
- <div className="topTit">登记信息</div>
- <div className="topInfo">
- <div className="topInfoRow">
- <div>
- <div className="one">登记编号:</div>
- <div>{info.num}</div>
- </div>
- <div>
- <div className="one">登记人员:</div>
- <div>{info.creatorName}</div>
- </div>
- </div>
- <div className="topInfoRow">
- <div>
- <div className="one">藏品来源:</div>
- <div>{info.sourceName}</div>
- </div>
- <div>
- <div className="one">审核结果:</div>
- <div>{info.statusTxt}</div>
- </div>
- </div>
- <div className="topInfoTex" title="666">
- <span>登记说明:</span>
- {info.description ? info.description : "-"}
- </div>
- <div className="topInfoTex" title="666">
- <span>审核说明:</span>
- {info.reason ? info.reason : "-"}
- </div>
- </div>
- <br />
- <div className="topTit">藏品信息</div>
- <div className="goodsInfo">
- {/* 封装的表格信息 */}
- <LookObjTable data={tableList} y={340} />
- </div>
- <div className="backBtn">
- {info.status === 2 ? (
- <AuthButton
- type="primary"
- onClick={() =>
- history.push(
- `/object/1/add?k=${urlParamRef.current.k}&d=${urlParamRef.current.d}&id=${urlParamRef.current.id}`
- )
- }
- >
- 编辑
- </AuthButton>
- ) : null}
-  
- <Button onClick={cancelFu}>返回</Button>
- </div>
- </div>
- </div>
- );
- }
- const MemoLookObject1 = React.memo(LookObject1);
- export default MemoLookObject1;
|