import React, { useCallback, useEffect, useMemo, useState } from 'react' import styles from './index.module.scss' import { useParams } from 'react-router-dom' import { A2A_APIgetInfo, A2A_APIremove } from '@/store/action/A2Abusiness' import { Button } from 'antd' import MyPopconfirm from '@/components/MyPopconfirm' import { A1addType } from '@/pages/A1Camera/data' import { MessageFu } from '@/utils/message' import history from '@/utils/history' import { A2AListCamerasType, A2AListType } from '@/types' import AddBusiness from '@/pages/A2Abusiness/AddBusiness' import LookTxt from '../components/LookTxt' import { A2AtopTypeObj } from '@/pages/A2Abusiness/data' import LookTxt2 from '../components/LookTxt2' import LookTable from '../components/LookTable' import { lookTable2 } from '../components/LookTable/tableData' function A2WX() { const urlObj: any = useParams() const [urlId, setUrlId] = useState(0) const [info, setInfo] = useState({} as A2AListType) // 获取地址栏参数 useEffect(() => { setUrlId(Number(urlObj.id)) }, [urlObj]) // 通过id获取详情 const getInfoFu = useCallback(async (id: number) => { const res = await A2A_APIgetInfo(id) if (res.code === 0) { const data = res.data const rtf = data.rtf || '{"isSection":"true","txtArr":[{"txt":"
"}]}' const refObj = JSON.parse(rtf) const rtfDesc = data.rtfDesc || '{"isSection":"true","txtArr":[{"txt":""}]}' const rtfDescObj = JSON.parse(rtfDesc) setInfo({ ...data, cameras: data.cameras || [], files: data.files || [], rtf: refObj, rtfDesc: rtfDescObj }) } }, []) // 进页面发送请求 useEffect(() => { if (urlId) { getInfoFu(urlId) } }, [getInfoFu, urlId]) // 点击删除 const delFu = useCallback(async () => { const res = await A2A_APIremove(urlId) if (res.code === 0) { MessageFu.success('删除成功!') history.go(-1) } }, [urlId]) // 点击编辑 const [openInfo, setOpenInfo] = useState