diff --git a/src/pages/reimbursement/mine/MyReimbursement.tsx b/src/pages/reimbursement/mine/MyReimbursement.tsx index 793bc74..0f53073 100644 --- a/src/pages/reimbursement/mine/MyReimbursement.tsx +++ b/src/pages/reimbursement/mine/MyReimbursement.tsx @@ -197,10 +197,12 @@ class Subpage extends React.Component { closeDetail = () => { this.setState({detailedReimbursement: undefined}) + this.tableAction.current?.reload() } showDetail(reimbursementId: number) { axiosInstance.get("common/reimbursement/" + reimbursementId).then((response) => { + console.log(response.data) this.setState({detailedReimbursement: response.data}) }).catch((error) => { openNotification("拉取报销单详情失败") @@ -224,7 +226,7 @@ class Subpage extends React.Component { amount: value.reimbursementInvoiceAmount + value.reimbursementAdditionalAmount, invoiceAmount: value.reimbursementInvoiceAmount, additionalAmount: value.reimbursementAdditionalAmount, - status: value.reimbursementStatus % 6, + status: value.reimbursementStatus % 7, departmentId: value.reimbursementSubmitDepartment.departmentId, submitDateTime: Date.parse(value.reimbursementSubmitTime), detail: "查看详情", @@ -243,7 +245,7 @@ class Subpage extends React.Component { amount: value[i].reimbursementInvoiceAmount + value[i].reimbursementAdditionalAmount, invoiceAmount: value[i].reimbursementInvoiceAmount, additionalAmount: value[i].reimbursementAdditionalAmount, - status: value[i].reimbursementStatus % 6, + status: value[i].reimbursementStatus % 7, departmentId: value[i].reimbursementSubmitDepartment.departmentId, submitDateTime: Date.parse(value[i].reimbursementSubmitTime), detail: "查看详情", @@ -339,7 +341,7 @@ class Subpage extends React.Component { <> actionRef={this.tableAction} diff --git a/src/pages/reimbursement/mine/ReimbursementDetail.tsx b/src/pages/reimbursement/mine/ReimbursementDetail.tsx index 2efd805..9c6989f 100644 --- a/src/pages/reimbursement/mine/ReimbursementDetail.tsx +++ b/src/pages/reimbursement/mine/ReimbursementDetail.tsx @@ -1,10 +1,31 @@ import React, {ReactNode} from "react"; -import {Button, Checkbox, Col, Descriptions, Modal, Popconfirm, Popover, Row, StepProps, Steps, Tag} from "antd"; +import { + Button, Radio, + Col, + Descriptions, + Modal, + Popconfirm, + Popover, + Row, + Select, + StepProps, + Steps, + Tag +} from "antd"; import TextArea from "antd/es/input/TextArea"; import {ApprovalProcess, Invoice, ReimbursementDetailModal} from "../../../models/ReimbursementDetailModal"; import dayjs, {Dayjs} from "dayjs"; import {ExclamationCircleOutlined} from "@ant-design/icons"; import displayInvoicesList from "./component/tempComponent"; +import { + CheckCircleOutlined, + ClockCircleOutlined, + CloseCircleOutlined, + MinusCircleOutlined, + SyncOutlined, +} from '@ant-design/icons'; +import axiosInstance from "../../../utils/axiosInstance"; +import {openNotification} from "./utils"; const statusEnum = { 0: {text: '已报销', status: 'Success'}, @@ -77,7 +98,7 @@ function displayRawInfo(reimbursement: ReimbursementDetailModal | undefined | nu ) } -function displaySteps(reimbursement: ReimbursementDetailModal | undefined | null, onApprove:boolean) { +function displaySteps(reimbursement: ReimbursementDetailModal | undefined | null, onApprove: boolean) { if (reimbursement == undefined) return null; let currentStep = 0; @@ -91,16 +112,16 @@ function displaySteps(reimbursement: ReimbursementDetailModal | undefined | null if (approvalSteps == null) approvalSteps = [] for (let i = 0; i < approvalSteps.length; i++) { - if (approvalSteps[i].approvalResult === i) { - let description: string | ReactNode = approvalSteps[i].approvalStaff.staffName + "】" + "审批通过"; + if (approvalSteps[i].approvalResult === i + 1) { + let description: string | ReactNode = "【" + approvalSteps[i].approvalStaff.staffName + "】" + "审批通过"; if (approvalSteps[i].approvalOpinion != null && approvalSteps[i].approvalOpinion !== "") { - description = (<>{approvalSteps[i].approvalStaff.staffName + "】" + "审批通过"}{"【" + approvalSteps[i].approvalStaff.staffName + "】" + "审批通过"}) } items.push({ // @ts-ignore - title: statusEnum2[i - 1] + "审批", + title: statusEnum2[i] + "审批", status: 'finish', subTitle: approvalSteps[i].approvalTime.replace("T", " "), description: description @@ -112,7 +133,7 @@ function displaySteps(reimbursement: ReimbursementDetailModal | undefined | null // @ts-ignore title: statusEnum2[approvalSteps.length] + "审批", status: 'process', - subTitle: onApprove?"请您审批":"审批中", + subTitle: onApprove ? "请您审核" : "审核中", description: "", }) currentStep = items.length - 2; @@ -211,14 +232,24 @@ class ReimbursementDetail extends React.Component { } approve = () => { - //TODO: approve - console.log("approve"); - this.props.closeDetail(); + let params = {approvalOpinion: this.state.approvalOpinion} + axiosInstance.put("approval/" + this.state.reimbursement.reimbursementId.toString() + "/"+(this.state.approvalChecked?"1":"0"), params).then((res) => { + openNotification("审核成功"); + this.props.closeDetail(); + }).catch((err) => { + openNotification(err.response.data.msg==null?"操作失败,请稍后重试":err.response.data.msg); + console.log(err); + }) } terminate = () => { - //TODO: terminate - console.log("terminate"); - this.props.closeDetail(); + let params = {approvalOpinion: ""} + axiosInstance.put("approval/" + this.state.reimbursement.reimbursementId.toString() + "/-1", params).then((res) => { + openNotification("已终止申请"); + this.props.closeDetail(); + }).catch((err) => { + openNotification(err.response.data.msg==null?"操作失败,请稍后重试":err.response.data.msg); + console.log(err); + }) } getSubmitButton = () => { if (this.state.reimbursement === undefined || this.state.reimbursement.reimbursementStatus === 0 @@ -245,7 +276,7 @@ class ReimbursementDetail extends React.Component { okText="确定" cancelText="取消" > - + ) } else if (this.props.accessLevel === 0) { return ( @@ -264,22 +295,24 @@ class ReimbursementDetail extends React.Component { } } checkerMenu = () => { - if (this.props.accessLevel === 1) { + if (this.props.accessLevel === 1 && this.state.reimbursement != undefined && + this.state.reimbursement.reimbursementStatus >= 1 && this.state.reimbursement.reimbursementStatus <= 4) { return (<> -