index.tsx 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  1. import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
  2. import styles from './index.module.scss'
  3. import { Button, Cascader, DatePicker, Form, FormInstance, Input, InputNumber, Select } from 'antd'
  4. import MyPopconfirm from '@/components/MyPopconfirm'
  5. import TextArea from 'antd/es/input/TextArea'
  6. import ZRichTexts from '@/components/ZRichTexts'
  7. import MyTable from '@/components/MyTable'
  8. import { Y33tableC } from '@/utils/tableData'
  9. import ImageLazy from '@/components/ImageLazy'
  10. import YtableVideo from '@/components/YtableVideo'
  11. import { selectObj } from '@/utils/select'
  12. import dayjs from 'dayjs'
  13. import { getTokenInfo } from '@/utils/storage'
  14. import Z3upFiles from '@/components/Z3upFiles'
  15. import { GoodFileType } from './type'
  16. import { baseURL } from '@/utils/http'
  17. import { fileImgArr, fileVideoArr } from '@/store/action/layout'
  18. import { API_C2dels } from '@/store/action/C2files'
  19. import { API_goodsAdd, API_goodsInfo } from '@/store/action/C1ledger'
  20. import { C1GoodType } from '@/pages/A3_ledger/C1ledger/type'
  21. import { MessageFu } from '@/utils/message'
  22. import history, { cascaderObjFu } from '@/utils/history'
  23. import ZGaddNow from '@/components/ZGaddNow'
  24. // 级联的数据转换成字符串
  25. export const cascaderChArr = [
  26. 'dictType',
  27. 'dictAge',
  28. 'pcsUnit',
  29. 'dictTexture1',
  30. 'dictTexture2',
  31. 'dictTexture3',
  32. 'dictTorn',
  33. 'sizeUnit',
  34. 'qualityDictScope',
  35. 'qualityUnit',
  36. 'inDictDateScope',
  37. 'source',
  38. 'dictHouse1',
  39. 'dictHouse2',
  40. // 其他模块有的级联字段
  41. 'dictAgeFirst'
  42. ]
  43. type Props = {
  44. closeFu: () => void
  45. nowSta: { key: string; id: string }
  46. isEdit: boolean //藏品编辑模块
  47. succFu: (
  48. obj: C1GoodType,
  49. type: '新增' | '编辑',
  50. sta: '存草稿' | '提交',
  51. flieNew?: GoodFileType[],
  52. fileOld?: GoodFileType[]
  53. ) => void
  54. }
  55. function AddGoods({ nowSta, closeFu, succFu, isEdit }: Props) {
  56. // 制档日期 / 制档人
  57. const [txtArr, setTxtArr] = useState([getTokenInfo().user.realName, dayjs().format('YYYY-MM-DD')])
  58. // 藏品编辑模块用来对比
  59. const objOld = useRef<any>({})
  60. // 编辑进来获取详情
  61. const getInfo = useCallback(async (id: number) => {
  62. const res = await API_goodsInfo(id)
  63. if (res.code === 0) {
  64. // 藏品编辑信息保存
  65. objOld.current = { ...res.data }
  66. // dateMaking inGoodsDate 2个日期需要格式处理一下
  67. const obj = { ...res.data }
  68. if (obj.dateMaking) obj.dateMaking = dayjs(obj.dateMaking)
  69. if (obj.inGoodsDate) obj.inGoodsDate = dayjs(obj.inGoodsDate)
  70. setTxtArr([obj.creatorName, dayjs(obj.createTime).format('YYYY-MM-DD')])
  71. cascaderChArr.forEach(v => {
  72. if (obj[v]) obj[v] = obj[v].split(',')
  73. })
  74. FormBoxRef.current?.setFieldsValue(obj)
  75. // 设置封面图
  76. // ZupThumbRef.current?.setFileComFileFu({
  77. // fileName: '',
  78. // filePath: obj.thumbPc,
  79. // thumb: obj.thumb
  80. // })
  81. // 设置富文本
  82. if (obj.rtf) ZRichTextRef.current?.ritxtShowFu(JSON.parse(obj.rtf))
  83. // 设置附件
  84. setTable(obj.file || [])
  85. }
  86. }, [])
  87. useEffect(() => {
  88. if (nowSta.id !== 'null') {
  89. getInfo(Number(nowSta.id))
  90. }
  91. }, [getInfo, nowSta.id])
  92. // 设置表单ref
  93. const FormBoxRef = useRef<FormInstance>(null)
  94. // 年代是否选择了其他
  95. const [ageAc, setAgeAc] = useState(false)
  96. // 封面图的ref
  97. // const ZupThumbRef = useRef<any>(null)
  98. // 富文本的ref
  99. const ZRichTextRef = useRef<any>(null)
  100. // 上传附件的ref
  101. const filesRef = useRef<any>(null)
  102. // 附件表格
  103. const [table, setTable] = useState<GoodFileType[]>([])
  104. // 附件删除记录id
  105. const fileDelIdArr = useRef<number[]>([])
  106. const tableFu = useCallback(
  107. (key: 'type' | 'effect', id: number, val: any) => {
  108. setTable(
  109. table.map(v => ({
  110. ...v,
  111. [key]: id === v.id ? val : v[key]
  112. }))
  113. )
  114. },
  115. [table]
  116. )
  117. // 附件类型和附件用途是否禁用
  118. const disabledSelect = useCallback(
  119. (id: number) => {
  120. let flag = false
  121. if (isEdit) {
  122. if (objOld.current && objOld.current.file && objOld.current.file.length) {
  123. const oldFileIds: number[] = objOld.current.file.map((v: any) => v.id)
  124. if (oldFileIds.includes(id)) flag = true
  125. }
  126. }
  127. return flag
  128. },
  129. [isEdit]
  130. )
  131. // 相关附件的操作
  132. const startBtn = useMemo(() => {
  133. return [
  134. {
  135. width: 100,
  136. title: '缩略图/视频',
  137. render: (item: GoodFileType) => {
  138. const fileNameArr = item.fileName.split('.')
  139. const fileNameLast = fileNameArr[fileNameArr.length - 1]
  140. return fileImgArr.includes(fileNameLast) ? (
  141. <div className='tableImgAuto'>
  142. <ImageLazy width={60} height={60} srcBig={item.filePath} src={item.thumb} />
  143. </div>
  144. ) : fileVideoArr.includes(fileNameLast) ? (
  145. <YtableVideo src={item.filePath} />
  146. ) : (
  147. ' - '
  148. )
  149. }
  150. },
  151. {
  152. title: '附件类型',
  153. render: (item: GoodFileType) => (
  154. <Select
  155. disabled={disabledSelect(item.id)}
  156. style={{ width: 120 }}
  157. placeholder='请选择'
  158. value={item.type}
  159. onChange={e => tableFu('type', item.id, e)}
  160. options={selectObj['附件类型']}
  161. />
  162. )
  163. },
  164. {
  165. title: '附件用途',
  166. render: (item: GoodFileType) => (
  167. <Cascader
  168. disabled={disabledSelect(item.id)}
  169. options={cascaderObjFu()['附件用途']}
  170. value={item.effect ? item.effect.split(',') : []}
  171. onChange={e => tableFu('effect', item.id, e ? e.join(',') : '')}
  172. placeholder='请选择'
  173. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  174. />
  175. )
  176. }
  177. ]
  178. }, [disabledSelect, tableFu])
  179. const tableLastBtn = useMemo(() => {
  180. return [
  181. {
  182. width: 120,
  183. title: '操作',
  184. render: (item: GoodFileType) => {
  185. return (
  186. <>
  187. <Button size='small' type='text'>
  188. <a href={baseURL + item.filePath} download target='_blank' rel='noreferrer'>
  189. 下载
  190. </a>
  191. </Button>
  192. <MyPopconfirm
  193. txtK='删除'
  194. onConfirm={() => {
  195. setTable(table.filter(v => v.id !== item.id))
  196. fileDelIdArr.current.push(item.id)
  197. }}
  198. />
  199. </>
  200. )
  201. }
  202. }
  203. ]
  204. }, [table])
  205. // 没有通过校验
  206. const onFinishFailed = useCallback((info: any) => {
  207. MessageFu.warning('请完善必填字段')
  208. const values = info.values || {}
  209. if (!values.qualityDictScope || !values.source) setTabTxt('附属信息')
  210. else setTabTxt('基本信息')
  211. }, [])
  212. // 通过校验点击确定
  213. const onFinish = useCallback(
  214. async (values: any) => {
  215. // 封面图
  216. // const coverUrl1 = ZupThumbRef.current?.fileComFileResFu()
  217. // 富文本
  218. const rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
  219. // 附件
  220. let fileIds = ''
  221. let fileSet: any = null
  222. if (table.length) {
  223. fileIds = table.map(v => v.id).join(',')
  224. fileSet = table.map(v => ({
  225. effect: v.effect,
  226. id: v.id,
  227. type: v.type
  228. }))
  229. }
  230. // 2个日期的格式处理
  231. let inGoodsDate = ''
  232. if (values.inGoodsDate) inGoodsDate = dayjs(values.inGoodsDate).format('YYYY-MM-DD')
  233. let dateMaking = ''
  234. if (values.dateMaking) dateMaking = dayjs(values.dateMaking).format('YYYY-MM-DD')
  235. // 默认以第一个附件为img的作为封面图
  236. const imgArr = table.filter(v => {
  237. const txtArr = v.fileName.split('.')
  238. const txt = txtArr[txtArr.length - 1]
  239. return v.type === 'img' && fileImgArr.includes(txt)
  240. })
  241. let thumb = ''
  242. let thumbPc = ''
  243. if (imgArr && imgArr.length) {
  244. thumb = imgArr[0].thumb
  245. thumbPc = imgArr[0].filePath
  246. }
  247. const obj = {
  248. ...values,
  249. thumb,
  250. thumbPc,
  251. rtf: JSON.stringify(rtf.val || ''),
  252. fileIds,
  253. fileSet,
  254. inGoodsDate,
  255. dateMaking,
  256. id:
  257. nowSta.id === 'null'
  258. ? selectArr.current.length
  259. ? selectArr.current[0].id
  260. : null
  261. : Number(nowSta.id)
  262. }
  263. for (const k in obj) {
  264. if (obj[k] === null || obj[k] === undefined) obj[k] = ''
  265. }
  266. // 级联的数据转换成字符串
  267. cascaderChArr.forEach(v => {
  268. if (values[v]) obj[v] = values[v].join(',')
  269. })
  270. // if (1 + 1 === 2) {
  271. // console.log(123, obj, staTxt.current)
  272. // return
  273. // }
  274. if (isEdit) {
  275. // 藏品编辑模块
  276. let flag = true
  277. // fileIds 要特别处理
  278. const fileNew = table.map(v => v.id).join(',')
  279. const fileOld = (objOld.current.file || []).map((v: any) => v.id).join(',')
  280. if (fileNew !== fileOld) flag = false
  281. // console.log(fileNew, fileOld)
  282. for (const k in obj) {
  283. if (!['fileIds', 'fileSet'].includes(k)) {
  284. if (objOld.current[k] !== obj[k]) {
  285. flag = false
  286. }
  287. }
  288. }
  289. if (flag) return MessageFu.warning('未修改藏品信息')
  290. // -----------藏品编辑模块进来---------------
  291. MessageFu.success('编辑成功')
  292. succFu(obj, '编辑', staTxt.current as '提交', table || [], objOld.current.file || [])
  293. closeFu()
  294. } else {
  295. // 藏品登记模块
  296. // 删除附件
  297. if (fileDelIdArr.current.length) {
  298. await API_C2dels(fileDelIdArr.current)
  299. }
  300. const res = await API_goodsAdd(obj, nowSta.id === 'null' ? '新增' : '编辑')
  301. if (res.code === 0) {
  302. MessageFu.success(nowSta.id === 'null' ? `${staTxt.current}成功` : '编辑成功')
  303. succFu(res.data, nowSta.id === 'null' ? '新增' : '编辑', staTxt.current as '提交')
  304. closeFu()
  305. }
  306. }
  307. },
  308. [closeFu, isEdit, nowSta.id, succFu, table]
  309. )
  310. // 点击提交 和存草稿
  311. const staTxt = useRef('')
  312. const btnOk = useCallback((val: '提交' | '存草稿') => {
  313. staTxt.current = val
  314. const btnDom = document.querySelector('#AddGoodsBtn') as HTMLDivElement
  315. if (btnDom) btnDom.click()
  316. }, [])
  317. const [tabTxt, setTabTxt] = useState('基本信息')
  318. // 从入馆藏品中登记
  319. const [selectOne, setSelectOne] = useState(false)
  320. const selectArr = useRef<C1GoodType[]>([])
  321. return (
  322. <div className={styles.AddGoods}>
  323. <div className='AddGtit'>
  324. <div className='AddGtitLL'>
  325. {['基本信息', '附属信息', '附件信息'].map(v => (
  326. <Button
  327. onClick={() => setTabTxt(v)}
  328. key={v}
  329. type={tabTxt === v ? 'primary' : 'default'}
  330. >
  331. {v}
  332. </Button>
  333. ))}
  334. </div>
  335. <div className='AddGtitRR'>
  336. {nowSta.id === 'null' ? (
  337. <>
  338. <Button onClick={() => setSelectOne(true)}>从入馆藏品中登记</Button>&emsp;
  339. <Button onClick={() => history.push('/goodEdit')}>查看历史记录</Button>
  340. </>
  341. ) : null}
  342. </div>
  343. </div>
  344. <div className='B3Nmain'>
  345. <Form
  346. scrollToFirstError={true}
  347. ref={FormBoxRef}
  348. name='basic'
  349. onFinish={onFinish}
  350. onFinishFailed={onFinishFailed}
  351. autoComplete='off'
  352. >
  353. {/* 基本信息 */}
  354. <div hidden={tabTxt !== '基本信息'}>
  355. <div className='B3Ntit'>档案信息</div>
  356. <div className='B3Nbox'>
  357. <div className='B3Nrow B3Nrow0'>
  358. <Form.Item
  359. label='藏品编号'
  360. name='numName'
  361. rules={[{ required: true, message: '请选择编号类型' }]}
  362. >
  363. <Select
  364. style={{ width: 140 }}
  365. options={selectObj['藏品编号类型']}
  366. placeholder='请选择'
  367. />
  368. </Form.Item>
  369. <Form.Item name='num' rules={[{ required: true, message: '请输入藏品编号' }]}>
  370. <Input maxLength={30} showCount placeholder='请输入内容' />
  371. </Form.Item>
  372. </div>
  373. <div className='B3Nrow'>
  374. <Form.Item label='分类号' name='numType'>
  375. <Input maxLength={30} showCount placeholder='请输入内容' />
  376. </Form.Item>
  377. </div>
  378. <div className='B3Nrow'>
  379. <div className='B3Nrowll'>制档人:</div>
  380. <div className='B3Nrowrr'>{txtArr[0]}</div>
  381. </div>
  382. <div className='B3Nrow'>
  383. <div className='B3Nrowll'>制档日期:</div>
  384. <div className='B3Nrowrr'>{txtArr[1]}</div>
  385. </div>
  386. </div>
  387. <div className='B3Ntit'>藏品基本信息</div>
  388. <div className='B3Nbox'>
  389. <div className='B3Nrow'>
  390. <Form.Item
  391. label='藏品名称'
  392. name='name'
  393. rules={[{ required: true, message: '请输入藏品名称' }]}
  394. >
  395. <Input maxLength={30} showCount placeholder='请输入内容' />
  396. </Form.Item>
  397. </div>
  398. <div className='B3Nrow'>
  399. <Form.Item label='藏品原名' name='namePrimitive'>
  400. <Input maxLength={30} showCount placeholder='请输入内容' />
  401. </Form.Item>
  402. </div>
  403. <div className='B3Nrow'>
  404. <Form.Item
  405. label='文物级别'
  406. name='dictLevel'
  407. rules={[{ required: true, message: '请选择文物级别' }]}
  408. >
  409. <Select options={selectObj['文物级别']} placeholder='请选择' />
  410. </Form.Item>
  411. </div>
  412. <div className='B3Nrow'>
  413. <Form.Item
  414. label='文物类别'
  415. name='dictType'
  416. rules={[{ required: true, message: '请选择文物类别' }]}
  417. >
  418. <Cascader
  419. options={cascaderObjFu()['文物类别']}
  420. placeholder='请选择'
  421. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  422. allowClear={false}
  423. />
  424. </Form.Item>
  425. </div>
  426. <div className='B3Nrow'>
  427. <Form.Item label='馆内藏品分类1' name='dictHouse1'>
  428. <Cascader
  429. options={cascaderObjFu()['馆内分类1']}
  430. placeholder='请选择'
  431. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  432. allowClear={true}
  433. changeOnSelect
  434. />
  435. </Form.Item>
  436. </div>
  437. <div className='B3Nrow'>
  438. <Form.Item label='馆内藏品分类2' name='dictHouse2'>
  439. <Cascader
  440. options={cascaderObjFu()['馆内分类2']}
  441. placeholder='请选择'
  442. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  443. allowClear={true}
  444. changeOnSelect
  445. />
  446. </Form.Item>
  447. </div>
  448. <div className='B3Nrow'>
  449. <Form.Item
  450. label='年代'
  451. name='dictAge'
  452. rules={[{ required: true, message: '请选择年代' }]}
  453. >
  454. <Cascader
  455. options={[...cascaderObjFu()['年代'], { name: '其他', id: '其他' }]}
  456. onChange={value => setAgeAc(value[0] === '其他')}
  457. placeholder='请选择'
  458. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  459. allowClear={false}
  460. />
  461. </Form.Item>
  462. </div>
  463. <div className='B3Nrow'>
  464. <Form.Item
  465. label='具体年代'
  466. name='ageInfo'
  467. rules={[{ required: ageAc, message: '请输入内容' }]}
  468. >
  469. <Input maxLength={30} showCount placeholder='请输入内容' />
  470. </Form.Item>
  471. </div>
  472. <div className='B3Nrow'>
  473. <Form.Item label='制作时间' name='dateMaking'>
  474. <DatePicker placeholder='请选择日期' />
  475. </Form.Item>
  476. <div className='B3NrowDing'>
  477. <Form.Item label='作者' name='author'>
  478. <Input maxLength={30} showCount placeholder='请输入内容' />
  479. </Form.Item>
  480. </div>
  481. </div>
  482. <div className='B3Nrow'>
  483. <Form.Item label='作者介绍' name='authorDesc'>
  484. <TextArea maxLength={500} showCount placeholder='请输入内容' />
  485. </Form.Item>
  486. </div>
  487. <div className='B3Nrow B3NrowNumOrCas'>
  488. <Form.Item
  489. label='数量'
  490. name='pcs'
  491. rules={[{ required: true, message: '请输入正整数' }]}
  492. >
  493. <InputNumber min={1} max={99999999} precision={0} placeholder='请输入正整数' />
  494. </Form.Item>
  495. <Form.Item name='pcsUnit' rules={[{ required: true, message: '请选择单位' }]}>
  496. <Cascader
  497. options={cascaderObjFu()['数量单位']}
  498. placeholder='请选择'
  499. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  500. allowClear={false}
  501. />
  502. </Form.Item>
  503. </div>
  504. <div className='B3Nrow'>
  505. <Form.Item label='实际数量' name='pcsActual'>
  506. <Input maxLength={30} showCount placeholder='请输入内容' />
  507. </Form.Item>
  508. </div>
  509. <div className='B3Nrow B3Nrow1'>
  510. <Form.Item
  511. label={
  512. <div>
  513. <span className='B3Nred'> * </span>质地
  514. </div>
  515. }
  516. name='dictTexture1'
  517. >
  518. <Cascader
  519. options={cascaderObjFu()['质地']}
  520. placeholder='请选择'
  521. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  522. />
  523. </Form.Item>
  524. <Form.Item name='dictTexture2'>
  525. <Cascader
  526. options={cascaderObjFu()['复合或组合质地']}
  527. placeholder='请选择'
  528. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  529. />
  530. </Form.Item>
  531. <Form.Item name='dictTexture3' rules={[{ required: true, message: '请选择质地3' }]}>
  532. <Cascader
  533. options={cascaderObjFu()['单一质地']}
  534. placeholder='请选择'
  535. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  536. allowClear={false}
  537. />
  538. </Form.Item>
  539. <div className='B3NrowDing'>
  540. <Form.Item
  541. label='完残程度'
  542. name='dictTorn'
  543. rules={[{ required: true, message: '请选择完残程度' }]}
  544. >
  545. <Cascader
  546. options={cascaderObjFu()['完残程度']}
  547. placeholder='请选择'
  548. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  549. allowClear={false}
  550. />
  551. </Form.Item>
  552. </div>
  553. </div>
  554. {/* 封面 */}
  555. {/* <div className='formRow'>
  556. <div className='formLeft'>封面图:</div>
  557. <div className='formRight'>
  558. <ZupOne
  559. ref={ZupThumbRef}
  560. isLook={false}
  561. fileCheck={false}
  562. size={5}
  563. dirCode='goodsAdd'
  564. myUrl='cms/goods/upload'
  565. format={['image/jpeg', 'image/png']}
  566. formatTxt='png、jpg和jpeg'
  567. checkTxt='请上传封面图!'
  568. upTxt='最多1张'
  569. myType='thumb'
  570. />
  571. </div>
  572. </div> */}
  573. <div className='B3Nrow'>
  574. <Form.Item label='完残情况' name='torn'>
  575. <TextArea maxLength={500} showCount placeholder='请输入内容' />
  576. </Form.Item>
  577. </div>
  578. <div className='B3Nrow'>
  579. <Form.Item label='保存状态' name='preserveState'>
  580. <TextArea maxLength={500} showCount placeholder='请输入内容' />
  581. </Form.Item>
  582. </div>
  583. <div className='B3Nrow'>
  584. <Form.Item label='色泽' name='color'>
  585. <TextArea maxLength={500} showCount placeholder='请输入内容' />
  586. </Form.Item>
  587. </div>
  588. <div className='B3Nrow'>
  589. <Form.Item label='用途' name='uses'>
  590. <TextArea maxLength={500} showCount placeholder='请输入内容' />
  591. </Form.Item>
  592. </div>
  593. <div className='B3Nrow'>
  594. <Form.Item label='形状描述' name='shape'>
  595. <TextArea maxLength={500} showCount placeholder='请输入内容' />
  596. </Form.Item>
  597. </div>
  598. <div className='B3Nrow'>
  599. <Form.Item label='著者' name='pressAuthor'>
  600. <Input maxLength={30} showCount placeholder='请输入内容' />
  601. </Form.Item>
  602. </div>
  603. <div className='B3Nrow'>
  604. <Form.Item label='版本' name='pressVersion'>
  605. <Input maxLength={30} showCount placeholder='请输入内容' />
  606. </Form.Item>
  607. </div>
  608. <div className='B3Nrow'>
  609. <Form.Item label='存卷' name='pressFile'>
  610. <Input maxLength={30} showCount placeholder='请输入内容' />
  611. </Form.Item>
  612. </div>
  613. {/* 备注 */}
  614. <div className='formRow formRow2'>
  615. <div className='formLeft'>备注:</div>
  616. <div className='formRight'>
  617. <ZRichTexts
  618. check={false}
  619. dirCode='goodsAdd'
  620. myUrl='cms/goods/upload'
  621. isLook={false}
  622. ref={ZRichTextRef}
  623. isOne={true}
  624. upAudioBtnNone={true}
  625. />
  626. </div>
  627. </div>
  628. </div>
  629. </div>
  630. {/* 附属信息 */}
  631. <div hidden={tabTxt !== '附属信息'}>
  632. <div className='B3Ntit'>尺寸和质量</div>
  633. <div className='B3Nbox'>
  634. <div className='formRow formRow2'>
  635. <div className='formLeft'>尺寸:</div>
  636. <div className='formRight formRightSize'>
  637. <Form.Item label='通长' name='sizeL'>
  638. <InputNumber
  639. min={0}
  640. max={99999999}
  641. precision={2}
  642. placeholder='请输入数字,最多两位小数'
  643. />
  644. </Form.Item>
  645. <Form.Item label='通宽' name='sizeW'>
  646. <InputNumber
  647. min={0}
  648. max={99999999}
  649. precision={2}
  650. placeholder='请输入数字,最多两位小数'
  651. />
  652. </Form.Item>
  653. <Form.Item label='通高' name='sizeH'>
  654. <InputNumber
  655. min={0}
  656. max={99999999}
  657. precision={2}
  658. placeholder='请输入数字,最多两位小数'
  659. />
  660. </Form.Item>
  661. <Form.Item name='sizeUnit'>
  662. <Cascader
  663. options={cascaderObjFu()['尺寸单位']}
  664. placeholder='请选择'
  665. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  666. />
  667. </Form.Item>
  668. </div>
  669. </div>
  670. <div className='B3Nrow'>
  671. <Form.Item
  672. label='质量范围'
  673. name='qualityDictScope'
  674. rules={[{ required: true, message: '请选择质量范围' }]}
  675. >
  676. <Cascader
  677. options={cascaderObjFu()['质量范围']}
  678. placeholder='请选择'
  679. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  680. allowClear={false}
  681. />
  682. </Form.Item>
  683. <div className='B3NrowDing B3NrowDing2'>
  684. <Form.Item label='具体质量' name='quality'>
  685. <InputNumber
  686. min={0}
  687. max={99999999}
  688. precision={2}
  689. placeholder='请输入数字,最多两位小数'
  690. />
  691. </Form.Item>
  692. <Form.Item name='qualityUnit'>
  693. <Cascader
  694. options={cascaderObjFu()['质量单位']}
  695. placeholder='请选择'
  696. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  697. />
  698. </Form.Item>
  699. </div>
  700. </div>
  701. <div className='B3Nrow'>
  702. <Form.Item label='具体尺寸' name='sizeInfo'>
  703. <TextArea maxLength={500} showCount placeholder='请输入内容' />
  704. </Form.Item>
  705. </div>
  706. </div>
  707. <div className='B3Ntit'>入藏及来源</div>
  708. <div className='B3Nbox'>
  709. <div className='B3Nrow'>
  710. <Form.Item label='入馆凭证号' name='inHouseNum'>
  711. <Input maxLength={30} showCount placeholder='请输入内容' />
  712. </Form.Item>
  713. </div>
  714. <div className='B3Nrow'>
  715. <Form.Item label='入藏凭证号' name='inGoodsNum'>
  716. <Input maxLength={30} showCount placeholder='请输入内容' />
  717. </Form.Item>
  718. </div>
  719. <div className='B3Nrow'>
  720. <Form.Item label='入藏日期' name='inGoodsDate'>
  721. <DatePicker placeholder='请选择日期' />
  722. </Form.Item>
  723. </div>
  724. <div className='B3Nrow'>
  725. <Form.Item
  726. label='入藏日期范围'
  727. className='B3NlongTxt'
  728. name='inDictDateScope'
  729. // rules={[{ required: true, message: '请选择入藏日期范围' }]}
  730. >
  731. <Cascader
  732. options={cascaderObjFu()['入藏日期范围']}
  733. placeholder='请选择'
  734. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  735. allowClear={true}
  736. />
  737. </Form.Item>
  738. </div>
  739. <div className='B3Nrow'>
  740. <Form.Item label='入藏去向' name='accountType'>
  741. <Select options={selectObj['入藏去向']} placeholder='请选择' />
  742. </Form.Item>
  743. </div>
  744. <div className='B3Nrow'>
  745. <Form.Item
  746. label='来源'
  747. name='source'
  748. rules={[{ required: true, message: '请选择来源' }]}
  749. >
  750. <Cascader
  751. options={cascaderObjFu()['来源']}
  752. placeholder='请选择'
  753. fieldNames={{ label: 'name', value: 'id', children: 'children' }}
  754. allowClear={false}
  755. />
  756. </Form.Item>
  757. </div>
  758. <div className='B3Nrow'>
  759. <Form.Item label='来源详情' name='sourceInfo'>
  760. <TextArea maxLength={500} showCount placeholder='请输入内容' />
  761. </Form.Item>
  762. </div>
  763. <div className='B3Nrow'>
  764. <Form.Item label='征集经过' name='sourcePass'>
  765. <TextArea maxLength={500} showCount placeholder='请输入内容' />
  766. </Form.Item>
  767. </div>
  768. <div className='B3Nrow'>
  769. <Form.Item label='铭记题跋' name='sourcePreface'>
  770. <TextArea maxLength={500} showCount placeholder='请输入内容' />
  771. </Form.Item>
  772. </div>
  773. <div className='B3Nrow'>
  774. <Form.Item label='鉴藏印记' name='sourceStamp'>
  775. <TextArea maxLength={500} showCount placeholder='请输入内容' />
  776. </Form.Item>
  777. </div>
  778. </div>
  779. <div className='B3Ntit'>藏品历史及流传</div>
  780. <div className='B3Nbox'>
  781. <div className='B3Nrow'>
  782. <Form.Item label='著作及有关书目' className='B3NlongTxt2' name='historyWork'>
  783. <TextArea maxLength={500} showCount placeholder='请输入内容' />
  784. </Form.Item>
  785. </div>
  786. <div className='B3Nrow'>
  787. <Form.Item label='流传经历' name='historyUndergo'>
  788. <TextArea maxLength={500} showCount placeholder='请输入内容' />
  789. </Form.Item>
  790. </div>
  791. </div>
  792. </div>
  793. {/* 附件信息 */}
  794. <div className='B3Nbox B3Nbox1' hidden={tabTxt !== '附件信息'}>
  795. <div className='B3Ntit'>
  796. <div className='B3Ntitll'>
  797. <span>附件类型为图像并且格式为图片的第一份数据为封面图</span>
  798. </div>
  799. <Z3upFiles
  800. max={1000}
  801. isLook={false}
  802. ref={filesRef}
  803. fileCheck={false}
  804. dirCode='goodsAdd'
  805. myUrl='cms/goods/upload'
  806. lookData={[]}
  807. size={500}
  808. noShowList={true}
  809. fileRes={obj => setTable([obj, ...table])}
  810. />
  811. </div>
  812. {/* 表格 */}
  813. <MyTable
  814. list={table}
  815. columnsTemp={Y33tableC}
  816. lastBtn={tableLastBtn}
  817. startBtn={startBtn}
  818. pagingInfo={false}
  819. />
  820. </div>
  821. {/* 确定和取消按钮 */}
  822. <Form.Item className='B3Nbtn'>
  823. <Button type='primary' htmlType='submit' id='AddGoodsBtn' hidden>
  824. 提交
  825. </Button>
  826. <Button type='primary' onClick={() => btnOk('提交')}>
  827. 提交
  828. </Button>
  829. {nowSta.id === 'null' ? (
  830. <>
  831. &emsp;
  832. <Button type='primary' onClick={() => btnOk('存草稿')}>
  833. 存草稿
  834. </Button>
  835. </>
  836. ) : null}
  837. {nowSta.key === '藏品登记' ? null : (
  838. <>
  839. &emsp;
  840. <MyPopconfirm txtK='取消' onConfirm={closeFu} />
  841. </>
  842. )}
  843. </Form.Item>
  844. </Form>
  845. </div>
  846. {/* 从入馆藏品中选择一个 */}
  847. {selectOne ? (
  848. <ZGaddNow
  849. register={true}
  850. nowSta={{ key: '藏品登记', id: 'cms/register/goods/getList' }}
  851. closeFu={() => setSelectOne(false)}
  852. dataResFu={data => {
  853. if (data.length && data[0].id) {
  854. selectArr.current = data
  855. getInfo(data[0].id)
  856. } else {
  857. selectArr.current = []
  858. FormBoxRef.current?.setFieldsValue({})
  859. }
  860. }}
  861. oldCheckArr={selectArr.current}
  862. isOne={true}
  863. />
  864. ) : null}
  865. </div>
  866. )
  867. }
  868. const MemoAddGoods = React.memo(AddGoods)
  869. export default MemoAddGoods