Commit d3c0e8ff authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 7d8a2f06 4f4d700e
......@@ -88,7 +88,7 @@ const SettlementList = () => {
title: '操作',
render: (text, record: any) => {
if(record.status === 1) {
return <Button type="link" onClick={() => handleManualsettlement(record.id)}>手动结算</Button>
return <a onClick={() => handleManualsettlement(record.id)}>手动结算</a>
}
return (
<StatusActions
......
......@@ -5,7 +5,7 @@
*/
import React, { useState, useEffect } from 'react';
import ModalContainer from '../ModalContainer';
import { Modal, Space, Button } from 'antd';
import { Modal, Space, Button, Popconfirm } from 'antd';
import ConfirmAccount from '../../components/ConfirmAccount';
import Voucher from '../../components/Voucher';
import { StatusEnum, TO_BE_RECONCILED, TO_BE_PAY, TO_BE_COLLECTED, COMPLETED } from '../../components/StatusTag';
......@@ -174,9 +174,19 @@ interface FileType {
const UploadVoucher: React.FC<UploadVocherProps> = (props) => {
const { settlementId, roleId } = props;
const [fileList, setFileList] = useState<FileType[]>([]);
const [isUploading, setIsUploading] = useState(false);
const getFileList = (list: FileType[], status) => {
if(status === 'done') {
setFileList(list);
setIsUploading(false)
} else {
setIsUploading(true);
}
}
const getFileList = (list: FileType[]) => {
setFileList(list);
const handleComfirm = (params) => {
props.handleUpload({onCancel: params.cancel, id: params.id, fileList: params.fileList})
}
return (
......@@ -193,10 +203,16 @@ const UploadVoucher: React.FC<UploadVocherProps> = (props) => {
footer={(
<Space>
<Button onClick={cancel}>取消</Button>
<Button
type={"primary"}
onClick={() => props.handleUpload({onCancel: cancel, id: props.id, fileList: fileList})}
>确认</Button>
{
isUploading
? <Popconfirm title="还有文件正在上传,是否确认提交?" okText="是" cancelText="否" onConfirm={() => handleComfirm({onCancel: cancel, id: props.id, fileList: fileList})}>
<Button type={"primary"}>确认</Button>
</Popconfirm>
: <Button
type={"primary"}
onClick={() => handleComfirm({onCancel: cancel, id: props.id, fileList: fileList})}
>确认</Button>
}
</Space>
)}
>
......
......@@ -23,7 +23,7 @@ interface Iprops {
fileList?: VoucherFileProps[],
id: number, // 结算方id
roleId: number, // 结算方角色id
getFileList: (params: any[]) => void
getFileList: (params: any[], status: string) => void
}
interface AccountInfo {
......@@ -85,6 +85,7 @@ const UploadPayVoucher: React.FC<Iprops> = (props) => {
showUploadList: false,
onChange(info: UploadChangeParam) {
if (info.file.status === 'uploading') {
props.getFileList([], "uploading")
setLoading(true)
return;
}
......@@ -101,7 +102,7 @@ const UploadPayVoucher: React.FC<Iprops> = (props) => {
proveUrl: data
})
setFileList(temp);
props.getFileList(temp)
props.getFileList(temp, "done")
}
setLoading(false)
}
......@@ -109,6 +110,15 @@ const UploadPayVoucher: React.FC<Iprops> = (props) => {
beforeUpload
};
const handleRemove = (value) => {
const list = [...fileList];
const res = list.filter((item) => item.proveUrl !== value.proveUrl);
setFileList(res)
if(props.getFileList) {
props.getFileList(res, "done")
}
}
return (
<div className={styles.container}>
<div className={styles.formItem}>
......@@ -124,10 +134,10 @@ const UploadPayVoucher: React.FC<Iprops> = (props) => {
<span className={styles.value}>{accountInfo?.bankDeposit}</span>
</div>
<p className={styles.voucherText}>上传支付凭证</p>
<Voucher files={fileList} />
<Voucher files={fileList} onRemove={handleRemove} />
<div className={styles.upload}>
<Upload {...uploadProps}>
<Button icon={<UploadOutlined />}>上传凭证</Button>
<Button loading={loading} icon={<UploadOutlined />}>上传凭证</Button>
<p className={styles.tips}>单个凭证文件大小不能超过200K</p>
</Upload>
</div>
......
......@@ -14,11 +14,16 @@ interface VoucherFileProps {
}
interface Iprops {
files: VoucherFileProps[]
onRemove: (item) => void
}
const Voucher: React.FC<Iprops> = (props) => {
const { files = [] } = props;
console.log(files);
const handleRemove = (item) => {
!!props.onRemove && props.onRemove(item);
}
return (
<>
{
......@@ -33,7 +38,7 @@ const Voucher: React.FC<Iprops> = (props) => {
<a href={item.proveUrl} target={"_blank"}>{item.name}</a>
</div>
<div className={styles.view}>
<a href={item.proveUrl} target={"_blank"}>预览</a>
<a onClick={() => handleRemove(item)}>删除</a>
</div>
</div>
)
......
......@@ -93,7 +93,7 @@ const ScoreInfo: React.FC = () => {
return (
<PageHeaderWrapper
onBack={() => history.goBack()}
// onBack={() => history.goBack()}
title={
<>
<PageHeader
......
......@@ -96,7 +96,7 @@ const SettlementList = () => {
title: '操作',
render: (text, record: any) => {
if(record.status === 1) {
return <Button type="link" onClick={() => handleManualsettlement(record.id)}>手动结算</Button>
return <a onClick={() => handleManualsettlement(record.id)}>手动结算</a>
}
return (
<StatusActions
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment