|
|
@@ -19,15 +19,24 @@ 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";
|
|
|
|
|
|
type Props = {
|
|
|
closeFu: () => void;
|
|
|
upInfoFu: () => void;
|
|
|
outInfo: A2addInfoType;
|
|
|
- type: "DJ" | "ZX";
|
|
|
+ myType: "DJ" | "ZX";
|
|
|
+ // 从藏品查看页面点击注销进来
|
|
|
+ isLookItem?: A2tableType;
|
|
|
};
|
|
|
|
|
|
-function A2Register({ closeFu, outInfo, upInfoFu, type }: Props) {
|
|
|
+function A2Register({ closeFu, outInfo, upInfoFu, myType, isLookItem }: Props) {
|
|
|
+ // 从 藏品查看也进来,直接把这条藏品信息添加到表格
|
|
|
+ useEffect(() => {
|
|
|
+ if (isLookItem && isLookItem.id) setTableList([isLookItem]);
|
|
|
+ }, [isLookItem]);
|
|
|
+
|
|
|
// 记录删除了的所有id集合
|
|
|
const delIdArr = useRef<number[]>([]);
|
|
|
|
|
|
@@ -63,7 +72,7 @@ function A2Register({ closeFu, outInfo, upInfoFu, type }: Props) {
|
|
|
description: topValue,
|
|
|
goodsIds: tableList.map((v) => v.id).join(","),
|
|
|
status,
|
|
|
- type: "DJ",
|
|
|
+ type: myType,
|
|
|
};
|
|
|
|
|
|
const res1 = await A2_APIaddWai(obj);
|
|
|
@@ -74,29 +83,41 @@ function A2Register({ closeFu, outInfo, upInfoFu, type }: Props) {
|
|
|
}
|
|
|
|
|
|
if (res1.code === 0) {
|
|
|
- MessageFu.success(`${outInfo.txt}成功!`);
|
|
|
+ MessageFu.success(`操作成功!`);
|
|
|
if (window.location.hash.includes("/submit")) {
|
|
|
- upInfoFu();
|
|
|
- closeFu();
|
|
|
+ history.replace("/404");
|
|
|
+ window.setTimeout(() => {
|
|
|
+ history.push("/submit");
|
|
|
+ }, 200);
|
|
|
} else history.push("/submit");
|
|
|
}
|
|
|
},
|
|
|
- [closeFu, outInfo.id, outInfo.txt, tableList, topValue, upInfoFu]
|
|
|
+ [myType, outInfo.id, outInfo.txt, tableList, topValue]
|
|
|
);
|
|
|
|
|
|
+ // 点击表格的查看
|
|
|
+ const [lookId, setLookId] = useState(0);
|
|
|
+
|
|
|
// 表格的操作模块的列
|
|
|
const listTableBtn = useMemo(() => {
|
|
|
return {
|
|
|
title: "操作",
|
|
|
render: (item: A2tableType) => (
|
|
|
<>
|
|
|
- <Button
|
|
|
- size="small"
|
|
|
- type="text"
|
|
|
- onClick={() => setAddInfo({ id: item.id, txt: "编辑" })}
|
|
|
- >
|
|
|
- 编辑
|
|
|
- </Button>
|
|
|
+ {myType === "DJ" ? (
|
|
|
+ <Button
|
|
|
+ size="small"
|
|
|
+ type="text"
|
|
|
+ onClick={() => setAddInfo({ id: item.id, txt: "编辑" })}
|
|
|
+ >
|
|
|
+ 编辑
|
|
|
+ </Button>
|
|
|
+ ) : (
|
|
|
+ <Button size="small" type="text" onClick={() => setLookId(item.id)}>
|
|
|
+ 查看
|
|
|
+ </Button>
|
|
|
+ )}
|
|
|
+
|
|
|
<Popconfirm
|
|
|
title="删除后无法恢复,是否删除?"
|
|
|
okText="删除"
|
|
|
@@ -115,7 +136,7 @@ function A2Register({ closeFu, outInfo, upInfoFu, type }: Props) {
|
|
|
</>
|
|
|
),
|
|
|
};
|
|
|
- }, [tableList]);
|
|
|
+ }, [tableList, myType]);
|
|
|
|
|
|
// 新增和编辑
|
|
|
const [addInfo, setAddInfo] = useState<A2addInfoType>({ id: 0, txt: "" });
|
|
|
@@ -134,13 +155,13 @@ function A2Register({ closeFu, outInfo, upInfoFu, type }: Props) {
|
|
|
return (
|
|
|
<div className={styles.A2Register}>
|
|
|
<div className="A2Rtop">
|
|
|
- {type === "ZX" ? (
|
|
|
+ {myType === "ZX" ? (
|
|
|
<div className="A2RtopTit">
|
|
|
注:注销后,将无法在清单中查询到此藏品;请谨慎操作
|
|
|
</div>
|
|
|
) : null}
|
|
|
<div className="A2RTitle">
|
|
|
- {type === "DJ" ? "登记申请" : "注销申请"}
|
|
|
+ {myType === "DJ" ? "登记申请" : "注销申请"}
|
|
|
</div>
|
|
|
<div className="A2Rtop1">申请说明:</div>
|
|
|
<div className="A2Rtop2">
|
|
|
@@ -194,16 +215,26 @@ function A2Register({ closeFu, outInfo, upInfoFu, type }: Props) {
|
|
|
{/* 点击新增和编辑出来的弹窗 --- 登记申请*/}
|
|
|
{addInfo.id ? (
|
|
|
<>
|
|
|
- {type === "DJ" ? (
|
|
|
+ {myType === "DJ" ? (
|
|
|
<A2AddModal
|
|
|
addInfo={addInfo}
|
|
|
closeFu={() => setAddInfo({ id: 0, txt: "" })}
|
|
|
upTableFu={(item, flag) => addOrEditSuccFu(item, flag)}
|
|
|
/>
|
|
|
- ) : null}
|
|
|
- {/* 待完善 ZX 新增 和 编辑 的页面*/}
|
|
|
+ ) : (
|
|
|
+ <A2CancelModal
|
|
|
+ oldList={tableList}
|
|
|
+ closeFu={() => setAddInfo({ id: 0, txt: "" })}
|
|
|
+ upTableFu={(itemArr) => setTableList(itemArr)}
|
|
|
+ />
|
|
|
+ )}
|
|
|
</>
|
|
|
) : null}
|
|
|
+
|
|
|
+ {/* 点击表格的查看 */}
|
|
|
+ {lookId ? (
|
|
|
+ <B1Look goodsId={lookId} closeFu={() => setLookId(0)} isCance={true} />
|
|
|
+ ) : null}
|
|
|
</div>
|
|
|
);
|
|
|
}
|