shaogen1995 2 rokov pred
rodič
commit
0b115f80c5

+ 0 - 53
src/pages/A2Goods/A2Register/A2CancelModal/index.module.scss

@@ -1,53 +0,0 @@
-.A2CancelModal {
-  :global {
-    .ant-modal-close {
-      display: none;
-    }
-
-    .ant-modal {
-      width: 1000px !important;
-    }
-
-    .A2Cmain {
-      padding-top: 20px;
-      border-top: 1px solid #ccc;
-
-      .A2Cinput {
-        display: flex;
-      }
-
-      .A2Ctit {
-        font-size: 14px;
-        color: #999;
-        margin: 8px 0 5px;
-
-        &>span {
-          color: var(--themeColor);
-        }
-      }
-
-      .A2Ctable {
-        margin-top: 15px;
-
-        .ant-table-body {
-          max-height: 400px;
-          min-height: 100px;
-          overflow-y: auto !important;
-          overflow-y: overlay !important;
-        }
-
-        .ant-table-cell {
-          text-align: center !important;
-        }
-        .ant-btn-text {
-          color: var(--themeColor);
-        }
-      }
-
-      .A2Cbtn {
-        margin-top: 20px;
-        text-align: center;
-      }
-    }
-  }
-}

+ 72 - 0
src/pages/A2Goods/A2Register/A2SelectModal/index.module.scss

@@ -0,0 +1,72 @@
+.A2SelectModal {
+  :global {
+
+    .A2Stit {
+      font-size: 14px;
+      color: #999;
+    }
+
+    .ant-modal-close {
+      display: none;
+    }
+
+    .ant-modal {
+      width: 1400px !important;
+    }
+
+    .A2Cmain {
+      padding-top: 20px;
+      border-top: 1px solid #ccc;
+
+      .A2Cinput {
+        display: flex;
+      }
+
+.A2CtableBox{
+  display: flex;
+  .A2Ctable {
+    width: calc(50% - 10px);
+    margin-top: 10px;
+    border: 1px solid #ccc;
+    padding: 10px;
+
+    &:nth-of-type(2){
+      margin-left: 20px;
+    }
+
+    .A2Ctit {
+      font-size: 14px;
+      color: #999;
+      margin-bottom: 5px;
+      &>span {
+        color: var(--themeColor);
+      }
+    }
+
+
+    .ant-table-body {
+      max-height: 400px;
+      min-height: 100px;
+      overflow-y: auto !important;
+      overflow-y: overlay !important;
+    }
+
+    .ant-table-cell {
+      text-align: center !important;
+    }
+
+    .ant-btn-text {
+      color: var(--themeColor);
+    }
+  }
+}
+
+ 
+
+      .A2Cbtn {
+        margin-top: 20px;
+        text-align: center;
+      }
+    }
+  }
+}

+ 55 - 23
src/pages/A2Goods/A2Register/A2CancelModal/index.tsx

@@ -1,7 +1,12 @@
 import React, { useCallback, useEffect, useMemo, useState } from "react";
 import styles from "./index.module.scss";
 import { Button, Input, Modal, Popconfirm, Table } from "antd";
-import { statusTxtObj, storageStatusTxtObj } from "../../data";
+import {
+  A2GoodObjTit,
+  A2GoodObjTxt,
+  statusTxtObj,
+  storageStatusTxtObj,
+} from "../../data";
 import { A2tableType } from "@/types";
 import { A2_APIresList } from "@/store/action/A2Goods";
 import { MessageFu } from "@/utils/message";
@@ -10,9 +15,10 @@ type Props = {
   oldList: A2tableType[]; //外层的表格数据,用来和 isAcList  同步
   upTableFu: (itemArr: A2tableType[]) => void;
   closeFu: () => void;
+  myType: "ZX" | "RK" | "YK" | "CK";
 };
 
