Karlis 进行的变更

main
yang.yongquan 2022-12-27 22:41:02 +08:00
parent 173c67e166
commit 9b37b62529
2 changed files with 61 additions and 47 deletions

View File

@ -1,3 +1,4 @@
import dayjs from "dayjs";
export interface Token {
accessToken: string;
@ -86,7 +87,7 @@ export class InvoiceCommit {
invoiceNo: string
invoiceCode:string
invoiceKind:string
invoiceDate:Date
invoiceDate:dayjs.Dayjs
invoiceAmount:number
invoiceAmountWithoutTax: number
invoiceCheckCode:string
@ -99,7 +100,7 @@ export class InvoiceCommit {
this.invoiceNo = ""
this.invoiceCode = ""
this.invoiceKind = ""
this.invoiceDate = new Date()
this.invoiceDate = dayjs()
this.invoiceAmount = 0
this.invoiceAmountWithoutTax = 0
this.invoiceCheckCode = "000000"
@ -113,7 +114,7 @@ export class InvoiceCommit {
this.invoiceNo = props.get("invoiceNo")!.toString()
this.invoiceCode = props.get("invoiceCode")!.toString()
this.invoiceKind = props.get("invoiceKind")!.toString()
this.invoiceDate = new Date(props.get("invoiceDate")!.toString())
//this.invoiceDate = new Date(props.get("invoiceDate")!.toString())
//this.invoiceAmount = props.get("invoiceAmount")!.toString()
//this.invoiceAmountWithoutTax = props.get("invoiceAmountWithoutTax")!.toString()
this.invoiceCheckCode = props.get("invoiceCheckCode")!.toString()

View File

@ -1,12 +1,15 @@
import React, {useState} from 'react';
import {Button, Modal, UploadProps, message, Upload, UploadFile, Form, Input,DatePicker} from 'antd';
import {Button, Modal, UploadProps, message, Upload, UploadFile, Form, Input, DatePicker} from 'antd';
import { InboxOutlined } from '@ant-design/icons';
import axiosInstance from "../../../utils/axiosInstance";
import {InvoiceCommit} from "../../../models/Staff";
import dayjs from 'dayjs';
import TextArea from "antd/es/input/TextArea";
import {constants} from "http2";
import type { FormInstance } from 'antd/es/form';
import {useAppDispatch} from "../../../models/hooks";
const { Dragger } = Upload;
let tempFile :File
const props: UploadProps = {
name: 'file',
@ -51,6 +54,7 @@ class FileUploadView extends React.Component<any, any>{
class InvoiceUploadView extends React.Component<any, any>{
formRef = React.createRef<FormInstance>();
constructor(props: {}) {
super(props);
this.state = {
@ -60,6 +64,7 @@ class InvoiceUploadView extends React.Component<any, any>{
uploadStep: 0,
invoiceCommit: new InvoiceCommit(),
}
this.state.invoiceCommit.invoiceNo="init"
}
setUploadOpen(value: Boolean) {
this.setState({uploadOpen: value})
@ -80,8 +85,8 @@ class InvoiceUploadView extends React.Component<any, any>{
handleOk = () => {
this.setLoading(true);
//this.setLoading(false);
this.setOpen(false);
//this.setLoading(false);
this.setOpen(false);
let data= new FormData();
data.append('invoiceFile',tempFile)
axiosInstance({
@ -92,20 +97,23 @@ class InvoiceUploadView extends React.Component<any, any>{
console.log(response.data)
let result = new InvoiceCommit()
result.invoiceNo = response.data.invoiceNo
result.invoiceDate = response.data.invoiceDate
result.invoiceDate = dayjs(response.data.invoiceDate)
result.invoiceAmount = response.data.invoiceAmount
result.invoiceCode = response.data.invoiceCode
result.invoiceCheckCode = response.data.invoiceCheckCode
result.invoiceKind = response.data.invoiceKind
result.invoiceFileName = response.data.invoiceFileName
result.invoiceExtraInfo = response.data.invoiceExtraInfo
result.invoiceExtraInfo = response.data.invoiceExtraInfo.toString()
this.setState({invoiceCommit:result})
this.formRef.current!.setFieldsValue(result);
}).catch(function (error) {
console.log(error)
})
this.setState({uploadStep:1})
this.setUploadOpen(true)
this.setLoading(false);
// let fakeData=new InvoiceCommit()
// fakeData.invoiceNo="No"
// fakeData.invoiceCode="Code"
@ -115,6 +123,7 @@ class InvoiceUploadView extends React.Component<any, any>{
};
handleCancel = () => {
this.setOpen(false);
};
@ -126,29 +135,32 @@ class InvoiceUploadView extends React.Component<any, any>{
console.log(this.state.uploadStep)
return (
<>
<Button type="primary" onClick={this.showUploadView}>
Open Modal with customized footer
</Button>
<Modal
open={this.state.open}
title="Title"
onOk={this.handleOk}
onCancel={this.handleCancel}
footer={[
<Button key="cancel" onClick={this.handleCancel}>
</Button>,
<Button key="next" type="primary" loading={this.state.loading} onClick={this.handleOk}>
</Button>
]}
>
<FileUploadView/>
</Modal>
// @ts-ignore
// @ts-ignore
return (
<>
<Button type="primary" onClick={this.showUploadView}>
Open Modal with customized footer
</Button>
<Modal
open={this.state.open}
title="Title"
onOk={this.handleOk}
onCancel={this.handleCancel}
footer={[
<Button key="cancel" onClick={this.handleCancel}>
</Button>,
<Button key="next" type="primary" loading={this.state.loading} onClick={this.handleOk}>
</Button>
]}
>
<FileUploadView/>
</Modal>
<Modal
open={this.state.uploadOpen}
title="Title"
onOk={this.submit}
onCancel={this.handleCancel}
@ -156,60 +168,61 @@ class InvoiceUploadView extends React.Component<any, any>{
<Button key="cancel" onClick={this.handleCancel}>
</Button>,
<Button key="next" type="primary" loading={this.state.loading} onClick={this.submit}
<Button key="next" type="primary" loading={false} onClick={this.submit}
>
</Button>
]}
>
<Form>
<Form ref={this.formRef} initialValues={{invoiceNo:this.state.invoiceCommit.invoiceNo}}>
<Form.Item
name={`invoice-no`}
name={`invoiceNo`}
label={`发票编码`}
>
<Input defaultValue={this.state.invoiceCommit.invoiceNo}/>
<Input />
</Form.Item>
<Form.Item
name={`invoice-Code`}
name={`invoiceCode`}
label={`发票代码`}
>
<Input defaultValue={this.state.invoiceCommit.invoiceCode}/>
<Input />
</Form.Item>
<Form.Item
name={`invoice-Kind`}
name={`invoiceKind`}
label={`发票类型`}
>
<Input defaultValue={this.state.invoiceCommit.invoiceKind}/>
<Input />
</Form.Item>
<Form.Item
name={`invoice-amount`}
name={`invoiceAmount`}
label={`计税总额`}
>
<Input defaultValue={this.state.invoiceCommit.invoiceAmount}/>
<Input />
</Form.Item>
<Form.Item
name={`invoice-amount-without-tax`}
name={`invoiceAmountWithoutTax`}
label={`非税金额`}
>
<Input defaultValue={this.state.invoiceCommit.invoiceAmountWithoutTax}/>
<Input/>
</Form.Item>
<Form.Item
name={`invoice-date`}
name={`invoiceDate`}
label={`开票日期`}
>
<DatePicker defaultValue={dayjs(this.state.invoiceCommit.invoiceDate)}/>
<DatePicker/>
</Form.Item>
<Form.Item
name={`invoice-check-code`}
name={`invoiceCheckCode`}
label={`核验码`}
>
<Input defaultValue={this.state.invoiceCommit.invoiceCheckCode}/>
<Input/>
</Form.Item>
<Form.Item
name={`invoice-extra-info`}
name={`invoiceExtraInfo`}
label={`其他信息`}
>
<TextArea defaultValue={this.state.invoiceCommit.invoiceExtraInfo}/>
<TextArea/>
</Form.Item>
</Form>
</Modal>