|
|
@@ -1,4 +1,4 @@
|
|
|
-import React from "react";
|
|
|
+import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
|
import styles from "./index.module.scss";
|
|
|
import {
|
|
|
A2inTableType,
|
|
|
@@ -6,21 +6,100 @@ import {
|
|
|
statusTxtObj,
|
|
|
storageStatusTxtObj,
|
|
|
} from "@/pages/A2Goods/data";
|
|
|
-import { Button, Popover, Tag } from "antd";
|
|
|
+import { Button, Popover, Table, Tag } from "antd";
|
|
|
import ImageLazy from "@/components/ImageLazy";
|
|
|
import { CaretDownOutlined } from "@ant-design/icons";
|
|
|
+import { A2_APIgetInfoSon } from "@/store/action/A2Goods";
|
|
|
+import { FileListType } from "@/components/Z_upFileOtherList";
|
|
|
+import { useSelector } from "react-redux";
|
|
|
+import { RootState } from "@/store";
|
|
|
+import filesLookFu from "@/utils/filesLook";
|
|
|
+import { baseURL } from "@/utils/http";
|
|
|
|
|
|
type Props = {
|
|
|
- info: A2inTableType;
|
|
|
+ goodsId: number;
|
|
|
closeFu: () => void;
|
|
|
};
|
|
|
|
|
|
-function B1Look({ info, closeFu }: Props) {
|
|
|
+function B1Look({ closeFu, goodsId }: Props) {
|
|
|
+ // isFileDonw 全局的是否允许下载
|
|
|
+ const isFileDonw = useSelector(
|
|
|
+ (state: RootState) => state.A0Layout.isFileDonw
|
|
|
+ );
|
|
|
+
|
|
|
+ const [info, setInfo] = useState({} as A2inTableType);
|
|
|
+ const [file, setFile] = useState([] as FileListType[]);
|
|
|
+
|
|
|
+ const getInfoFu = useCallback(async (id: number) => {
|
|
|
+ const res = await A2_APIgetInfoSon(id);
|
|
|
+
|
|
|
+ if (res.code === 0) {
|
|
|
+ setInfo(res.data.entity);
|
|
|
+ setFile(res.data.file);
|
|
|
+ }
|
|
|
+ }, []);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ getInfoFu(goodsId);
|
|
|
+ }, [getInfoFu, goodsId]);
|
|
|
+
|
|
|
+ // 尺寸的信息
|
|
|
+ const sizeRes = useMemo(() => {
|
|
|
+ let temp = info.size || " , , ";
|
|
|
+ const temp2 = temp.split(",");
|
|
|
+ return temp2.map((v) => v.replace(" ", ""));
|
|
|
+ }, [info.size]);
|
|
|
+
|
|
|
+ const columns = useMemo(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ title: "附件名称",
|
|
|
+ dataIndex: "name",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "上传人",
|
|
|
+ dataIndex: "creatorName",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "上传时间",
|
|
|
+ dataIndex: "createTime",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: "操作",
|
|
|
+ render: (item: FileListType) => (
|
|
|
+ <>
|
|
|
+ {filesLookFu(item.name) ? (
|
|
|
+ <Button
|
|
|
+ size="small"
|
|
|
+ type="text"
|
|
|
+ onClick={() => filesLookFu(item.name, item.filePath)}
|
|
|
+ >
|
|
|
+ 预览
|
|
|
+ </Button>
|
|
|
+ ) : null}
|
|
|
+ {isFileDonw ? (
|
|
|
+ <a
|
|
|
+ href={baseURL + item.filePath}
|
|
|
+ download={item.name}
|
|
|
+ target="_blank"
|
|
|
+ rel="noreferrer"
|
|
|
+ >
|
|
|
+ <Button size="small" type="text">
|
|
|
+ 下载
|
|
|
+ </Button>
|
|
|
+ </a>
|
|
|
+ ) : null}
|
|
|
+ </>
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ }, [isFileDonw]);
|
|
|
+
|
|
|
return (
|
|
|
<div className={styles.B1Look}>
|
|
|
<div className="B1Ltop">
|
|
|
<div className="B1Ltop1">
|
|
|
- <ImageLazy width={270} height={270} src={info.thumb} />
|
|
|
+ <ImageLazy width={298} height={318} src={info.thumb} />
|
|
|
</div>
|
|
|
<div className="B1Ltop2">
|
|
|
<div className="B1Ltop2_1">
|
|
|
@@ -36,20 +115,94 @@ function B1Look({ info, closeFu }: Props) {
|
|
|
</Tag>
|
|
|
</div>
|
|
|
<div>
|
|
|
+ {/* 待完善 */}
|
|
|
<Button type="primary">藏品日志</Button> 
|
|
|
<Popover placement="bottom" content={"666"}>
|
|
|
<Button type="primary">
|
|
|
操作
|
|
|
<CaretDownOutlined rev={undefined} />
|
|
|
</Button>
|
|
|
- </Popover> 
|
|
|
+ </Popover>
|
|
|
+  
|
|
|
<Button onClick={closeFu}>返回</Button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div className="B1Ltop2_2"></div>
|
|
|
+ <div className="B1Ltop2_2">
|
|
|
+ {/* 左侧信息 */}
|
|
|
+ <div className="B1LcRow">
|
|
|
+ <div className="B1LcRowIn">
|
|
|
+ <div>名称:</div>
|
|
|
+ <div>{info.name}</div>
|
|
|
+ </div>
|
|
|
+ <div className="B1LcRowIn">
|
|
|
+ <div>编号:</div>
|
|
|
+ <div>{info.num}</div>
|
|
|
+ </div>
|
|
|
+ <div className="B1LcRowIn">
|
|
|
+ <div>时代:</div>
|
|
|
+ <div>{info.dictAge || "(空)"}</div>
|
|
|
+ </div>
|
|
|
+ <div className="B1LcRowIn">
|
|
|
+ <div>质地:</div>
|
|
|
+ <div>{info.dictTexture || "(空)"}</div>
|
|
|
+ </div>
|
|
|
+ <div className="B1LcRowIn">
|
|
|
+ <div>尺寸:</div>
|
|
|
+ <div>
|
|
|
+ <span>长:{sizeRes[0] || "(空)"}</span> 
|
|
|
+ <span>宽:{sizeRes[1] || "(空)"}</span> 
|
|
|
+ <span>高:{sizeRes[2] || "(空)"}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className="B1LcRowIn">
|
|
|
+ <div>重量:</div>
|
|
|
+ <div>{info.quality || "(空)"}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ {/* 右侧信息 */}
|
|
|
+ <div className="B1LcRow B1LcRow2">
|
|
|
+ <div className="B1LcRowIn">
|
|
|
+ <div>实际数量:</div>
|
|
|
+ <div>{info.pcs || "(空)"}</div>
|
|
|
+ </div>
|
|
|
+ <div className="B1LcRowIn">
|
|
|
+ <div>来源:</div>
|
|
|
+ <div>{info.source || "(空)"}</div>
|
|
|
+ </div>
|
|
|
+ <div className="B1LcRowIn">
|
|
|
+ <div>完残程度:</div>
|
|
|
+ <div>{info.complete || "(空)"}</div>
|
|
|
+ </div>
|
|
|
+ <div className="B1LcRowIn">
|
|
|
+ <div>级别:</div>
|
|
|
+ <div>{info.dictLevel || "(空)"}</div>
|
|
|
+ </div>
|
|
|
+ <div className="B1LcRowIn">
|
|
|
+ <div>定级时间:</div>
|
|
|
+ <div>{info.levelTime || "(空)"}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ {/* 简介 */}
|
|
|
+ <div className="B1LcTxt">
|
|
|
+ <div>简介:</div>
|
|
|
+ <div className="mySorrl">{info.description || "(空)"}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div className="B1Lfoll">
|
|
|
+ <div className="B1LfollTit">附件:</div>
|
|
|
+ <div className="B1LfollTable">
|
|
|
+ <Table
|
|
|
+ size="small"
|
|
|
+ scroll={{ y: 370 }}
|
|
|
+ dataSource={file}
|
|
|
+ columns={columns}
|
|
|
+ rowKey="id"
|
|
|
+ pagination={false}
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div className="B1Lfoll"></div>
|
|
|
</div>
|
|
|
);
|
|
|
}
|