From 7cad47c256cad2f3085a54e2692ae6a567c63c6a Mon Sep 17 00:00:00 2001 From: "yang.yongquan" <3395816735@qq.com> Date: Tue, 3 Jan 2023 16:18:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=8A=A5=E9=94=80?= =?UTF-8?q?=E5=8D=95=E6=8F=90=E4=BA=A4=E7=9A=84check=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mine/ReimbursementCreate.tsx | 19 ++++++++++++++++--- src/pages/reimbursement/mine/utils.ts | 8 +++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/pages/reimbursement/mine/ReimbursementCreate.tsx b/src/pages/reimbursement/mine/ReimbursementCreate.tsx index 3596448..b0baadf 100644 --- a/src/pages/reimbursement/mine/ReimbursementCreate.tsx +++ b/src/pages/reimbursement/mine/ReimbursementCreate.tsx @@ -22,7 +22,8 @@ import {invoiceTypeNameMap} from "../../../models/Invoice"; import SingleInvoiceSelector from "./component/SingleInvoiceSelector"; import MultiInvoiceSelector from "./component/MultiInvoiceSelector"; import {ActionType, StatisticCard} from "@ant-design/pro-components"; -import {openNotification} from "./utils"; +import {openNotification, openErrorNotification} from "./utils"; +import {NotificationPlacement} from "antd/es/notification/interface"; const {Operation} = StatisticCard; @@ -132,12 +133,24 @@ class ReimbursementCreate extends React.Component { submitCheck = () => { //TODO: check - return {ok: true, msg: ""} + let msgContent:string = "" + if(this.state.departureName == "" ) { + msgContent = "未填写出发地" + } else if(this.state.destinationName == "") { + msgContent = "未填写目的地" + } else if(this.state.departureInvoice == null) { + msgContent = "未上传出发票据" + } else if(this.state.selectedDepartment == null || this.state.selectedDepartment.isEmpty()) { + msgContent = "未选择报销部门" + } else { + return {ok: true, msg: ""} + } + return {ok: false, msg: msgContent} } submit = () => { let checkResult = this.submitCheck() if (!checkResult.ok) { - openNotification(checkResult.msg) + openErrorNotification(checkResult.msg) return } let params = { diff --git a/src/pages/reimbursement/mine/utils.ts b/src/pages/reimbursement/mine/utils.ts index 1f84ffc..b85f18d 100644 --- a/src/pages/reimbursement/mine/utils.ts +++ b/src/pages/reimbursement/mine/utils.ts @@ -8,4 +8,10 @@ export const openNotification = (hint: string) => { console.log('Notification Clicked!'); }, }); -}; \ No newline at end of file +}; + +export const openErrorNotification = (placement: string) => { + notification.error({ + message: `${placement}` + }); +} \ No newline at end of file