shaogen1995 2 年之前
父节点
当前提交
0b10f5d4dd

+ 27 - 16
src/components/LookObjTable/index.tsx

@@ -1,5 +1,5 @@
 import { Button, Modal, Select, Table } from "antd";
-import React, { useCallback, useEffect, useMemo, useState } from "react";
+import React, { useCallback, useMemo, useState } from "react";
 import ImageLazy from "../ImageLazy";
 import "./index.css";
 import classNames from "classnames";
@@ -95,8 +95,20 @@ function LookObjTable({ data, y }: Props) {
 
   // 附件类型下拉框
   const { info, fileList } = useSelector(
-    (state: RootState) => state.objectStore.oneGoodsInfo
+    (state: RootState) => state.object1Store.oneGoodsInfo
   );
+  // 外形尺寸和具体质量
+  let sizeRes = "";
+  if (info.size && info.size.length) {
+    const sizeArr = info.size.split(",");
+    sizeRes = `(通长)${sizeArr[0]}cm (通宽)${sizeArr[1]}cm (通高)${sizeArr[2]}cm`;
+  }
+
+  let qualityRes ='-'
+  if(info.quality&&info.quality.length){
+    const qualityArr =info.quality.split(',')
+    qualityRes=qualityArr[0]+qualityArr[1]
+  }
 
   const fileSelectList = useMemo(() => {
     return [
@@ -148,7 +160,7 @@ function LookObjTable({ data, y }: Props) {
       {/* 点击查看出来的对话框 */}
       <Modal
         wrapClassName="lookObjTable"
-        destroyOnClose
+        // destroyOnClose
         open={show}
         title="查看藏品"
         onCancel={() => setShow(false)}
@@ -180,11 +192,11 @@ function LookObjTable({ data, y }: Props) {
           <div className="row">
             <div>
               <span>藏品名称:</span>
-              <p>{info.formRow}</p>
+              <p>{info.name}</p>
             </div>
             <div>
               <span>原名:</span>
-              <p>{info.namePrimitive}</p>
+              <p>{info.namePrimitive?info.namePrimitive:'-'}</p>
             </div>
           </div>
           <div className="row">
@@ -194,7 +206,7 @@ function LookObjTable({ data, y }: Props) {
             </div>
             <div>
               <span>藏品编号:</span>
-              <p>{info.num?info.num:'-'}</p>
+              <p>{info.num ? info.num : "-"}</p>
             </div>
           </div>
           <div className="row">
@@ -210,7 +222,7 @@ function LookObjTable({ data, y }: Props) {
           <div className="row">
             <div>
               <span>具体年代:</span>
-              <p>{info.ageSpecific?info.ageSpecific:'-'}</p>
+              <p>{info.ageSpecific ? info.ageSpecific : "-"}</p>
             </div>
             <div>
               <span>文物类别:</span>
@@ -230,8 +242,7 @@ function LookObjTable({ data, y }: Props) {
           </div>
           <div className="rowFull">
             <span>外形尺寸:</span>
-            <p>{info.size}</p>
-            {/* <p>(通长)66666666&emsp;(通宽)66666666&emsp;(通高)66666666</p> */}
+            <p dangerouslySetInnerHTML={{ __html: sizeRes }}></p>
           </div>
           <div className="rowFull">
             <span>具体尺寸:</span>
@@ -245,7 +256,7 @@ function LookObjTable({ data, y }: Props) {
             </div>
             <div>
               <span>具体质量:</span>
-              <p>{info.quality?info.quality:'-'}</p>
+              <p>{qualityRes}</p>
             </div>
           </div>
 
@@ -256,7 +267,7 @@ function LookObjTable({ data, y }: Props) {
             </div>
             <div>
               <span>保存状态:</span>
-              <p>{info.repair?info.repair:'-'}</p>
+              <p>{info.repair ? info.repair : "-"}</p>
             </div>
           </div>
 
@@ -267,28 +278,28 @@ function LookObjTable({ data, y }: Props) {
             </div>
             <div>
               <span>入藏年度:</span>
-              <p>{info.checkInYear?info.checkInYear:'-'}</p>
+              <p>{info.checkInYear ? info.checkInYear : "-"}</p>
             </div>
           </div>
 
           <div className="row">
             <div>
               <span>著者:</span>
-              <p>{info.author?info.author:'-'}</p>
+              <p>{info.author ? info.author : "-"}</p>
             </div>
             <div>
               <span>版本:</span>
-              <p>{info.vision?info.vision:'-'}</p>
+              <p>{info.vision ? info.vision : "-"}</p>
             </div>
           </div>
 
           <div className="rowFull">
             <span>存卷:</span>
-            <p>{info.onFile?info.onFile:'-'}</p>
+            <p>{info.onFile ? info.onFile : "-"}</p>
           </div>
           <div className="rowFull">
             <span>来源说明:</span>
-            <p>{info.description?info.description:'-'}</p>
+            <p>{info.description ? info.description : "-"}</p>
           </div>
         </div>
 

+ 1 - 1
src/pages/ObjectSon/Object1/AuditObject1/index.tsx

@@ -52,7 +52,7 @@ function AuditObject1() {
   }, [getInfo]);
 
   const { info, list: tableList } = useSelector(
-    (state: RootState) => state.objectStore.lookInfo
+    (state: RootState) => state.object1Store.lookInfo
   );
 
   // 审核结果筛选

+ 1 - 1
src/pages/ObjectSon/Object1/LookObject1/index.tsx

@@ -50,7 +50,7 @@ function LookObject1() {
   }, [getInfo]);
 
   const { info, list: tableList } = useSelector(
-    (state: RootState) => state.objectStore.lookInfo
+    (state: RootState) => state.object1Store.lookInfo
   );
 
   return (

+ 2 - 2
src/pages/ObjectSon/Object1/index.tsx

@@ -36,7 +36,7 @@ export default function Object1() {
   // 顶部的状态改变了,统一管理,传到二级页码
   const statusRef = useRef<null | number>(null);
 
-  const dataTit = useSelector((state: RootState) => state.objectStore.infoNum1);
+  const dataTit = useSelector((state: RootState) => state.object1Store.infoNum1);
 
   // 封装发送请求的函数
   const getList = () => {
@@ -152,7 +152,7 @@ export default function Object1() {
     setTableSelect({ ...tableSelect, pageNum, pageSize });
   };
 
-  const results = useSelector((state: RootState) => state.objectStore.info1);
+  const results = useSelector((state: RootState) => state.object1Store.info1);
 
   const columns = useMemo(() => {
     return [

+ 12 - 1
src/pages/ObjectSon/Object2/LookObject2/index.module.scss

@@ -37,12 +37,23 @@
                 margin-left: 10px;
                 color: #fff;
                 height: 20px;
-                line-height: 20px;
+                display: flex;
+                align-items: center;
                 padding: 0 5px;
                 border-radius: 3px;
                 font-size: 12px;
+              }
+              .bs1{
+                border: 1px solid #ccc;
+                color: black;
+                // background-color: var(--themeColor);
+              }
+              .bs2{
                 background-color: var(--themeColor);
               }
+              .bs3{
+                background-color: green;
+              }
             }
           }
 

+ 146 - 119
src/pages/ObjectSon/Object2/LookObject2/index.tsx

@@ -17,6 +17,10 @@ import { useLocation } from "react-router-dom";
 import styles from "./index.module.scss";
 import "./index.css";
 import LookObject2Log from "./table";
+import { storageStatusObj } from "@/store/action/object1";
+import { baseURL } from "@/utils/http";
+import classNames from "classnames";
+import { getObj2InfoInAPI } from "@/store/action/object2";
 function LookObject2() {
   const dispatch = useDispatch();
   // 获取地址栏参数
@@ -27,11 +31,40 @@ function LookObject2() {
     // console.log("地址栏参数", urlParamRef.current);
   }, [location]);
 
+  // 进页面通过id获取单个藏品详情
+  const getObj2InfoInAPIFu = useCallback(async () => {
+    const id = urlParamRef.current.id;
+    const res = await getObj2InfoInAPI(id);
+    const info = res.data.entity;
+    const fileList = {
+      img: [],
+      video: [],
+      audio: [],
+      model: [],
+      doc: [],
+    } as any;
+    res.data.file.forEach((v: any) => {
+      fileList[v.type].push(v);
+    });
+
+    dispatch({
+      type: "object2/getOneGoodsInfo",
+      payload: { info, fileList },
+    });
+  }, [dispatch]);
+
+  useEffect(() => {
+    getObj2InfoInAPIFu();
+  }, [getObj2InfoInAPIFu]);
+
   // 点击返回
   const cancelFu = () => {
     history.push({
       pathname: `/object/2`,
-      state: { k: urlParamRef.current.k ? urlParamRef.current.k : "1" },
+      state: {
+        k: urlParamRef.current.k ? urlParamRef.current.k : "1",
+        d: urlParamRef.current.d,
+      },
     });
   };
 
@@ -51,44 +84,23 @@ function LookObject2() {
     setFileSelect(value);
   };
 
-  // 里面的表格数据
-  const results = useSelector((state: RootState) => state.loginStore.fileData);
-  useEffect(() => {
-    dispatch({
-      type: "login/setFileData",
-      payload: {
-        img: [
-          {
-            id: 1,
-            name: "图片1",
-            time: "2022-12-13",
-            img: "https://ts1.cn.mm.bing.net/th/id/R-C.6d2d3fecd79a96e43d1a410640d7199b?rik=B7RCgF82Vb7P0A&riu=http%3a%2f%2f5b0988e595225.cdn.sohucs.com%2fimages%2f20190831%2f3e03e9c2473c40b180aa99a37c0589fa.jpeg&ehk=JXdgMrjnolHlMkdX9N0K7%2fzBc9wi7FSFDjSGclreQbI%3d&risl=&pid=ImgRaw&r=0",
-          },
-          {
-            id: 2,
-            name: "图片2",
-            time: "2022-12-14",
-            img: "",
-          },
-          {
-            id: 3,
-            name: "图片3",
-            time: "2022-12-14",
-            img: "",
-          },
-        ],
-        video: [
-          {
-            id: 4,
-            name: "视频1",
-            time: "2022-12-14",
-            img: "",
-          },
-        ],
-        audio: [],
-      },
-    });
-  }, [dispatch]);
+  // 从仓库中获取信息
+  const { info, fileList } = useSelector(
+    (state: RootState) => state.object2Store.oneGoodsInfo
+  );
+
+  // 外形尺寸和具体质量
+  let sizeRes = "";
+  if (info.size && info.size.length) {
+    const sizeArr = info.size.split(",");
+    sizeRes = `(通长)${sizeArr[0]}cm&emsp;(通宽)${sizeArr[1]}cm&emsp;(通高)${sizeArr[2]}cm`;
+  }
+
+  let qualityRes = "-";
+  if (info.quality && info.quality.length) {
+    const qualityArr = info.quality.split(",");
+    qualityRes = qualityArr[0] + qualityArr[1];
+  }
 
   // 里面表格格式
   const columns = useMemo(() => {
@@ -99,19 +111,19 @@ function LookObject2() {
       },
       {
         title: "上传人",
-        dataIndex: "time",
+        dataIndex: "creatorName",
       },
 
       {
         title: "上传时间",
-        dataIndex: "time",
+        dataIndex: "updateTime",
       },
       {
         title: "操作",
         render: (item: any) => (
           <a
             target="_blank"
-            href="https://ts1.cn.mm.bing.net/th/id/R-C.6d2d3fecd79a96e43d1a410640d7199b?rik=B7RCgF82Vb7P0A&riu=http%3a%2f%2f5b0988e595225.cdn.sohucs.com%2fimages%2f20190831%2f3e03e9c2473c40b180aa99a37c0589fa.jpeg&ehk=JXdgMrjnolHlMkdX9N0K7%2fzBc9wi7FSFDjSGclreQbI%3d&risl=&pid=ImgRaw&r=0"
+            href={baseURL + item.filePath}
             download
             rel="noreferrer"
           >
@@ -124,7 +136,7 @@ function LookObject2() {
       tempArr.unshift({
         title: "缩略图",
         render: (item: any) => (
-          <ImageLazy width={80} height={50} src={item.img} />
+          <ImageLazy width={80} height={50} src={item.filePath} />
         ),
       });
     }
@@ -190,35 +202,52 @@ function LookObject2() {
         {/* 上面的信息 */}
         <div className="topInfoBox">
           <div className="topInfoBoxL">
-            <ImageLazy
-              src="http://project.4dage.com:8016/content/1_1001/img/20220810_1553241331042.JPG"
-              width={300}
-              height={300}
-            />
+            <ImageLazy src={info.thumb} width={300} height={300} />
           </div>
           <div className="topInfoBoxR">
             <div className="topInfoBoxRTit">
               <div>
-                <h1>陶瓷花瓶</h1>
-                <div className="bs">已入库</div>
+                <h1>{info.name}</h1>
+                <div
+                  className={classNames(
+                    "bs",
+                    info.storageStatus === "0"
+                      ? "bs1"
+                      : info.storageStatus === "in"
+                      ? "bs2"
+                      : "bs3"
+                  )}
+                >
+                  {storageStatusObj[info.storageStatus]}
+                </div>
               </div>
               <div>
-                <AuthButton
-                  size="small"
-                  type="primary"
-                  onClick={() => titCutFu("1")}
-                >
-                  申请编辑
-                </AuthButton>
-                &emsp;
-                <AuthButton
-                  size="small"
-                  type="primary"
-                  onClick={() => titCutFu("2")}
-                >
-                  申请移库
-                </AuthButton>
-                &emsp;
+                {info.tempEdit === 0 ? (
+                  <>
+                    <AuthButton
+                      size="small"
+                      type="primary"
+                      onClick={() => titCutFu("1")}
+                    >
+                      申请编辑
+                    </AuthButton>
+                    &emsp;
+                  </>
+                ) : null}
+                {/* {info.tempMove === 0 && info.storageStatus !== "0" ? ( */}
+                {info.tempMove === 0 ? (
+                  <>
+                    <AuthButton
+                      size="small"
+                      type="primary"
+                      onClick={() => titCutFu("2")}
+                    >
+                      申请移库
+                    </AuthButton>
+                    &emsp;
+                  </>
+                ) : null}
+
                 <AuthButton size="small" onClick={() => titCutFu("3")}>
                   操作记录
                 </AuthButton>
@@ -226,133 +255,131 @@ function LookObject2() {
             </div>
             <div className="topInfoBoxRTxt">
               <div className="row">
-                <div>
+                <div title={info.name}>
                   <span>藏品名称:</span>
-                  <p>
-                    阿松大阿松阿松大阿松阿松大阿松阿松大阿松阿松大阿松阿松大阿松阿松大阿松阿松大阿松阿松大阿松阿松大阿松
-                  </p>
+                  <p>{info.name}</p>
                 </div>
-                <div>
+                <div title={info.namePrimitive}>
                   <span>原名:</span>
-                  <p>666666666</p>
+                  <p>{info.namePrimitive?info.namePrimitive:'-'}</p>
                 </div>
               </div>
               <div className="row">
-                <div>
+                <div title={info.dictNum}>
                   <span>藏品编号名称:</span>
-                  <p>666666666</p>
+                  <p>{info.dictNum}</p>
                 </div>
-                <div>
+                <div title={info.num}>
                   <span>藏品编号:</span>
-                  <p>
-                    阿松大阿松阿松大阿松阿松大阿松阿松大阿松阿松大阿松阿松大阿松阿松大阿松阿松大阿松阿松大阿松阿松大阿松
-                  </p>
+                  <p>{info.num ? info.num : "-"}</p>
                 </div>
               </div>
               <div className="row">
-                <div>
+                <div title={info.dictAge}>
                   <span>年代:</span>
-                  <p>666666666</p>
+                  <p>{info.dictAge}</p>
                 </div>
-                <div>
+                <div title={info.dictTexture}>
                   <span>文物质地:</span>
-                  <p>666666666</p>
+                  <p>{info.dictTexture}</p>
                 </div>
               </div>
               <div className="row">
-                <div>
+                <div title={info.ageSpecific}>
                   <span>具体年代:</span>
-                  <p>666666666</p>
+                  <p>{info.ageSpecific ? info.ageSpecific : "-"}</p>
                 </div>
-                <div>
+                <div title={info.dictGoodType}>
                   <span>文物类别:</span>
-                  <p>666666666</p>
+                  <p>{info.dictGoodType}</p>
                 </div>
               </div>
 
               <div className="row">
-                <div>
+                <div title={info.pcs}>
                   <span>实际数量:</span>
-                  <p>666666666</p>
+                  <p>{info.pcs}</p>
                 </div>
-                <div>
+                <div title={info.dictLevel}>
                   <span>文物级别:</span>
-                  <p>666666666</p>
+                  <p>{info.dictLevel}</p>
                 </div>
               </div>
               <div className="row">
-                <div>
+                <div title={sizeRes}>
                   <span>外形尺寸:</span>
-                  <p>(通长)66666666 (通宽)66666666 (通高)66666666 /cm</p>
+                  <p dangerouslySetInnerHTML={{ __html: sizeRes }}></p>
                 </div>
-                <div>
+                <div title={info.sizeSpecific}>
                   <span>具体尺寸:</span>
-                  <p>666666666</p>
+                  <p>{info.sizeSpecific}</p>
                 </div>
               </div>
               <div className="row">
-                <div>
+                <div title={info.dictQualityScope}>
                   <span>质量范围:</span>
-                  <p>666666666</p>
+                  <p>{info.dictQualityScope}</p>
                 </div>
-                <div>
+                <div title={qualityRes}>
                   <span>具体质量:</span>
-                  <p>666666666</p>
+                  <p>{qualityRes}</p>
                 </div>
               </div>
 
               <div className="row">
-                <div>
+                <div title={info.complete}>
                   <span>完残程度:</span>
-                  <p>666666666</p>
+                  <p>{info.complete}</p>
                 </div>
-                <div>
+                <div title={info.repair}>
                   <span>保存状态:</span>
-                  <p>666666666</p>
+                  <p>{info.repair ? info.repair : "-"}</p>
                 </div>
               </div>
 
               <div className="row">
-                <div>
+                <div title={info.dictCheckInScope}>
                   <span>入藏时间范围:</span>
-                  <p>666666666</p>
+                  <p>{info.dictCheckInScope}</p>
                 </div>
-                <div>
+                <div title={info.checkInYear}>
                   <span>入藏年度:</span>
-                  <p>666666666</p>
+                  <p>{info.checkInYear ? info.checkInYear : "-"}</p>
                 </div>
               </div>
 
               <div className="row">
-                <div>
+                <div title={info.author}>
                   <span>著者:</span>
-                  <p>666666666</p>
+                  <p>{info.author ? info.author : "-"}</p>
                 </div>
-                <div>
+                <div title={info.vision}>
                   <span>版本:</span>
-                  <p>666666666</p>
+                  <p>{info.vision ? info.vision : "-"}</p>
                 </div>
               </div>
 
               <div className="row">
-                <div>
+                <div title={info.onFile}>
                   <span>存卷:</span>
-                  <p>666666666</p>
+                  <p>{info.onFile ? info.onFile : "-"}</p>
                 </div>
-                <div>
+                <div title={info.description}>
                   <span>来源说明:</span>
-                  <p>666666666</p>
+                  <p>{info.description ? info.description : "-"}</p>
                 </div>
               </div>
 
               <div className="row">
-                <div>
+                <div title={info.storageAncestorName}>
                   <span>入库位置:</span>
-                  <p>666666666</p>
+                  <p>
+                    {info.storageAncestorName ? info.storageAncestorName : "-"}
+                  </p>
                 </div>
-                <div>
+                <div title={info.outLocation}>
                   <span>出库位置:</span>
-                  <p>666666666</p>
+                  <p>{info.outLocation ? info.outLocation : "-"}</p>
                 </div>
               </div>
             </div>
@@ -375,7 +402,7 @@ function LookObject2() {
           <Table
             size="small"
             scroll={{ y: 190 }}
-            dataSource={results[fileSelect]}
+            dataSource={fileList[fileSelect]}
             columns={columns}
             rowKey="id"
             pagination={false}

+ 6 - 0
src/pages/ObjectSon/Object2/index.module.scss

@@ -38,6 +38,12 @@
       overflow-y: auto;
       display: flex;
       flex-wrap: wrap;
+      .imgListNone{
+        color: var(--themeColor);
+        font-size: 20px;
+        margin: 0 auto;
+        padding-top: 200px;
+      }
 
       .imgListRow {
         cursor: pointer;

+ 197 - 76
src/pages/ObjectSon/Object2/index.tsx

@@ -1,8 +1,8 @@
 import BreadTit from "@/components/BreadTit";
 import { RootState } from "@/store";
-import { Button, Input, Pagination, Select, Table } from "antd";
-import { useEffect, useMemo, useRef, useState } from "react";
-import { useSelector } from "react-redux";
+import { Button, Input, message, Pagination, Select, Table } from "antd";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { useDispatch, useSelector } from "react-redux";
 import styles from "./index.module.scss";
 import { UnorderedListOutlined, AppstoreOutlined } from "@ant-design/icons";
 import classNames from "classnames";
@@ -11,17 +11,29 @@ import history from "@/utils/history";
 import { useLocation } from "react-router-dom";
 import dayjs from "dayjs";
 import ExportJsonExcel from "js-export-excel";
+import { getObject2List } from "@/store/action/object2";
+import http from "@/utils/http";
 const { Option } = Select;
 export default function Object2() {
+  const dispatch = useDispatch();
+
   // 从仓库中获取藏品编号名称下拉数据
   const options = useSelector(
     (state: RootState) => state.loginStore.selectAll["藏品编号名称"]
   );
 
+  // 从仓库中获取表格数据(图片展示数据)
+  const results = useSelector((state: RootState) => state.object2Store.info2);
+
   // 封装发送请求的函数
   const getList = () => {
-    const data = { ...tableSelect, pageNum: pageNumRef.current, aaaaa: value };
-    console.log("------", data);
+    const data = {
+      ...tableSelect,
+      pageNum: pageNumRef.current,
+      searchType: value,
+    };
+    dispatch(getObject2List(data));
+    // console.log("------", data);
   };
 
   // 获取地址栏参数
@@ -37,11 +49,35 @@ export default function Object2() {
 
   // 筛选表格的数据
   const [tableSelect, setTableSelect] = useState<any>({
-    bianhao: null,
-    name: "",
+    dictNum: null,
+    searchKey: "",
     pageSize: 10,
     pageNum: 1,
   });
+
+  // 图片页面和列表页面的切换
+  const [cutShow, setCutShow] = useState("cutShow1");
+
+  // 当前图片查看或者表格查看数据统一
+
+  const cutShowRef = useRef("1");
+
+  // 进页面如果 d的值为2 切换到表格显示
+  useEffect(() => {
+    const urlParam = location.state || {};
+    if (urlParam.d && urlParam.d === "2") {
+      cutShowRef.current = "2";
+      window.setTimeout(() => {
+        setCutShow("cutShow2");
+      }, 20);
+    }
+  }, [location.state]);
+
+  const cutShowFu = useCallback((val: string) => {
+    cutShowRef.current = val === "cutShow1" ? "1" : "2";
+    setCutShow(val);
+  }, []);
+
   // 当前页码统一
   const pageNumRef = useRef(1);
   useEffect(() => {
@@ -62,76 +98,65 @@ export default function Object2() {
 
   // 藏品来源下拉框改变
   const handleChange = (val: string) => {
-    setTableSelect({ ...tableSelect, bianhao: val, pageNum: 1 });
+    setTableSelect({ ...tableSelect, dictNum: val, pageNum: 1 });
   };
 
   // 搜索输入框下拉
-  const [value, setValue] = useState("name1");
+  const [value, setValue] = useState("name");
   const valueChangeFu = (val: string) => {
+    if (tableSelect.searchKey) {
+      // 根据输入框的值重新发送请求
+      setTableSelect({ ...tableSelect, searchType: val });
+    }
+
     setValue(val);
   };
   const nameTime = useRef(-1);
   const nameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
     clearTimeout(nameTime.current);
     nameTime.current = window.setTimeout(() => {
-      setTableSelect({ ...tableSelect, name: e.target.value, pageNum: 1 });
+      setTableSelect({ ...tableSelect, searchKey: e.target.value, pageNum: 1 });
     }, 500);
   };
 
-  // 图片页面和列表页面的切换
-  const [cutShow, setCutShow] = useState("cutShow1");
-
   // 关于表格的数据
   const paginationChange = (pageNum: number, pageSize: number) => {
     setTableSelect({ ...tableSelect, pageNum, pageSize });
   };
 
-  const results = {
-    list: [
-      { img: "", name: "666-1", id: 1 },
-      {
-        img: "http://project.4dage.com:8016/content/1_1001/img/20220810_1553241331042.JPG",
-        name: "666-2",
-        id: 2,
-      },
-      { img: "", name: "sada阿三大苏打sada阿三大苏打-3", id: 3 },
-      { img: "", name: "666-4", id: 4 },
-      { img: "", name: "666-5", id: 5 },
-      { img: "", name: "666-6", id: 6 },
-      { img: "", name: "666-7", id: 7 },
-      { img: "", name: "666-8", id: 8 },
-      { img: "", name: "666-9", id: 9 },
-      { img: "", name: "666-10", id: 10 },
-      { img: "", name: "666-11", id: 11 },
-      { img: "", name: "666-12", id: 12 },
-      { img: "", name: "666-13", id: 13 },
-      { img: "", name: "666-14", id: 14 },
-      { img: "", name: "666-15", id: 15 },
-      { img: "", name: "666-16", id: 16 },
-      { img: "", name: "666-17", id: 17 },
-      { img: "", name: "666-18", id: 18 },
-      { img: "", name: "666-19", id: 19 },
-      { img: "", name: "666-20", id: 20 },
-      { img: "", name: "666-21", id: 21 },
-      { img: "", name: "666-22", id: 22 },
-      { img: "", name: "666-23", id: 23 },
-    ],
-    total: 23,
-  };
-
   const columns = useMemo(() => {
     return [
       {
         title: "缩略图",
         render: (item: any) => (
-          <ImageLazy width={120} height={70} src={item.img} />
+          <ImageLazy width={120} height={70} src={item.thumb} />
         ),
       },
       {
-        title: "标题",
+        title: "藏品编号名称",
+        dataIndex: "dictNum",
+      },
+      {
+        title: "藏品编号",
+        render: (item: any) => (item.num ? item.num : "-"),
+      },
+      {
+        title: "藏品名称",
         dataIndex: "name",
       },
       {
+        title: "年代",
+        dataIndex: "dictAge",
+      },
+      {
+        title: "质地",
+        dataIndex: "dictTexture",
+      },
+      {
+        title: "状态",
+        dataIndex: "storageStatusTxt",
+      },
+      {
         title: "操作",
         render: (item: any) => (
           <>
@@ -140,7 +165,7 @@ export default function Object2() {
               danger
               onClick={() =>
                 history.push(
-                  `/object/2/look?k=${pageNumRef.current}&id=${item.id}`
+                  `/object/2/look?k=${pageNumRef.current}&d=${cutShowRef.current}&id=${item.id}`
                 )
               }
             >
@@ -154,23 +179,109 @@ export default function Object2() {
   }, []);
 
   // 点击导出
-  const deriveFu = () => {
+  const deriveFu = useCallback(async () => {
+    if (results.list.length === 0)
+      return message.warning("当前搜索条件没有数据!");
     const name = dayjs(new Date()).format("YYYYMMDDHHmmss");
+    const res = await http.post("cms/ledger/pageList", {
+      ...tableSelect,
+      pageSize: 9999,
+      searchType: value,
+    });
+    const sheetData = res.data.records;
+    sheetData.forEach((v: any) => {
+      if (v.size && v.size.length) {
+        const sizeArr = v.size.split(",");
+        v.sizeRes = `(通长)${sizeArr[0]}cm;(通宽)${sizeArr[1]}cm;(通高)${sizeArr[2]}cm`;
+      }
+      v.qualityRes = "-";
+      if (v.quality && v.quality.length) {
+        const qualityArr = v.quality.split(",");
+        v.qualityRes = qualityArr[0] + qualityArr[1];
+      }
+      v.namePrimitive = v.namePrimitive ? v.namePrimitive : "-";
+      v.num = v.num ? v.num : "-";
+      v.ageSpecific = v.ageSpecific ? v.ageSpecific : "-";
+      v.repair = v.repair ? v.repair : "-";
+      v.checkInYear = v.checkInYear ? v.checkInYear : "-";
+      v.author = v.author ? v.author : "-";
+      v.vision = v.vision ? v.vision : "-";
+      v.onFile = v.onFile ? v.onFile : "-";
+      v.description = v.description ? v.description : "-";
+      v.storageAncestorName = v.storageAncestorName
+        ? v.storageAncestorName
+        : "-";
+      v.outLocation = v.outLocation ? v.outLocation : "-";
+    });
     const option = {
       fileName: name,
       datas: [
         {
-          sheetData: results.list,
+          sheetData,
           sheetName: name,
-          sheetFilter: ["img", "name", "id"],
-          sheetHeader: ["图片", "名字", "id"],
-          // columnWidths: [10, 10, 10],
+          sheetFilter: [
+            "name",
+            "namePrimitive",
+            "dictNum",
+            "num",
+            "dictAge",
+            "dictTexture",
+            "ageSpecific",
+            "dictGoodType",
+            "pcs",
+            "dictLevel",
+            "sizeRes",
+            "sizeSpecific",
+            "dictQualityScope",
+            "qualityRes",
+            "complete",
+            "repair",
+            "dictCheckInScope",
+            "checkInYear",
+            "author",
+            "vision",
+            "onFile",
+            "description",
+            "storageAncestorName",
+            "outLocation",
+          ],
+          sheetHeader: [
+            "藏品名称",
+            "原名",
+            "藏品编号名称",
+            "藏品编号",
+            "年代",
+            "文物质地",
+            "具体年代",
+            "文物类别",
+            "实际数量",
+            "文物级别",
+            "外形尺寸",
+            "具体尺寸",
+            "质量范围",
+            "具体质量",
+            "完残程度",
+            "保存状态",
+            "入藏时间范围",
+            "入藏年度",
+            "著者",
+            "版本",
+            "存卷",
+            "来源说明",
+            "入库位置",
+            "出库位置",
+          ],
+          columnWidths: [
+            10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+            10, 10, 10, 10, 10, 10, 10,
+          ],
         },
       ],
     };
+
     const toExcel = new ExportJsonExcel(option); //new
     toExcel.saveExcel(); //保存
-  };
+  }, [results.list, tableSelect, value]);
 
   return (
     <div className={styles.Object2}>
@@ -188,7 +299,7 @@ export default function Object2() {
               placeholder="请选择"
               allowClear
               style={{ width: 150 }}
-              value={tableSelect.bianhao}
+              value={tableSelect.dictNum}
               onChange={handleChange}
               options={options.map((v: any) => ({
                 label: v.name,
@@ -203,9 +314,9 @@ export default function Object2() {
               value={value}
               onChange={(val) => valueChangeFu(val)}
             >
-              <Option value="name1">藏品名称</Option>
-              <Option value="name2">藏品年代</Option>
-              <Option value="name3">藏品质地</Option>
+              <Option value="name">藏品名称</Option>
+              <Option value="age">藏品年代</Option>
+              <Option value="texture">藏品质地</Option>
             </Select>
             <Input
               maxLength={10}
@@ -220,7 +331,7 @@ export default function Object2() {
           </div>
           <div className="row">
             <div
-              onClick={() => setCutShow("cutShow1")}
+              onClick={() => cutShowFu("cutShow1")}
               className={classNames(
                 "cutShow",
                 cutShow === "cutShow1" ? "active" : ""
@@ -229,7 +340,7 @@ export default function Object2() {
               <AppstoreOutlined />
             </div>
             <div
-              onClick={() => setCutShow("cutShow2")}
+              onClick={() => cutShowFu("cutShow2")}
               className={classNames(
                 "cutShow",
                 "cutShow2",
@@ -242,21 +353,31 @@ export default function Object2() {
         </div>
         {/* 图片展示列表 */}
         <div className="imgList" hidden={cutShow !== "cutShow1"}>
-          {results.list.map((v) => (
-            <div
-              title="666666"
-              onClick={() =>
-                history.push(
-                  `/object/2/look?k=${pageNumRef.current}&id=${v.id}`
-                )
-              }
-              key={v.id}
-              className="imgListRow"
-            >
-              <ImageLazy noLook={true} width={193} height={190} src={v.img} />
-              <p>{v.name}</p>
-            </div>
-          ))}
+          {results.list.length ? (
+            results.list.map((v: any) => (
+              <div
+                title={v.name}
+                onClick={() =>
+                  history.push(
+                    `/object/2/look?k=${pageNumRef.current}&d=${cutShowRef.current}&id=${v.id}`
+                  )
+                }
+                key={v.id}
+                className="imgListRow"
+              >
+                <ImageLazy
+                  noLook={true}
+                  width={193}
+                  height={190}
+                  src={v.thumb}
+                />
+                <p>{v.name}</p>
+              </div>
+            ))
+          ) : (
+            <div className="imgListNone">暂无数据</div>
+          )}
+          {}
         </div>
 
         {/* 表格展示列表 */}

+ 10 - 3
src/store/action/object1.ts

@@ -47,6 +47,13 @@ export const statusObj = {
   3: "已完成", //审核通过
 } as any;
 
+// 入库出库的状态筛选
+export const storageStatusObj = {
+  "0": "未入库",
+  in: "已入库 ",
+  out: "已出库",
+} as any;
+
 /**
  * 获取藏品登记列表信息
  */
@@ -139,6 +146,6 @@ export const getInfoInAPI = (id: number) => {
 /**
  * 审核藏品信息
  */
-export const auditObject1API = (data:any) => {
-  return http.post('cms/register/audit',data);
-};
+export const auditObject1API = (data: any) => {
+  return http.post("cms/register/audit", data);
+};

+ 31 - 0
src/store/action/object2.ts

@@ -0,0 +1,31 @@
+import http from "@/utils/http";
+import { message } from "antd";
+import store, { AppDispatch } from "..";
+import { storageStatusObj } from "./object1";
+
+/**
+ * 获取藏品登记列表信息
+ */
+export const getObject2List = (data: any) => {
+  return async (dispatch: AppDispatch) => {
+    // 获取列表数据
+    const res: any = await http.post("cms/ledger/pageList", data);
+    const list = res.data.records;
+    list.forEach((v: any) => {
+      v.storageStatusTxt = storageStatusObj[v.storageStatus];
+    });
+    const obj = {
+      list,
+      total: res.data.total,
+    };
+    dispatch({ type: "object2/getList", payload: obj });
+  };
+};
+
+
+/**
+ * 通过id获取藏品总账详情
+ */
+export const getObj2InfoInAPI = (id: number) => {
+  return http.get(`cms/ledger/detail/${id}`);
+};

+ 8 - 6
src/store/reducer/index.ts

@@ -1,11 +1,13 @@
-import { combineReducers } from 'redux'
-import loginReducer from './login'
-import objectReducer from './object'
+import { combineReducers } from "redux";
+import loginReducer from "./login";
+import object1Reducer from "./object1";
+import object2Reducer from "./object2";
 
 // 合并 reducer
 const rootReducer = combineReducers({
   loginStore: loginReducer,
-  objectStore:objectReducer
-})
+  object1Store: object1Reducer,
+  object2Store: object2Reducer,
+});
 
-export default rootReducer
+export default rootReducer;

+ 1 - 1
src/store/reducer/object.ts

@@ -31,7 +31,7 @@ type LoginActionType =
   | { type: "object1/getLookInfo"; payload: any }
   | { type: "object1/getOneGoodsInfo"; payload: any };
 // 频道 reducer
-export default function objectReducer(
+export default function object1Reducer(
   state = initState,
   action: LoginActionType
 ) {

+ 41 - 0
src/store/reducer/object2.ts

@@ -0,0 +1,41 @@
+// 初始化状态应用注解
+const initState = {
+  // 表格数据
+  info2: {
+    list: [] as any,
+    total: 0,
+  },
+
+  // // 点击查看的单个藏品信息
+  oneGoodsInfo: {
+    info: {},
+    fileList: {
+      img: [],
+      video: [],
+      audio: [],
+      model: [],
+      doc: [],
+    },
+  } as any,
+};
+
+type LoginActionType =
+  | { type: "object2/getList"; payload: any }
+  | { type: "object2/getOneGoodsInfo"; payload: any };
+// 频道 reducer
+export default function object2Reducer(
+  state = initState,
+  action: LoginActionType
+) {
+  switch (action.type) {
+    // 表格数据2
+    case "object2/getList":
+      return { ...state, info2: action.payload };
+    // 查看页面的数据
+    case "object2/getOneGoodsInfo":
+      return { ...state, oneGoodsInfo: action.payload };
+
+    default:
+      return state;
+  }
+}

+ 1 - 0
src/utils/http.ts

@@ -60,6 +60,7 @@ http.interceptors.response.use(
     return response.data;
   },
   async function (err) {
+    axajInd = 0;
     setTimeout(() => {
       lodingDom.style.opacity = 0;
       lodingDom.style.pointerEvents = "none";