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