This commit is contained in:
xixi 2024-08-23 12:31:55 +08:00
parent f4f1f52e57
commit 82a1a7e995

View File

@ -8,7 +8,8 @@ import {
import { useSelector, useDispatch } from 'react-redux' import { useSelector, useDispatch } from 'react-redux'
import { get, put, downloadUrl } from '../../util/AjaxUtils' import { get, put, downloadUrl } from '../../util/AjaxUtils'
import type { TableProps } from 'antd'; import type { TableProps } from 'antd';
import {getMenuActive} from '../../util/cache' import { getMenuActive } from '../../util/cache'
import { useNavigate } from "react-router-dom";
interface DataType { interface DataType {
projName: string; projName: string;
projPayment: string; projPayment: string;
@ -26,6 +27,7 @@ import { useLocation } from 'react-router-dom'
export default function Refun() { export default function Refun() {
const height = window.innerHeight - 180; const height = window.innerHeight - 180;
const [messageApi, contextHolder] = message.useMessage(); const [messageApi, contextHolder] = message.useMessage();
const nav = useNavigate();
const [isLoading, setIsLoading] = useState(false) const [isLoading, setIsLoading] = useState(false)
const [page, setPage] = useState(1) // 分页 const [page, setPage] = useState(1) // 分页
// const [total, setTotal] = useState(0) // 数据总数 // const [total, setTotal] = useState(0) // 数据总数
@ -33,7 +35,7 @@ export default function Refun() {
const [revokeModal, setRevokeModal] = useState(false) //撤销弹窗 const [revokeModal, setRevokeModal] = useState(false) //撤销弹窗
const [projRefundApplyId, setprojRefundApplyId] = useState('') //要撤销的id const [projRefundApplyId, setprojRefundApplyId] = useState('') //要撤销的id
const { state } = useLocation() const { state } = useLocation()
const type = state? state.type:getMenuActive() const type = state ? state.type : getMenuActive()
// setMenuActive(type) // setMenuActive(type)
// {state.type} // {state.type}
const columns: TableProps<DataType>['columns'] = const columns: TableProps<DataType>['columns'] =
@ -59,7 +61,7 @@ export default function Refun() {
key: 'projPayment', key: 'projPayment',
align: 'center', align: 'center',
width: 150, width: 150,
render: (text) => <div style={{color:'red',fontWeight:700}}>{text/100}</div>, render: (text) => <div style={{ color: 'red', fontWeight: 700 }}>{text / 100}</div>,
}, },
{ {
title: '退款原因', title: '退款原因',
@ -113,9 +115,9 @@ export default function Refun() {
// }}> 预览</div> // }}> 预览</div>
(record.refundVoucherFileKVs).map((item: any, index: number) => ( (record.refundVoucherFileKVs).map((item: any, index: number) => (
<div style={{ cursor: 'pointer', color: 'var(--color-blue)' }} key={index} onClick={() => { <div style={{ cursor: 'pointer', color: 'var(--color-blue)' }} key={index} onClick={() => {
window.open(downloadUrl(item.key, false), '_blank') window.open(downloadUrl(item.key, false), '_blank')
}}>{item.value}</div> }}>{item.value}</div>
)) ))
@ -147,7 +149,7 @@ export default function Refun() {
key: 'projPayment', key: 'projPayment',
align: 'center', align: 'center',
width: 150, width: 150,
render: (text) => <div style={{color:'red',fontWeight:700}}>{text/100}</div>, render: (text) => <div style={{ color: 'red', fontWeight: 700 }}>{text / 100}</div>,
}, },
{ {
title: '退款原因', title: '退款原因',
@ -199,11 +201,11 @@ export default function Refun() {
// <div className='refunBtn' onClick={() => { // <div className='refunBtn' onClick={() => {
// console.log(record.refundVoucherFileKVs); // console.log(record.refundVoucherFileKVs);
// }}> 预览</div> // }}> 预览</div>
(record.refundVoucherFileKVs).map((item: any,index:number) => ( (record.refundVoucherFileKVs).map((item: any, index: number) => (
<div style={{ cursor: 'pointer', color: 'var(--color-blue)' }} key={index} onClick={() => { <div style={{ cursor: 'pointer', color: 'var(--color-blue)' }} key={index} onClick={() => {
window.open(downloadUrl(item.key, false), '_blank') window.open(downloadUrl(item.key, false), '_blank')
}}>{item.value}</div> }}>{item.value}</div>
)) ))
@ -248,7 +250,7 @@ export default function Refun() {
key: 'projPayment', key: 'projPayment',
align: 'center', align: 'center',
width: 150, width: 150,
render: (text) => <div style={{color:'red',fontWeight:700}}>{text/100}</div>, render: (text) => <div style={{ color: 'red', fontWeight: 700 }}>{text / 100}</div>,
}, },
{ {
title: '退款原因', title: '退款原因',
@ -302,9 +304,9 @@ export default function Refun() {
// }}> 预览</div> // }}> 预览</div>
(record.refundVoucherFileKVs).map((item: any, index: number) => ( (record.refundVoucherFileKVs).map((item: any, index: number) => (
<div style={{ cursor: 'pointer', color: 'var(--color-blue)' }} key={index} onClick={() => { <div style={{ cursor: 'pointer', color: 'var(--color-blue)' }} key={index} onClick={() => {
window.open(downloadUrl(item.key, false), '_blank') window.open(downloadUrl(item.key, false), '_blank')
}}>{item.value}</div> }}>{item.value}</div>
)) ))
@ -411,9 +413,11 @@ export default function Refun() {
} }
}) })
} }
// useEffect(()=>{ useEffect(() => {
// getData(page) if (!state) {
// },[]) nav('/home')
}
}, [])
useEffect(() => { useEffect(() => {
// getData(1) // getData(1)
setPage(1) setPage(1)
@ -450,11 +454,11 @@ export default function Refun() {
} }
} }
scroll={{ y: height - 150}} scroll={{ y: height - 150 }}
rowKey="projId" rowKey="projId"
/> />
</Spin> </Spin>
<div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: 15 ,width:'100%'}}> <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: 15, width: '100%' }}>
{/* <Pagination defaultCurrent={page} total={total} pageSize={10} showSizeChanger={false} onChange={(page) => { {/* <Pagination defaultCurrent={page} total={total} pageSize={10} showSizeChanger={false} onChange={(page) => {
setPage(page) setPage(page)
getData(page) getData(page)