|
|
@@ -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
|