1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012 |
- import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
- import styles from './index.module.scss'
- import { Button, Cascader, DatePicker, Form, FormInstance, Input, InputNumber, Select } from 'antd'
- import MyPopconfirm from '@/components/MyPopconfirm'
- import TextArea from 'antd/es/input/TextArea'
- import ZRichTexts from '@/components/ZRichTexts'
- import MyTable from '@/components/MyTable'
- import { Y33tableC } from '@/utils/tableData'
- import ImageLazy from '@/components/ImageLazy'
- import YtableVideo from '@/components/YtableVideo'
- import { selectObj } from '@/utils/select'
- import dayjs from 'dayjs'
- import { getTokenInfo } from '@/utils/storage'
- import Z3upFiles from '@/components/Z3upFiles'
- import { GoodFileType } from './type'
- import { baseURL } from '@/utils/http'
- import { fileImgArr, fileVideoArr } from '@/store/action/layout'
- import { API_C2dels } from '@/store/action/C2files'
- import { API_goodsAdd, API_goodsInfo } from '@/store/action/C1ledger'
- import { C1GoodType } from '@/pages/A3_ledger/C1ledger/type'
- import { MessageFu } from '@/utils/message'
- import history, { cascaderObjFu } from '@/utils/history'
- import ZGaddNow from '@/components/ZGaddNow'
- // 级联的数据转换成字符串
- export const cascaderChArr = [
- 'dictType',
- 'dictAge',
- 'pcsUnit',
- 'dictTexture1',
- 'dictTexture2',
- 'dictTexture3',
- 'dictTorn',
- 'sizeUnit',
- 'qualityDictScope',
- 'qualityUnit',
- 'inDictDateScope',
- 'source',
- 'dictHouse1',
- 'dictHouse2',
- // 其他模块有的级联字段
- 'dictAgeFirst'
- ]
- // 下拉框为空的时候转变成null
- export const addZiSelectChArr = ['numName', 'dictLevel', 'accountType']
- type Props = {
- closeFu: () => void
- nowSta: { key: string; id: string }
- isEdit: boolean //藏品编辑模块
- editSnap?: C1GoodType //藏品模块属于新增还是编辑
- succFu: (
- obj: C1GoodType,
- type: '新增' | '编辑',
- sta: '存草稿' | '提交',
- flieNew?: GoodFileType[],
- fileOld?: GoodFileType[],
- oldInfo?: C1GoodType
- ) => void
- }
- function AddGoods({ nowSta, closeFu, succFu, isEdit, editSnap }: Props) {
- // 制档日期 / 制档人
- const [txtArr, setTxtArr] = useState([getTokenInfo().user.realName, dayjs().format('YYYY-MM-DD')])
- // 藏品编辑模块用来对比
- const objOld = useRef<any>({})
- // 编辑进来获取详情
- const getInfo = useCallback(
- async (id: number) => {
- const res = await API_goodsInfo(id)
- if (res.code === 0) {
- // 藏品编辑信息保存
- objOld.current = { ...res.data }
- // dateMaking inGoodsDate 2个日期需要格式处理一下
- const obj = editSnap && editSnap.id ? { ...editSnap } : { ...res.data }
- if (obj.dateMaking) obj.dateMaking = dayjs(obj.dateMaking)
- // if (obj.inGoodsDate) obj.inGoodsDate = dayjs(obj.inGoodsDate)
- setTxtArr([obj.creatorName, dayjs(obj.createTime).format('YYYY-MM-DD')])
- cascaderChArr.forEach(v => {
- if (obj[v]) obj[v] = obj[v].split(',')
- })
- addZiSelectChArr.forEach(v => {
- if (!obj[v]) obj[v] = null
- })
- FormBoxRef.current?.setFieldsValue(obj)
- // 设置封面图
- // ZupThumbRef.current?.setFileComFileFu({
- // fileName: '',
- // filePath: obj.thumbPc,
- // thumb: obj.thumb
- // })
- // 设置富文本
- if (obj.rtf) ZRichTextRef.current?.ritxtShowFu(JSON.parse(obj.rtf))
- // 设置附件
- setTable(obj.file || [])
- }
- },
- [editSnap]
- )
- useEffect(() => {
- if (nowSta.id !== 'null') {
- getInfo(Number(nowSta.id))
- }
- }, [getInfo, nowSta.id])
- // 设置表单ref
- const FormBoxRef = useRef<FormInstance>(null)
- // 年代是否选择了其他
- const [ageAc, setAgeAc] = useState(false)
- // 封面图的ref
- // const ZupThumbRef = useRef<any>(null)
- // 富文本的ref
- const ZRichTextRef = useRef<any>(null)
- // 上传附件的ref
- const filesRef = useRef<any>(null)
- // 附件表格
- const [table, setTable] = useState<GoodFileType[]>([])
- // 附件删除记录id
- const fileDelIdArr = useRef<number[]>([])
- const tableFu = useCallback(
- (key: 'type' | 'effect', id: number, val: any) => {
- setTable(
- table.map(v => ({
- ...v,
- [key]: id === v.id ? val : v[key]
- }))
- )
- },
- [table]
- )
- // 附件类型和附件用途是否禁用
- const disabledSelect = useCallback(
- (id: number) => {
- let flag = false
- if (isEdit) {
- if (objOld.current && objOld.current.file && objOld.current.file.length) {
- const oldFileIds: number[] = objOld.current.file.map((v: any) => v.id)
- if (oldFileIds.includes(id)) flag = true
- }
- }
- return flag
- },
- [isEdit]
- )
- // 相关附件的操作
- const startBtn = useMemo(() => {
- return [
- {
- width: 100,
- title: '缩略图/视频',
- render: (item: GoodFileType) => {
- const fileNameArr = item.fileName.split('.')
- const fileNameLast = fileNameArr[fileNameArr.length - 1]
- return fileImgArr.includes(fileNameLast) ? (
- <div className='tableImgAuto'>
- <ImageLazy width={60} height={60} srcBig={item.filePath} src={item.thumb} />
- </div>
- ) : fileVideoArr.includes(fileNameLast) ? (
- <YtableVideo src={item.filePath} />
- ) : (
- ' - '
- )
- }
- },
- {
- title: '附件类型',
- render: (item: GoodFileType) => (
- <Select
- disabled={disabledSelect(item.id)}
- style={{ width: 120 }}
- placeholder='请选择'
- value={item.type}
- onChange={e => tableFu('type', item.id, e)}
- options={selectObj['附件类型']}
- />
- )
- },
- {
- title: '附件用途',
- render: (item: GoodFileType) => (
- <Cascader
- disabled={disabledSelect(item.id)}
- options={cascaderObjFu()['附件用途']}
- value={item.effect ? item.effect.split(',') : []}
- onChange={e => tableFu('effect', item.id, e ? e.join(',') : '')}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- />
- )
- }
- ]
- }, [disabledSelect, tableFu])
- const tableLastBtn = useMemo(() => {
- return [
- {
- width: 120,
- title: '操作',
- render: (item: GoodFileType) => {
- return (
- <>
- <Button size='small' type='text'>
- <a href={baseURL + item.filePath} download target='_blank' rel='noreferrer'>
- 下载
- </a>
- </Button>
- <MyPopconfirm
- txtK='删除'
- onConfirm={() => {
- setTable(table.filter(v => v.id !== item.id))
- fileDelIdArr.current.push(item.id)
- }}
- />
- </>
- )
- }
- }
- ]
- }, [table])
- // 没有通过校验
- const onFinishFailed = useCallback((info: any) => {
- const values = info.values || {}
- const errArr = info.errorFields
- if (errArr.some((v: any) => v.name.includes('inGoodsDate'))) {
- setTabTxt('附属信息')
- MessageFu.warning('请输入正确的入藏日期格式')
- } else if (!values.qualityDictScope || !values.source) {
- setTabTxt('附属信息')
- MessageFu.warning('请完善附属信息必填字段')
- } else {
- setTabTxt('基本信息')
- MessageFu.warning('请完善基本信息必填字段')
- }
- }, [])
- // 通过校验点击确定
- const onFinish = useCallback(
- async (values: any) => {
- // 封面图
- // const coverUrl1 = ZupThumbRef.current?.fileComFileResFu()
- // 富文本
- const rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
- // 附件
- let fileIds = ''
- let fileSet: any = null
- if (table.length) {
- fileIds = table.map(v => v.id).join(',')
- fileSet = table.map(v => ({
- effect: v.effect,
- id: v.id,
- type: v.type
- }))
- }
- // 2个日期的格式处理
- // let inGoodsDate = ''
- // if (values.inGoodsDate) inGoodsDate = dayjs(values.inGoodsDate).format('YYYY-MM-DD')
- let dateMaking = ''
- if (values.dateMaking) dateMaking = dayjs(values.dateMaking).format('YYYY-MM-DD')
- // 默认以第一个附件为img的作为封面图
- const imgArr = table.filter(v => {
- const txtArr = v.fileName.split('.')
- const txt = txtArr[txtArr.length - 1]
- return v.type === 'img' && fileImgArr.includes(txt)
- })
- let thumb = ''
- let thumbPc = ''
- if (imgArr && imgArr.length) {
- thumb = imgArr[0].thumb
- thumbPc = imgArr[0].filePath
- }
- let idRes = nowSta.id === 'null' ? null : Number(nowSta.id)
- if (selectArr.current.length && selectArr.current[0].id) idRes = selectArr.current[0].id
- const obj = {
- ...values,
- thumb,
- thumbPc,
- rtf: JSON.stringify(rtf.val || ''),
- fileIds,
- fileSet,
- // inGoodsDate,
- dateMaking,
- id: idRes
- }
- for (const k in obj) {
- if (obj[k] === null || obj[k] === undefined) obj[k] = ''
- }
- // 级联的数据转换成字符串
- cascaderChArr.forEach(v => {
- if (values[v]) obj[v] = values[v].join(',')
- })
- // if (1 + 1 === 2) {
- // console.log(123, obj)
- // return
- // }
- if (isEdit) {
- // 藏品编辑模块
- let flag = true
- // fileIds 要特别处理
- const fileNew = table.map(v => v.id).join(',')
- const fileOld = (objOld.current.file || []).map((v: any) => v.id).join(',')
- if (fileNew !== fileOld) flag = false
- // console.log(fileNew, fileOld)
- for (const k in obj) {
- if (!['fileIds', 'fileSet'].includes(k)) {
- if (objOld.current[k] !== obj[k]) {
- flag = false
- }
- }
- }
- if (flag) return MessageFu.warning('未修改藏品信息')
- // -----------藏品编辑模块进来---------------
- MessageFu.success(`${staTxt.current}成功`)
- succFu(
- obj,
- '编辑',
- staTxt.current as '提交',
- table || [],
- objOld.current.file || [],
- objOld.current
- )
- closeFu()
- } else {
- // 藏品登记模块
- // 删除附件
- if (fileDelIdArr.current.length) {
- await API_C2dels(fileDelIdArr.current)
- }
- const res = await API_goodsAdd(obj, idRes ? '编辑' : '新增')
- if (res.code === 0) {
- MessageFu.success(nowSta.id === 'null' ? `${staTxt.current}成功` : '编辑成功')
- succFu(res.data, nowSta.id === 'null' ? '新增' : '编辑', staTxt.current as '提交')
- closeFu()
- }
- }
- },
- [closeFu, isEdit, nowSta.id, succFu, table]
- )
- // 点击提交 和存草稿
- const staTxt = useRef('')
- const btnOk = useCallback((val: '提交' | '存草稿') => {
- staTxt.current = val
- const btnDom = document.querySelector('#AddGoodsBtn') as HTMLDivElement
- if (btnDom) btnDom.click()
- }, [])
- const [tabTxt, setTabTxt] = useState('基本信息')
- // 从入馆入藏藏品中登记
- const [selectOne, setSelectOne] = useState(false)
- const selectArr = useRef<C1GoodType[]>([])
- return (
- <div className={styles.AddGoods}>
- <div className='AddGtit'>
- <div className='AddGtitLL'>
- {isEdit ? <span>藏品修改{editSnap ? '-编辑' : '-新增'}</span> : null}
- {['基本信息', '附属信息', '附件信息'].map(v => (
- <Button
- onClick={() => setTabTxt(v)}
- key={v}
- type={tabTxt === v ? 'primary' : 'default'}
- >
- {v}
- </Button>
- ))}
- </div>
- <div className='AddGtitRR'>
- {nowSta.id === 'null' ? (
- <>
- <Button onClick={() => setSelectOne(true)}>从入馆入藏中登记</Button> 
- <Button onClick={() => history.push('/goodEdit')}>查看历史记录</Button>
- </>
- ) : null}
- </div>
- </div>
- <div className='B3Nmain'>
- <Form
- scrollToFirstError={true}
- ref={FormBoxRef}
- name='basic'
- onFinish={onFinish}
- onFinishFailed={onFinishFailed}
- autoComplete='off'
- >
- {/* 基本信息 */}
- <div hidden={tabTxt !== '基本信息'}>
- <div className='B3Ntit'>档案信息</div>
- <div className='B3Nbox'>
- <div className='B3Nrow B3Nrow0'>
- <Form.Item
- label='藏品编号'
- name='numName'
- rules={[{ required: true, message: '请选择编号类型' }]}
- >
- <Select
- style={{ width: 140 }}
- options={selectObj['藏品编号类型']}
- placeholder='请选择'
- />
- </Form.Item>
- <Form.Item name='num' rules={[{ required: true, message: '请输入藏品编号' }]}>
- <Input maxLength={30} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='分类号' name='numType'>
- <Input maxLength={30} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <div className='B3Nrowll'>制档人:</div>
- <div className='B3Nrowrr'>{txtArr[0]}</div>
- </div>
- <div className='B3Nrow'>
- <div className='B3Nrowll'>制档日期:</div>
- <div className='B3Nrowrr'>{txtArr[1]}</div>
- </div>
- </div>
- <div className='B3Ntit'>藏品基本信息</div>
- <div className='B3Nbox'>
- <div className='B3Nrow'>
- <Form.Item
- label='藏品名称'
- name='name'
- rules={[{ required: true, message: '请输入藏品名称' }]}
- >
- <Input maxLength={30} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='藏品原名' name='namePrimitive'>
- <Input maxLength={30} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item
- label='文物级别'
- name='dictLevel'
- rules={[{ required: true, message: '请选择文物级别' }]}
- >
- <Select options={selectObj['文物级别']} placeholder='请选择' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item
- label='文物类别'
- name='dictType'
- rules={[{ required: true, message: '请选择文物类别' }]}
- >
- <Cascader
- options={cascaderObjFu()['文物类别']}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- allowClear={false}
- />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='馆内藏品分类1' name='dictHouse1'>
- <Cascader
- options={cascaderObjFu()['馆内分类1']}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- allowClear={true}
- changeOnSelect
- />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='馆内藏品分类2' name='dictHouse2'>
- <Cascader
- options={cascaderObjFu()['馆内分类2']}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- allowClear={true}
- changeOnSelect
- />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item
- label='年代'
- name='dictAge'
- rules={[{ required: true, message: '请选择年代' }]}
- >
- <Cascader
- options={[...cascaderObjFu()['年代'], { name: '其他', id: '其他' }]}
- onChange={value => setAgeAc(value[0] === '其他')}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- allowClear={false}
- />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item
- label='具体年代'
- name='ageInfo'
- rules={[{ required: ageAc, message: '请输入内容' }]}
- >
- <Input maxLength={30} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='制作时间' name='dateMaking'>
- <DatePicker placeholder='请选择日期' />
- </Form.Item>
- <div className='B3NrowDing'>
- <Form.Item label='作者' name='author'>
- <Input maxLength={30} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='作者介绍' name='authorDesc'>
- <TextArea maxLength={500} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow B3NrowNumOrCas'>
- <Form.Item
- label='数量'
- name='pcs'
- rules={[{ required: true, message: '请输入正整数' }]}
- >
- <InputNumber min={1} max={99999999} precision={0} placeholder='请输入正整数' />
- </Form.Item>
- <Form.Item name='pcsUnit' rules={[{ required: true, message: '请选择单位' }]}>
- <Cascader
- options={cascaderObjFu()['数量单位']}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- allowClear={false}
- />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='实际数量' name='pcsActual'>
- <Input maxLength={30} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow B3Nrow1'>
- <Form.Item
- label={
- <div>
- <span className='B3Nred'> * </span>质地
- </div>
- }
- name='dictTexture1'
- >
- <Cascader
- options={cascaderObjFu()['质地']}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- />
- </Form.Item>
- <Form.Item name='dictTexture2'>
- <Cascader
- options={cascaderObjFu()['复合或组合质地']}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- />
- </Form.Item>
- <Form.Item name='dictTexture3' rules={[{ required: true, message: '请选择质地3' }]}>
- <Cascader
- options={cascaderObjFu()['单一质地']}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- allowClear={false}
- />
- </Form.Item>
- <div className='B3NrowDing'>
- <Form.Item
- label='完残程度'
- name='dictTorn'
- rules={[{ required: true, message: '请选择完残程度' }]}
- >
- <Cascader
- options={cascaderObjFu()['完残程度']}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- allowClear={false}
- />
- </Form.Item>
- </div>
- </div>
- {/* 封面 */}
- {/* <div className='formRow'>
- <div className='formLeft'>封面图:</div>
- <div className='formRight'>
- <ZupOne
- ref={ZupThumbRef}
- isLook={false}
- fileCheck={false}
- size={5}
- dirCode='goodsAdd'
- myUrl='cms/goods/upload'
- format={['image/jpeg', 'image/png']}
- formatTxt='png、jpg和jpeg'
- checkTxt='请上传封面图!'
- upTxt='最多1张'
- myType='thumb'
- />
- </div>
- </div> */}
- <div className='B3Nrow'>
- <Form.Item label='完残情况' name='torn'>
- <TextArea maxLength={500} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='保存状态' name='preserveState'>
- <TextArea maxLength={500} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='色泽' name='color'>
- <TextArea maxLength={500} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='用途' name='uses'>
- <TextArea maxLength={500} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='形状描述' name='shape'>
- <TextArea maxLength={500} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='著者' name='pressAuthor'>
- <Input maxLength={30} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='版本' name='pressVersion'>
- <Input maxLength={30} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='存卷' name='pressFile'>
- <Input maxLength={30} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- {/* 备注 */}
- <div className='formRow formRow2'>
- <div className='formLeft'>备注:</div>
- <div className='formRight'>
- <ZRichTexts
- check={false}
- dirCode='goodsAdd'
- myUrl='cms/goodsFile/upload'
- isLook={false}
- ref={ZRichTextRef}
- isOne={true}
- upAudioBtnNone={true}
- />
- </div>
- </div>
- </div>
- </div>
- {/* 附属信息 */}
- <div hidden={tabTxt !== '附属信息'}>
- <div className='B3Ntit'>尺寸和质量</div>
- <div className='B3Nbox'>
- <div className='formRow formRow2'>
- <div className='formLeft'>尺寸:</div>
- <div className='formRight formRightSize'>
- <Form.Item label='通长' name='sizeL'>
- <InputNumber
- min={0}
- max={99999999}
- precision={2}
- placeholder='请输入数字,最多两位小数'
- />
- </Form.Item>
- <Form.Item label='通宽' name='sizeW'>
- <InputNumber
- min={0}
- max={99999999}
- precision={2}
- placeholder='请输入数字,最多两位小数'
- />
- </Form.Item>
- <Form.Item label='通高' name='sizeH'>
- <InputNumber
- min={0}
- max={99999999}
- precision={2}
- placeholder='请输入数字,最多两位小数'
- />
- </Form.Item>
- <Form.Item name='sizeUnit'>
- <Cascader
- options={cascaderObjFu()['尺寸单位']}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- />
- </Form.Item>
- </div>
- </div>
- <div className='B3Nrow'>
- <Form.Item
- label='质量范围'
- name='qualityDictScope'
- rules={[{ required: true, message: '请选择质量范围' }]}
- >
- <Cascader
- options={cascaderObjFu()['质量范围']}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- allowClear={false}
- />
- </Form.Item>
- <div className='B3NrowDing B3NrowDing2'>
- <Form.Item label='具体质量' name='quality'>
- <InputNumber
- min={0}
- max={99999999}
- precision={2}
- placeholder='请输入数字,最多两位小数'
- />
- </Form.Item>
- <Form.Item name='qualityUnit'>
- <Cascader
- options={cascaderObjFu()['质量单位']}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- />
- </Form.Item>
- </div>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='具体尺寸' name='sizeInfo'>
- <TextArea maxLength={500} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- </div>
- <div className='B3Ntit'>入藏及来源</div>
- <div className='B3Nbox'>
- <div className='B3Nrow'>
- <Form.Item label='入馆凭证号' name='inHouseNum'>
- <Input maxLength={30} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='入藏凭证号' name='inGoodsNum'>
- <Input maxLength={30} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item
- label='入藏日期'
- name='inGoodsDate'
- rules={[
- {
- pattern: /^(?:\d{4}(?:-(0[1-9]|1[0-2])(?:-(0[1-9]|[12]\d|3[01]))?)?)?$/,
- message: '格式应为YYYY、YYYY-MM或YYYY-MM-DD(如2000、2000-01、2000-01-01)'
- }
- ]}
- getValueFromEvent={e => e.target.value.replace(/\s+/g, '')}
- >
- <Input
- maxLength={10}
- showCount
- placeholder='请输入日期'
- onKeyPress={e => /[^0-9-]/.test(e.key) && e.preventDefault()}
- />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item
- label='入藏日期范围'
- className='B3NlongTxt'
- name='inDictDateScope'
- // rules={[{ required: true, message: '请选择入藏日期范围' }]}
- >
- <Cascader
- options={cascaderObjFu()['入藏日期范围']}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- allowClear={true}
- />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='入藏去向' name='accountType'>
- <Select options={selectObj['入藏去向']} placeholder='请选择' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item
- label='来源'
- name='source'
- rules={[{ required: true, message: '请选择来源' }]}
- >
- <Cascader
- options={cascaderObjFu()['来源']}
- placeholder='请选择'
- fieldNames={{ label: 'name', value: 'id', children: 'children' }}
- allowClear={false}
- />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='来源详情' name='sourceInfo'>
- <TextArea maxLength={500} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='征集经过' name='sourcePass'>
- <TextArea maxLength={500} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='铭记题跋' name='sourcePreface'>
- <TextArea maxLength={500} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='鉴藏印记' name='sourceStamp'>
- <TextArea maxLength={500} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- </div>
- <div className='B3Ntit'>藏品历史及流传</div>
- <div className='B3Nbox'>
- <div className='B3Nrow'>
- <Form.Item label='著作及有关书目' className='B3NlongTxt2' name='historyWork'>
- <TextArea maxLength={500} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- <div className='B3Nrow'>
- <Form.Item label='流传经历' name='historyUndergo'>
- <TextArea maxLength={500} showCount placeholder='请输入内容' />
- </Form.Item>
- </div>
- </div>
- </div>
- {/* 附件信息 */}
- <div className='B3Nbox B3Nbox1' hidden={tabTxt !== '附件信息'}>
- <div className='B3Ntit'>
- <div className='B3Ntitll'>
- <span>附件类型为图像并且格式为图片的第一份数据为封面图</span>
- </div>
- <Z3upFiles
- max={1000}
- isLook={false}
- ref={filesRef}
- fileCheck={false}
- dirCode='goodsAdd'
- myUrl='cms/goods/upload'
- lookData={[]}
- size={500}
- noShowList={true}
- fileRes={obj => setTable([...table, obj])}
- />
- </div>
- {/* 表格 */}
- <MyTable
- list={table}
- columnsTemp={Y33tableC}
- lastBtn={tableLastBtn}
- startBtn={startBtn}
- pagingInfo={false}
- />
- </div>
- {/* 确定和取消按钮 */}
- <Form.Item className='B3Nbtn'>
- <Button type='primary' htmlType='submit' id='AddGoodsBtn' hidden>
- 提交
- </Button>
- <Button type='primary' onClick={() => btnOk('提交')}>
- 提交
- </Button>
- {(nowSta.id === 'null' || isEdit) && !editSnap ? (
- <>
-  
- <Button type='primary' onClick={() => btnOk('存草稿')}>
- 存草稿
- </Button>
- </>
- ) : null}
- {nowSta.key === '藏品登记' ? null : (
- <>
-  
- <MyPopconfirm txtK='取消' onConfirm={closeFu} />
- </>
- )}
- </Form.Item>
- </Form>
- </div>
- {/* 从入馆入藏藏品中选择一个 */}
- {selectOne ? (
- <ZGaddNow
- register={true}
- nowSta={{ key: '藏品登记', id: 'cms/register/goods/getList' }}
- closeFu={() => setSelectOne(false)}
- dataResFu={data => {
- if (data.length && data[0].id) {
- selectArr.current = data
- getInfo(data[0].id)
- } else {
- selectArr.current = []
- FormBoxRef.current?.setFieldsValue({})
- }
- }}
- oldCheckArr={selectArr.current}
- isOne={true}
- />
- ) : null}
- </div>
- )
- }
- const MemoAddGoods = React.memo(AddGoods)
- export default MemoAddGoods
|