shaogen1995 2 gadi atpakaļ
vecāks
revīzija
0c84adcdd4

+ 13 - 0
package-lock.json

@@ -37,6 +37,7 @@
         "@types/history": "^5.0.0",
         "@types/react-router-dom": "^5.3.3",
         "customize-cra": "^1.0.0",
+        "default-passive-events": "^2.0.0",
         "react-app-rewired": "^2.2.1"
       }
     },
@@ -6145,6 +6146,12 @@
         "node": ">= 10"
       }
     },
+    "node_modules/default-passive-events": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmmirror.com/default-passive-events/-/default-passive-events-2.0.0.tgz",
+      "integrity": "sha512-eMtt76GpDVngZQ3ocgvRcNCklUMwID1PaNbCNxfpDXuiOXttSh0HzBbda1HU9SIUsDc02vb7g9+3I5tlqe/qMQ==",
+      "dev": true
+    },
     "node_modules/define-lazy-prop": {
       "version": "2.0.0",
       "resolved": "https://registry.npmmirror.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
@@ -21529,6 +21536,12 @@
         "execa": "^5.0.0"
       }
     },
+    "default-passive-events": {
+      "version": "2.0.0",
+      "resolved": "https://registry.npmmirror.com/default-passive-events/-/default-passive-events-2.0.0.tgz",
+      "integrity": "sha512-eMtt76GpDVngZQ3ocgvRcNCklUMwID1PaNbCNxfpDXuiOXttSh0HzBbda1HU9SIUsDc02vb7g9+3I5tlqe/qMQ==",
+      "dev": true
+    },
     "define-lazy-prop": {
       "version": "2.0.0",
       "resolved": "https://registry.npmmirror.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",

+ 1 - 0
package.json

@@ -56,6 +56,7 @@
     "@types/history": "^5.0.0",
     "@types/react-router-dom": "^5.3.3",
     "customize-cra": "^1.0.0",
+    "default-passive-events": "^2.0.0",
     "react-app-rewired": "^2.2.1"
   },
   "homepage": "."

+ 3 - 0
src/assets/styles/base.css

@@ -125,3 +125,6 @@ img{
   object-fit: cover;
 }
 
+[hidden] {
+  display: none !important;
+}

+ 3 - 2
src/components/ImageLazy/index.tsx

@@ -6,7 +6,7 @@ import imgLoding from "@/assets/img/login/loading.gif";
 import imgErr from "@/assets/img/login/IMGerror.png";
 import classNames from "classnames";
 import { EyeOutlined } from "@ant-design/icons";
-import { Image } from 'antd';
+import { Image } from "antd";
 
 type Props = {
   width?: number;
@@ -39,7 +39,8 @@ function ImageLazy({ width = 100, height = 100, src }: Props) {
       <div className="lazyBox">
         <Lazyimg
           onLoad={onLoad}
-          src={baseURL + src}
+          // src={baseURL + src}
+          src={src}
           width={width}
           height={height}
           alt=""

+ 51 - 0
src/components/ObjectAdd/index.css

@@ -27,6 +27,7 @@
   display: none;
 }
 .ObjectAdd .ant-modal {
+  top: 30px !important;
   width: 1000px !important;
 }
 .ObjectAdd .formRow {
@@ -89,3 +90,53 @@
 .ObjectAdd .formRowFull .ant-form-item .ant-select-in-form-item {
   width: 858px;
 }
+.ObjectAdd .fileBox .fileBoxRow {
+  margin-bottom: 24px;
+  display: flex;
+}
+.ObjectAdd .fileBox .fileBoxRow .fileBoxRow_tit {
+  width: 119px;
+  text-align: right;
+}
+.ObjectAdd .fileBox .fileBoxRow .fileBoxRow_r {
+  padding-left: 20px;
+  position: relative;
+}
+.ObjectAdd .fileBox .fileBoxRow .fileBoxRow_r input {
+  display: none;
+}
+.ObjectAdd .fileBox .fileBoxRow .fileBoxRow_r .fileBoxRow_up {
+  cursor: pointer;
+  font-size: 30px;
+  width: 100px;
+  height: 100px;
+  background-color: #fafafa;
+  border: 1px dashed #ccc;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+.ObjectAdd .fileBox .fileBoxRow .fileBoxRow_r .fileBoxRow_r_img {
+  width: 120px;
+  height: 120px;
+  position: relative;
+}
+.ObjectAdd .fileBox .fileBoxRow .fileBoxRow_r .fileBoxRow_r_img .clearCover {
+  cursor: pointer;
+  z-index: 10;
+  position: absolute;
+  width: 50px;
+  height: 50px;
+  top: 50%;
+  transform: translateY(-50%);
+  right: -50px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  font-size: 24px;
+}
+.ObjectAdd .fileBox .fileBoxRow .fileBoxRow_r .fileBoxRow_r_tit {
+  margin-top: 5px;
+  font-size: 14px;
+  color: #7e7c7c;
+}

+ 64 - 0
src/components/ObjectAdd/index.less

@@ -34,6 +34,7 @@
   }
 
   .ant-modal {
+    top: 30px !important;
     width: 1000px !important;
   }
 
@@ -125,4 +126,67 @@
     }
   }
 
