|
|
@@ -1,5 +1,5 @@
|
|
|
import store, { RootState } from "@/store";
|
|
|
-import { Button, Checkbox, Form, Input, Popconfirm, Select } from "antd";
|
|
|
+import { Button, Checkbox, Form, FormInstance, Input, Popconfirm, Select } from "antd";
|
|
|
import React, {
|
|
|
useCallback,
|
|
|
useEffect,
|
|
|
@@ -46,14 +46,14 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu }: Props) {
|
|
|
});
|
|
|
|
|
|
// 表单的ref
|
|
|
- const FormBoxRef = useRef<any>({});
|
|
|
+ const FormBoxRef = useRef<FormInstance>(null);
|
|
|
|
|
|
// 文件的dirCode码
|
|
|
const [dirCode, setDirCode] = useState("");
|
|
|
|
|
|
const getInfoInAPIFu = useCallback(async (id: number) => {
|
|
|
const res = await getGoodsInfoByIdAPI(id);
|
|
|
- FormBoxRef.current.setFieldsValue(res.data.entity);
|
|
|
+ FormBoxRef.current?.setFieldsValue(res.data.entity);
|
|
|
setCover(res.data.entity.thumb);
|
|
|
|
|
|
if (res.data.entity.type) setTypeCheck(res.data.entity.type.split(","));
|
|
|
@@ -78,7 +78,7 @@ function GoodsAdd({ id, closeMoalFu, addListFu, editListFu }: Props) {
|
|
|
if (id > 0) getInfoInAPIFu(id);
|
|
|
else {
|
|
|
setDirCode(Date.now() + "");
|
|
|
- FormBoxRef.current.setFieldsValue({
|
|
|
+ FormBoxRef.current?.setFieldsValue({
|
|
|
display: 1,
|
|
|
});
|
|
|
}
|