|
@@ -3,6 +3,7 @@ import {
|
|
Button,
|
|
Button,
|
|
Checkbox,
|
|
Checkbox,
|
|
Form,
|
|
Form,
|
|
|
|
+ FormInstance,
|
|
Input,
|
|
Input,
|
|
Popconfirm,
|
|
Popconfirm,
|
|
Radio,
|
|
Radio,
|
|
@@ -38,6 +39,7 @@ import {
|
|
import { baseURL } from "@/utils/http";
|
|
import { baseURL } from "@/utils/http";
|
|
import { FileListType, GoodsTableType } from "@/types";
|
|
import { FileListType, GoodsTableType } from "@/types";
|
|
import { domShowFu, progressDomFu } from "@/utils/domShow";
|
|
import { domShowFu, progressDomFu } from "@/utils/domShow";
|
|
|
|
+import { CheckboxValueType } from "antd/es/checkbox/Group";
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
id: number;
|
|
id: number;
|
|
@@ -48,8 +50,23 @@ type Props = {
|
|
|
|
|
|
function GoodsAdd({ id, closeMoalFu, addListFu, editListFu }: Props) {
|
|
function GoodsAdd({ id, closeMoalFu, addListFu, editListFu }: Props) {
|
|
// 后面添加的的知识驿站
|
|
// 后面添加的的知识驿站
|
|
|
|
+ const valueZS1Info = useMemo(() => {
|
|
|
|
+ return ["军事", "历史", "人物", "科学", "教育", "经济"];
|
|
|
|
+ }, []);
|
|
|
|
+
|
|
const [valueZS1, setValueZS1] = useState("");
|
|
const [valueZS1, setValueZS1] = useState("");
|
|
- const [valueZS2, setValueZS2] = useState<any>([]);
|
|
|
|
|
|
+ // 取消选中
|
|
|
|
+ const valueZS1Close = useCallback(
|
|
|
|
+ (item: string) => {
|
|
|
|
+ if (item === valueZS1) {
|
|
|
|
+ setValueZS1("");
|
|
|
|
+ setValueZS2([]);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ [valueZS1]
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+ const [valueZS2, setValueZS2] = useState<CheckboxValueType[]>([]);
|
|
|
|
|
|
// 上传附件的信息
|
|
// 上传附件的信息
|
|
const [fileList, setFileList] = useState({
|
|
const [fileList, setFileList] = useState({
|
|
@@ -60,14 +77,14 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu }: Props) {
|
|
});
|
|
});
|
|
|
|
|
|
// 表单的ref
|
|
// 表单的ref
|
|
- const FormBoxRef = useRef<any>({});
|
|
|
|
|
|
+ const FormBoxRef = useRef<FormInstance>(null);
|
|
|
|
|
|
// 文件的dirCode码
|
|
// 文件的dirCode码
|
|
const [dirCode, setDirCode] = useState("");
|
|
const [dirCode, setDirCode] = useState("");
|
|
|
|
|
|
const getInfoInAPIFu = useCallback(async (id: number) => {
|
|
const getInfoInAPIFu = useCallback(async (id: number) => {
|
|
const res = await getGoodsInfoByIdAPI(id);
|
|
const res = await getGoodsInfoByIdAPI(id);
|
|
- FormBoxRef.current.setFieldsValue(res.data.entity);
|
|
|
|
|
|
+ FormBoxRef.current?.setFieldsValue(res.data.entity);
|
|
setCover(res.data.entity.thumb);
|
|
setCover(res.data.entity.thumb);
|
|
|
|
|
|
if (res.data.entity.type) setTypeCheck(res.data.entity.type.split(","));
|
|
if (res.data.entity.type) setTypeCheck(res.data.entity.type.split(","));
|
|
@@ -96,7 +113,7 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu }: Props) {
|
|
if (id > 0) getInfoInAPIFu(id);
|
|
if (id > 0) getInfoInAPIFu(id);
|
|
else {
|
|
else {
|
|
setDirCode(Date.now() + "");
|
|
setDirCode(Date.now() + "");
|
|
- FormBoxRef.current.setFieldsValue({
|
|
|
|
|
|
+ FormBoxRef.current?.setFieldsValue({
|
|
topic: "不展示",
|
|
topic: "不展示",
|
|
display: 1,
|
|
display: 1,
|
|
isBarrage: 0,
|
|
isBarrage: 0,
|
|
@@ -826,24 +843,22 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu }: Props) {
|
|
<div className="myformBox">
|
|
<div className="myformBox">
|
|
<div className="label">知识驿站:</div>
|
|
<div className="label">知识驿站:</div>
|
|
<div className="laseFormRight">
|
|
<div className="laseFormRight">
|
|
- <div className="laseFormRightRow">
|
|
|
|
|
|
+ <div className="laseFormRightRow laseFormRightRow1">
|
|
<div className="laseFormRightLabel">类别标签:</div>
|
|
<div className="laseFormRightLabel">类别标签:</div>
|
|
<Radio.Group
|
|
<Radio.Group
|
|
onChange={(e) => setValueZS1(e.target.value)}
|
|
onChange={(e) => setValueZS1(e.target.value)}
|
|
value={valueZS1}
|
|
value={valueZS1}
|
|
>
|
|
>
|
|
- <Radio value={"军事"}>军事</Radio>
|
|
|
|
- <Radio value={"历史"}>历史</Radio>
|
|
|
|
- <Radio value={"人物"}>人物</Radio>
|
|
|
|
- <Radio value={"科学"}>科学</Radio>
|
|
|
|
- <Radio value={"教育"}>教育</Radio>
|
|
|
|
- <Radio value={"经济"}>经济</Radio>
|
|
|
|
|
|
+ {valueZS1Info.map((v) => (
|
|
|
|
+ <Radio key={v} value={v} onClick={() => valueZS1Close(v)}>
|
|
|
|
+ {v}
|
|
|
|
+ </Radio>
|
|
|
|
+ ))}
|
|
</Radio.Group>
|
|
</Radio.Group>
|
|
</div>
|
|
</div>
|
|
<div className="laseFormRightTit">
|
|
<div className="laseFormRightTit">
|
|
如需文物关联知识驿站,请至少标注类别标签
|
|
如需文物关联知识驿站,请至少标注类别标签
|
|
</div>
|
|
</div>
|
|
- <br />
|
|
|
|
<div className="laseFormRightRow">
|
|
<div className="laseFormRightRow">
|
|
<div className="laseFormRightLabel">国家标签:</div>
|
|
<div className="laseFormRightLabel">国家标签:</div>
|
|
<Checkbox.Group
|
|
<Checkbox.Group
|