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

View File

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