import React, { useCallback, useEffect, useMemo, useState } from 'react' import styles from './index.module.scss' import { useParams } from 'react-router-dom' import { Y1tabArr, Y1TabArrType } from '../Y1cathet/Y1main' import classNames from 'classnames' import { Button, Dropdown, MenuProps } from 'antd' import MyPopconfirm from '@/components/MyPopconfirm' import Y11com from '../Y1cathet/Y11com' import Y22com from '../Y1cathet/Y22com' import Y33com from '../Y1cathet/Y33com' import Y44com from '../Y1cathet/Y44com' import { C1GoodType } from '@/pages/A3_ledger/C1ledger/type' import { API_goodsInfo } from '@/store/action/C1ledger' import { EXPORT_WORD_ENUM, exportWordHandler } from '@/utils/exportWordTemplates' import { API_goodFileList } from '@/store/action/C2files' import { C3_APIfocus, C3_APIfocusNo } from '@/store/action/C3focus' import { MessageFu } from '@/utils/message' import C22revamp from '@/pages/C_goodsManage/C22goodEdit/C22revamp' function Y2look() { const { id: sId } = useParams() const [info, setInfo] = useState({} as C1GoodType) const getInfoFu = useCallback(async (id: number) => { const res = await API_goodsInfo(id) if (res.code === 0) { setInfo(res.data) } }, []) const handleExport = async () => { const res = await API_goodFileList(sId) exportWordHandler(EXPORT_WORD_ENUM.COLLECTION_CARD, { ...info, imagePages: [ { thumb: info.thumb }, ...res.data.filter((i: any) => i.type === 'img') ] }) } useEffect(() => { getInfoFu(sId) }, [getInfoFu, sId]) const [tabAc, setTabAc] = useState('藏品信息') // 待完善 各种按钮跳转等等 const items1 = useMemo(() => { let arr: MenuProps['items'] = [ { key: '1', label: ( setIsEdit(true)}> 编辑 ) }, { key: '2', label: ( {}} Dom={删除} /> ) } ] return arr }, []) const items2 = useMemo(() => { let arr: MenuProps['items'] = [ { key: '1', label: 入库 }, { key: '2', label: 移库 }, { key: '3', label: 出库 }, { key: '4', label: 注销 } ] return arr }, []) const items3 = useMemo(() => { let arr: MenuProps['items'] = [ { key: '1', label: 事故登记 }, { key: '2', label: 残损登记 }, { key: '3', label: 现状登记 }, { key: '4', label: 文物修复 } ] return arr }, []) // 点击关注 const focusFu = useCallback( async (val: '关注' | '取消关注') => { const res = val === '关注' ? await C3_APIfocus(sId) : await C3_APIfocusNo(sId) if (res.code === 0) { MessageFu.success(val + '成功!') getInfoFu(sId) } }, [getInfoFu, sId] ) // 点击藏品编辑(修改) const [isEdit, setIsEdit] = useState(false) return (
藏品详情
{Y1tabArr.map(v => (
setTabAc(v)} > {v}
))}
{info.display === 1 ? ( <>   ) : null} {info.display === 1 ? ( <>   ) : null} {/* */}
{info.id ? (
{tabAc === '藏品信息' ? : null} {tabAc === '库存信息' ? : null} {tabAc === '藏品附件' ? : null} {tabAc === '藏品日志' ? : null}
) : null} {isEdit ? (
setIsEdit(false)} type='新增' />
) : null}
) } const MemoY2look = React.memo(Y2look) export default MemoY2look