diff --git a/src/route/Refun/Refun.tsx b/src/route/Refun/Refun.tsx index 12fbe1a..34e8adb 100644 --- a/src/route/Refun/Refun.tsx +++ b/src/route/Refun/Refun.tsx @@ -8,7 +8,8 @@ import { import { useSelector, useDispatch } from 'react-redux' import { get, put, downloadUrl } from '../../util/AjaxUtils' import type { TableProps } from 'antd'; -import {getMenuActive} from '../../util/cache' +import { getMenuActive } from '../../util/cache' +import { useNavigate } from "react-router-dom"; interface DataType { projName: string; projPayment: string; @@ -26,6 +27,7 @@ import { useLocation } from 'react-router-dom' export default function Refun() { const height = window.innerHeight - 180; const [messageApi, contextHolder] = message.useMessage(); + const nav = useNavigate(); const [isLoading, setIsLoading] = useState(false) const [page, setPage] = useState(1) // 分页 // const [total, setTotal] = useState(0) // 数据总数 @@ -33,7 +35,7 @@ export default function Refun() { const [revokeModal, setRevokeModal] = useState(false) //撤销弹窗 const [projRefundApplyId, setprojRefundApplyId] = useState('') //要撤销的id const { state } = useLocation() - const type = state? state.type:getMenuActive() + const type = state ? state.type : getMenuActive() // setMenuActive(type) // {state.type} const columns: TableProps['columns'] = @@ -59,7 +61,7 @@ export default function Refun() { key: 'projPayment', align: 'center', width: 150, - render: (text) =>
{text/100}
, + render: (text) =>
{text / 100}
, }, { title: '退款原因', @@ -112,12 +114,12 @@ export default function Refun() { // // console.log(record.img); // }}> 预览 (record.refundVoucherFileKVs).map((item: any, index: number) => ( - -
{ - window.open(downloadUrl(item.key, false), '_blank') - }}>{item.value}
- - + +
{ + window.open(downloadUrl(item.key, false), '_blank') + }}>{item.value}
+ + )) ), @@ -147,7 +149,7 @@ export default function Refun() { key: 'projPayment', align: 'center', width: 150, - render: (text) =>
{text/100}
, + render: (text) =>
{text / 100}
, }, { title: '退款原因', @@ -199,13 +201,13 @@ export default function Refun() { //
{ // console.log(record.refundVoucherFileKVs); // }}> 预览
- (record.refundVoucherFileKVs).map((item: any,index:number) => ( - -
{ - window.open(downloadUrl(item.key, false), '_blank') - }}>{item.value}
- - + (record.refundVoucherFileKVs).map((item: any, index: number) => ( + +
{ + window.open(downloadUrl(item.key, false), '_blank') + }}>{item.value}
+ + )) ), @@ -248,7 +250,7 @@ export default function Refun() { key: 'projPayment', align: 'center', width: 150, - render: (text) =>
{text/100}
, + render: (text) =>
{text / 100}
, }, { title: '退款原因', @@ -301,11 +303,11 @@ export default function Refun() { // // console.log(record.img); // }}> 预览 (record.refundVoucherFileKVs).map((item: any, index: number) => ( - -
{ - window.open(downloadUrl(item.key, false), '_blank') - }}>{item.value}
- + +
{ + window.open(downloadUrl(item.key, false), '_blank') + }}>{item.value}
+ )) ), @@ -411,15 +413,17 @@ export default function Refun() { } }) } - // useEffect(()=>{ - // getData(page) - // },[]) + useEffect(() => { + if (!state) { + nav('/home') + } + }, []) useEffect(() => { // getData(1) setPage(1) getData(1) console.log(type); - + }, [type]) return ( @@ -450,11 +454,11 @@ export default function Refun() { } } - scroll={{ y: height - 150}} + scroll={{ y: height - 150 }} rowKey="projId" /> -
+
{/* { setPage(page) getData(page)