|
@@ -12,21 +12,14 @@ import {
|
|
} from "antd";
|
|
} from "antd";
|
|
import { PlusOutlined, CloseCircleOutlined } from "@ant-design/icons";
|
|
import { PlusOutlined, CloseCircleOutlined } from "@ant-design/icons";
|
|
import TextArea from "antd/es/input/TextArea";
|
|
import TextArea from "antd/es/input/TextArea";
|
|
-import React, {
|
|
|
|
- useCallback,
|
|
|
|
- useEffect,
|
|
|
|
- useMemo,
|
|
|
|
- useRef,
|
|
|
|
- useState,
|
|
|
|
-} from "react";
|
|
|
|
|
|
+import React, { useCallback, useMemo, useRef, useState } from "react";
|
|
import styles from "./index.module.scss";
|
|
import styles from "./index.module.scss";
|
|
import classNames from "classnames";
|
|
import classNames from "classnames";
|
|
import "./index.css";
|
|
import "./index.css";
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
import { RootState } from "@/store";
|
|
import { RootState } from "@/store";
|
|
import ImageLazy from "../ImageLazy";
|
|
import ImageLazy from "../ImageLazy";
|
|
-import { object1AddUpFileAPI } from "@/store/action/object1";
|
|
|
|
-import dayjs from "dayjs";
|
|
|
|
|
|
+import { goodsSonAddAPI, object1AddUpFileAPI } from "@/store/action/object1";
|
|
const { Option } = Select;
|
|
const { Option } = Select;
|
|
|
|
|
|
type Props = {
|
|
type Props = {
|
|
@@ -46,9 +39,46 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
};
|
|
};
|
|
// 通过校验之后发送请求
|
|
// 通过校验之后发送请求
|
|
const onFinish = async (values: any) => {
|
|
const onFinish = async (values: any) => {
|
|
- console.log("具体质量的单位", danweiValue);
|
|
|
|
|
|
+ const oldObj = {} as any;
|
|
|
|
+ for (const k in values) {
|
|
|
|
+ if (values[k]) oldObj[k] = values[k];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 外形尺寸 3个 字段 变成一个组数
|
|
|
|
+ const size = [values.size1, values.size2, values.size3];
|
|
|
|
+ // 具体质量 + 单位
|
|
|
|
+ let quality = "";
|
|
|
|
+ if (values.quality) quality = values.quality + danweiValue;
|
|
|
|
+ // 文件id
|
|
|
|
+ const fileIds = [] as any;
|
|
|
|
+ for (const k in results) {
|
|
|
|
+ results[k].forEach((v: any) => {
|
|
|
|
+ fileIds.push(v.id);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ // 年代
|
|
|
|
+ const dictAge = values.dictAge.join("/");
|
|
|
|
+ // 文物质地
|
|
|
|
+ const dictTexture = values.dictTexture.join("/");
|
|
|
|
+
|
|
|
|
+ const obj = {
|
|
|
|
+ ...oldObj,
|
|
|
|
+ size,
|
|
|
|
+ quality,
|
|
|
|
+ thumb: cover,
|
|
|
|
+ dirCode: dirCode + "",
|
|
|
|
+ fileIds: fileIds.join(","),
|
|
|
|
+ registerId: dirCode,
|
|
|
|
+ dictAge,
|
|
|
|
+ dictTexture,
|
|
|
|
+ };
|
|
|
|
+ await dispatch(goodsSonAddAPI(obj));
|
|
|
|
+ // 关闭弹窗
|
|
|
|
+ colsePage();
|
|
|
|
+
|
|
|
|
+ // console.log('------封面信息',cover);
|
|
|
|
|
|
- console.log("--点击确定存到仓库", values);
|
|
|
|
|
|
+ // console.log('-------附件信息',results);
|
|
};
|
|
};
|
|
|
|
|
|
// 选择商品信息还是附近(默认商品信息)
|
|
// 选择商品信息还是附近(默认商品信息)
|
|
@@ -92,20 +122,20 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
const defaultData = useRef<any>(null);
|
|
const defaultData = useRef<any>(null);
|
|
if (id) {
|
|
if (id) {
|
|
defaultData.current = {
|
|
defaultData.current = {
|
|
- name1: "编辑",
|
|
|
|
- name3: "索书号",
|
|
|
|
- name5: ["其他"],
|
|
|
|
|
|
+ name: "编辑",
|
|
|
|
+ dictNum: "索书号",
|
|
|
|
+ dictAge: ["其他"],
|
|
};
|
|
};
|
|
} else {
|
|
} else {
|
|
defaultData.current = {
|
|
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,
|
|
|
|
- name19: options9[0].name ? options9[0].name : null,
|
|
|
|
|
|
+ dictNum: options1[0].name ? options1[0].name : null,
|
|
|
|
+ dictAge: ["地质年代", "显生宙", "新生代", "第四纪"],
|
|
|
|
+ dictTexture: ["单一质地", "有机质", "竹"],
|
|
|
|
+ dictGoodType: options4[0].name ? options4[0].name : null,
|
|
|
|
+ dictLevel: options5[0].name ? options5[0].name : null,
|
|
|
|
+ dictQualityScope: options6[0].name ? options6[0].name : null,
|
|
|
|
+ complete: options7[0].name ? options7[0].name : null,
|
|
|
|
+ dictCheckInScope: options9[0].name ? options9[0].name : null,
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
@@ -142,7 +172,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
const tempArr = [
|
|
const tempArr = [
|
|
{
|
|
{
|
|
title: "附件名称",
|
|
title: "附件名称",
|
|
- dataIndex: "fileName",
|
|
|
|
|
|
+ dataIndex: "name",
|
|
},
|
|
},
|
|
{
|
|
{
|
|
title: "上传时间",
|
|
title: "上传时间",
|
|
@@ -255,6 +285,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
if (res.code === 0) {
|
|
if (res.code === 0) {
|
|
message.success("上传成功!");
|
|
message.success("上传成功!");
|
|
if (upFileFlagRef.current) {
|
|
if (upFileFlagRef.current) {
|
|
|
|
+ // 重新上传
|
|
const id = upFileFlagRef.current;
|
|
const id = upFileFlagRef.current;
|
|
const data = {
|
|
const data = {
|
|
...results,
|
|
...results,
|
|
@@ -263,20 +294,17 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
else
|
|
else
|
|
return {
|
|
return {
|
|
...res.data,
|
|
...res.data,
|
|
- id:Date.now(),
|
|
|
|
- createTime: dayjs(Date.now()).format("YYYY-MM-DD"),
|
|
|
|
};
|
|
};
|
|
}),
|
|
}),
|
|
};
|
|
};
|
|
dispatch({ type: "login/setFileData", payload: data });
|
|
dispatch({ type: "login/setFileData", payload: data });
|
|
} else {
|
|
} else {
|
|
|
|
+ // 新上传
|
|
const data = {
|
|
const data = {
|
|
...results,
|
|
...results,
|
|
[fileSelect]: [
|
|
[fileSelect]: [
|
|
{
|
|
{
|
|
...res.data,
|
|
...res.data,
|
|
- id:Date.now(),
|
|
|
|
- createTime: dayjs(Date.now()).format("YYYY-MM-DD"),
|
|
|
|
},
|
|
},
|
|
...results[fileSelect],
|
|
...results[fileSelect],
|
|
],
|
|
],
|
|
@@ -333,19 +361,19 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
<div className="formRow">
|
|
<div className="formRow">
|
|
<Form.Item
|
|
<Form.Item
|
|
label="藏品名称"
|
|
label="藏品名称"
|
|
- name="name1"
|
|
|
|
|
|
+ name="name"
|
|
rules={[{ required: true, message: "不能为空!" }]}
|
|
rules={[{ required: true, message: "不能为空!" }]}
|
|
>
|
|
>
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
</Form.Item>
|
|
</Form.Item>
|
|
- <Form.Item label="原名" name="name2">
|
|
|
|
|
|
+ <Form.Item label="原名" name="namePrimitive">
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
</Form.Item>
|
|
</Form.Item>
|
|
</div>
|
|
</div>
|
|
{/* 藏品编号名称----------藏品编号 */}
|
|
{/* 藏品编号名称----------藏品编号 */}
|
|
<div className="formRow">
|
|
<div className="formRow">
|
|
<div className="bs">*</div>
|
|
<div className="bs">*</div>
|
|
- <Form.Item label="藏品编号名称" name="name3">
|
|
|
|
|
|
+ <Form.Item label="藏品编号名称" name="dictNum">
|
|
<Select
|
|
<Select
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
options={options1.map((v: any) => ({
|
|
options={options1.map((v: any) => ({
|
|
@@ -354,7 +382,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
}))}
|
|
}))}
|
|
/>
|
|
/>
|
|
</Form.Item>
|
|
</Form.Item>
|
|
- <Form.Item label="藏品编号" name="name4">
|
|
|
|
|
|
+ <Form.Item label="藏品编号" name="num">
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
</Form.Item>
|
|
</Form.Item>
|
|
</div>
|
|
</div>
|
|
@@ -362,7 +390,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
<div className="formRow">
|
|
<div className="formRow">
|
|
<div className="bs bs2">*</div>
|
|
<div className="bs bs2">*</div>
|
|
<div className="bs bs3">*</div>
|
|
<div className="bs bs3">*</div>
|
|
- <Form.Item label="年代" name="name5">
|
|
|
|
|
|
+ <Form.Item label="年代" name="dictAge">
|
|
<Cascader
|
|
<Cascader
|
|
allowClear={false}
|
|
allowClear={false}
|
|
fieldNames={{
|
|
fieldNames={{
|
|
@@ -374,7 +402,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
/>
|
|
/>
|
|
</Form.Item>
|
|
</Form.Item>
|
|
- <Form.Item label="文物质地" name="name6">
|
|
|
|
|
|
+ <Form.Item label="文物质地" name="dictTexture">
|
|
<Cascader
|
|
<Cascader
|
|
allowClear={false}
|
|
allowClear={false}
|
|
fieldNames={{
|
|
fieldNames={{
|
|
@@ -390,10 +418,10 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
{/* 具体年代----------文物类别 */}
|
|
{/* 具体年代----------文物类别 */}
|
|
<div className="formRow">
|
|
<div className="formRow">
|
|
<div className="bs bs3">*</div>
|
|
<div className="bs bs3">*</div>
|
|
- <Form.Item label="具体年代" name="name7">
|
|
|
|
|
|
+ <Form.Item label="具体年代" name="ageSpecific">
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
</Form.Item>
|
|
</Form.Item>
|
|
- <Form.Item label="文物类别" name="name8">
|
|
|
|
|
|
+ <Form.Item label="文物类别" name="dictGoodType">
|
|
<Select
|
|
<Select
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
options={options4.map((v: any) => ({
|
|
options={options4.map((v: any) => ({
|
|
@@ -409,11 +437,11 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
<Form.Item
|
|
<Form.Item
|
|
rules={[{ required: true, message: "不能为空!" }]}
|
|
rules={[{ required: true, message: "不能为空!" }]}
|
|
label="实际数量"
|
|
label="实际数量"
|
|
- name="name9"
|
|
|
|
|
|
+ name="pcs"
|
|
>
|
|
>
|
|
<InputNumber min={1} maxLength={8} placeholder="请输入数字" />
|
|
<InputNumber min={1} maxLength={8} placeholder="请输入数字" />
|
|
</Form.Item>
|
|
</Form.Item>
|
|
- <Form.Item label="文物级别" name="name10">
|
|
|
|
|
|
+ <Form.Item label="文物级别" name="dictLevel">
|
|
<Select
|
|
<Select
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
options={options5.map((v: any) => ({
|
|
options={options5.map((v: any) => ({
|
|
@@ -428,7 +456,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
<Form.Item
|
|
<Form.Item
|
|
rules={[{ required: true, message: "不能为空!" }]}
|
|
rules={[{ required: true, message: "不能为空!" }]}
|
|
label="外形尺寸"
|
|
label="外形尺寸"
|
|
- name="name11"
|
|
|
|
|
|
+ name="size1"
|
|
>
|
|
>
|
|
<InputNumber
|
|
<InputNumber
|
|
min={1}
|
|
min={1}
|
|
@@ -440,7 +468,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
<Form.Item
|
|
<Form.Item
|
|
rules={[{ required: true, message: "不能为空!" }]}
|
|
rules={[{ required: true, message: "不能为空!" }]}
|
|
label=""
|
|
label=""
|
|
- name="name12"
|
|
|
|
|
|
+ name="size2"
|
|
>
|
|
>
|
|
<InputNumber
|
|
<InputNumber
|
|
min={1}
|
|
min={1}
|
|
@@ -453,7 +481,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
className="formRowThreeRow"
|
|
className="formRowThreeRow"
|
|
rules={[{ required: true, message: "不能为空!" }]}
|
|
rules={[{ required: true, message: "不能为空!" }]}
|
|
label=""
|
|
label=""
|
|
- name="name13"
|
|
|
|
|
|
+ name="size3"
|
|
>
|
|
>
|
|
<InputNumber
|
|
<InputNumber
|
|
min={1}
|
|
min={1}
|
|
@@ -467,7 +495,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
<div className="formRow formRowFull">
|
|
<div className="formRow formRowFull">
|
|
<Form.Item
|
|
<Form.Item
|
|
label="具体尺寸"
|
|
label="具体尺寸"
|
|
- name="name14"
|
|
|
|
|
|
+ name="sizeSpecific"
|
|
rules={[{ required: true, message: "不能为空!" }]}
|
|
rules={[{ required: true, message: "不能为空!" }]}
|
|
>
|
|
>
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
@@ -476,7 +504,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
{/* 质量范围----------具体质量 */}
|
|
{/* 质量范围----------具体质量 */}
|
|
<div className="formRow">
|
|
<div className="formRow">
|
|
<div className="bs bs4">*</div>
|
|
<div className="bs bs4">*</div>
|
|
- <Form.Item label="质量范围" name="name15">
|
|
|
|
|
|
+ <Form.Item label="质量范围" name="dictQualityScope">
|
|
<Select
|
|
<Select
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
options={options6.map((v: any) => ({
|
|
options={options6.map((v: any) => ({
|
|
@@ -488,7 +516,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
<Form.Item
|
|
<Form.Item
|
|
className="formRowSelec"
|
|
className="formRowSelec"
|
|
label="具体质量"
|
|
label="具体质量"
|
|
- name="name16"
|
|
|
|
|
|
+ name="quality"
|
|
>
|
|
>
|
|
<InputNumber
|
|
<InputNumber
|
|
min={1}
|
|
min={1}
|
|
@@ -512,7 +540,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
{/* 完残程度----------保存状态 */}
|
|
{/* 完残程度----------保存状态 */}
|
|
<div className="formRow">
|
|
<div className="formRow">
|
|
<div className="bs bs4">*</div>
|
|
<div className="bs bs4">*</div>
|
|
- <Form.Item label="完残程度" name="name17">
|
|
|
|
|
|
+ <Form.Item label="完残程度" name="complete">
|
|
<Select
|
|
<Select
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
options={options7.map((v: any) => ({
|
|
options={options7.map((v: any) => ({
|
|
@@ -521,7 +549,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
}))}
|
|
}))}
|
|
/>
|
|
/>
|
|
</Form.Item>
|
|
</Form.Item>
|
|
- <Form.Item label="保存状态" name="name18">
|
|
|
|
|
|
+ <Form.Item label="保存状态" name="repair">
|
|
<Select
|
|
<Select
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
options={options8.map((v: any) => ({
|
|
options={options8.map((v: any) => ({
|
|
@@ -534,7 +562,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
{/* 入藏时间范围----------入藏年度 */}
|
|
{/* 入藏时间范围----------入藏年度 */}
|
|
<div className="formRow">
|
|
<div className="formRow">
|
|
<div className="bs">*</div>
|
|
<div className="bs">*</div>
|
|
- <Form.Item label="入藏时间范围" name="name19">
|
|
|
|
|
|
+ <Form.Item label="入藏时间范围" name="dictCheckInScope">
|
|
<Select
|
|
<Select
|
|
placeholder="请选择"
|
|
placeholder="请选择"
|
|
options={options9.map((v: any) => ({
|
|
options={options9.map((v: any) => ({
|
|
@@ -543,7 +571,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
}))}
|
|
}))}
|
|
/>
|
|
/>
|
|
</Form.Item>
|
|
</Form.Item>
|
|
- <Form.Item label="入藏年度" name="name20">
|
|
|
|
|
|
+ <Form.Item label="入藏年度" name="checkInYear">
|
|
<InputNumber
|
|
<InputNumber
|
|
min={1000}
|
|
min={1000}
|
|
maxLength={4}
|
|
maxLength={4}
|
|
@@ -553,22 +581,22 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
</div>
|
|
</div>
|
|
{/* 著者----------版本 */}
|
|
{/* 著者----------版本 */}
|
|
<div className="formRow">
|
|
<div className="formRow">
|
|
- <Form.Item label="著者" name="name21">
|
|
|
|
|
|
+ <Form.Item label="著者" name="author">
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
</Form.Item>
|
|
</Form.Item>
|
|
- <Form.Item label="版本" name="name22">
|
|
|
|
|
|
+ <Form.Item label="版本" name="vision">
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
</Form.Item>
|
|
</Form.Item>
|
|
</div>
|
|
</div>
|
|
{/* 存卷*/}
|
|
{/* 存卷*/}
|
|
<div className="formRow formRowFull">
|
|
<div className="formRow formRowFull">
|
|
- <Form.Item label="存卷" name="name23">
|
|
|
|
|
|
+ <Form.Item label="存卷" name="onFile">
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
<Input maxLength={50} showCount placeholder="请输入" />
|
|
</Form.Item>
|
|
</Form.Item>
|
|
</div>
|
|
</div>
|
|
{/* 来源说明*/}
|
|
{/* 来源说明*/}
|
|
<div className="formRow formRowFull">
|
|
<div className="formRow formRowFull">
|
|
- <Form.Item label="来源说明" name="name24">
|
|
|
|
|
|
+ <Form.Item label="来源说明" name="description">
|
|
<TextArea
|
|
<TextArea
|
|
rows={3}
|
|
rows={3}
|
|
placeholder="请输入"
|
|
placeholder="请输入"
|
|
@@ -618,7 +646,7 @@ function ObjectAdd({ id, colsePage, editId, dirCode }: Props) {
|
|
</div>
|
|
</div>
|
|
{/* 附件上传 */}
|
|
{/* 附件上传 */}
|
|
<div className="fileBoxRow">
|
|
<div className="fileBoxRow">
|
|
- <div className="fileBoxRow_tit">上传附件:</div>
|
|
|
|
|
|
+ <div className="fileBoxRow_tit fileBoxRow_tit2">上传附件:</div>
|
|
<div className="fileBoxRow_r">
|
|
<div className="fileBoxRow_r">
|
|
<input
|
|
<input
|
|
type="file"
|
|
type="file"
|