import { Button, Cascader, Form, Input, InputNumber, message, Modal, Select, } from "antd"; import React, { useRef, useState } from "react"; import styles from "./index.module.scss"; import classNames from "classnames"; import "./index.css"; import { useSelector } from "react-redux"; import { RootState } from "@/store"; const { Option } = Select; type Props = { id: any; colsePage: any; }; function ObjectAdd({ id, colsePage }: Props) { // 没有通过校验 const onFinishFailed = () => { return message.warning("有表单不符号规则!"); }; // 通过校验之后发送请求 const onFinish = async (values: any) => { console.log("具体质量的单位", danweiValue); console.log("--点击确定存到仓库", values); }; // 选择商品信息还是附近(默认商品信息) const [titSelect, setTitSelect] = useState("tit1"); // 从仓库中获取各下拉数据 const options1 = useSelector( (state: RootState) => state.loginStore.selectAll["藏品编号名称"] ); const options2 = useSelector( (state: RootState) => state.loginStore.selectAll["年代"] ); const options3 = useSelector( (state: RootState) => state.loginStore.selectAll["质地"] ); const options4 = useSelector( (state: RootState) => state.loginStore.selectAll["文物类别"] ); const options5 = useSelector( (state: RootState) => state.loginStore.selectAll["文物级别"] ); const options6 = useSelector( (state: RootState) => state.loginStore.selectAll["质量范围"] ); const options7 = useSelector( (state: RootState) => state.loginStore.selectAll["完残程度"] ); const options8 = useSelector( (state: RootState) => state.loginStore.selectAll["保存状态"] ); // 单位选择 const [danweiValue, setDanweiValue] = useState("kg"); // 设置表单初始数据(区分编辑和新增) const defaultData = useRef(null); if (id) { defaultData.current = { name1: "编辑", name3: "索书号", name5: ["其他"], }; } else { defaultData.current = { name3: options1[0].name ? options1[0].name : null, name5: ["地质年代", "显生宙", "新生代", "第四纪"], name6: ["单一质地", "有机质", "竹"], name8: options4[0].name ? options4[0].name : null, name10: options5[0].name ? options5[0].name : null, name15: options6[0].name ? options6[0].name : null, name17: options7[0].name ? options7[0].name : null, }; } return (
{/* 商品信息和附件切换 */}
setTitSelect("tit1")} className={classNames(titSelect === "tit1" ? "active" : "")} > 商品信息
setTitSelect("tit2")} className={classNames( "ObjectAddTitTow", titSelect === "tit2" ? "active" : "" )} > 附件
*
*
*
*
({ label: v.name, value: v.name, }))} />
*
} /> {/*
*/}
*
({ label: v.name, value: v.name, }))} />

); } const MemoObjectAdd = React.memo(ObjectAdd); export default MemoObjectAdd;