添加了打回发票的理由

main
白封羽 2023-01-08 20:10:28 +08:00
parent 6871657990
commit 29991bdf99
4 changed files with 21 additions and 9 deletions

View File

@ -1,5 +1,5 @@
import React, {useEffect, useState} from "react"; import React, {useEffect, useState} from "react";
import {Button, DatePicker, Form, Input, InputNumber, Modal, Select, Typography, Image} from "antd"; import {Button, DatePicker, Form, Input, InputNumber, Modal, Select, Typography, Image, Popconfirm} from "antd";
import { import {
InvoiceDetail, InvoiceDetail,
InvoiceIdentifyResponse, InvoiceIdentifyResponse,
@ -14,11 +14,12 @@ import qs from "qs";
const {Text, Paragraph} = Typography; const {Text, Paragraph} = Typography;
function InvoiceDetailModal(props: { invoiceDetail: any, open: boolean, onClose: () => void, needRefresh?: () => void, isBase64?:boolean }) { function InvoiceDetailModal(props: { invoiceDetail: any, open: boolean, onClose: () => void, needRefresh?: () => void, isBase64?:boolean,isOwner:boolean}) {
//const [open, setOpen] = useState(false) //const [open, setOpen] = useState(false)
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const [invoice, setInvoice] = useState(null as any) const [invoice, setInvoice] = useState(null as any)
const [formItems, setFormItems] = useState(undefined) const [formItems, setFormItems] = useState(undefined)
const [withdrawReason, setWithdrawReason] = useState("")
//const [form] = Form.useForm(); //const [form] = Form.useForm();
useEffect(() => { useEffect(() => {
@ -79,11 +80,12 @@ function InvoiceDetailModal(props: { invoiceDetail: any, open: boolean, onClose:
refreshFormItems(value) refreshFormItems(value)
} }
const withDraw = () => { const withdraw = () => {
setLoading(true) setLoading(true)
axiosInstance({ axiosInstance({
url: 'common/invoice/' + props.invoiceDetail.invoiceId, url: 'common/invoice/' + props.invoiceDetail.invoiceId,
method: 'delete', method: 'delete',
data:{deleteOpinion:withdrawReason}
}).then(response => { }).then(response => {
console.log(response.data) console.log(response.data)
setLoading(false) setLoading(false)
@ -106,10 +108,17 @@ function InvoiceDetailModal(props: { invoiceDetail: any, open: boolean, onClose:
<div style={{width: '100%', display: "flex", flexDirection: "row", justifyContent: "space-between"}}> <div style={{width: '100%', display: "flex", flexDirection: "row", justifyContent: "space-between"}}>
<Text>{props.invoiceDetail?.modified ? '' : ''}</Text> <Text>{props.invoiceDetail?.modified ? '' : ''}</Text>
<div> <div>
{props.invoiceDetail?.invoiceState === 0 && <Button danger loading={loading} onClick={withDraw} {props.invoiceDetail?.invoiceState === 0 && <Popconfirm
title={props.isOwner?"确定撤回吗?":"请填写撤回理由"}
onConfirm={withdraw}
okText="确定"
//showCancel={false}
cancelText="取消"
onCancel={() => {setWithdrawReason("")}}
description={props.isOwner?"":<TextArea rows={4} onChange={(e)=>{setWithdrawReason(e.target.value)}}/>}
> >
<Button danger type="primary"></Button>
</Button>} </Popconfirm>}
<Button type="primary" href={baseUrl + props.invoiceDetail?.invoiceFileUri} download <Button type="primary" href={baseUrl + props.invoiceDetail?.invoiceFileUri} download
> >

View File

@ -416,7 +416,9 @@ function InvoiceListView(props: { isManagement: boolean }) {
pageSize={Number(search.get('pageSize') ? search.get('pageSize') : 10)} pageSize={Number(search.get('pageSize') ? search.get('pageSize') : 10)}
total={totalNum} onChange={onChange}/> total={totalNum} onChange={onChange}/>
</div> </div>
<InvoiceDetailModal needRefresh={() => { <InvoiceDetailModal
isOwner={!props.isManagement}
needRefresh={() => {
searchInvoiceContent(invoiceSearchOption) searchInvoiceContent(invoiceSearchOption)
}} invoiceDetail={invoiceDetail} open={detailModalOpen} onClose={() => { }} invoiceDetail={invoiceDetail} open={detailModalOpen} onClose={() => {
setDetailModalOpen(false) setDetailModalOpen(false)

View File

@ -284,7 +284,8 @@ function MessageList(props: { count: number, onCountChange: (count: number) => v
</Badge> </Badge>
</Popover> </Popover>
<InvoiceDetailModal open={invoiceModalOpen} invoiceDetail={invoiceDetail} <InvoiceDetailModal open={invoiceModalOpen} invoiceDetail={invoiceDetail}
onClose={() => setInvoiceModalOpen(false)} isBase64={true}/> onClose={() => setInvoiceModalOpen(false)} isBase64={true}
isOwner={true}/>
<ReimbursementDetail closeDetail={()=>{setReimbursementDetail(undefined)}} <ReimbursementDetail closeDetail={()=>{setReimbursementDetail(undefined)}}
accessLevel={-1} reimbursement={reimbursementDetail}/> accessLevel={-1} reimbursement={reimbursementDetail}/>
</> </>

View File

@ -113,7 +113,7 @@ function DisplayInvoicesList(props:{departureInvoice: Invoice, destinationInvoic
onSelect={onSelect} onSelect={onSelect}
treeData={getTreeData()} treeData={getTreeData()}
/> />
<InvoiceDetailModal invoiceDetail={invoiceDetail} open={detailModalOpen} onClose={() => { <InvoiceDetailModal isOwner={true} invoiceDetail={invoiceDetail} open={detailModalOpen} onClose={() => {
setDetailModalOpen(false) setDetailModalOpen(false)
}}/> }}/>
</>) </>)