+  // 附件
+  .fileBox {
+    .fileBoxRow {
+      margin-bottom: 24px;
+      display: flex;
+
+      .fileBoxRow_tit {
+        width: 119px;
+        text-align: right;
+      }
+
+      .fileBoxRow_r {
+        padding-left: 20px;
+        position: relative;
+
+        input {
+          display: none;
+        }
+
+        .fileBoxRow_up {
+          cursor: pointer;
+          font-size: 30px;
+          width: 100px;
+          height: 100px;
+          background-color: #fafafa;
+          border: 1px dashed #ccc;
+          display: flex;
+          justify-content: center;
+          align-items: center;
+
+
+        }
+
+        .fileBoxRow_r_img {
+          width: 120px;
+          height: 120px;
+          position: relative;
+
+          .clearCover {
+            cursor: pointer;
+            z-index: 10;
+            position: absolute;
+            width: 50px;
+            height: 50px;
+            top: 50%;
+            transform: translateY(-50%);
+            right: -50px;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            font-size: 24px;
+          }
+        }
+
+        .fileBoxRow_r_tit {
+          margin-top: 5px;
+          font-size: 14px;
+          color: rgb(126, 124, 124);
+        }
+      }
+    }
+  }
+
 }

+ 533 - 179
src/components/ObjectAdd/index.tsx

@@ -6,14 +6,25 @@ import {
   InputNumber,
   message,
   Modal,
+  Popconfirm,
   Select,
+  Table,
 } from "antd";
-import React, { useRef, useState } from "react";
+import { PlusOutlined, CloseCircleOutlined } from "@ant-design/icons";
+import TextArea from "antd/es/input/TextArea";
+import React, {
+  useCallback,
+  useEffect,
+  useMemo,
+  useRef,
+  useState,
+} from "react";
 import styles from "./index.module.scss";
 import classNames from "classnames";
 import "./index.css";
-import { useSelector } from "react-redux";
+import { useDispatch, useSelector } from "react-redux";
 import { RootState } from "@/store";
+import ImageLazy from "../ImageLazy";
 const { Option } = Select;
 
 type Props = {
@@ -22,8 +33,11 @@ type Props = {
 };
 
 function ObjectAdd({ id, colsePage }: Props) {
+  const dispatch = useDispatch();
+
   // 没有通过校验
   const onFinishFailed = () => {
+    setTitSelect("tit1");
     return message.warning("有表单不符号规则!");
   };
   // 通过校验之后发送请求
@@ -62,6 +76,9 @@ function ObjectAdd({ id, colsePage }: Props) {
   const options8 = useSelector(
     (state: RootState) => state.loginStore.selectAll["保存状态"]
   );
+  const options9 = useSelector(
+    (state: RootState) => state.loginStore.selectAll["入藏时间范围"]
+  );
 
   // 单位选择
   const [danweiValue, setDanweiValue] = useState("kg");
@@ -84,9 +101,207 @@ function ObjectAdd({ id, colsePage }: Props) {
       name10: options5[0].name ? options5[0].name : null,
       name15: options6[0].name ? options6[0].name : null,
       name17: options7[0].name ? options7[0].name : null,
+      name19: options9[0].name ? options9[0].name : null,
     };
   }
 
+  // -----------关于藏品附件的信息
+  const [fileSelect, setFileSelect] = useState("img");
+
+  const fileSelectChangeFu = (value: string) => {
+    setFileSelect(value);
+  };
+
+  // 表格数据
+  useEffect(() => {
+    dispatch({
+      type: "login/setFileData",
+      payload: {
+        img: [
+          {
+            id: 1,
+            name: "图片1",
+            time: "2022-12-13",
+            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",
+            time: "2022-12-14",
+            img: "",
+          },
+          {
+            id: 3,
+            name: "图片3",
+            time: "2022-12-14",
+            img: "",
+          },
+        ],
+        video: [
+          {
+            id: 4,
+            name: "视频1",
+            time: "2022-12-14",
+            img: "",
+          },
+        ],
+        audio: [],
+      },
+    });
+  }, [dispatch]);
+
+  const results = useSelector((state: RootState) => state.loginStore.fileData);
+
+  // 点击表格里面的删除
+  const delOne = useCallback(
+    (id: number) => {
+      const data = {
+        ...results,
+        [fileSelect]: results[fileSelect].filter((v: any) => v.id !== id),
+      };
+      dispatch({ type: "login/setFileData", payload: data });
+    },
+    [dispatch, fileSelect, results]
+  );
+
+  // 表格格式
+  const columns = useMemo(() => {
+    const tempArr = [
+      {
+        title: "附件名称",
+        dataIndex: "name",
+      },
+      {
+        title: "上传时间",
+        dataIndex: "time",
+      },
+      {
+        title: "操作",
+        render: (item: any) => (
+          <>
+            <Button type="text" danger onClick={() => upFileFu(item.id)}>
+              重传
+            </Button>
+            <Popconfirm
+              title="确定删除吗?"
+              okText="确定"
+              cancelText="取消"
+              onConfirm={() => delOne(item.id)}
+            >
+              <Button type="text" danger>
+                删除
+              </Button>
+            </Popconfirm>
+          </>
+        ),
+      },
+    ];
+
+    if (fileSelect === "img") {
+      tempArr.unshift({
+        title: "缩略图",
+        render: (item: any) => (
+          <div className="tableImg">
+            <ImageLazy width={120} height={70} src={item.img} />
+          </div>
+        ),
+      });
+    }
+
+    return tempArr;
+  }, [delOne, fileSelect]);
+
+  const [cover, setCover] = useState(
+    "http://project.4dage.com:8016/content/1_1001/img/20220810_1553241331042.JPG"
+  );
+
+  const fileSelectList = useMemo(() => {
+    return [
+      { id: 1, value: "img", label: "高清图片" },
+      { id: 2, value: "video", label: "视频文件" },
+      { id: 3, value: "audio", label: "音频文件" },
+      { id: 4, value: "model", label: "三维模型" },
+      { id: 5, value: "file", label: "文档资料" },
+    ];
+  }, []);
+
+  // 上传封面
+  const myInput = useRef<HTMLInputElement>(null);
+  const handeUpPhoto = (e: React.ChangeEvent<HTMLInputElement>) => {
+    if (e.target.files) {
+      // 拿到files信息
+      const filesInfo = e.target.files[0];
+      // 校验格式
+      const type = ["image/jpeg", "image/png"];
+      if (!type.includes(filesInfo.type)) {
+        e.target.value = "";
+        return message.warning("只支持jpg、png格式!");
+      }
+      // 校验大小
+      if (filesInfo.size > 10 * 1024 * 1024) {
+        e.target.value = "";
+        return message.warning("最大支持10M!");
+      }
+
+      // 测试代码
+      console.log("-------", filesInfo);
+
+      // 创建FormData对象
+      const fd = new FormData();
+      // 把files添加进FormData对象(‘photo’为后端需要的字段)
+      fd.append("file", filesInfo);
+      // fd.append("type", "img");
+    }
+  };
+
+  // 上传附件
+  const myInput2 = useRef<HTMLInputElement>(null);
+
+  const upFileFlagRef = useRef(false);
+
+  const upFileFu = (flag?: any) => {
+    upFileFlagRef.current = flag ? flag : 0;
+    myInput2.current?.click();
+  };
+  const handeUpPhoto2 = useCallback(
+    (e: React.ChangeEvent<HTMLInputElement>) => {
+      if (e.target.files) {
+        // 拿到files信息
+        const filesInfo = e.target.files[0];
+
+        // 创建FormData对象
+        const fd = new FormData();
+        // 把files添加进FormData对象(‘photo’为后端需要的字段)
+        fd.append("file", filesInfo);
+        // fd.append("type", "img");
+
+        e.target.value = "";
+        if (upFileFlagRef.current) {
+          console.log("重新上传", upFileFlagRef.current);
+
+          const id = upFileFlagRef.current;
+          const data = {
+            ...results,
+            [fileSelect]: results[fileSelect].map((v: any) => {
+              if (id !== v.id) return v;
+              else
+                return {
+                  id: 10,
+                  name: "9999",
+                  time: "2022-12-14",
+                  img: "",
+                };
+            }),
+          };
+          dispatch({ type: "login/setFileData", payload: data });
+        } else {
+          console.log("新上传");
+        }
+      }
+    },
+    [dispatch, fileSelect, results]
+  );
+
   return (
     <div className={styles.ObjectAdd}>
       <Modal
@@ -124,186 +339,325 @@ function ObjectAdd({ id, colsePage }: Props) {
           autoComplete="off"
           initialValues={defaultData.current}
         >
-          <div className="formRow">
-            <Form.Item
-              label="藏品名称"
-              name="name1"
-              rules={[{ required: true, message: "不能为空!" }]}
-            >
-              <Input maxLength={50} showCount placeholder="请输入" />
-            </Form.Item>
-            <Form.Item label="原名" name="name2">
-              <Input maxLength={50} showCount placeholder="请输入" />
-            </Form.Item>
-          </div>
-
-          <div className="formRow">
-            <div className="bs">*</div>
-            <Form.Item label="藏品编号名称" name="name3">
-              <Select
-                placeholder="请选择"
-                options={options1.map((v: any) => ({
-                  label: v.name,
-                  value: v.name,
-                }))}
-              />
-            </Form.Item>
-            <Form.Item label="藏品编号" name="name4">
-              <Input maxLength={50} showCount placeholder="请输入" />
-            </Form.Item>
-          </div>
-
-          <div className="formRow">
-            <div className="bs bs2">*</div>
-            <div className="bs bs3">*</div>
-            <Form.Item label="年代" name="name5">
-              <Cascader
-                allowClear={false}
-                fieldNames={{
-                  label: "name",
-                  value: "name",
-                  children: "children",
-                }}
-                options={options2}
-                placeholder="请选择"
-              />
-            </Form.Item>
-            <Form.Item label="文物质地" name="name6">
-              <Cascader
-                allowClear={false}
-                fieldNames={{
-                  label: "name",
-                  value: "name",
-                  children: "children",
-                }}
-                options={options3}
-                placeholder="请选择"
-              />
-            </Form.Item>
-          </div>
-
-          <div className="formRow">
-            <div className="bs bs3">*</div>
-            <Form.Item label="具体年代" name="name7">
-              <Input maxLength={50} showCount placeholder="请输入" />
-            </Form.Item>
-            <Form.Item label="文物类别" name="name8">
-              <Select
-                placeholder="请选择"
-                options={options4.map((v: any) => ({
-                  label: v.name,
-                  value: v.name,
-                }))}
-              />
-            </Form.Item>
-          </div>
-
-          <div className="formRow">
-            <div className="bs bs3">*</div>
-            <Form.Item
-              rules={[{ required: true, message: "不能为空!" }]}
-              label="实际数量"
-              name="name9"
-            >
-              <InputNumber maxLength={8} placeholder="请输入数字" />
-            </Form.Item>
-            <Form.Item label="文物级别" name="name10">
-              <Select
-                placeholder="请选择"
-                options={options5.map((v: any) => ({
-                  label: v.name,
-                  value: v.name,
-                }))}
-              />
-            </Form.Item>
-          </div>
-
-          <div className="formRow formRowThree">
-            <Form.Item
-              rules={[{ required: true, message: "不能为空!" }]}
-              label="外形尺寸"
-              name="name11"
-            >
-              <InputNumber maxLength={8} placeholder="通长" addonAfter="cm" />
-            </Form.Item>
-            <Form.Item
-              rules={[{ required: true, message: "不能为空!" }]}
-              label=""
-              name="name12"
-            >
-              <InputNumber maxLength={8} placeholder="通宽" addonAfter="cm" />
-            </Form.Item>
-            <Form.Item
-              className="formRowThreeRow"
-              rules={[{ required: true, message: "不能为空!" }]}
-              label=""
-              name="name13"
-            >
-              <InputNumber maxLength={8} placeholder="通高" addonAfter="cm" />
-            </Form.Item>
-          </div>
-
-          <div className="formRow formRowFull">
-            <Form.Item
-              label="具体尺寸"
-              name="name14"
-              rules={[{ required: true, message: "不能为空!" }]}
-            >
-              <Input maxLength={50} showCount placeholder="请输入" />
-            </Form.Item>
-          </div>
-
-          <div className="formRow">
-            <div className="bs bs4">*</div>
-            <Form.Item label="质量范围" name="name15">
-              <Select
-                placeholder="请选择"
-                options={options6.map((v: any) => ({
-                  label: v.name,
-                  value: v.name,
-                }))}
-              />
-            </Form.Item>
-            <Form.Item className="formRowSelec" label="具体质量" name="name16">
-              <InputNumber
-                maxLength={8}
-                placeholder="请输入"
-                addonAfter={
-                  <Select
-                    value={danweiValue}
-                    onChange={(val) => setDanweiValue(val)}
-                  >
-                    <Option value="kg">kg</Option>
-                    <Option value="g">g</Option>
-                  </Select>
-                }
-              />
-              {/* <div className="formRowSelecSon">
+          {/* -----------------------表单信息 */}
+          <div className="formBox" hidden={titSelect === "tit2"}>
+            {/* 藏品名称----------原名 */}
+            <div className="formRow">
+              <Form.Item
+                label="藏品名称"
+                name="name1"
+                rules={[{ required: true, message: "不能为空!" }]}
+              >
+                <Input maxLength={50} showCount placeholder="请输入" />
+              </Form.Item>
+              <Form.Item label="原名" name="name2">
+                <Input maxLength={50} showCount placeholder="请输入" />
+              </Form.Item>
+            </div>
+            {/* 藏品编号名称----------藏品编号 */}
+            <div className="formRow">
+              <div className="bs">*</div>
+              <Form.Item label="藏品编号名称" name="name3">
+                <Select
+                  placeholder="请选择"
+                  options={options1.map((v: any) => ({
+                    label: v.name,
+                    value: v.name,
+                  }))}
+                />
+              </Form.Item>
+              <Form.Item label="藏品编号" name="name4">
+                <Input maxLength={50} showCount placeholder="请输入" />
+              </Form.Item>
+            </div>
+            {/* 年代----------文物质地 */}
+            <div className="formRow">
+              <div className="bs bs2">*</div>
+              <div className="bs bs3">*</div>
+              <Form.Item label="年代" name="name5">
+                <Cascader
+                  allowClear={false}
+                  fieldNames={{
+                    label: "name",
+                    value: "name",
+                    children: "children",
+                  }}
+                  options={options2}
+                  placeholder="请选择"
+                />
+              </Form.Item>
+              <Form.Item label="文物质地" name="name6">
+                <Cascader
+                  allowClear={false}
+                  fieldNames={{
+                    label: "name",
+                    value: "name",
+                    children: "children",
+                  }}
+                  options={options3}
+                  placeholder="请选择"
+                />
+              </Form.Item>
+            </div>
+            {/* 具体年代----------文物类别 */}
+            <div className="formRow">
+              <div className="bs bs3">*</div>
+              <Form.Item label="具体年代" name="name7">
+                <Input maxLength={50} showCount placeholder="请输入" />
+              </Form.Item>
+              <Form.Item label="文物类别" name="name8">
+                <Select
+                  placeholder="请选择"
+                  options={options4.map((v: any) => ({
+                    label: v.name,
+                    value: v.name,
+                  }))}
+                />
+              </Form.Item>
+            </div>
+            {/* 实际数量----------文物级别 */}
+            <div className="formRow">
+              <div className="bs bs3">*</div>
+              <Form.Item
+                rules={[{ required: true, message: "不能为空!" }]}
+                label="实际数量"
+                name="name9"
+              >
+                <InputNumber min={1} maxLength={8} placeholder="请输入数字" />
+              </Form.Item>
+              <Form.Item label="文物级别" name="name10">
+                <Select
+                  placeholder="请选择"
+                  options={options5.map((v: any) => ({
+                    label: v.name,
+                    value: v.name,
+                  }))}
+                />
+              </Form.Item>
+            </div>
+            {/* 外形尺寸----------通长,宽,高 */}
+            <div className="formRow formRowThree">
+              <Form.Item
+                rules={[{ required: true, message: "不能为空!" }]}
+                label="外形尺寸"
+                name="name11"
+              >
+                <InputNumber
+                  min={1}
+                  maxLength={8}
+                  placeholder="通长"
+                  addonAfter="cm"
+                />
+              </Form.Item>
+              <Form.Item
+                rules={[{ required: true, message: "不能为空!" }]}
+                label=""
+                name="name12"
+              >
+                <InputNumber
+                  min={1}
+                  maxLength={8}
+                  placeholder="通宽"
+                  addonAfter="cm"
+                />
+              </Form.Item>
+              <Form.Item
+                className="formRowThreeRow"
+                rules={[{ required: true, message: "不能为空!" }]}
+                label=""
+                name="name13"
+              >
+                <InputNumber
+                  min={1}
+                  maxLength={8}
+                  placeholder="通高"
+                  addonAfter="cm"
+                />
+              </Form.Item>
+            </div>
+            {/* 具体尺寸*/}
+            <div className="formRow formRowFull">
+              <Form.Item
+                label="具体尺寸"
+                name="name14"
+                rules={[{ required: true, message: "不能为空!" }]}
+              >
+                <Input maxLength={50} showCount placeholder="请输入" />
+              </Form.Item>
+            </div>
+            {/* 质量范围----------具体质量 */}
+            <div className="formRow">
+              <div className="bs bs4">*</div>
+              <Form.Item label="质量范围" name="name15">
+                <Select
+                  placeholder="请选择"
+                  options={options6.map((v: any) => ({
+                    label: v.name,
+                    value: v.name,
+                  }))}
+                />
+              </Form.Item>
+              <Form.Item
+                className="formRowSelec"
+                label="具体质量"
+                name="name16"
+              >
+                <InputNumber
+                  min={1}
+                  maxLength={8}
+                  placeholder="请输入"
+                  addonAfter={
+                    <Select
+                      value={danweiValue}
+                      onChange={(val) => setDanweiValue(val)}
+                    >
+                      <Option value="kg">kg</Option>
+                      <Option value="g">g</Option>
+                    </Select>
+                  }
+                />
+                {/* <div className="formRowSelecSon">
                 
               </div> */}
-            </Form.Item>
+              </Form.Item>
+            </div>
+            {/* 完残程度----------保存状态 */}
+            <div className="formRow">
+              <div className="bs bs4">*</div>
+              <Form.Item label="完残程度" name="name17">
+                <Select
+                  placeholder="请选择"
+                  options={options7.map((v: any) => ({
+                    label: v.name,
+                    value: v.name,
+                  }))}
+                />
+              </Form.Item>
+              <Form.Item label="保存状态" name="name18">
+                <Select
+                  placeholder="请选择"
+                  options={options8.map((v: any) => ({
+                    label: v.name,
+                    value: v.name,
+                  }))}
+                />
+              </Form.Item>
+            </div>
+            {/* 入藏时间范围----------入藏年度 */}
+            <div className="formRow">
+              <div className="bs">*</div>
+              <Form.Item label="入藏时间范围" name="name19">
+                <Select
+                  placeholder="请选择"
+                  options={options9.map((v: any) => ({
+                    label: v.name,
+                    value: v.name,
+                  }))}
+                />
+              </Form.Item>
+              <Form.Item label="入藏年度" name="name20">
+                <InputNumber
+                  min={1000}
+                  maxLength={4}
+                  placeholder="请输入数字"
+                />
+              </Form.Item>
+            </div>
+            {/* 著者----------版本 */}
+            <div className="formRow">
+              <Form.Item label="著者" name="name21">
+                <Input maxLength={50} showCount placeholder="请输入" />
+              </Form.Item>
+              <Form.Item label="版本" name="name22">
+                <Input maxLength={50} showCount placeholder="请输入" />
+              </Form.Item>
+            </div>
+            {/* 存卷*/}
+            <div className="formRow formRowFull">
+              <Form.Item label="存卷" name="name23">
+                <Input maxLength={50} showCount placeholder="请输入" />
+              </Form.Item>
+            </div>
+            {/* 来源说明*/}
+            <div className="formRow formRowFull">
+              <Form.Item label="来源说明" name="name24">
+                <TextArea
+                  rows={3}
+                  placeholder="请输入"
+                  showCount
+                  maxLength={255}
+                />
+              </Form.Item>
+            </div>
           </div>
-
-          <div className="formRow">
-            <div className="bs bs4">*</div>
-            <Form.Item label="完残程度" name="name17">
-              <Select
-                placeholder="请选择"
-                options={options7.map((v: any) => ({
-                  label: v.name,
-                  value: v.name,
-                }))}
-              />
-            </Form.Item>
-            <Form.Item label="保存状态" name="name18">
-              <Select
-                placeholder="请选择"
-                options={options8.map((v: any) => ({
-                  label: v.name,
-                  value: v.name,
-                }))}
-              />
-            </Form.Item>
+          {/* -----------------------附件信息 */}
+          <div hidden={titSelect === "tit1"}>
+            <div className="fileBox">
+              {/* 封面上传 */}
+              <div className="fileBoxRow">
+                <div className="fileBoxRow_tit">藏品图片:</div>
+                <div className="fileBoxRow_r">
+                  <div
+                    hidden={cover !== ""}
+                    className="fileBoxRow_up"
+                    onClick={() => myInput.current?.click()}
+                  >
+                    <PlusOutlined />
+                    <input
+                      type="file"
+                      accept=".png,.jpg"
+                      ref={myInput}
+                      onChange={(e) => handeUpPhoto(e)}
+                    />
+                  </div>
+                  <div className="fileBoxRow_r_img" hidden={cover === ""}>
+                    <ImageLazy width={120} height={120} src={cover} />
+                    <Popconfirm
+                      title="确定删除吗?"
+                      okText="确定"
+                      cancelText="取消"
+                      onConfirm={() => setCover("")}
+                    >
+                      <div className="clearCover">
+                        <CloseCircleOutlined />
+                      </div>
+                    </Popconfirm>
+                  </div>
+                  <div className="fileBoxRow_r_tit">
+                    支持上传jpg,png格式,大小&lt;10M
+                  </div>
+                </div>
+              </div>
+              {/* 附件上传 */}
+              <div className="fileBoxRow">
+                <div className="fileBoxRow_tit">上传附件:</div>
+                <div className="fileBoxRow_r">
+                  <input
+                    type="file"
+                    ref={myInput2}
+                    onChange={(e) => handeUpPhoto2(e)}
+                  />
+                  <Select
+                    style={{ width: 150 }}
+                    value={fileSelect}
+                    onChange={fileSelectChangeFu}
+                    options={fileSelectList}
+                  />
+                  &emsp;
+                  <Button onClick={() => upFileFu()}>上传附件</Button>
+                </div>
+              </div>
+              {/* 表格主体 */}
+              <div className="addTableBox_table">
+                <Table
+                  scroll={{ y: 300 }}
+                  dataSource={results[fileSelect]}
+                  columns={columns}
+                  rowKey="id"
+                  pagination={false}
+                />
+              </div>
+            </div>
           </div>
 
           <br />

+ 2 - 0
src/index.tsx

@@ -1,3 +1,5 @@
+// import 'default-passive-events';
+
 import App from "./App";
 import store from "./store/index";
 

+ 2 - 10
src/pages/ObjectSon/Object1/AddObject1/index.tsx

@@ -37,15 +37,7 @@ function AddObject1() {
     setAddInfoTop({ ...addInfoTop, laiyuan: value });
   };
 
-  // const tabList = useMemo(() => {
-  //   return [
-  //     { id: 1, value: "img", label: "高清图片" },
-  //     { id: 2, value: "video", label: "视频文件" },
-  //     { id: 3, value: "audio", label: "音频文件" },
-  //     { id: 4, value: "model", label: "三维模型" },
-  //     { id: 5, value: "file", label: "文档资料" },
-  //   ];
-  // }, []);
+
 
   // 表格数据
 
@@ -148,7 +140,7 @@ function AddObject1() {
   };
 
   // 点击添加或者编辑出来页面
-  const [addPage, setAddPage] = useState(true);
+  const [addPage, setAddPage] = useState(false);
 
   // 点击添加或者编辑
 

+ 8 - 2
src/store/reducer/login.ts

@@ -1,18 +1,24 @@
 // 初始化状态应用注解
 const initState = {
   selectAll: {} as any,
+  fileData: {} as any,
 };
 
-type LoginActionType = { type: "login/getSelectAll"; payload: any };
-
+type LoginActionType =
+  | { type: "login/getSelectAll"; payload: any }
+  | { type: "login/setFileData"; payload: any };
 // 频道 reducer
 export default function loginReducer(
   state = initState,
   action: LoginActionType
 ) {
   switch (action.type) {
+    // 所有的下拉列表数据
     case "login/getSelectAll":
       return { ...state, selectAll: action.payload };
+    // 新增编辑藏品的附件数据
+    case "login/setFileData":
+      return { ...state, fileData: action.payload };
     default:
       return state;
   }