-function A2CancelModal({ oldList, upTableFu, closeFu }: Props) {
+function A2SelectModal({ oldList, upTableFu, closeFu, myType }: Props) {
   // 搜索框
   const [txt, setTxt] = useState("");
   const [txtRes, setTxtRes] = useState("");
@@ -24,7 +30,7 @@ function A2CancelModal({ oldList, upTableFu, closeFu }: Props) {
   const [list, setList] = useState<A2tableType[]>([]);
 
   useEffect(() => {
-    if (!txtRes) setList([]);
+    if (!txtRes) setList(listAll);
     else
       setList(
         listAll.filter((v) => v.name.includes(txtRes) || v.num.includes(txtRes))
@@ -106,9 +112,16 @@ function A2CancelModal({ oldList, upTableFu, closeFu }: Props) {
 
   return (
     <Modal
-      wrapClassName={styles.A2CancelModal}
+      wrapClassName={styles.A2SelectModal}
       open={true}
-      title="添加注销藏品"
+      title={
+        <>
+          添加藏品 - {Reflect.get(A2GoodObjTxt, myType)}&emsp;
+          <span className="A2Stit">
+            仅支持添加状态为 [已登记] {Reflect.get(A2GoodObjTit, myType)} 的藏品
+          </span>
+        </>
+      }
       footer={
         [] // 设置footer为空,去掉 取消 确定默认按钮
       }
@@ -129,22 +142,41 @@ function A2CancelModal({ oldList, upTableFu, closeFu }: Props) {
           </Button>
         </div>
 
-        {/* 提示语 */}
-        <div className="A2Ctit">
-          当前已添加 &nbsp;<span>{isAcList.length}</span>
-          &nbsp;个。仅支持添加状态为[已登记][未入库/已入库/已出库]的藏品
-        </div>
-
-        {/* 表格主体 */}
-        <div className="A2Ctable">
-          <Table
-            size="small"
-            scroll={{ y: 400 }}
-            dataSource={list}
-            columns={columns}
-            rowKey="id"
-            pagination={false}
-          />
+        <div className="A2CtableBox">
+          {/* 左边的未选中的表格 */}
+          <div className="A2Ctable">
+            <div className="A2Ctit">
+              共计&nbsp;<span>{listAll.length}</span>
+              &nbsp;个藏品。
+            </div>
+
+            <Table
+              size="small"
+              scroll={{ y: 400 }}
+              dataSource={list.filter(
+                (v) => !isAcList.map((c) => c.id).includes(v.id)
+              )}
+              columns={columns}
+              rowKey="id"
+              pagination={false}
+            />
+          </div>
+          {/* 右边表格 */}
+          <div className="A2Ctable">
+            <div className="A2Ctit">
+              已添加&nbsp;<span>{isAcList.length}</span>
+              &nbsp;个藏品。
+            </div>
+
+            <Table
+              size="small"
+              scroll={{ y: 400 }}
+              dataSource={isAcList}
+              columns={columns}
+              rowKey="id"
+              pagination={false}
+            />
+          </div>
         </div>
 
         {/* 按钮 */}
@@ -176,6 +208,6 @@ function A2CancelModal({ oldList, upTableFu, closeFu }: Props) {
   );
 }
 
-const MemoA2CancelModal = React.memo(A2CancelModal);
+const MemoA2SelectModal = React.memo(A2SelectModal);
 
-export default MemoA2CancelModal;
+export default MemoA2SelectModal;

+ 4 - 4
src/pages/A2Goods/A2Register/index.tsx

@@ -19,19 +19,18 @@ import {
 import history from "@/utils/history";
 import { A2tableType } from "@/types";
 import ZlistTable from "@/components/ZlistTable";
-import A2CancelModal from "./A2CancelModal";
 import B1Look from "@/pages/B1Submit/B1Look";
+import A2SelectModal from "./A2SelectModal";
 
 type Props = {
   closeFu: () => void;
-  upInfoFu: () => void;
   outInfo: A2addInfoType;
   myType: "DJ" | "ZX";
   // 从藏品查看页面点击注销进来
   isLookItem?: A2tableType;
 };
 
-function A2Register({ closeFu, outInfo, upInfoFu, myType, isLookItem }: Props) {
+function A2Register({ closeFu, outInfo, myType, isLookItem }: Props) {
   // 从 藏品查看也进来,直接把这条藏品信息添加到表格
   useEffect(() => {
     if (isLookItem && isLookItem.id) setTableList([isLookItem]);
@@ -222,10 +221,11 @@ function A2Register({ closeFu, outInfo, upInfoFu, myType, isLookItem }: Props) {
               upTableFu={(item, flag) => addOrEditSuccFu(item, flag)}
             />
           ) : (
-            <A2CancelModal
+            <A2SelectModal
               oldList={tableList}
               closeFu={() => setAddInfo({ id: 0, txt: "" })}
               upTableFu={(itemArr) => setTableList(itemArr)}
+              myType='ZX'
             />
           )}
         </>

+ 15 - 0
src/pages/A2Goods/data.ts

@@ -103,3 +103,18 @@ export const storageStatusTxtObj = {
   3: "出库中",
   4: "移库中",
 };
+
+
+export const A2GoodObjTxt = {
+  ZX: "注销",
+  RK: "入库",
+  YK: "移库",
+  CK: "出库",
+};
+
+export const A2GoodObjTit = {
+  ZX: "[未入库]",
+  RK: "[未入库]",
+  YK: "[已入库]",
+  CK: "[已入库]",
+};

+ 0 - 1
src/pages/A2Goods/index.tsx

@@ -256,7 +256,6 @@ function A2Goods() {
         <A2Register
           closeFu={() => setOutInfo({ id: 0, txt: "" })}
           outInfo={outInfo}
-          upInfoFu={() => {}}
           myType={outType}
         />
       ) : null}

+ 55 - 61
src/pages/B1Submit/B1Info/index.tsx

@@ -35,71 +35,66 @@ function B1Info({ closeFu, lookId, pageKey, upTableFu }: Props) {
   // 藏品编辑的id存储
   const oldToNewId = useRef(0);
 
-  const getInfoFu = useCallback(
-    async (id: number, flag?: boolean) => {
-      const res = await A2_APIgetInfo(id);
-      if (res.code === 0) {
-        if (res.data.entity.type === "BJ") {
-          // 藏品编辑的信息,特殊处理
-          let oldTxt = "{}";
-          let newTxt = "{}";
-          if (res.data.edit) {
-            if (res.data.edit.beforeGoods) oldTxt = res.data.edit.beforeGoods;
-            if (res.data.edit.afterGoods) newTxt = res.data.edit.afterGoods;
-          }
+  const getInfoFu = useCallback(async (id: number) => {
+    const res = await A2_APIgetInfo(id);
+    if (res.code === 0) {
+      if (res.data.entity.type === "BJ") {
+        // 藏品编辑的信息,特殊处理
+        let oldTxt = "{}";
+        let newTxt = "{}";
+        if (res.data.edit) {
+          if (res.data.edit.beforeGoods) oldTxt = res.data.edit.beforeGoods;
+          if (res.data.edit.afterGoods) newTxt = res.data.edit.afterGoods;
+        }
 
-          const oldObj = JSON.parse(oldTxt);
-          const newObj = JSON.parse(newTxt);
-
-          // 把 这个 单个藏品的id 存起来 用于 审批失败的 编辑按钮
-          oldToNewId.current = oldObj.id;
-
-          const tempArr = [] as B1EditTable[];
-
-          for (const k in newObj) {
-            if (k !== "id" && k !== "fileIds") {
-              const txt = Reflect.get(B1EditKeyObj, k);
-              let oldValue = Reflect.get(oldObj, k);
-              let newValue = Reflect.get(newObj, k);
-
-              if (k === "size") {
-                // 尺寸信息的处理
-                const arr1 = oldValue
-                  .split(",")
-                  .map((v: string) => v.replace(" ", ""));
-                oldValue = `长:${arr1[0] || "-"} 宽:${arr1[1] || "-"} 高:${
-                  arr1[2] || "-"
-                } `;
-                const arr2 = newValue
-                  .split(",")
-                  .map((v: string) => v.replace(" ", ""));
-                newValue = `长:${arr2[0] || "-"} 宽:${arr2[1] || "-"} 高:${
-                  arr2[2] || "-"
-                } `;
-              }
-
-              tempArr.push({
-                id: newObj.id + txt,
-                txt,
-                oldValue: oldValue || "(空)",
-                newValue: newValue || "(空)",
-                type: txt === "封面图" ? "img" : "",
-              } as B1EditTable);
+        const oldObj = JSON.parse(oldTxt);
+        const newObj = JSON.parse(newTxt);
+
+        // 把 这个 单个藏品的id 存起来 用于 审批失败的 编辑按钮
+        oldToNewId.current = oldObj.id;
+
+        const tempArr = [] as B1EditTable[];
+
+        for (const k in newObj) {
+          if (k !== "id" && k !== "fileIds") {
+            const txt = Reflect.get(B1EditKeyObj, k);
+            let oldValue = Reflect.get(oldObj, k);
+            let newValue = Reflect.get(newObj, k);
+
+            if (k === "size") {
+              // 尺寸信息的处理
+              const arr1 = oldValue
+                .split(",")
+                .map((v: string) => v.replace(" ", ""));
+              oldValue = `长:${arr1[0] || "-"} 宽:${arr1[1] || "-"} 高:${
+                arr1[2] || "-"
+              } `;
+              const arr2 = newValue
+                .split(",")
+                .map((v: string) => v.replace(" ", ""));
+              newValue = `长:${arr2[0] || "-"} 宽:${arr2[1] || "-"} 高:${
+                arr2[2] || "-"
+              } `;
             }
-          }
 
-          setTableListByEdit(tempArr);
-        } else {
-          // 除了藏品编辑之外的表格数据
-          setTableList(res.data.child);
+            tempArr.push({
+              id: newObj.id + txt,
+              txt,
+              oldValue: oldValue || "(空)",
+              newValue: newValue || "(空)",
+              type: txt === "封面图" ? "img" : "",
+            } as B1EditTable);
+          }
         }
-        setInfo(res.data.entity);
-        // 通知 列表 页面 更新
-        if (flag) upTableFu();
+
+        setTableListByEdit(tempArr);
+      } else {
+        // 除了藏品编辑之外的表格数据
+        setTableList(res.data.child);
       }
-    },
-    [upTableFu]
-  );
+      setInfo(res.data.entity);
+    }
+  }, []);
 
   useEffect(() => {
     getInfoFu(lookId);
@@ -388,7 +383,6 @@ function B1Info({ closeFu, lookId, pageKey, upTableFu }: Props) {
           <A2Register
             closeFu={() => setOutInfo({ id: 0, txt: "" })}
             outInfo={outInfo}
-            upInfoFu={() => getInfoFu(info.id, true)}
             myType={info.type}
           />
         ) : null

+ 0 - 1
src/pages/B1Submit/B1Look/index.tsx

@@ -302,7 +302,6 @@ function B1Look({ closeFu, goodsId, isCance }: Props) {
       {btnKey.txt === "注销" ? (
         <A2Register
           outInfo={{ id: btnKey.id, txt: "新增" }}
-          upInfoFu={() => {}}
           closeFu={() => setBtnKey({ id: 0, txt: "" })}
           myType="ZX"
           // 把这一条藏品信息传进去