|
@@ -1,12 +1,14 @@
|
|
import AuthButton from "@/components/AuthButton";
|
|
import AuthButton from "@/components/AuthButton";
|
|
import BreadTit from "@/components/BreadTit";
|
|
import BreadTit from "@/components/BreadTit";
|
|
import history, { urlParameter } from "@/utils/history";
|
|
import history, { urlParameter } from "@/utils/history";
|
|
-import { Input, message, Select, Image, Table, Popconfirm } from "antd";
|
|
|
|
|
|
+import { Input, message, Select, Table, Popconfirm, Image } from "antd";
|
|
import TextArea from "antd/es/input/TextArea";
|
|
import TextArea from "antd/es/input/TextArea";
|
|
-import React, { useEffect, useMemo, useState } from "react";
|
|
|
|
|
|
+import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
import { useLocation } from "react-router-dom";
|
|
import { useLocation } from "react-router-dom";
|
|
-import imgErr from "@/assets/img/login/imgErr.png";
|
|
|
|
|
|
+import imgErr from "@/assets/img/login/IMGerror.png";
|
|
import styles from "./index.module.scss";
|
|
import styles from "./index.module.scss";
|
|
|
|
+import ObjectAdd from "@/components/ObjectAdd";
|
|
|
|
+import ImageLazy from "@/components/ImageLazy/index";
|
|
function AddObject1() {
|
|
function AddObject1() {
|
|
// 获取地址栏参数
|
|
// 获取地址栏参数
|
|
const location = useLocation();
|
|
const location = useLocation();
|
|
@@ -45,7 +47,11 @@ function AddObject1() {
|
|
|
|
|
|
// 点击删除
|
|
// 点击删除
|
|
const delTableListFu = () => {
|
|
const delTableListFu = () => {
|
|
- console.log("删除");
|
|
|
|
|
|
+ console.log("多个删除", tableSelectList);
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const delOne = (id: number) => {
|
|
|
|
+ console.log("单个删除", id);
|
|
};
|
|
};
|
|
|
|
|
|
const rowSelection = {
|
|
const rowSelection = {
|
|
@@ -54,27 +60,33 @@ function AddObject1() {
|
|
},
|
|
},
|
|
};
|
|
};
|
|
|
|
|
|
- const [results, setResults] = useState([
|
|
|
|
- {
|
|
|
|
- id: 1,
|
|
|
|
- name: "图片1",
|
|
|
|
- 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", img: "" },
|
|
|
|
- { id: 3, name: "图片3", img: "" },
|
|
|
|
- { id: 4, name: "图片4", img: "" },
|
|
|
|
- { id: 5, name: "图片4", img: "" },
|
|
|
|
- { id: 6, name: "图片4", img: "" },
|
|
|
|
- { id: 7, name: "图片4", img: "" },
|
|
|
|
- { id: 8, name: "图片4", img: "" },
|
|
|
|
- { id: 9, name: "图片4", img: "" },
|
|
|
|
- { id: 10, name: "图片4", img: "" },
|
|
|
|
- {
|
|
|
|
- id: 11,
|
|
|
|
- name: "图片4",
|
|
|
|
- img: "https://ts1.cn.mm.bing.net/th/id/R-C.3745122e5760fe2283195293d76bc1e0?rik=YBMOcCcn7CX6Ig&riu=http%3a%2f%2fup.deskcity.org%2fpic%2f20%2fe4%2f4d%2f20e44dce0fe116832ba890edaf2ede32.jpg&ehk=vldj1pqTKyKgirU8ck%2f%2bJWEhtPm22Owe5VEmGNMeLpA%3d&risl=&pid=ImgRaw&r=0",
|
|
|
|
- },
|
|
|
|
- ]);
|
|
|
|
|
|
+ const results = useMemo(() => {
|
|
|
|
+ return [
|
|
|
|
+ {
|
|
|
|
+ id: 1,
|
|
|
|
+ name: "图片1",
|
|
|
|
+ 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", img: "https://ts1.cn.mm" },
|
|
|
|
+ {
|
|
|
|
+ id: 3,
|
|
|
|
+ name: "图片3",
|
|
|
|
+ img: "http://project.4dage.com:8016/content/1_1001/img/20220810_1553241331042.JPG",
|
|
|
|
+ },
|
|
|
|
+ { id: 4, name: "图片4", img: "3" },
|
|
|
|
+ { id: 5, name: "图片4", img: "4" },
|
|
|
|
+ { id: 6, name: "图片4", img: "5" },
|
|
|
|
+ { id: 7, name: "图片4", img: "6" },
|
|
|
|
+ { id: 8, name: "图片4", img: "7" },
|
|
|
|
+ { id: 9, name: "图片4", img: "8" },
|
|
|
|
+ { id: 10, name: "图片4", img: "9" },
|
|
|
|
+ {
|
|
|
|
+ id: 11,
|
|
|
|
+ name: "图片4",
|
|
|
|
+ img: "https://ts1.cn.mm.bing.net/th/id/R-C.3745122e5760fe2283195293d76bc1e0?rik=YBMOcCcn7CX6Ig&riu=http%3a%2f%2fup.deskcity.org%2fpic%2f20%2fe4%2f4d%2f20e44dce0fe116832ba890edaf2ede32.jpg&ehk=vldj1pqTKyKgirU8ck%2f%2bJWEhtPm22Owe5VEmGNMeLpA%3d&risl=&pid=ImgRaw&r=0",
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+ }, []);
|
|
|
|
|
|
const columns = useMemo(() => {
|
|
const columns = useMemo(() => {
|
|
return [
|
|
return [
|
|
@@ -82,13 +94,13 @@ function AddObject1() {
|
|
title: "缩略图",
|
|
title: "缩略图",
|
|
render: (item: any) => (
|
|
render: (item: any) => (
|
|
<div className="tableImg">
|
|
<div className="tableImg">
|
|
- <Image
|
|
|
|
|
|
+ <ImageLazy width={120} height={70} src={item.img} />
|
|
|
|
+ {/* <Image
|
|
|
|
+ src={item.img}
|
|
width={120}
|
|
width={120}
|
|
height={70}
|
|
height={70}
|
|
placeholder={true}
|
|
placeholder={true}
|
|
- fallback={imgErr}
|
|
|
|
- src={item.img}
|
|
|
|
- />
|
|
|
|
|
|
+ /> */}
|
|
</div>
|
|
</div>
|
|
),
|
|
),
|
|
},
|
|
},
|
|
@@ -100,17 +112,23 @@ function AddObject1() {
|
|
title: "操作",
|
|
title: "操作",
|
|
render: (item: any) => (
|
|
render: (item: any) => (
|
|
<>
|
|
<>
|
|
- <AuthButton type="text" danger>
|
|
|
|
|
|
+ <AuthButton type="text" danger onClick={() => addPageFu(item.id)}>
|
|
编辑
|
|
编辑
|
|
</AuthButton>
|
|
</AuthButton>
|
|
- <AuthButton type="text" danger>
|
|
|
|
- 删除
|
|
|
|
- </AuthButton>
|
|
|
|
|
|
+ <Popconfirm
|
|
|
|
+ title="确定删除吗?"
|
|
|
|
+ okText="确定"
|
|
|
|
+ cancelText="取消"
|
|
|
|
+ onConfirm={() => delOne(item.id)}
|
|
|
|
+ >
|
|
|
|
+ <AuthButton type="text" danger>
|
|
|
|
+ 删除
|
|
|
|
+ </AuthButton>
|
|
|
|
+ </Popconfirm>
|
|
</>
|
|
</>
|
|
),
|
|
),
|
|
},
|
|
},
|
|
];
|
|
];
|
|
- // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
// 点击返回
|
|
// 点击返回
|
|
@@ -128,6 +146,18 @@ function AddObject1() {
|
|
// cancelFu()
|
|
// cancelFu()
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ // 点击添加或者编辑出来页面
|
|
|
|
+ const [addPage, setAddPage] = useState(false);
|
|
|
|
+
|
|
|
|
+ // 点击添加或者编辑
|
|
|
|
+
|
|
|
|
+ const addId = useRef<any>(null);
|
|
|
|
+
|
|
|
|
+ const addPageFu = (id?: any) => {
|
|
|
|
+ addId.current = id;
|
|
|
|
+ setAddPage(true);
|
|
|
|
+ };
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<div className={styles.AddObject1}>
|
|
<div className={styles.AddObject1}>
|
|
<div className="breadTit">
|
|
<div className="breadTit">
|
|
@@ -188,7 +218,8 @@ function AddObject1() {
|
|
<div className="addTableBox_Tit">
|
|
<div className="addTableBox_Tit">
|
|
<div className="addTableBox_TitL">藏品信息</div>
|
|
<div className="addTableBox_TitL">藏品信息</div>
|
|
<div className="addTableBox_TitR">
|
|
<div className="addTableBox_TitR">
|
|
- <AuthButton>添加</AuthButton> 
|
|
|
|
|
|
+ <AuthButton onClick={() => addPageFu(null)}>添加</AuthButton>
|
|
|
|
+  
|
|
<Popconfirm
|
|
<Popconfirm
|
|
title="确定删除吗?"
|
|
title="确定删除吗?"
|
|
okText="确定"
|
|
okText="确定"
|
|
@@ -224,6 +255,10 @@ function AddObject1() {
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ {/* 点击添加或者编辑出来的页面 */}
|
|
|
|
+ {addPage ? (
|
|
|
|
+ <ObjectAdd id={addId.current} colsePage={() => setAddPage(false)} />
|
|
|
|
+ ) : null}
|
|
</div>
|
|
</div>
|
|
);
|
|
);
|
|
}
|
|
}
|