index.tsx 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
  2. import styles from './index.module.scss'
  3. import { useParams } from 'react-router-dom'
  4. import { pageTitTxtObj } from '@/pages/D_storeManage/D4impStor/D4edit'
  5. import X3auditInfo from '@/pages/X_stock/X3auditInfo'
  6. import { Button, DatePicker, Input } from 'antd'
  7. import dayjs from 'dayjs'
  8. import { B3aForm1 } from '@/pages/B_enterTibet/B3_4page/B3edit/data'
  9. import Z3upFiles from '@/components/Z3upFiles'
  10. import ZRichTexts from '@/components/ZRichTexts'
  11. import B3GaddNow from '@/pages/B_enterTibet/B3goodsTable/B3GaddNow'
  12. import MyTable from '@/components/MyTable'
  13. import history, { btnFlagFu2, openGoodsInfoFu, textFu } from '@/utils/history'
  14. import MyPopconfirm from '@/components/MyPopconfirm'
  15. import { B3eTableC, statusObj } from '@/utils/tableData'
  16. import { MessageFu } from '@/utils/message'
  17. import classNames from 'classnames'
  18. import Y1cathet from '@/pages/Y_goodsDetails/Y1cathet'
  19. import B3GaddNew from '@/pages/B_enterTibet/B3goodsTable/B3GaddNew'
  20. import ImageLazy from '@/components/ImageLazy'
  21. import X2lookText from '@/pages/X_stock/X2lookText'
  22. import B3flowTable from '@/pages/B_enterTibet/B3flowTable'
  23. import { FourTableType } from '@/pages/B_enterTibet/B3_4page/type'
  24. import {
  25. C6_APIcreate,
  26. C6_APIdel,
  27. C6_APIgetInfo,
  28. C6_APIrevocation,
  29. C6_APIsaveApply,
  30. C6_APIsaveAudit,
  31. C6_APIsaveCreate,
  32. C6_APIsaveDraft
  33. } from '@/store/action/C6edit'
  34. import { EXbtnFu } from '@/utils/EXBtn'
  35. import {
  36. ArrKeyType,
  37. Y11infoArr1,
  38. Y11infoArr2,
  39. Y11infoArr3,
  40. Y11infoArr4,
  41. Y11infoArr5
  42. } from '@/pages/Y_goodsDetails/Y1cathet/data'
  43. import { baseURL } from '@/utils/http'
  44. import { GoodFileType } from '@/pages/B_enterTibet/B3goodsTable/B3GaddNew/type'
  45. export type OldNewType = {
  46. name: string
  47. qian: string | GoodFileType[]
  48. hou: string | GoodFileType[]
  49. }
  50. const oldNewTxtArr: ArrKeyType = [
  51. ...Y11infoArr1,
  52. ...Y11infoArr2,
  53. ...Y11infoArr3,
  54. ...Y11infoArr4,
  55. ...Y11infoArr5,
  56. {
  57. name: '封面图',
  58. key: 'thumb',
  59. backFu: info => {
  60. return { thumb: info.thumb, thumbPc: info.thumbPc }
  61. }
  62. }
  63. ]
  64. function C6add() {
  65. // 新旧附件信息对比
  66. const [oldNewArr, setOldNewArr] = useState<OldNewType[]>([])
  67. const { key, id } = useParams<any>()
  68. // key:1 新增 2编辑 3审批 4查看
  69. // 滚到顶部
  70. const sollrDom = useRef<HTMLDivElement>(null)
  71. // 顶部数据
  72. const [topInfo, setTopInfo] = useState({} as FourTableType)
  73. // 创建订单
  74. const creatFu = useCallback(async () => {
  75. const res = await C6_APIcreate()
  76. if (res.code === 0) {
  77. setTopInfo(res.data)
  78. }
  79. }, [])
  80. // 获取详情
  81. const getInfoFu = useCallback(async () => {
  82. const res = await C6_APIgetInfo(id)
  83. if (res.code === 0) {
  84. const obj = { ...res.data }
  85. try {
  86. if (obj.goods && obj.goods.length && obj.goods[0].tempGoodsJson)
  87. obj.tempGoodsJson = JSON.parse(obj.goods[0].tempGoodsJson)
  88. if (obj.snap) setOldNewArr(JSON.parse(obj.snap))
  89. } catch (error) {
  90. console.log('error:', error)
  91. }
  92. setTopInfo(obj)
  93. // 设置富文本
  94. ZRichTextRef.current?.ritxtShowFu(JSON.parse(res.data.rtf || '{}'))
  95. }
  96. }, [id])
  97. useEffect(() => {
  98. if (key === '1') creatFu()
  99. else getInfoFu()
  100. if (sollrDom.current) sollrDom.current.scrollTop = 0
  101. }, [creatFu, getInfoFu, key])
  102. // 上传附件的ref
  103. const filesRef = useRef<any>(null)
  104. // const filesRes = filesRef.current.filesIdRes();
  105. // 富文本的ref
  106. const ZRichTextRef = useRef<any>(null)
  107. // 审批意见的ref
  108. const ZAuditRef = useRef<any>(null)
  109. const timeChange = useCallback(
  110. (e: any) => {
  111. setTopInfo({ ...topInfo, date: dayjs(e).format('YYYY-MM-DD') })
  112. },
  113. [topInfo]
  114. )
  115. // 审批的sta
  116. const [auditSta, setAuDitSta] = useState('')
  117. // 新增的底部按钮点击
  118. const btnClickFu = useCallback(
  119. async (val: '草稿' | '创建' | '保存' | '审批') => {
  120. if (!topInfo.name) return MessageFu.warning('申请名称不能为空')
  121. // 藏品编辑校验
  122. if (val !== '草稿') {
  123. if (!topInfo.goods || (topInfo.goods && topInfo.goods.length === 0))
  124. return MessageFu.warning('请选择藏品')
  125. if (oldNewArr.length === 0) return MessageFu.warning('未修改藏品信息')
  126. }
  127. if (val === '审批') {
  128. // console.log('审批信息富文本', rtf2)
  129. if (!auditSta) {
  130. if (sollrDom.current) sollrDom.current.scrollTop = 0
  131. return MessageFu.warning('请选择审批结果')
  132. }
  133. const rtf2 = ZAuditRef.current?.resData()
  134. const res = await C6_APIsaveAudit({
  135. orderId: topInfo.id,
  136. rtfOpinion: rtf2,
  137. status: auditSta === '同意' ? 1 : 2
  138. })
  139. if (res.code === 0) {
  140. MessageFu.success('审批成功')
  141. // 跳详情页
  142. history.push(`/edit_add/4/${topInfo.id}`)
  143. }
  144. } else {
  145. const rtf1 = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
  146. // console.log('申请信息富文本', JSON.stringify(rtf1.val || ''))
  147. // 上传附件
  148. const filesRes = filesRef.current.filesIdRes()
  149. const obj = {
  150. ...topInfo,
  151. fileIds: filesRes.join(','),
  152. rtf: JSON.stringify(rtf1.val || ''),
  153. goodsIds: topInfo.goods.map(v => v.id).join(','),
  154. snap: JSON.stringify(oldNewArr),
  155. tempGoodsJson: topInfo.tempGoodsJson
  156. }
  157. // console.log(123, obj)
  158. // if (1 + 1 === 2) return
  159. if (val === '草稿') {
  160. // 存草稿 当前页保存 不跳转
  161. const res = await C6_APIsaveDraft(obj)
  162. if (res.code === 0) {
  163. MessageFu.success('草稿保存成功')
  164. }
  165. } else {
  166. const res = val === '创建' ? await C6_APIsaveCreate(obj) : await C6_APIsaveApply(obj)
  167. if (res.code === 0) {
  168. MessageFu.success(`${val}成功`)
  169. // 跳到详情页
  170. history.push(`/edit_add/4/${topInfo.id}`)
  171. }
  172. }
  173. }
  174. },
  175. [auditSta, oldNewArr, topInfo]
  176. )
  177. // 打开侧边栏
  178. const [cathet, setCathet] = useState(0)
  179. const startBtn = useMemo(() => {
  180. return [
  181. {
  182. title: '藏品编号',
  183. render: (item: FourTableType) => {
  184. return (
  185. <span
  186. onClick={() => setCathet(item.id)}
  187. className={classNames('D1GtNum', item.id === cathet ? 'D1GtNumAc' : '')}
  188. >
  189. {item.num}
  190. </span>
  191. )
  192. }
  193. }
  194. ]
  195. }, [cathet])
  196. const tableLastBtn = useMemo(() => {
  197. return [
  198. {
  199. title: '操作',
  200. render: (item: FourTableType) => {
  201. return (
  202. <>
  203. <Button size='small' type='text' onClick={() => openGoodsInfoFu(item.id)}>
  204. 查看
  205. </Button>
  206. {['3', '4'].includes(key) ? null : (
  207. <MyPopconfirm
  208. txtK='删除'
  209. onConfirm={() =>
  210. setTopInfo({
  211. ...topInfo,
  212. goods: topInfo.goods.filter(v => v.id !== item.id)
  213. })
  214. }
  215. />
  216. )}
  217. </>
  218. )
  219. }
  220. }
  221. ]
  222. }, [key, topInfo])
  223. // 点击所选藏品 / 继续编辑
  224. const [nowSta, setNowSta] = useState({ key: '', id: '', type: '' })
  225. // 查看的按钮创建-提交-撤回
  226. const lookBtnFu = useCallback(
  227. async (val: '创建' | '提交' | '撤回') => {
  228. const rtf1 = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
  229. // console.log('申请信息富文本', JSON.stringify(rtf1.val || ''))
  230. // 上传附件
  231. const filesRes = filesRef.current.filesIdRes()
  232. const obj = {
  233. ...topInfo,
  234. fileIds: filesRes.join(','),
  235. rtf: JSON.stringify(rtf1.val || ''),
  236. goodsIds: topInfo.goods.map(v => v.id).join(','),
  237. snap: JSON.stringify(oldNewArr),
  238. tempGoodsJson: topInfo.tempGoodsJson
  239. }
  240. const res =
  241. val === '创建'
  242. ? await C6_APIsaveCreate(obj)
  243. : val === '提交'
  244. ? await C6_APIsaveApply(obj)
  245. : await C6_APIrevocation(id)
  246. if (res.code === 0) {
  247. if (sollrDom.current) sollrDom.current.scrollTop = 0
  248. MessageFu.success(val + '成功')
  249. getInfoFu()
  250. }
  251. },
  252. [getInfoFu, id, oldNewArr, topInfo]
  253. )
  254. // 查看模式点击删除
  255. const delFu = useCallback(async () => {
  256. const res = await C6_APIdel(id)
  257. if (res.code === 0) {
  258. MessageFu.success('删除成功')
  259. history.push('/edit')
  260. }
  261. }, [id])
  262. // 查看模式点击审批 编辑
  263. const lookJumpFu = useCallback(
  264. (val: '审批' | '编辑') => {
  265. history.push(`/edit_add/${val === '审批' ? 3 : 2}/${id}`)
  266. MessageFu.success(`已跳转至${val}页面`)
  267. },
  268. [id]
  269. )
  270. // 查看模式下的按钮
  271. const lookBtn = useMemo(() => {
  272. return (
  273. <>
  274. {btnFlagFu2(topInfo)['创建'] ? (
  275. <Button type='primary' onClick={() => lookBtnFu('创建')}>
  276. 创建
  277. </Button>
  278. ) : null}
  279. {btnFlagFu2(topInfo)['提交'] ? (
  280. <Button type='primary' onClick={() => lookBtnFu('提交')}>
  281. 提交
  282. </Button>
  283. ) : null}
  284. {btnFlagFu2(topInfo)['撤回'] ? (
  285. <MyPopconfirm
  286. txtK='撤回'
  287. onConfirm={() => lookBtnFu('撤回')}
  288. Dom={
  289. <Button type='primary' danger>
  290. 撤回
  291. </Button>
  292. }
  293. />
  294. ) : null}
  295. {btnFlagFu2(topInfo)['审批'] ? (
  296. <Button type='primary' onClick={() => lookJumpFu('审批')}>
  297. 审批
  298. </Button>
  299. ) : null}
  300. {btnFlagFu2(topInfo)['编辑'] ? (
  301. <Button type='primary' onClick={() => lookJumpFu('编辑')}>
  302. 编辑
  303. </Button>
  304. ) : null}
  305. {btnFlagFu2(topInfo)['重新提交'] ? (
  306. <Button type='primary' onClick={() => lookBtnFu('提交')}>
  307. 重新提交
  308. </Button>
  309. ) : null}
  310. {EXbtnFu(topInfo)}
  311. {btnFlagFu2(topInfo)['删除'] ? (
  312. <MyPopconfirm
  313. txtK='删除'
  314. onConfirm={() => delFu()}
  315. Dom={
  316. <Button type='primary' danger>
  317. 删除
  318. </Button>
  319. }
  320. />
  321. ) : null}
  322. <Button onClick={() => history.push('/edit')}>返回</Button>
  323. </>
  324. )
  325. }, [delFu, lookBtnFu, lookJumpFu, topInfo])
  326. // 编辑明细 表格
  327. const tableLastBtn2Fu = useCallback((item: OldNewType, key: 'qian' | 'hou') => {
  328. if (item.name === '备注') {
  329. if (textFu(item[key] as string)) {
  330. return (
  331. <Button size='small' type='text' onClick={() => setLook(textFu(item[key] as string))}>
  332. 查看
  333. </Button>
  334. )
  335. } else return '-'
  336. } else if (item.name === '附件信息') {
  337. let arr = item[key] as GoodFileType[]
  338. return arr.length
  339. ? arr.map((v: any, i: number) => (
  340. <a key={v.id} href={baseURL + v.filePath} download target='_blank' rel='noreferrer'>
  341. {v.fileName}
  342. {i < arr!.length - 1 ? ',' : ''}
  343. </a>
  344. ))
  345. : '-'
  346. } else if (item.name === '封面图') {
  347. const info: any = item[key]
  348. return (
  349. <div className='tableImgAuto'>
  350. <ImageLazy
  351. width={60}
  352. height={60}
  353. srcBig={info.thumbPc || info.filePath}
  354. src={info.thumb}
  355. />
  356. </div>
  357. )
  358. } else return item[key] || '(空)'
  359. }, [])
  360. const tableLastBtn2 = useMemo(() => {
  361. return [
  362. {
  363. title: '编辑项',
  364. render: (item: OldNewType) =>
  365. ['封面图', '附件信息', '备注'].includes(item.name) ? (
  366. <span className='C6tab2Tit'>{item.name}</span>
  367. ) : (
  368. item.name
  369. )
  370. },
  371. {
  372. title: '编辑前',
  373. render: (item: OldNewType) => tableLastBtn2Fu(item, 'qian')
  374. },
  375. {
  376. title: '编辑后',
  377. render: (item: OldNewType) => tableLastBtn2Fu(item, 'hou')
  378. }
  379. ]
  380. }, [tableLastBtn2Fu])
  381. //查看富文本信息
  382. const [look, setLook] = useState('')
  383. return (
  384. <div className={styles.C6add}>
  385. <div className='pageTitle'>藏品编辑-{Reflect.get(pageTitTxtObj, key)}</div>
  386. <div className='C6main' ref={sollrDom}>
  387. {['3'].includes(key) ? (
  388. <X3auditInfo
  389. dirCode='C6edit'
  390. myUrl='cms/orderEdit/upload'
  391. auditSta={auditSta}
  392. auditStaFu={val => setAuDitSta(val)}
  393. ref={ZAuditRef}
  394. />
  395. ) : null}
  396. {/* 表单字段、附件等 */}
  397. <div className='C6Tit'>
  398. 申请信息
  399. {key === '1' ? null : (
  400. <Button type='dashed'>{Reflect.get(statusObj, topInfo.status)}</Button>
  401. )}
  402. </div>
  403. <div className='C6rowAll'>
  404. <div className='C6row'>
  405. <div className='C6rowll'>
  406. <span> * </span>申请名称:
  407. </div>
  408. <div className='C6rowrr'>
  409. <Input
  410. value={topInfo.name}
  411. onChange={e => setTopInfo({ ...topInfo, name: e.target.value.trim() })}
  412. readOnly={['3', '4'].includes(key)}
  413. placeholder='请输入内容'
  414. maxLength={30}
  415. showCount
  416. />
  417. </div>
  418. </div>
  419. <div className='C6row'>
  420. <div className='C6rowll'>
  421. <span> * </span>业务日期:
  422. </div>
  423. <div className='C6rowrr'>
  424. <DatePicker
  425. disabled={['3', '4'].includes(key)}
  426. allowClear={false}
  427. value={dayjs(topInfo.date)}
  428. onChange={timeChange}
  429. />
  430. </div>
  431. </div>
  432. {B3aForm1.map(v => (
  433. <div className='C6row' key={v.name}>
  434. <div className='C6rowll'>{v.name}:</div>
  435. <div className='C6rowrr'>
  436. {topInfo[v.key as 'name']}
  437. {['3', '4'].includes(key) && v.name === '发起人'
  438. ? ' - ' + topInfo.createTime || ''
  439. : ''}
  440. </div>
  441. </div>
  442. ))}
  443. <div className='C6row C6row2'>
  444. <div className='C6rowll'>附件:</div>
  445. <div className='C6rowrr'>
  446. <Z3upFiles
  447. max={10}
  448. isLook={['3', '4'].includes(key)}
  449. ref={filesRef}
  450. fileCheck={false}
  451. dirCode='C6edit'
  452. myUrl='cms/orderEdit/upload'
  453. lookData={topInfo.files || []}
  454. size={500}
  455. />
  456. </div>
  457. </div>
  458. <div className='C6row'>
  459. <div className='C6rowll'>原因事由:</div>
  460. <div className='C6rowrr'>
  461. <Input
  462. value={topInfo.reason}
  463. onChange={e => setTopInfo({ ...topInfo, reason: e.target.value })}
  464. readOnly={['3', '4'].includes(key)}
  465. placeholder='请输入内容'
  466. maxLength={30}
  467. showCount
  468. />
  469. </div>
  470. </div>
  471. <div className='C6row C6rowFull'>
  472. <div className='C6rowll'>备注:</div>
  473. <div className='C6rowrr'>
  474. <ZRichTexts
  475. check={false}
  476. dirCode='C6edit'
  477. myUrl='cms/orderEdit/upload'
  478. isLook={['3', '4'].includes(key)}
  479. ref={ZRichTextRef}
  480. isOne={true}
  481. upAudioBtnNone={true}
  482. />
  483. </div>
  484. </div>
  485. </div>
  486. {/* 所选藏品 */}
  487. <div className='C6googsBox'>
  488. <div className='C6Tit2'>
  489. <div className='C6Tit2ll'>所选藏品</div>
  490. <div className='C6Tit2rr'>
  491. {['3', '4'].includes(key) ? null : (
  492. <>
  493. <Button
  494. type='primary'
  495. onClick={() =>
  496. setNowSta({ key: '7', id: 'cms/orderEdit/goods/getList', type: 'now' })
  497. }
  498. >
  499. 选择藏品
  500. </Button>
  501. <Button
  502. disabled={!(topInfo.goods && topInfo.goods.length)}
  503. type='primary'
  504. onClick={() =>
  505. setNowSta({ key: '7', id: topInfo.goods[0].id + '', type: 'new' })
  506. }
  507. >
  508. 继续编辑
  509. </Button>
  510. </>
  511. )}
  512. </div>
  513. </div>
  514. {/* 表格 */}
  515. <MyTable
  516. list={topInfo.goods || []}
  517. columnsTemp={B3eTableC}
  518. startBtn={startBtn}
  519. lastBtn={tableLastBtn}
  520. pagingInfo={false}
  521. />
  522. </div>
  523. {/* 编辑明细 */}
  524. <div className='C6googsBox'>
  525. <div className='C6Tit'>编辑明细</div>
  526. {/* 表格 */}
  527. <MyTable
  528. rowKey='name'
  529. list={oldNewArr}
  530. columnsTemp={[]}
  531. lastBtn={tableLastBtn2}
  532. pagingInfo={false}
  533. />
  534. </div>
  535. {/* 申请流程 */}
  536. {['3', '4'].includes(key) ? <B3flowTable tableArr={topInfo.audits || []} /> : null}
  537. </div>
  538. {/* 底部按钮 */}
  539. <div className='C6btn'>
  540. {key === '4' ? (
  541. lookBtn
  542. ) : (
  543. <>
  544. {key === '3' ? (
  545. <Button type='primary' onClick={() => btnClickFu('审批')}>
  546. 审批
  547. </Button>
  548. ) : (
  549. <Button type='primary' onClick={() => btnClickFu(key === '1' ? '创建' : '保存')}>
  550. {key === '1' ? '创建' : '保存'}
  551. </Button>
  552. )}
  553. {key === '1' ? (
  554. <Button type='primary' onClick={() => btnClickFu('草稿')}>
  555. 存草稿
  556. </Button>
  557. ) : null}
  558. <MyPopconfirm txtK='取消' onConfirm={() => history.push('/edit')} />
  559. </>
  560. )}
  561. </div>
  562. {/* 打开侧边栏 */}
  563. <Y1cathet sId={cathet} closeFu={() => setCathet(0)} />
  564. {/* 所选藏品弹窗 / 继续编辑 */}
  565. {nowSta.id ? (
  566. nowSta.type === 'now' ? (
  567. <B3GaddNow
  568. isOne={true}
  569. nowSta={nowSta}
  570. closeFu={() => setNowSta({ key: '', id: '', type: '' })}
  571. dataResFu={data => {
  572. setTopInfo({ ...topInfo, goods: data })
  573. setTimeout(() => {
  574. setNowSta({ key: '7', id: data[0].id + '', type: 'new' })
  575. }, 20)
  576. // 编辑明细清空
  577. if (topInfo.goods && topInfo.goods[0] && data[0].id !== topInfo.goods[0].id) {
  578. setOldNewArr([])
  579. }
  580. }}
  581. oldCheckArr={topInfo.goods || []}
  582. />
  583. ) : (
  584. <B3GaddNew
  585. nowSta={nowSta}
  586. closeFu={() => setNowSta({ key: '', id: '', type: '' })}
  587. isEdit={true}
  588. succFu={(newObj, _, fileNewTemp, fileOldTemp) => {
  589. const arrRes: OldNewType[] = []
  590. oldNewTxtArr.forEach(v => {
  591. const oldInfo = topInfo.goods[0]
  592. let oldTxt = oldInfo[v.key]
  593. let newTxt = newObj[v.key] as string
  594. if ((oldTxt || newTxt) && oldTxt !== newTxt && v.name !== '制档日期') {
  595. if (v.backFu && v.name !== '备注') oldTxt = v.backFu(oldInfo)
  596. if (v.backFu && v.name !== '备注') newTxt = v.backFu(newObj)
  597. arrRes.push({
  598. name: v.name,
  599. qian: oldTxt,
  600. hou: newTxt
  601. })
  602. }
  603. })
  604. // 附件信息的对比
  605. const fileOld = fileOldTemp || []
  606. const fileNew = fileNewTemp || []
  607. const fileOldIds = fileOld.map(v => v.id).join('')
  608. const fileNewIds = fileNew.map(v => v.id).join('')
  609. if (fileOldIds !== fileNewIds) {
  610. arrRes.push({
  611. name: '附件信息',
  612. qian: fileOld.map(
  613. v =>
  614. ({
  615. id: v.id,
  616. fileName: v.fileName,
  617. filePath: v.filePath
  618. } as GoodFileType)
  619. ),
  620. hou: fileNew.map(
  621. v =>
  622. ({
  623. id: v.id,
  624. fileName: v.fileName,
  625. filePath: v.filePath
  626. } as GoodFileType)
  627. )
  628. })
  629. }
  630. setTopInfo({ ...topInfo, tempGoodsJson: newObj })
  631. setOldNewArr(arrRes)
  632. }}
  633. />
  634. )
  635. ) : null}
  636. {/* 查看富文本 */}
  637. {look ? <X2lookText closeFu={() => setLook('')} text={look} /> : null}
  638. </div>
  639. )
  640. }
  641. const MemoC6add = React.memo(C6add)
  642. export default MemoC6add